geoprior.models.subsidence.step_core#
Core step computations for subsidence physics evaluation.
Functions
|
Compute GeoPrior physics residuals and losses for a batch. |
- geoprior.models.subsidence.step_core.physics_core(model, inputs, training, return_maps=False, *, for_train=False)[source]#
Compute GeoPrior physics residuals and losses for a batch.
This function implements the shared physics pathway used by both training and evaluation for GeoPrior-style PINN models. It is designed to keep the physics logic consistent across:
train_step()(when physics losses are added to the total loss)evaluation routines (when physics diagnostics are reported)
At a high level, the function performs:
Input preparation and SI conversions (thickness, head, coords).
Forward pass through the model to obtain data predictions and physics logits.
Mapping of physics logits to bounded physical fields (\(K\), \(S_s\), \(tau\)) and the closure prior \(tau_{phys}\).
Automatic differentiation to obtain PDE derivatives with respect to the model coords.
Chain-rule scaling to SI-consistent derivatives.
Construction of residual maps for: * consolidation relaxation residual, * groundwater flow residual, * time-scale prior residual, * smoothness prior residual, * bounds residual.
Optional nondimensionalization / residual scaling.
Assembly of physics losses, gating schedules, and diagnostic epsilon metrics.
The returned dictionary contains predictions, auxiliary forward outputs, packed physics values (for logging), and optionally the full residual maps and fields.
- Parameters:
model (
object) –Model instance providing GeoPrior-style methods and attributes.
The function expects the model to expose (at minimum):
scaling_kwargsdictResolved scaling and convention payload.
time_unitsstr or NoneDataset time unit (for per-second conversions).
forecast_horizonintHorizon length used to tile coords when needed.
_forward_all(inputs, training=...)callableForward pass returning
(y_pred, aux).
split_data_predictions(x)callableSplit concatenated data head into subsidence and GWL.
split_physics_predictions(x)callableSplit concatenated physics head into
(K_logits, Ss_logits, dlogtau_logits, Q_logits).
pde_modes_activeiterable of strActive PDE modes (e.g., {‘consolidation’, ‘gw_flow’}).
Optional gates:
_q_gate(),_subs_resid_gate().Optional physics switch:
_physics_off().
The function is tolerant to partial capabilities and will short-circuit when physics is disabled, but missing mandatory signals (e.g., thickness) raise errors.
inputs (dict[str, Any | None]) – Dict input batch following the GeoPrior batch API.
training (bool)
return_maps (bool)
for_train (bool)
- Return type: