emout.core.boundaries package

Module contents

Boundary wrappers for MPIEMSES finbound mode.

Re-exports all public classes and constants for backward compatibility.

class emout.core.boundaries.Boundary(inp, unit, index, btype)[source]

Bases: object

Base class for a single finbound sub-boundary.

Concrete subclasses know which &ptcond parameters to consult and how to construct their MeshSurface3D representation. They must implement _build_params() and _build_mesh(), and they should declare mesh_class so BoundaryCollection.mesh can filter broadcast keyword arguments to the kwargs the underlying mesh class actually accepts.

Parameters:
  • inp – The emout.utils.InpFile holding data.inp’s namelist.

  • unit – The emout.utils.Units instance for SI conversion (may be None if the simulation has no unit conversion key).

  • index (int) – Zero-indexed position of this boundary inside boundary_types.

  • btype (str) – The MPIEMSES type string ("sphere", "cylinderz", …). Kept so classes handling several axis variants can infer the axis letter.

mesh(*, use_si=True, **overrides)[source]

Build the MeshSurface3D for this boundary.

Parameters auto-detected from data.inp may be overridden by passing keyword arguments. Overrides are interpreted in the same unit system as the returned mesh: SI metres by default (use_si=True), or simulation grid units when use_si=False.

Return type:

MeshSurface3D

mesh_class: Type[MeshSurface3D] | None = None

The MeshSurface3D subclass that this boundary builds. Used by BoundaryCollection.mesh() to filter broadcast keyword arguments so that, for example, data.boundaries.mesh(theta_range=...) only forwards theta_range to boundaries whose mesh class actually accepts it. Set to None to opt out of filtering.

plot3d(*, use_si=True, mesh_kwargs=None, plotter=None, offsets=None, show=False, color='0.7', opacity=0.6, show_edges=False, add_axes=True, **kwargs)[source]

Draw this boundary mesh on a PyVista plotter and return it.

mesh_kwargs is forwarded to mesh(); remaining keyword arguments are forwarded to PyVista plotter.add_mesh.

render(*, use_si=True, **style_kwargs)[source]

Build the mesh and wrap it in a RenderItem for plot_surfaces.

Convenience that mirrors MeshSurface3D.render(). use_si defaults to True (SI metres) and is forwarded to mesh(); remaining keyword arguments are passed through to RenderItem (style, solid_color, alpha, …). For finer mesh-construction control, chain explicitly: boundary.mesh(ntheta=96).render(style="solid").

class emout.core.boundaries.BoundaryCollection(inp, unit, remote_open_kwargs=None)[source]

Bases: object

Collection of boundaries discovered in data.inp’s finbound config.

Supports len, iteration, and integer indexing. mesh() returns a composite MeshSurface3D concatenating every boundary, with optional per-index or common keyword overrides.

Boundaries of unsupported types (or legacy single-body modes outside boundary_type = 'complex') are silently skipped. A skipped list records the reason per skipped slot for debugging.

classmethod from_boundaries(boundaries, unit=None)[source]

Build a collection from an explicit iterable of boundaries.

Skips the namelist parsing path used by __init__. Useful when composing boundaries with + (boundary1 + boundary2) or constructing ad-hoc subsets for plotting and tests.

Parameters:
  • boundaries (Iterable[Boundary]) – Iterable of Boundary instances. BoundaryCollection children are flattened.

  • unit – Optional emout.utils.Units for SI conversion. Falls back to the first non-None unit found on the input boundaries.

Return type:

BoundaryCollection

mesh(*, use_si=True, per=None, **common_overrides)[source]

Return the composite mesh of all recognised boundaries.

Parameters:
  • use_si (bool, default True) – Convert geometry to SI metres via data.unit.length.reverse. Pass use_si=False to keep simulation grid units instead.

  • per (dict, optional) – Mapping from boundary index (0-based) to a dict of overrides passed to that boundary’s mesh() call. Per-index entries are merged on top of (and override) the broadcast common_overrides and bypass the kwarg filter — they go straight through to boundary.mesh().

  • **common_overrides

    Overrides broadcast to every boundary. Each boundary only sees the subset of these kwargs that its underlying mesh_class __init__ actually accepts (introspected via inspect.signature()). For example:

    data.boundaries.mesh(theta_range=[0, np.pi])
    

    forwards theta_range to the sphere/cylinder/disk/circle/ plane-with-circle entries that support it and silently drops it for cuboid/rectangle/flat-surface entries.

Return type:

MeshSurface3D

