Crystal is a group of algorithms for extracting regions of uniform quadrilateral structure in an unstructured mesh and reorganizing the mesh representation to expose said structure in order to enable efficient exploitation of the underlying structure, all whilst preserving the mesh model.
A mesh can be built from either a .dat file - e.g. as generated by naca0012.m - or a .msh file generated by Gmsh.
The mesh builder binary file can be built by running make run-builder.
bin/run-builder build-from-dat example_mesh.dat example_mesh.p.part
bin/run-builder build-from-msh example_mesh.msh example_mesh.p.part
Structure detection is performed on a .p.part file, and produces a .p file.
For detecting a single structured region use structure-detection/detect_and_append_structure.py. For detecting multiple structured regions use structure-detection/detect_multiple_structure.py.
Make sure that the following has been performed:
-
The binary file
bin/mesh-printerhas been compiled. If not runmake mesh-printer -
The files
obj/protogen/mesh_pb2.pyandobj/protogen/__init__.pyhave been created, along with a symlinkstructure-detection/protogento theobj/protogen/directory. If not runmake obj/protogen/mesh_pb2.py. -
The
LD_LIBRARY_PATHenvironment variable must have a path to the protocol bufferlibdirectory. Normally this is done simply usingsource .env
Note that single detection may fail and will not be retried.
Run detection using a random seed.
structure-detection/detect_and_append_structure.py example_mesh.p.part example_mesh.p
Run detection using a system-seeded RNG. Runs are deterministic, including the start node.
structure-detection/detect_and_append_structure.py --random_seed=1234 example_mesh.p.part example_mesh.p
Run detection using a given start node. Note that the RNG is still system-seeded, so determinism is not guaranteed.
structure-detection/detect_and_append_structure.py --start_node=999 example_mesh.p.part example_mesh.p
Run detection using a given start node and a given RNG seed. Runs are deterministic.
structure-detection/detect_and_append_structure.py --start_node=999 --random_seed=123 example_mesh.p.part example_mesh.p
This method is more flexible, as it attempts to detect multiple structured regions, as well as coping with failed detection.
Run detection using a system-seeded RNG, with the default limits.
structure-detection/detect_multiple_structure.py example_mesh.p.part example_mesh.p
--random_seed and --start_node are as before. Note that start_node determines the first attempted node, the remaining are determined through the RNG.
--max_regions determines the maximum number of structured regions to detect. The default value is 50.
--max_fail determines the maximum number of consecutive detection failures before giving up. The default value is 25.
--max_rows and --max_cols determine the maximum number of rows and columns, respectively, that each structured region may have.
--cells-etc enables detection of structured cell and edge regions, in addition to structured vertex regions. This is the default behavior.
--no-cells-etc results in only structured vertex regions being detected.
To run the airfoil computation:
- Create a
.pfile using the above instructions,example_mesh.psay. - Create the binary file
bin/run-airfoil-computationusingmake run-airfoil-computation. - Make sure that the
LD_LIBRARY_PATHenvironment variable has a path to the protocol bufferlibdirectory. Normally this is done simply usingsource .env - Run with
bin/run-airfoil-computation example_mesh.p