Extract Geometry
Having a geometry file of an object is useful for testing geometry parameterizations or visualizing specific aspects of the geometry. For example, it can be helpful to prototype design variables on a simplified geometry before applying it to a complete mesh and case. Extracting a geometry is done through ParaView by importing the mesh, isolating the desired patches, and exporting the surfaces.
The extract geometry post-processing routine is available through both a command line executable and through the Python API. Using either method, the utility will read the mesh and write out the wall surfaces into a STL file.
Command Line
To call the utility from the command line, simply call the utility using the following command with the desired options:
usage: extract_geometry [-h] [-i INPUT_FILE] [-o OUTPUT_DIRECTORY]
[-p PATCHES [PATCHES ...]] [-ow OVERWRITE]
Named Arguments
- -i, --input_file
Relative path to input file.
Default:
''- -o, --output_directory
Relative path to output directory. Default is ./
Default:
'./'- -p, --patches
Patches to include in the geometry file. Default is group/wall.
Default:
'group/wall'- -ow, --overwrite
Flag to overwrite existing temporary geometry and geometry files. Default is False.
Default:
'False'
Python API
To call the utility from Python, import the necessary modules and call the function with the necessary inputs:
- postprocessing.paraview.geometry.extract_geometry(input_file=None, output_directory='./', patches='group/wall', overwrite='False')
Function to extract a geometry from an OpenFOAM mesh and write it as an STL.
- Parameters:
- input_filestr
Path to file to load with Paraview.
- output_directorystr
Path to directory where the geometry files will be written. Default is “./”.
- patchesstr or list
Patch name(s) to include in the geometry. Default is “group/wall”.
- overwritestr
Flag to overwrite existing temporary geometry and geometry files. Default is False.