OpenFoam Export

A class build to handle mass exportation of OpenFoam files.
Written By: Matthew Stadelman
Date Written: 2016/08/08
Last Modifed: 2016/08/08
class apmapflow.openfoam.openfoam_export.OpenFoamExport(field=None, avg_fact=1.0, mesh_params=None)[source]

A class to handle generation and exporting of OpenFoam files

__init__(field=None, avg_fact=1.0, mesh_params=None)[source]

Handles generation and exporting of OpenFoam files

__weakref__

list of weak references to the object (if defined)

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:

  1. An already existing OpenFoamFile instances
  2. A string representing the path to a valid OpenFoamFile
  3. 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

write_mesh_file(path='.', create_dirs=True, overwrite=False)[source]

Passes arguments off to the BlockMeshDict method

write_symmetry_plane(path='.', create_dirs=True, overwrite=False)[source]

Passes arguments off to the BlockMeshDict method