zoomy_core.mesh.column_structure module

zoomy_core.mesh.column_structure module#

Column structure for extruded meshes.

Provides vertical column mapping and numerical integration operations for meshes built by BaseMesh.extrude_2d() or mesh_extrude.

Cell indexing convention (from extrusion):

cell_3d = iz * n_horizontal + i_horizontal

where iz is the layer index (0 = bottom, n_layers-1 = top) and i_horizontal is the horizontal cell index.

class zoomy_core.mesh.column_structure.ColumnStructure(n_horizontal, n_layers)#

Bases: object

Vertical column mapping for extruded meshes.

Precomputes column-cell mapping and layer weights for numerical vertical integration in sigma coordinates (zeta in [0, 1]).

Parameters:
  • n_horizontal (int) – Number of horizontal (inner) cells.

  • n_layers (int) – Number of vertical layers.

integrate(Q)#

Numerical vertical integral: integral_0^1 Q(zeta) dzeta.

Midpoint rule over uniform layers.

Parameters:

Q (ndarray, shape (n_vars, n_3d_cells)) – Field values on the full extruded mesh.

Returns:

Vertically integrated values per horizontal cell.

Return type:

ndarray, shape (n_vars, n_horizontal)

partial_integrate(Q, from_top=True)#

Running vertical integral per cell.

Computes integral_zeta^1 Q(zeta’) dzeta’ (from_top=True) or integral_0^zeta Q(zeta’) dzeta’ (from_top=False).

Parameters:
  • Q (ndarray, shape (n_vars, n_3d_cells)) –

  • from_top (bool) – If True, integrate from surface (zeta=1) downward. If False, integrate from bottom (zeta=0) upward.

Returns:

Running integral value at each cell.

Return type:

ndarray, shape (n_vars, n_3d_cells)

scatter_to_column(Q_horiz)#

Broadcast horizontal values to all layers in each column.

Parameters:

Q_horiz (ndarray, shape (n_vars, n_horizontal)) –

Return type:

ndarray, shape (n_vars, n_3d_cells)

gather_layer(Q, iz)#

Extract values at a single layer.

Parameters:
  • Q (ndarray, shape (n_vars, n_3d_cells)) –

  • iz (int) – Layer index (0 = bottom, n_layers-1 = top).

Return type:

ndarray, shape (n_vars, n_horizontal)