Geometry Infrastructure
Mesh
Mesh data structures for 1-D and 2-D geometries.
A mesh is an immutable description of a spatial domain: cell edges, material assignments, and derived quantities (volumes, surfaces, cell centres). Solvers receive a mesh and build mutable, solver-specific state on top of it.
Both Mesh1D and Mesh2D are frozen dataclasses –
once created, their fields cannot be reassigned.
- class orpheus.geometry.mesh.Mesh1D(edges, mat_ids, coord=CoordSystem.CARTESIAN)[source]
Bases:
objectOne-dimensional mesh in Cartesian, cylindrical, or spherical coordinates.
- Parameters:
edges (ndarray, shape (N+1,)) – Monotonically increasing cell boundary positions. For cylindrical / spherical meshes these are radii.
mat_ids (ndarray, shape (N,)) – Integer material ID for each cell.
coord (CoordSystem) – Coordinate system (default: Cartesian).
- edges: ndarray
- mat_ids: ndarray
- coord: CoordSystem = 'cartesian'
- property N: int
Number of cells.
- property widths: ndarray
Cell widths (edge-to-edge distance), shape (N,).
- property centers: ndarray
Cell centre positions, shape (N,).
- property volumes: ndarray
Cell volumes, shape (N,). Formula depends on coord.
- property surfaces: ndarray
Surface areas at each edge, shape (N+1,). Formula depends on coord.
- property total_width: float
Total extent of the mesh (outer edge minus inner edge).
- class orpheus.geometry.mesh.Mesh2D(edges_x, edges_y, mat_map, coord=CoordSystem.CARTESIAN)[source]
Bases:
objectTwo-dimensional mesh: Cartesian (x, y) or cylindrical (r, z).
- Parameters:
edges_x (ndarray, shape (Nx+1,)) – Edge positions in the first direction (x or r).
edges_y (ndarray, shape (Ny+1,)) – Edge positions in the second direction (y or z).
mat_map (ndarray, shape (Nx, Ny)) – Integer material ID for each cell.
coord (CoordSystem) –
CARTESIANfor (x, y) orCYLINDRICALfor (r, z).
- edges_x: ndarray
- edges_y: ndarray
- mat_map: ndarray
- coord: CoordSystem = 'cartesian'
- property nx: int
Number of cells in x (or r) direction.
- property ny: int
Number of cells in y (or z) direction.
- property dx: ndarray
Cell widths in x (or r) direction, shape (Nx,).
- property dy: ndarray
Cell widths in y (or z) direction, shape (Ny,).
- property centers_x: ndarray
Cell centres in x (or r) direction, shape (Nx,).
- property centers_y: ndarray
Cell centres in y (or z) direction, shape (Ny,).
- property volumes: ndarray
Cell volumes, shape (Nx, Ny). Formula depends on coord.
- property mat_ids: ndarray
Flat material-ID array, shape (Nx*Ny,).
Compatible with
data.macro_xs.cell_xs.assemble_cell_xs().
Coordinate Systems
Coordinate systems and their volume / surface formulas.
This module is the single point where coordinate-system dependence lives. All mesh classes delegate to these functions.
Supported coordinate systems
Cartesian – flat geometry (slab, plate, box)
Cylindrical – annular geometry (pin cell, tube)
Spherical – shell geometry (pebble, sphere)
Volume formulas (1-D)
Cartesian |
\(V_i = x_{i+1} - x_i\) |
Cylindrical |
\(V_i = \pi (r_{i+1}^2 - r_i^2)\) |
Spherical |
\(V_i = \tfrac{4}{3}\pi (r_{i+1}^3 - r_i^3)\) |
Surface formulas (1-D)
Cartesian |
\(S = 1\) (per unit transverse area) |
Cylindrical |
\(S = 2\pi r\) (per unit height) |
Spherical |
\(S = 4\pi r^2\) |
- class orpheus.geometry.coord.CoordSystem(*values)[source]
Bases:
EnumCoordinate system identifier.
- CARTESIAN = 'cartesian'
- CYLINDRICAL = 'cylindrical'
- SPHERICAL = 'spherical'
- orpheus.geometry.coord.compute_volumes_1d(coord, edges)[source]
Cell volumes from 1-D edge positions.
- Parameters:
coord (CoordSystem) – Coordinate system.
edges (ndarray, shape (N+1,)) – Monotonically increasing edge positions.
- Returns:
Volume of each cell.
- Return type:
ndarray, shape (N,)
- orpheus.geometry.coord.compute_surfaces_1d(coord, edges)[source]
Surface areas at each 1-D edge position.
- Parameters:
coord (CoordSystem) – Coordinate system.
edges (ndarray, shape (N+1,)) – Edge positions.
- Returns:
Surface area at every edge.
- Return type:
ndarray, shape (N+1,)
- orpheus.geometry.coord.compute_volumes_2d(coord, edges_x, edges_y)[source]
Cell volumes from 2-D edge positions.
- Parameters:
coord (CoordSystem) –
CARTESIANfor (x, y) orCYLINDRICALfor (r, z).edges_x (ndarray, shape (Nx+1,)) – Edge positions in x (or radial) direction.
edges_y (ndarray, shape (Ny+1,)) – Edge positions in y (or axial) direction.
- Returns:
Volume of each cell.
- Return type:
ndarray, shape (Nx, Ny)
Factories
Mesh construction factories.
Zone-based construction
A zone is a material region defined by its outer boundary. The
mesh1d_from_zones() function subdivides each zone into cells
with a coordinate-system-aware strategy:
Cartesian – equal-width cells.
Cylindrical – equal-volume annuli.
Spherical – equal-volume shells.
PWR convenience factories
pwr_slab_half_cell() and pwr_pin_equivalent() build
standard 3-zone (fuel | clad | coolant) meshes with sensible defaults.
- class orpheus.geometry.factories.Zone(outer_edge, mat_id, n_cells)[source]
Bases:
objectOne material zone for mesh construction.
- Parameters:
- outer_edge: float
- mat_id: int
- n_cells: int
- orpheus.geometry.factories.mesh1d_from_zones(zones, coord=CoordSystem.CARTESIAN, origin=0.0)[source]
Build a
Mesh1Dfrom a list of zones.
- orpheus.geometry.factories.pwr_slab_half_cell(n_fuel=10, n_clad=3, n_cool=7, fuel_half=0.9, clad_thick=0.2, cool_thick=0.7)[source]
Cartesian 1-D half-cell: fuel | clad | coolant.
The mesh starts at x = 0 (reflective symmetry plane at the fuel centre) and extends to x = fuel_half + clad_thick + cool_thick.
Material IDs: 2 = fuel, 1 = clad, 0 = coolant.
- orpheus.geometry.factories.pwr_pin_equivalent(n_fuel=10, n_clad=3, n_cool=7, r_fuel=0.9, r_clad=1.1, pitch=3.6)[source]
Cylindrical 1-D Wigner-Seitz equivalent pin cell.
The square unit cell (side = pitch) is replaced by a cylinder of equal area:
r_cell = pitch / sqrt(pi).Material IDs: 2 = fuel, 1 = clad, 0 = coolant. Sub-cells use equal-volume annuli.
- orpheus.geometry.factories.homogeneous_1d(n_cells, total_width, mat_id=0, coord=CoordSystem.CARTESIAN)[source]
Uniform 1-D mesh with a single material.
- orpheus.geometry.factories.slab_fuel_moderator(n_fuel, n_mod, t_fuel, t_mod)[source]
1-D Cartesian slab benchmark: fuel + moderator.
Material IDs: 2 = fuel (inner), 0 = moderator (outer).
- orpheus.geometry.factories.pwr_pin_2d(radii=None, mat_ids=None, pitch=3.6, n_cells=10)[source]
2-D Cartesian mesh from concentric annular regions.
Each cell in the uniform (n_cells x n_cells) grid is assigned a material ID based on its distance from the pin centre (pitch / 2).
- Parameters:
radii (list[float], optional) – Outer radii of each annular region. Default: [0.9, 1.1] (fuel, clad; everything beyond is coolant).
mat_ids (list[int], optional) – Material ID for each annulus, plus one for the region beyond the outermost radius. Default: [2, 1, 0].
pitch (float) – Unit cell side length (cm).
n_cells (int) – Number of mesh cells per side.
- Return type:
Mesh2D