|
| 1 | +Mesh Doctor |
| 2 | +--------------- |
| 3 | + |
| 4 | +``mesh-doctor`` is a ``python`` executable that can be used through the command line to perform various checks, validations, and tiny fixes to the ``vtk`` mesh that are meant to be used in ``geos``. |
| 5 | +``mesh-doctor`` is organized as a collection of modules with their dedicated sets of options. |
| 6 | +The current page will introduce those modules, but the details and all the arguments can be retrieved by using the ``--help`` option for each module. |
| 7 | + |
| 8 | +Modules |
| 9 | +^^^^^^^ |
| 10 | + |
| 11 | +To list all the modules available through ``mesh-doctor``, you can simply use the ``--help`` option, which will list all available modules as well as a quick summary. |
| 12 | + |
| 13 | +.. code-block:: |
| 14 | +
|
| 15 | + $ python src/geos/mesh/doctor/mesh_doctor.py --help |
| 16 | + usage: mesh_doctor.py [-h] [-v] [-q] -i VTK_MESH_FILE |
| 17 | + {collocated_nodes,element_volumes,fix_elements_orderings,generate_cube,generate_fractures,generate_global_ids,non_conformal,self_intersecting_elements,supported_elements} |
| 18 | + ... |
| 19 | +
|
| 20 | + Inspects meshes for GEOSX. |
| 21 | +
|
| 22 | + positional arguments: |
| 23 | + {collocated_nodes,element_volumes,fix_elements_orderings,generate_cube,generate_fractures,generate_global_ids,non_conformal,self_intersecting_elements,supported_elements} |
| 24 | + Modules |
| 25 | + collocated_nodes |
| 26 | + Checks if nodes are collocated. |
| 27 | + element_volumes |
| 28 | + Checks if the volumes of the elements are greater than "min". |
| 29 | + fix_elements_orderings |
| 30 | + Reorders the support nodes for the given cell types. |
| 31 | + generate_cube |
| 32 | + Generate a cube and its fields. |
| 33 | + generate_fractures |
| 34 | + Splits the mesh to generate the faults and fractures. [EXPERIMENTAL] |
| 35 | + generate_global_ids |
| 36 | + Adds globals ids for points and cells. |
| 37 | + non_conformal |
| 38 | + Detects non conformal elements. [EXPERIMENTAL] |
| 39 | + self_intersecting_elements |
| 40 | + Checks if the faces of the elements are self intersecting. |
| 41 | + supported_elements |
| 42 | + Check that all the elements of the mesh are supported by GEOSX. |
| 43 | +
|
| 44 | + options: |
| 45 | + -h, --help |
| 46 | + show this help message and exit |
| 47 | + -v Use -v 'INFO', -vv for 'DEBUG'. Defaults to 'WARNING'. |
| 48 | + -q Use -q to reduce the verbosity of the output. |
| 49 | + -i VTK_MESH_FILE, --vtk-input-file VTK_MESH_FILE |
| 50 | +
|
| 51 | + Note that checks are dynamically loaded. |
| 52 | + An option may be missing because of an unloaded module. |
| 53 | + Increase verbosity (-v, -vv) to get full information. |
| 54 | +
|
| 55 | +Then, if you are interested in a specific module, you can ask for its documentation using the ``mesh-doctor module_name --help`` pattern. |
| 56 | +For example |
| 57 | + |
| 58 | +.. code-block:: |
| 59 | +
|
| 60 | + $ python src/geos/mesh/doctor/mesh_doctor.py collocated_nodes --help |
| 61 | + usage: mesh_doctor.py collocated_nodes [-h] --tolerance TOLERANCE |
| 62 | +
|
| 63 | + options: |
| 64 | + -h, --help show this help message and exit |
| 65 | + --tolerance TOLERANCE [float]: The absolute distance between two nodes for them to be considered collocated. |
| 66 | +
|
| 67 | +``mesh-doctor`` loads its module dynamically. |
| 68 | +If a module can't be loaded, ``mesh-doctor`` will proceed and try to load other modules. |
| 69 | +If you see a message like |
| 70 | + |
| 71 | +.. code-block:: bash |
| 72 | +
|
| 73 | + [1970-04-14 03:07:15,625][WARNING] Could not load module "collocated_nodes": No module named 'vtkmodules' |
| 74 | +
|
| 75 | +then most likely ``mesh-doctor`` could not load the ``collocated_nodes`` module, because the ``vtk`` python package was not found. |
| 76 | +Thereafter, the documentation for module ``collocated_nodes`` will not be displayed. |
| 77 | +You can solve this issue by installing the dependencies of ``mesh-doctor`` defined in its ``requirements.txt`` file (``python -m pip install -r requirements.txt``). |
| 78 | + |
| 79 | +Here is a list and brief description of all the modules available. |
| 80 | + |
| 81 | +``collocated_nodes`` |
| 82 | +"""""""""""""""""""" |
| 83 | + |
| 84 | +Displays the neighboring nodes that are closer to each other than a prescribed threshold. |
| 85 | +It is not uncommon to define multiple nodes for the exact same position, which will typically be an issue for ``geos`` and should be fixed. |
| 86 | + |
| 87 | +.. code-block:: |
| 88 | +
|
| 89 | + $ python src/geos/mesh/doctor/mesh_doctor.py collocated_nodes --help |
| 90 | + usage: mesh_doctor.py collocated_nodes [-h] --tolerance TOLERANCE |
| 91 | +
|
| 92 | + options: |
| 93 | + -h, --help show this help message and exit |
| 94 | + --tolerance TOLERANCE [float]: The absolute distance between two nodes for them to be considered collocated. |
| 95 | +
|
| 96 | +``element_volumes`` |
| 97 | +""""""""""""""""""" |
| 98 | + |
| 99 | +Computes the volumes of all the cells and displays the ones that are below a prescribed threshold. |
| 100 | +Cells with negative volumes will typically be an issue for ``geos`` and should be fixed. |
| 101 | + |
| 102 | +.. code-block:: |
| 103 | +
|
| 104 | + $ python src/geos/mesh/doctor/mesh_doctor.py element_volumes --help |
| 105 | + usage: mesh_doctor.py element_volumes [-h] --min 0.0 |
| 106 | +
|
| 107 | + options: |
| 108 | + -h, --help show this help message and exit |
| 109 | + --min 0.0 [float]: The minimum acceptable volume. Defaults to 0.0. |
| 110 | +
|
| 111 | +``fix_elements_orderings`` |
| 112 | +"""""""""""""""""""""""""" |
| 113 | + |
| 114 | +It sometimes happens that an exported mesh does not abide by the ``vtk`` orderings. |
| 115 | +The ``fix_elements_orderings`` module can rearrange the nodes of given types of elements. |
| 116 | +This can be convenient if you cannot regenerate the mesh. |
| 117 | + |
| 118 | +.. code-block:: |
| 119 | +
|
| 120 | + $ python src/geos/mesh/doctor/mesh_doctor.py fix_elements_orderings --help |
| 121 | + usage: mesh_doctor.py fix_elements_orderings [-h] [--Hexahedron 1,6,5,4,7,0,2,3] [--Prism5 8,2,0,7,6,9,5,1,4,3] |
| 122 | + [--Prism6 11,2,8,10,5,0,9,7,6,1,4,3] [--Pyramid 3,4,0,2,1] |
| 123 | + [--Tetrahedron 2,0,3,1] [--Voxel 1,6,5,4,7,0,2,3] |
| 124 | + [--Wedge 3,5,4,0,2,1] --output OUTPUT [--data-mode binary, ascii] |
| 125 | +
|
| 126 | + options: |
| 127 | + -h, --help show this help message and exit |
| 128 | + --Hexahedron 1,6,5,4,7,0,2,3 |
| 129 | + [list of integers]: node permutation for "Hexahedron". |
| 130 | + --Prism5 8,2,0,7,6,9,5,1,4,3 |
| 131 | + [list of integers]: node permutation for "Prism5". |
| 132 | + --Prism6 11,2,8,10,5,0,9,7,6,1,4,3 |
| 133 | + [list of integers]: node permutation for "Prism6". |
| 134 | + --Pyramid 3,4,0,2,1 [list of integers]: node permutation for "Pyramid". |
| 135 | + --Tetrahedron 2,0,3,1 [list of integers]: node permutation for "Tetrahedron". |
| 136 | + --Voxel 1,6,5,4,7,0,2,3 [list of integers]: node permutation for "Voxel". |
| 137 | + --Wedge 3,5,4,0,2,1 [list of integers]: node permutation for "Wedge". |
| 138 | + --output OUTPUT [string]: The vtk output file destination. |
| 139 | + --data-mode binary, ascii |
| 140 | + [string]: For ".vtu" output format, the data mode can be binary or ascii. Defaults to binary. |
| 141 | +
|
| 142 | +``generate_cube`` |
| 143 | +""""""""""""""""" |
| 144 | + |
| 145 | +This module conveniently generates cubic meshes in ``vtk``. |
| 146 | +It can also generate fields with simple values. |
| 147 | +This tool can also be useful to generate a trial mesh that will later be refined or customized. |
| 148 | + |
| 149 | +.. code-block:: |
| 150 | +
|
| 151 | + $ python src/geos/mesh/doctor/mesh_doctor.py generate_cube --help |
| 152 | + usage: mesh_doctor.py generate_cube [-h] [--x 0:1.5:3] [--y 0:5:10] [--z 0:1] [--nx 2:2] [--ny 1:1] [--nz 4] |
| 153 | + [--fields name:support:dim [name:support:dim ...]] [--cells] [--no-cells] |
| 154 | + [--points] [--no-points] --output OUTPUT [--data-mode binary, ascii] |
| 155 | +
|
| 156 | + options: |
| 157 | + -h, --help show this help message and exit |
| 158 | + --x 0:1.5:3 [list of floats]: X coordinates of the points. |
| 159 | + --y 0:5:10 [list of floats]: Y coordinates of the points. |
| 160 | + --z 0:1 [list of floats]: Z coordinates of the points. |
| 161 | + --nx 2:2 [list of integers]: Number of elements in the X direction. |
| 162 | + --ny 1:1 [list of integers]: Number of elements in the Y direction. |
| 163 | + --nz 4 [list of integers]: Number of elements in the Z direction. |
| 164 | + --fields name:support:dim |
| 165 | + [name:support:dim ...]: Create fields on CELLS or POINTS, with given dimension (typically 1 or 3). |
| 166 | + --cells [bool]: Generate global ids for cells. Defaults to true. |
| 167 | + --no-cells [bool]: Don't generate global ids for cells. |
| 168 | + --points [bool]: Generate global ids for points. Defaults to true. |
| 169 | + --no-points [bool]: Don't generate global ids for points. |
| 170 | + --output OUTPUT [string]: The vtk output file destination. |
| 171 | + --data-mode binary, ascii |
| 172 | + [string]: For ".vtu" output format, the data mode can be binary or ascii. Defaults to binary. |
| 173 | +
|
| 174 | +``generate_fractures`` |
| 175 | +"""""""""""""""""""""" |
| 176 | + |
| 177 | +For a conformal fracture to be defined in a mesh, ``geos`` requires the mesh to be split at the faces where the fracture gets across the mesh. |
| 178 | +The ``generate_fractures`` module will split the mesh and generate the multi-block ``vtk`` files. |
| 179 | + |
| 180 | +.. code-block:: |
| 181 | +
|
| 182 | + $ python src/geos/mesh/doctor/mesh_doctor.py generate_fractures --help |
| 183 | + usage: mesh_doctor.py generate_fractures [-h] --policy field, internal_surfaces [--name NAME] [--values VALUES] --output OUTPUT |
| 184 | + [--data-mode binary, ascii] [--fractures_output_dir FRACTURES_OUTPUT_DIR] |
| 185 | +
|
| 186 | + options: |
| 187 | + -h, --help show this help message and exit |
| 188 | + --policy field, internal_surfaces |
| 189 | + [string]: The criterion to define the surfaces that will be changed into fracture zones. Possible values are "field, internal_surfaces" |
| 190 | + --name NAME [string]: If the "field" policy is selected, defines which field will be considered to define the fractures. |
| 191 | + If the "internal_surfaces" policy is selected, defines the name of the attribute will be considered to identify the fractures. |
| 192 | + --values VALUES [list of comma separated integers]: If the "field" policy is selected, which changes of the field will be considered as a fracture. |
| 193 | + If the "internal_surfaces" policy is selected, list of the fracture attributes. |
| 194 | + You can create multiple fractures by separating the values with ':' like shown in this example. |
| 195 | + --values 10,12:13,14,16,18:22 will create 3 fractures identified respectively with the values (10,12), (13,14,16,18) and (22). |
| 196 | + If no ':' is found, all values specified will be assumed to create only 1 single fracture. |
| 197 | + --output OUTPUT [string]: The vtk output file destination. |
| 198 | + --data-mode binary, ascii |
| 199 | + [string]: For ".vtu" output format, the data mode can be binary or ascii. Defaults to binary. |
| 200 | + --fractures_output_dir FRACTURES_OUTPUT_DIR |
| 201 | + [string]: The output directory for the fractures meshes that will be generated from the mesh. |
| 202 | + --fractures_data_mode FRACTURES_DATA_MODE |
| 203 | + [string]: For ".vtu" output format, the data mode can be binary or ascii. Defaults to binary. |
| 204 | +
|
| 205 | +``generate_global_ids`` |
| 206 | +""""""""""""""""""""""" |
| 207 | + |
| 208 | +When running ``geos`` in parallel, `global ids` can be used to refer to data across multiple ranks. |
| 209 | +The ``generate_global_ids`` can generate `global ids` for the imported ``vtk`` mesh. |
| 210 | + |
| 211 | +.. code-block:: |
| 212 | +
|
| 213 | + $ python src/geos/mesh/doctor/mesh_doctor.py generate_global_ids --help |
| 214 | + usage: mesh_doctor.py generate_global_ids [-h] [--cells] [--no-cells] [--points] [--no-points] --output OUTPUT |
| 215 | + [--data-mode binary, ascii] |
| 216 | +
|
| 217 | + options: |
| 218 | + -h, --help show this help message and exit |
| 219 | + --cells [bool]: Generate global ids for cells. Defaults to true. |
| 220 | + --no-cells [bool]: Don't generate global ids for cells. |
| 221 | + --points [bool]: Generate global ids for points. Defaults to true. |
| 222 | + --no-points [bool]: Don't generate global ids for points. |
| 223 | + --output OUTPUT [string]: The vtk output file destination. |
| 224 | + --data-mode binary, ascii |
| 225 | + [string]: For ".vtu" output format, the data mode can be binary or ascii. Defaults to binary. |
| 226 | +
|
| 227 | +``non_conformal`` |
| 228 | +""""""""""""""""" |
| 229 | + |
| 230 | +This module will detect elements which are close enough (there's a user defined threshold) but which are not in front of each other (another threshold can be defined). |
| 231 | +`Close enough` can be defined in terms or proximity of the nodes and faces of the elements. |
| 232 | +The angle between two faces can also be precribed. |
| 233 | +This module can be a bit time consuming. |
| 234 | + |
| 235 | +.. code-block:: |
| 236 | +
|
| 237 | + $ python src/geos/mesh/doctor/mesh_doctor.py non_conformal --help |
| 238 | + usage: mesh_doctor.py non_conformal [-h] [--angle_tolerance 10.0] [--point_tolerance POINT_TOLERANCE] |
| 239 | + [--face_tolerance FACE_TOLERANCE] |
| 240 | +
|
| 241 | + options: |
| 242 | + -h, --help show this help message and exit |
| 243 | + --angle_tolerance 10.0 [float]: angle tolerance in degrees. Defaults to 10.0 |
| 244 | + --point_tolerance POINT_TOLERANCE |
| 245 | + [float]: tolerance for two points to be considered collocated. |
| 246 | + --face_tolerance FACE_TOLERANCE |
| 247 | + [float]: tolerance for two faces to be considered "touching". |
| 248 | +
|
| 249 | +``self_intersecting_elements`` |
| 250 | +"""""""""""""""""""""""""""""" |
| 251 | + |
| 252 | +Some meshes can have cells that auto-intersect. |
| 253 | +This module will display the elements that have faces intersecting. |
| 254 | + |
| 255 | +.. code-block:: |
| 256 | +
|
| 257 | + $ python src/geos/mesh/doctor/mesh_doctor.py self_intersecting_elements --help |
| 258 | + usage: mesh_doctor.py self_intersecting_elements [-h] [--min 2.220446049250313e-16] |
| 259 | +
|
| 260 | + options: |
| 261 | + -h, --help show this help message and exit |
| 262 | + --min 2.220446049250313e-16 |
| 263 | + [float]: The tolerance in the computation. Defaults to your machine precision 2.220446049250313e-16. |
| 264 | +
|
| 265 | +``supported_elements`` |
| 266 | +"""""""""""""""""""""" |
| 267 | + |
| 268 | +``geos`` supports a specific set of elements. |
| 269 | +Let's cite the standard elements like `tetrahedra`, `wedges`, `pyramids` or `hexahedra`. |
| 270 | +But also prismes up to 11 faces. |
| 271 | +``geos`` also supports the generic ``VTK_POLYHEDRON``/``42`` elements, which are converted on the fly into one of the elements just described. |
| 272 | + |
| 273 | +The ``supported_elements`` check will validate that no unsupported element is included in the input mesh. |
| 274 | +It will also verify that the ``VTK_POLYHEDRON`` cells can effectively get converted into a supported type of element. |
| 275 | + |
| 276 | +.. code-block:: |
| 277 | +
|
| 278 | + $ python src/geos/mesh/doctor/mesh_doctor.py supported_elements --help |
| 279 | + usage: mesh_doctor.py supported_elements [-h] [--chunck_size 1] [--nproc 8] |
| 280 | +
|
| 281 | + options: |
| 282 | + -h, --help show this help message and exit |
| 283 | + --chunck_size 1 [int]: Defaults chunk size for parallel processing to 1 |
| 284 | + --nproc 8 [int]: Number of threads used for parallel processing. Defaults to your CPU count 8. |
0 commit comments