pogona.MeshManager

class pogona.MeshManager[source]

Bases: pogona.component.Component

Attributes

cache_path

Directory for cached objects.

component_name

Unique name of this component, unless it is "Generic component".

openfoam_cases_path

Path to MaMoKo OpenFOAM cases.

__init__()[source]

Methods

__init__()

finalize(simulation_kernel)

get_file_name_for_cached_mesh(mesh_string)

get_valid_filename(s)

Copied from the Django project's django.utils.text: https://github.com/django/django/blob/master/django/utils/text.py

initialize(simulation_kernel, init_stage)

Use InitStages to initialize this Component instance.

load_vector_field(openfoam_sim_path[, ...])

param openfoam_sim_path

Path to the OpenFOAM simulation

parse_mesh(import_folder, mesh_string[, ...])

process_new_time_step(simulation_kernel, ...)

save_cached_vector_field(mesh_string, ...)

set_arguments(**kwargs)

Read arguments as key value pairs and set this component's member variables accordingly.

__init__()[source]
finalize(simulation_kernel: pogona.simulation_kernel.SimulationKernel)
get_file_name_for_cached_mesh(mesh_string: str)[source]
static get_valid_filename(s)[source]

Copied from the Django project’s django.utils.text: https://github.com/django/django/blob/master/django/utils/text.py

Return the given string converted to a string that can be used for a clean filename. Remove leading and trailing spaces; convert other spaces to underscores; and remove anything that is not an alphanumeric, dash, underscore, or dot. >>> MeshManager.get_valid_filename(“john’s portrait in 2004.jpg”) ‘johns_portrait_in_2004.jpg’

initialize(simulation_kernel: pogona.simulation_kernel.SimulationKernel, init_stage: pogona.component.InitStages)[source]

Use InitStages to initialize this Component instance.

load_vector_field(openfoam_sim_path: str, mesh_index: Optional[str] = None, walls_patch_names: Optional[Set[str]] = None, dummy_boundary_points: Optional[str] = None) pogona.vector_field.VectorField[source]
Parameters
  • openfoam_sim_path – Path to the OpenFOAM simulation result (the directory for one specific time step) for the vector field to load.

  • mesh_index – A unique string for the OpenFOAM simulation case and mesh given by openfoam_sim_path. Will be converted internally using MeshManager.get_valid_filename. If None, a mesh index will be generated from openfoam_sim_path.

  • walls_patch_names – Which patches to consider as boundaries (typically does not include inlets and outlets).

  • dummy_boundary_points – ‘face-centers’, ‘face-points’, or ‘none’/None (default). TODO: enum?

Returns

The cached vector field, if it exists. Otherwise the vector field will be loaded from the given path.

parse_mesh(import_folder: str, mesh_string: str, walls_patch_names: Optional[Set[str]] = None, dummy_boundary_points: Optional[str] = None) pogona.vector_field.VectorField[source]
process_new_time_step(simulation_kernel: pogona.simulation_kernel.SimulationKernel, notification_stage: pogona.component.NotificationStages)
save_cached_vector_field(mesh_string, vector_field: pogona.vector_field.VectorField)[source]
set_arguments(**kwargs)

Read arguments as key value pairs and set this component’s member variables accordingly. Validity of the argument values will be checked in initialize().

cache_path = ''

Directory for cached objects. (Not relative to the results folder.)

By default, this will be set to <OpenFOAM cases path>/cache.

component_name = 'Generic component'

Unique name of this component, unless it is “Generic component”.

id

Unique integer component ID

openfoam_cases_path = ''

Path to MaMoKo OpenFOAM cases. Usually this is passed to the individual objects directly. In the MeshManager, this path is only used as a default prefix for cache_path if cache_path is not set explicitly.