-
Notifications
You must be signed in to change notification settings - Fork 60
Add element volume computation to GeometryFM3D #925
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
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-coordinateselem2d_ids— maps each 3D element to its 2D footprint_znon 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_volumeson 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
_znthrough 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request