Skip to content

Add element volume computation to GeometryFM3D #925

@ecomodeller

Description

@ecomodeller

Context

Element volumes are needed for 3D layered meshes. The building blocks already exist in the codebase — this is mainly an assembly task.

What exists today

  • GeometryFM2D.get_element_area() — horizontal areas, handles geographic coordinates (lon/lat → m² via cos(lat) correction)
  • _GeometryFMLayered._calc_dz() — element heights from node z-coordinates
  • elem2d_ids — maps each 3D element to its 2D footprint
  • _zn on DataArray — time-varying node z-coordinates (n_timesteps, n_nodes)

Approach

Formula: volume = 2D_area * dz — exact for MIKE FM prismatic elements (vertical extrusion).

Static volumes (both projected and geographic)

areas_2d[elem2d_ids] * dz. Geographic coordinates only affect horizontal area, which get_element_area() already handles. Z is always in meters.

Dynamic (time-varying) volumes

2D area is constant over time, only dz changes per timestep. The _zn array lives on DataArray, not geometry, so:

  • Static property element_volumes on GeometryFM3D using static z
  • Method calc_element_volumes(zn=None) accepting optional dynamic zn (same pattern as _calc_dz)
  • Consider convenience on DataArray that passes _zn through automatically

Complexity summary

Scenario Complexity Notes
Static + projected Trivial Multiply existing quantities
Static + geographic Trivial Already handled by get_element_area()
Dynamic + any CRS Moderate Need _zn data, API design question

Verification

MIKE 3 engine can produce a volume item — use as ground truth for both sigma and sigma-z meshes, including dynamic cases with wetting/drying.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions