OpenFoam¶
-
class
apmapflow.openfoam.
OpenFoamDict
(name, values=None)[source]¶ Class used to build the dictionary style OpenFoam input blocks
-
class
apmapflow.openfoam.
OpenFoamList
(name, values=None)[source]¶ Class used to build the output lists used in blockMeshDict.
-
class
apmapflow.openfoam.
OpenFoamFile
(*args, **kwargs)[source]¶ Class used to build OpenFoam input files
-
class
apmapflow.openfoam.
BlockMeshDict
(field, avg_fact=1.0, mesh_params=None, offset_field=None)[source]¶ This is a special subclass of OpenFoamFile used to generate and output a blockMeshDict for OpenFoam
-
generate_threshold_mesh
(min_value=0.0, max_value=1000000000.0)[source]¶ Generates a mesh excluding all blocks below the min_value arg. Regions that are isolated by the thresholding are also automatically removed.
-
set_boundary_patches
(boundary_blocks, reset=False)[source]¶ Sets up boundary patches based on the dictionary passed in. Overlapping declarations are overwritten by the last patch to use that face. The boundary blocks dictionary contains a dictionary entry for each patch name.
- boundary_blocks dictionary has the format of:
- {patch_name: {
<side>: [ block-list ], <side>: [ block-list ], ...
} where <side> is left, right, bottom, top, front or back and block list is a list of blocks to add that patch to the side of.
- reset - boolean : if True then the face labels dictionary
and _faces array are re-initialized to default values
-
write_foam_file
(path='.', create_dirs=True, overwrite=False)[source]¶ Writes a full blockMeshDict file based on stored geometry data
-
-
class
apmapflow.openfoam.
OpenFoamExport
(field=None, avg_fact=1.0, mesh_params=None)[source]¶ A class to handle generation and exporting of OpenFoam files
-
generate_block_mesh_dict
(field, avg_fact=1.0, mesh_params=None)[source]¶ Passes arguments off to BlockMeshDict init method.
-
generate_foam_files
(*args)[source]¶ Generates, reads and adds OpenFoam files to the export to provide a centralized location to perform modifications and write files. Any number of ‘file’ arguments may be passed into this function but they are required to have one of the following three forms:
- An already existing OpenFoamFile instances
- A string representing the path to a valid OpenFoamFile
- An iterable acceptable to the dictionary constructor with at
- minimum 2 keys: location and object; ‘class’ is an optional key. Those 2/3 keys are removed and the rest of the iterable is passed along to the OpenFoamFile __init__ method as the ‘values’ keyword.
Files are stored on the export object in a dictionary attribute called ‘foam_files’. Keys in this dictionary have the format of ‘location.name’. Where ‘name’ is ‘name’ attribute on the OpenFoamFile.
-
write_foam_files
(path='.', overwrite=False)[source]¶ Writes the files generated by ‘generate_foam_files’ to their associated directories on the supplied path. If a directory doesn’t exist then it is created
-