Process Architecture#
This page is the code-oriented entry point for hydromodpy.physics,
the layer that turns validated configuration into the runtime
Flow and Transport objects consumed by solver adapters.
It groups the package map, the reusable contracts, the runtime data model, and every UML diagram (component, class, sequence, lifecycle, extension) in one place.
Package map#
The current hydromodpy.physics stack is split into six concerns:
hydromodpy.physics: public compatibility facade that re-exports the main process symbols.hydromodpy.physics.contracts: explicit import path for generic process-layer contracts reused internally.hydromodpy.physics.prototype: process-agnostic building blocks (ProcessSpatial,ProcessSpatialConfig,InitialCondition,BoundaryCondition,SinkSource).hydromodpy.physics.flow: concrete flow process plus typed config and payload models.hydromodpy.physics.transport: concrete transport process plus typed config.hydromodpy.physics.forcing: helpers that turn loaded data into process-ready forcing payloads aligned to simulation time.hydromodpy.physics.hydrology: hydrological utilities, synthetic forcing helpers, and thepyhelpcoupling stack.
Runtime role:
physicsdefines the hydrological problem payloads,simulationdecides when those payloads are executed,solverdecides how they are numerically solved.
Reading paths by concern#
Generic process contracts (“what is the shared contract behind process objects?”):
hydromodpy/process/contracts.pyhydromodpy/process/prototype/__init__.pyfiles under
hydromodpy/process/prototype/
Flow process (“what does the project materialize before a flow solve?”):
hydromodpy/process/flow/__init__.pyhydromodpy/process/flow/flow.pyhydromodpy/process/flow/flow_config.pyinitial / boundary / sinks-source payload files in the same package
Transport process (“what transport runtime object is passed to the adapter?”):
hydromodpy/process/transport/transport.pyhydromodpy/process/transport/transport_config.py
Forcing bridge (“how do loaded data become solver-ready time series?”):
hydromodpy/process/forcing/forcing_bridge.pyhydromodpy/process/forcing/time_alignment.py
Adding a new process (extension workflow): see the activity diagram below.
Layer separation (component diagram)#
Architectural boundaries between configuration, runtime process objects, conceptual hydrology helpers, adapter logic, and solver backends.
Notes:
Config parsing and validation are isolated from solver-specific code.
Conceptual hydrology forcing remains outside
hydromodpy.physicsand is exposed through the simulation forcing adapter layer.Runtime process classes are solver-agnostic containers.
Adapter components are the only layer allowed to translate runtime data to solver input formats.
Config class diagram#
Validated configuration classes (Pydantic models): shared
ProcessSpatialConfig base, FlowConfig and TransportConfig
specialisations, flow-specific initial conditions, boundary
conditions, and sink/source configs.
Notes:
FlowConfigandTransportConfiginherit fromProcessSpatialConfig.FlowInitialConditioninherits from prototypeInitialCondition.FlowBoundaryConditionConfigandFlowSinksSourcesConfigare dedicated flow models (not subclasses of prototypeBoundaryCondition/SinkSource).TransportConfigcurrently keeps boundary and sink/source payloads as generic mappings.
Runtime class diagram#
Runtime inheritance and composition for process objects:
ProcessSpatial as the abstract runtime base, Flow and
Transport as concrete implementations, runtime initial
conditions, boundary conditions, and sink/source containers.
Notes:
FlowandTransportboth inherit fromProcessSpatial.FlowInitialConditioninherits from prototypeInitialCondition.Runtime boundary conditions stored by
ProcessSpatialuse prototypeBoundaryCondition.Runtime sink/source storage is generic (
dict[str, object]), with process-specific payloads injected by child classes.Recharge chronicle preparation stays outside this inheritance tree and is handled by simulation forcing services before solver assembly.
Lifecycle state machine#
The usual lifecycle of a ProcessSpatial-based runtime object,
from creation to solver execution and post-processing.
Notes:
RuntimeHydratedmeans parameters, IC, BC, and sinks/sources are set.PreparedForSolverrepresents adapter-resolved arrays / dictionaries.Failures can route back to hydration after config or data corrections.
Runtime-to-solver sequence#
The main runtime handoff from process objects to solver backends:
runtime construction of Flow from validated config, recharge
chronicle preparation before solver assembly, adapter-level
transformation into solver payloads, and backend-specific execution.
Notes:
The sequence is logical and backend-agnostic at the high level.
Payload conversion is explicitly separated from process runtime state.
Recharge forcing is prepared before solver assembly and injected as already-aligned series.
Solver wrappers remain consumers of already-normalised process data.
For detailed DIS payload semantics, see MODFLOW-NWT Contracts.
Extending with a new process#
Practical workflow to add a new ProcessSpatial specialisation:
config model first, then runtime class, then adapters. Testing and
documentation updates are mandatory completion steps; iteration is
expected before final integration.
Reading path before extending:
hydromodpy/process/prototype/process_spatial_config.pyhydromodpy/process/prototype/process_spatial.pyhydromodpy/process/flow/as the main concrete examplehydromodpy/solver/base/registry.pyhydromodpy/solver/compatibility.py
See also#
TOML To Solver Walkthrough for the configuration-to-solver path that consumes process objects.
Solver Architecture for the backend-side architecture.
Test Families and Quality Roles for the test expectations on a new process / solver pair.