cwatm_model module

Note

Base module: run from root with settings file e.g. python run_cwatm.py settings.ini

class cwatm.cwatm_model.CWATModel[source]

Bases: cwatm.cwatm_initial.CWATModel_ini, cwatm.cwatm_dynamic.CWATModel_dyn

Main CWatM model class combining initialization and dynamics.

This class serves as the primary interface for the Community Water Model (CWatM), inheriting from both the initialization (CWATModel_ini) and dynamic (CWATModel_dyn) components to provide a complete hydrological modeling framework.

The model handles:

  • Initial setup and parameter configuration

  • Temporal simulation loops

  • Integration of all hydrological processes

  • Model state management

Variables
  • all attributes from CWATModel_ini and CWATModel_dyn including (Inherits) –

  • var (-) –

  • model (-) –

Notes

The initial part handles all non-temporal initialization procedures including reading input data, setting up model parameters, and initializing state variables. The dynamic part manages the temporal simulation loop, executing hydrological processes for each time step.

dynamic()

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