plot(*, ax=None, use_si=True, offsets=None, per=None, backend='mpl', style='solid', solid_color='0.7', alpha=0.6, **kwargs)[source]

Plot boundary meshes in 3-D.

Use this to inspect boundary geometry without a field overlay. To overlay on field data, use Data3d.plot_surfaces(data.boundaries).

Parameters:
  • ax (Axes3D, optional) – Target 3-D axes. Created if None.

  • use_si (bool, default True) – Convert to SI metres.

  • offsets (tuple of (float or str), optional) – (x_offset, y_offset, z_offset) applied to mesh vertices. Accepts "left", "center", "right" or numeric values.

  • per (dict, optional) – Per-boundary mesh overrides.

  • backend ({'mpl', 'pyvista'}, default 'mpl') – Rendering backend.

  • style (str) – Rendering style forwarded to RenderItem.

  • solid_color – Rendering style forwarded to RenderItem.

  • alpha (float) – Rendering style forwarded to RenderItem.

plot3d(*, plotter=None, use_si=True, offsets=None, per=None, mesh_kwargs=None, show=False, color=None, opacity=None, surface_color='0.7', surface_opacity=0.6, show_edges=False, add_axes=True, surface_kwargs=None, filename=None, savefilename=None, **kwargs)[source]

Plot boundary meshes in 3-D with PyVista.

render(*, use_si=True, per=None, **style_kwargs)[source]

Build the composite mesh and wrap it in a RenderItem.

use_si defaults to True (SI metres). use_si and per are forwarded to mesh(); remaining keyword arguments are forwarded to RenderItem (style, solid_color, alpha, …).

property types: Tuple[str, ...]

Return boundary type names included in this collection.

class emout.core.boundaries.CircleBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES circlex/circley/circlezCircleMeshSurface.

mesh_class

alias of CircleMeshSurface

class emout.core.boundaries.CuboidBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES cuboid boundary → BoxMeshSurface.

mesh_class

alias of BoxMeshSurface

class emout.core.boundaries.CylinderBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES cylinderx/y/z and open-cylinder*.

cylinder_origin holds the lower end of the cylinder along the chosen axis; we place that point at the mesh origin with tmin=0, tmax=cylinder_height so the cylinder extends in the +axis direction (matching the Fortran convention).

property axis_letter: str
property is_open: bool
mesh_class

alias of CylinderMeshSurface

class emout.core.boundaries.CylinderHoleBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES legacy cylinder-hole → cylindrical pit.

The Fortran implementation uses the same xlrechole/xurechole… bounds as RectangleHoleBoundary but treats them as defining the cylindrical radius (half of xu - xl). We return a CylinderMeshSurface with only the side and bottom parts, matching the Fortran wall + bottom-circle construction.

mesh_class

alias of CylinderMeshSurface

class emout.core.boundaries.DiskBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES diskx/y/z annular disk → DiskMeshSurface.

property axis_letter: str
mesh_class

alias of DiskMeshSurface

class emout.core.boundaries.FlatSurfaceBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES legacy flat-surfaceRectangleMeshSurface.

Reads the scalar zssurf (and domain extents nx/ny) to build a flat rectangular plane at z = zssurf that spans the entire horizontal domain.

mesh_class

alias of RectangleMeshSurface

class emout.core.boundaries.PlaneWithCircleBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES plane-with-circlex/y/zPlaneWithCircleMeshSurface.

These are single flat planes perpendicular to the chosen axis with a circular aperture at plane_with_circle_origin. The plane itself is drawn large enough to cover the simulation domain (nx/ny/nz grid extents).

property axis_letter: str
mesh_class

alias of PlaneWithCircleMeshSurface

class emout.core.boundaries.RectangleBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES rectangle boundary → single-face BoxMeshSurface.

The flat face is inferred from whichever of x/y/z has min == max.

mesh_class

alias of BoxMeshSurface

class emout.core.boundaries.RectangleHoleBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES legacy rectangle-hole → pit-shaped box.

The Fortran implementation in surfaces.F90 assembles the hole from nine rectangles (bottom of the pit, four walls, and four top-plane pieces surrounding the opening). For visualization purposes this class returns the rectangular pit itself as a BoxMeshSurface with the top face omitted — that is the opening — which is the most useful shape to overlay on a field plot.

mesh_class

alias of BoxMeshSurface

class emout.core.boundaries.SphereBoundary(inp, unit, index, btype)[source]

Bases: Boundary

MPIEMSES sphere boundary → SphereMeshSurface.

mesh_class

alias of SphereMeshSurface