cwatm_dynamic module

class cwatm.cwatm_dynamic.CWATModel_dyn[source]

Bases: cwatm.management_modules.dynamicModel.DynamicModel

CWatM dynamic model execution class for temporal hydrological simulation.

This class implements the temporal loop of the CWatM hydrological model, executing all hydrological processes for each time step in the simulation period. It coordinates the sequential execution of hydrological modules to simulate the complete water cycle including precipitation, evapotranspiration, soil processes, groundwater, surface runoff, routing, and water management.

The dynamic execution follows a specific sequence to maintain physical consistency and proper water balance accounting throughout the hydrological system.

Global variables

Variable [self.var]

Type

Description

Unit

channelStorage

Array

Channel water storage

m3

unmetDemand_runningSum

Array

Unmet water demand (too less water availability)

m

totalET_WB

Array

Total evapotranspiration including waterbodies

m

lakeReservoirStorage

Array

Storage of lakes and reservoirs

m3

tws

Array

Total water storage

m

modflow

Flag

True if modflow_coupling = True in settings file

bool

storGroundwater

Array

Groundwater storage (non-fossil). This is primarily used when not usin

m

smallevapWaterBody

Array

Evaporation from small lakes

m

EvapWaterBodyM

Array

Evaporation from lakes and reservoirs

m

dynamicLandcover

Flag

If landcover changes per year or is constant

bool

totalET

Array

Total evapotranspiration for each cell including all landcover types

m

totalSto

Array

Total soil,snow and vegetation storage for each cell including all lan

m

InvCellArea

Array

Inverse of cell area of each simulated mesh

1/m2

EvapoChannel

Array

Channel evaporation

m3

gridcell_storage

Array

storage of water due to runoff concentration

m

groundwater_storage_available

Array

Groundwater storage. Used with MODFLOW.

m

lakeResStorage

Array

smalllakeStorage

Array

unmetDemand

Array

Unmet groundwater demand to determine potential fossil groundwaterwate

m

Variables
  • attributes are inherited from the parent DynamicModel class and (All) –

  • in the CWATModel_ini class, including (initialized) –

  • Hydrological module instances (-) –

  • Model state variables (self.var) (-) –

  • Configuration parameters (self.conf) (-) –

  • Timing and output systems (-) –

Notes

The execution order is critical for maintaining water balance and physical consistency. The sequence follows the natural hydrological cycle from atmospheric inputs through terrestrial processes to surface water routing and water management.

Performance timing is tracked for each major process group to identify computational bottlenecks and optimize model efficiency.

dynamic()[source]

Execute one time step of the complete hydrological simulation.

Performs the temporal execution of all hydrological processes for the current time step, following the natural sequence of the water cycle. This method coordinates all hydrological modules to simulate water movement and storage changes throughout the terrestrial hydrological system.

The execution sequence includes: 1. Time step management and meteorological data reading 2. Potential evapotranspiration calculation 3. Precipitation partitioning (rain/snow) and snow processes 4. Land cover dynamics and irrigation scheduling 5. Soil water processes across different land cover types 6. Groundwater processes (standard or MODFLOW coupling) 7. Surface runoff concentration and small water body processes 8. Channel routing and large water body management 9. Water quality calculations 10. Total water storage accounting 11. Environmental flow assessment 12. Output generation and state variable updates

Parameters

None – All required data accessed through self.var and module instances

Returns

Results stored in model state variables and written to output files

Return type

None

Notes

Special execution modes: - Environmental flow only: If calc_environflow is True and

calc_ef_afterRun is False, only environmental flow is calculated

  • Calibration mode: If Flags[‘calib’] is True, only meteorological data reading and output generation are performed

Output verbosity controlled by flags: - ‘v’ or ‘veryquiet’: No progress output - ‘l’ or ‘loud’: Time step and discharge information - ‘t’ or ‘printtime’: Detailed timing of each process

Total Water Storage (TWS) calculation includes: - Groundwater storage (available or with unmet demand accounting) - Soil moisture storage across all layers and land cover types - Surface water storage (lakes, reservoirs, channels) - Runoff concentration storage (if enabled)

MODFLOW integration: - When self.var.modflow is True, uses groundwater_modflow_module - Requires proper finalization at simulation end to close files - Temporary MODFLOW files must be properly managed for multi-run scenarios

i = 1