Bamboost

bamboost.plugins_dev.fenics

Attributes

  • __all__=['FenicsBamboostPlugin']
  • log=BAMBOOST_LOGGER.getChild('bamboost_plugin_fenics')

Classes

WriteStrategy

Enum for write style.

Attributes:
  • SCATTERED=0

    Scattered write style. Each process writes its own data. This is slower because the location to write to is not necessarily contiguous.

  • CONTIGUOUS=1

    Contiguous write style. Data is gathered on the root process and written contigously.

_FenicsStepWriter

_FenicsStepWriter(self, series, step)

Helper writer for input from FEniCS directly.

Arguments:
  • series:Series[bamboost._typing.Mutable]
  • step:int
_FenicsStepWriter.add_field(self, name, function, *, mesh_name=DEFAULT_MESH_NAME, field_type=FieldType.NODE) -> None

Add a Fenics function to the step.

Arguments:
  • name:str

    The name of the field.

  • function:fenics.fenics.Function

    The Fenics function to add.

  • mesh_name:str=bamboost.constants.DEFAULT_MESH_NAME

    (Optional) The name of the mesh to which the field belongs. ()

  • field_type:FieldType=bamboost.core.simulation.FieldType.bamboost.core.simulation.FieldType.NODE

    (Optional) The type of the field (default: FieldType.NODE). This is only relevant for XDMF writing.

_FenicsFieldData

Bases
_FenicsFieldData.add_fenics_function(self, name, function, field_type=FieldType.NODE, attrs=None, dtype=None, *, file_map=True) -> None

Add a Fenics function to the field.

Arguments:
  • name:str
  • function:fenics.fenics.Function
  • field_type:FieldType=bamboost.core.simulation.FieldType.bamboost.core.simulation.FieldType.NODE
  • attrs:typing.Optional[dict[str, typing.Any]]=None
  • dtype:typing.Optional[str]=None
  • file_map:bool=True
_FenicsFieldData._dump_fenics_field(self, name, field, dtype=None, center=FieldType.NODE) -> None
Arguments:
  • name:str
  • field:fenics.fenics.Function
  • dtype:typing.Optional[str]=None
  • center:FieldType=bamboost.core.simulation.FieldType.bamboost.core.simulation.FieldType.NODE
_FenicsFieldData._dump_fenics_field_on_root(self, name, field, dtype=None, center=FieldType.NODE) -> None

Assembles the vector on the root process and writes it to file contiguously.

This is faster but requires the entire array to fit in memory.

Arguments:
  • name:str
  • field:fenics.fenics.Function

    FEniCS function

  • dtype:typing.Optional[str]=None

    Optional. Numpy style datatype, see h5py documentation, defaults to the dtype of the vector

  • center:FieldType=bamboost.core.simulation.FieldType.bamboost.core.simulation.FieldType.NODE

    Optional. Center of the data. Can be 'Node' or 'Cell'. Default is 'Node'.

_FenicsFieldData._get_global_dofs(self, func) -> tuple[np.ndarray, np.ndarray, int]

Get global dofs for a given function.

Arguments:
  • func:fenics.fenics.Function
Returns
numpy.numpy.ndarrayA tuple with the local vector, a mapping from the local to the
_FenicsFieldData._get_global_dofs_cell_data(self, func) -> tuple[np.ndarray, np.ndarray, int]

Get global dofs for a given function.

Arguments:
  • func:fenics.fenics.Function
Returns
numpy.numpy.ndarrayA tuple with the local vector, a mapping from the local to the

_FenicsMeshes

Bases
_FenicsMeshes.add_fenics_mesh(self, mesh, name=DEFAULT_MESH_NAME, cell_type=CellType.TRIANGLE) -> None

Add a mesh with the given name to the simulation.

Arguments:
  • mesh:fenics.fenics.Mesh
  • name:str=bamboost.constants.DEFAULT_MESH_NAME

    Name of the mesh

  • cell_type:CellType=bamboost.core.simulation.CellType.bamboost.core.simulation.CellType.TRIANGLE

    Cell type (default: "triangle"). In general, we do not care about the cell type and leave it up to the user to make sense of the data they provide. However, the cell type specified is needed for writing an XDMF file. For possible types, consult the XDMF/paraview manual.

_T_FenicsPluginOpts

Attributes:
  • write_strategy:WriteStrategy

    Write strategy for the data. Contiguous is faster but requires the entire array to fit in memory of the root process.

FenicsBamboostPlugin

Plugin for writing FEniCS data to HDF5 files.

Attributes:
  • FenicsWriter=bamboost.plugins_dev.fenics._FenicsStepWriter
  • FenicsFieldData=bamboost.plugins_dev.fenics._FenicsFieldData
  • FenicsMeshes=bamboost.plugins_dev.fenics._FenicsMeshes