A python script for exporting the finite element mesh generated by Altair Flux software, in a compatible xml format that is ready to be imported into FEniCS. The script is written both to be run within Flux's PyFlux interpreter, and also from a Linux command line using the python2 or python3 interpreter. When run within Flux, the script first writes the mesh nodes, mesh faces, and the user-defined names assigned to the physical faces into their own respective txt files inside the current working directory. Then, the script feeds these txt files as inputs, and extracts relevant information for building the xml files for the mesh and the physical descriptions that are importable into FEniCS, and then creates two xml files within the working directory. When the script is run in a Linux terminal with a python interpreter, the script expects three input txt files, which are exported from Flux. And in the end, again, creates two xml files describing the mesh ready to be imported into FEniCS.
Download and move the python script into your working directory, which is your Flux working directory, or houses the exported txt files from Flux.
The script is compatible with both python2 and python3 interpreters.
When run from a Linux terminal, script needs three txt file inputs, and two
output filenames. The proper usage pattern can be seen by calling the script
with -h
flag:
$ python3 flux_to_fenics_mesh_transfer.py -h
When run from within Flux, the script can be run without needing any input file specification.
To run the script within Flux, just import the script into the Flux, and run it. This will create a bunch of files into the Flux working directory:
- mesh-node-export-first-order.txt
- mesh-face-export-first-order.txt
- face-physical-description.txt
- node_element_file_cleaned.txt
- face_element_file_cleaned.txt
- face_element_node_info.txt
- face_element_face_info.txt
- face_number_reference.txt
- mesh.xml
- physical_region.xml
Of these files, first, second, and third are main inputs to the script. The eighth, ninth, and tenth files are the main outputs of the script.
For details on these files, check the project wiki.
On the other hand, user can run this python script on a Linux terminal. In this case, the user has to provide the script with the main input files mentioned above. The user also has to specify the names of the output files to be created.
An example for proper script call from a Linux terminal is given below:
python3 flux_to_fenics_mesh_transfer.py -i mesh-node-export-first-order.txt -i mesh-face-export-first-order.txt -i face-physical-description.txt -o mesh.xml -o physical_region.xml
Here, three -i
flags denote the filenames of input files, and the two -o
flags
denote the filenames of the output files that are going to be created. The input
files should have been exported from Flux software previously. This can be done
by initially running the script within Flux.
- Cagatay "Chagatai" Eren