pyopensn.mesh.MeshContinuum
- class pyopensn.mesh.MeshContinuum
Mesh continuum.
Wrapper of
opensn::MeshContinuum
.- ComputeVolumePerBlockID(self: pyopensn.mesh.MeshContinuum) dict[int, float]
Compute volume per block ID
- Returns:
Key is the block ID and the value is the computed volume
- Return type:
Dict[int, float]
- ExportToPVTU(self: pyopensn.mesh.MeshContinuum, file_base_name: str) None
Write grid cells into PVTU format.
- Parameters:
file_base_name (str) – Base name of the output file.
- SetBlockIDFromFunction(self: pyopensn.mesh.MeshContinuum, func: Callable[[pyopensn.math.Vector3, int], int]) None
Set block ID from a function.
- Parameters:
func (Callable[[pyopensn.math.Vector3, int], int]) – Function/lambda computing new block ID from cell centroid and old block ID.
Examples
>>> # Change block ID from 0 to 1 for cells inside the unit sphere. >>> def block_id_setter(cell_centroid, old_id): ... if (old_id == 0) and (cell_centroid.Norm() < 1.0): ... return 1 ... return old_id >>> mesh.SetBlockIDFromFunction(block_id_setter)
- SetBlockIDFromLogicalVolume(self: pyopensn.mesh.MeshContinuum, log_vol: opensn::LogicalVolume, block_id: int, inside: bool) None
Set block ID’s using a logical volume.
- Parameters:
log_vol (pyopensn.logvol.LogicalVolume) – Logical volume that determines which mesh cells will be selected.
block_id (int) – Block ID that will be assigned.
inside (bool) – If true, the selected mesh cells are the ones whose centroids are inside the logival volume. Otherwise, the selected meshes are the ones whose centroids are outside of the logical volume.
- SetBoundaryIDFromLogicalVolume(self: pyopensn.mesh.MeshContinuum, log_vol: opensn::LogicalVolume, boundary_name: str, inside: bool = True) None
Set boundary ID’s using a logical volume.
- Parameters:
log_vol (pyopensn.logvol.LogicalVolume) – Logical volume that determines which mesh cells will be selected.
boundary_name (str) – Name of the boundary.
inside (bool, default=True) – If true, the selected cell facess are the ones whose centroids are inside the logival volume. Otherwise, the selected meshes are the ones whose centroids are outside of the logical volume.
- SetOrthogonalBoundaries(self: pyopensn.mesh.MeshContinuum) None
Set boundary IDs for xmin/xmax, ymin/ymax, zmin/zmax for a right parallelpiped domain.
- SetUniformBlockID(self: pyopensn.mesh.MeshContinuum, mat_id: int) None
Set block ID’s for all cells to the specified block ID.
- property dimension
Number of dimensions of the mesh.