Confusion about storage to be used as a target volume.
Good Morning I am currently using the CESM-coupled branch of mizuRoute for reservoir modeling with the Hanasaki et al. (2006) parametrization. Previously, I was running mizuRoute with only Cmax as the input for reservoir segments. However, I now intend to use a time series of storage as a target volume to ensure that the generated streamflow is not solely dependent on runoff from my LSM but is also influenced by reservoir storage dynamics.
Earlier I was using this control file
! ****************************************************************************************************************************
! ***** DEFINITION OF MODEL CONTROL INFORMATION ******************************************************************************
! ****************************************************************************************************************************
! ****************************************************************************************************************************
! Note: lines starting with "!" are treated as comment lines -- there is no limit on the number of comment lines.
! lines starting with <xxx> are read till "!"
!
! ****************************************************************************************************************************
! RUN CONTROL
! --------------------------
<case_name> newvol ! simulation case name
<sim_start> 2000-01-01 00:00:00 ! time of simulation start (yyyy-mm-dd hh:mm:ss)
<sim_end> 2020-12-31 00:00:00 ! time of simulation end (yyyy-mm-dd hh:mm:ss)
<newFileFrequency> single ! output netcdf frequency. daily, monthly, yearly, single
!<outputFrequency> daily ! output frequency (integer for multiple of simulation time step or daily, monthly or yearly)
<dt_qsim> 86400 ! simulation time interval [sec]
<DWvolume> T ! volume at the end of time step at reach [L3] - diffusive wave
<restart_write> last ! restart write option. never, last, specified (need to specify date with <restart_date>
!<fname_state_in> newvol.r.2023-01-01-00000.nc ! input netCDF for channel states
! ****************************************************************************************************************************
! DEFINE DIRECTORIES
! --------------------------
<ancil_dir> /home/ ! directory containing ancillary data (river network, remapping netCDF)
<input_dir> /home/ ! directory containing input data (runoff netCDF)
<output_dir> /home/ ! directory containing output data
! ****************************************************************************************************************************
! DEFINE FINE NAME AND DIMENSIONS
! ---------------------------------------
<fname_ntopOld> Network_topology_merit_with_lake_final_new_vol.nc ! name of netCDF containing river segment data
<dname_sseg> n ! dimension name of the stream segments
<dname_nhru> n ! dimension name of the HRUs
! ****************************************************************************************************************************
! DEFINE DESIRED VARIABLES FOR THE NETWORK TOPOLOGY
! ---------------------------------------------------------
<seg_outlet> -9999 ! seg_id of outlet streamflow segment -9999 for all segments
! ****************************************************************************************************************************
! ROUTE options
! --------------------------
<route_opt> 5 ! option for routing schemes 0-> runoff accum, 1->IRF, 2->KWT, 3->KW, 4->MC, 5->DW
<doesBasinRoute> 1 ! basin routing? 0-> no, 1-> basin UH
! DEFINE RUNOFF FILE
! ----------------------------------
<fname_qsim> runoff_cal_17.txt ! name of netCDF (lat/lon runoff grid)
<vname_qsim> Runoff ! variable name of HRU runoff
<vname_evapo> Evap_tavg ! name of HRU evaporation variable
<vname_precip> TotalPrecip_tavg ! name of HRU precipitation variable
<vname_time> time ! name of time variable in the runoff file
<dname_time> time ! name of time dimension
<dname_xlon> lon ! name of x(j) dimension
<dname_ylat> lat ! name of y(i) dimension
<units_qsim> mm/day ! units of runoff
<dt_qsim> 86400 ! time interval of the runoff
<input_fillvalue> -9999.000 !
! ****************************************************************************************************************************
! DEFINE RUNOFF MAPPING FILE
! ----------------------------------
<is_remap> T ! logical to indicate runnoff needs to be mapped to river network HRU
<fname_remap> Resv_weight_final.nc ! name of netCDF for HM_HRU-RN_HRU mapping data
<vname_hruid_in_remap> polyid ! variable name of RN_HRU in the mapping file
<vname_weight> weight ! variable name of areal weights of overlapping HM_HUs for each RN_HRU
<vname_i_index> i_index ! name of ylat index
<vname_j_index> j_index ! name of xlon index
<vname_num_qhru> overlaps ! name of variable containing numbers of runoff HRUs within each river network HRU
<dname_hru_remap> polyid ! dimension name of RN_HRU (in the mapping file)
<dname_data_remap> data ! dimension name of ragged HM_HRU *************************
! Spatially constant parameter Namelist name
! ---------------------------
<param_nml> param.nml.default ! namelist parameters
! ****************************************************************************************************************************
! Dictionary to map variable names
! ---------------------------
<varname_area> area ! name of variable holding hru area
<varname_length> length ! name of variable holding segment length
<varname_slope> slope ! name of variable holding segment slope
<varname_HRUid> ID ! name of variable holding HRU id
<varname_hruSegId> ID ! name of variable holding the stream segment below each HRU
<varname_segId> ID ! name of variable holding the ID of each stream segment
<varname_downSegId> ID_next ! name of variable holding the ID of the next downstream segment
<varname_islake> is_lake !
<varname_lakeModelType> lake_type ! if all reservoirs are natural
<varname_H06_Smax> lake_vol !
<varname_H06_S_ini> lake_vol !
<varname_H06_alpha> H06_alpha !
<varname_H06_envfact> H06_envfact !
<varname_H06_c1> H06_c1 !
<varname_H06_c2> H06_c2 !
<varname_H06_exponent> H06_exponent !
<varname_H06_denominator> H06_denominator !
<varname_H06_c_compare> H06_c_compare !
<varname_H06_frac_Sdead> H06_frac_Sdead !
<varname_H06_I_mem_F> H06_I_mem_F !
<varname_H06_D_mem_F> H06_D_mem_F !
<varname_H06_I_mem_L> H06_I_mem_L !
<varname_H06_D_mem_L> H06_D_mem_L !
<varname_H06_E_rel_ini> H06_E_rel_init !
<varname_H06_purpose> H06_purpose !
! ****************************************************************************************************************************
! ****************************************************************************************************************************
! ****************************************************************************************************************************
Now I have been able to figure out that following water management options and run control options need to be included into my control file. !``` DEFINE RUNOFF FILE ! ---------------------------------- ! water-management option <fname_wm> WM_NC_IN ! name of text file containing water-management netcdf (chronologically ordered) <vname_flux_wm> VARNAME_WM_FLUX ! name of varibale for abstraction/injection <vname_vol_wm> VARNAME_WM_VOL ! name of varibale for target volume for managed lakes <vname_time_wm> VARNAME_WM_TIME ! name of time variable <vname_segid_wm> VARNAME_WM_SEG ! name of the segment (or lake) ID varibale in netCDFs <dname_time_wm> DIMNAME_WM_TIME ! name of time dimension <dname_segid_wm> DIMNAME_WM_SEG ! name of segment/lake ID dimension
! RUN CONTROL ! -------------------------------------------- !-- lake and water management (wm) mode <is_lake_sim> T ! switch on (T) or off (F) lake simulation <is_flux_wm> T ! switch on (T) or off (F) abstraction from or injection to seg/lakes <is_vol_wm> T ! switch on (T) or off (F) target volume (threshold lake volume where water release is trigerred) <is_vol_wm_jumpstart> T ! switch on (T) or off (F) for start for lakes with target volume ! ****************************************************************************************************************************
How exactly should I input the storage data? I could not find relevant test cases online for reference. Should I simply list the NetCDF filenames in WM_NC_IN, ensuring that each reservoir has its own separately generated NetCDF file containing the storage time series? Or should I use a single NetCDF file that contains the storage time series for all reservoirs combined?
Any guidance on the correct approach and file structuring would be greatly appreciated.
I believe you need the following in your control file:
- Ensure that
<is_lake_sim>is set correctly, as you are using lake - I do not see that in the control file. (I'm not sure about the most recent changes, but if this flag is false, the lake will not be simulated, even if it exists in the network topology - default is false). - Set
<is_vol_wm>to True, as you need to pass the target volume. - Set
<is_vol_wm_jumpstart>to True to initialize the lake volume at the given target volume. - Provide the target volume in a NetCDF file with the same time intervals as the runoff files. Similar to runoff files, you can specify the inputs using:
<fname_wm><vname_vol_wm><vname_time_wm><vname_segid_wm><dname_time_wm><dname_segid_wm>
Thankyou for the response. In a case where all the lakes that have been included are under Hanasaki with no-irrigation condition, should the model ask for inflow and demand where I am providing runoff precip and evap separately.
<varname_H06_I_Jan> H06_I_Jan ! Monthly inflow
<varname_H06_D_Jan> H06_D_Jan ! Monthly demand
I am providing runoff, precip & evap as a separate input but everytime I try to run the case without any target volume specifications with this control file, the model stops to give this error:
---- Read river network data ---
Reading area into structure HRU
Reading ID into structure HRU2SEG
Reading ID into structure HRU2SEG
Reading length into structure SEG
Reading slope into structure SEG
Reading lake_vol into structure SEG
Reading H06_alpha into structure SEG
Reading H06_envfact into structure SEG
Reading lake_vol into structure SEG
Reading H06_c1 into structure SEG
Reading H06_c2 into structure SEG
Reading H06_exponent into structure SEG
Reading H06_denominator into structure SEG
Reading H06_c_compare into structure SEG
Reading H06_frac_Sdead into structure SEG
Reading H06_E_rel_init into structure SEG
shr_mpi_abort/FATAL ERROR: init_data/init_ntopo_data/init_ntopo/getData, read_segment/NetCDF: Variable not found; name=H06_I_Jan
**Am I missing something conceptual here ?
The control file is as follows:**
! ****************************************************************************************************************************
! ***** DEFINITION OF MODEL CONTROL INFORMATION ******************************************************************************
! ****************************************************************************************************************************
! ****************************************************************************************************************************
! Note: lines starting with "!" are treated as comment lines -- there is no limit on the number of comment lines.
! lines starting with <xxx> are read till "!"
!
! ****************************************************************************************************************************
! RUN CONTROL
! --------------------------
<case_name> newvoltest ! simulation case name
<sim_start> 2000-01-01 00:00:00 ! time of simulation start (yyyy-mm-dd hh:mm:ss)
<sim_end> 2020-12-31 00:00:00 ! time of simulation end (yyyy-mm-dd hh:mm:ss)
<newFileFrequency> single ! output netcdf frequency. daily, monthly, yearly, single
!<outputFrequency> daily ! output frequency (integer for multiple of simulation time step or daily, monthly or yearly)
<dt_qsim> 86400 ! simulation time interval [sec]
<DWvolume> T ! volume at the end of time step at reach [L3] - diffusive wave
<restart_write> last ! restart write option. never, last, specified (need to specify date with <restart_date>
!<fname_state_in> newvol.r.2023-01-01-00000.nc ! input netCDF for channel states
<is_lake_sim> T ! switch on (T) or off (F) lake simulation
! ****************************************************************************************************************************
! DEFINE DIRECTORIES
! --------------------------
<ancil_dir> /ancillary_data/ ! directory containing ancillary data (river network, remapping netCDF)
<input_dir> /input/ ! directory containing input data (runoff netCDF)
<output_dir> /output/newvol/ ! directory containing output data
! ****************************************************************************************************************************
! DEFINE FINE NAME AND DIMENSIONS
! ---------------------------------------
<fname_ntopOld> Network_topology_merit_with_lake_modified.nc ! name of netCDF containing river segment data
<dname_sseg> n ! dimension name of the stream segments
<dname_nhru> n ! dimension name of the HRUs
! ****************************************************************************************************************************
! DEFINE DESIRED VARIABLES FOR THE NETWORK TOPOLOGY
! ---------------------------------------------------------
<seg_outlet> -9999 ! seg_id of outlet streamflow segment -9999 for all segments
! ****************************************************************************************************************************
! ROUTE options
! --------------------------
<route_opt> 5 ! option for routing schemes 0-> runoff accum, 1->IRF, 2->KWT, 3->KW, 4->MC, 5->DW
<doesBasinRoute> 1 ! basin routing? 0-> no, 1-> basin UH
! DEFINE RUNOFF FILE
! ----------------------------------
<fname_qsim> cal_17.txt ! name of netCDF (lat/lon runoff grid)
<vname_qsim> Runoff ! variable name of HRU runoff
<vname_evapo> Evap_tavg ! name of HRU evaporation variable
<vname_precip> TotalPrecip_tavg ! name of HRU precipitation variable
<vname_time> time ! name of time variable in the runoff file
<dname_time> time ! name of time dimension
<dname_xlon> lon ! name of x(j) dimension
<dname_ylat> lat ! name of y(i) dimension
<units_qsim> mm/day ! units of runoff
<dt_qsim> 86400 ! time interval of the runoff
<input_fillvalue> -9999.000 !
! ****************************************************************************************************************************
! DEFINE RUNOFF MAPPING FILE
! ----------------------------------
<is_remap> T ! logical to indicate runnoff needs to be mapped to river network HRU
<fname_remap> Resv_Merit_weight_final.nc ! name of netCDF for HM_HRU-RN_HRU mapping data
<vname_hruid_in_remap> polyid ! variable name of RN_HRU in the mapping file
<vname_weight> weight ! variable name of areal weights of overlapping HM_HUs for each RN_HRU
<vname_i_index> i_index ! name of ylat index
<vname_j_index> j_index ! name of xlon index
<vname_num_qhru> overlaps ! name of variable containing numbers of runoff HRUs within each river network HRU
<dname_hru_remap> polyid ! dimension name of RN_HRU (in the mapping file)
<dname_data_remap> data ! dimension name of ragged HM_HRU *************************
! Spatially constant parameter Namelist name
! ---------------------------
<param_nml> param.nml.default ! namelist parameters
! ****************************************************************************************************************************
! Dictionary to map variable names
! ---------------------------
<varname_area> area ! name of variable holding hru area
<varname_length> length ! name of variable holding segment length
<varname_slope> slope ! name of variable holding segment slope
<varname_HRUid> ID ! name of variable holding HRU id
<varname_hruSegId> ID ! name of variable holding the stream segment below each HRU
<varname_segId> ID ! name of variable holding the ID of each stream segment
<varname_downSegId> ID_next ! name of variable holding the ID of the next downstream segment
<varname_islake> is_lake !
<varname_lakeModelType> lake_type ! if all reservoirs are natural
<varname_H06_Smax> lake_vol !
<varname_H06_S_ini> lake_vol !
<varname_H06_alpha> H06_alpha !
<varname_H06_envfact> H06_envfact !
<varname_H06_c1> H06_c1 !
<varname_H06_c2> H06_c2 !
<varname_H06_exponent> H06_exponent !
<varname_H06_denominator> H06_denominator !
<varname_H06_c_compare> H06_c_compare !
<varname_H06_frac_Sdead> H06_frac_Sdead !
<varname_H06_I_mem_F> H06_I_mem_F !
<varname_H06_D_mem_F> H06_D_mem_F !
<varname_H06_I_mem_L> H06_I_mem_L !
<varname_H06_D_mem_L> H06_D_mem_L !
<varname_H06_E_rel_ini> H06_E_rel_init !
<varname_H06_purpose> H06_purpose !
! ****************************************************************************************************************************
! ****************************************************************************************************************************
! ****************************************************************************************************************************
Yes, it expects you to provide the following input in the control file.
Some input variables must be nonzero, such as varname_H06_I_Jan. If memory is set to True, these input values will be replaced over time with what the simulation produces in mizuRoute using the runoff field you provide to the model.
After the years specified by varname_H06_I_mem_L, if varname_H06_I_mem_F is set to True, the Hanasaki input will be derived from the mizuRoute discharge simulation, and the model will forget the initial varname_H06_I_Jan values you provided.
For demand, if you don’t have any, you can set the values to zero, but the variables must still be provided to mizuRoute.
You might already be aware, but you can check how Demand is formulated in the appendix of this study and see what happens when Demand terms are all set to zero.
Hope everything works fine!
Thank You I understand the memory concept now. After simply defining the varname_H06_I_Jan to a random value of 50, I ran the model and an error pops up saying that negative runoff is exceeded. This is a section of log file showing the error
---- Read river network data ---
Reading area into structure HRU
Reading ID into structure HRU2SEG
Reading ID into structure HRU2SEG
Reading length into structure SEG
Reading slope into structure SEG
Reading lake_vol into structure SEG
Reading H06_alpha into structure SEG
Reading H06_envfact into structure SEG
Reading lake_vol into structure SEG
Reading H06_c1 into structure SEG
Reading H06_c2 into structure SEG
Reading H06_exponent into structure SEG
Reading H06_denominator into structure SEG
Reading H06_c_compare into structure SEG
Reading H06_frac_Sdead into structure SEG
Reading H06_E_rel_init into structure SEG
Reading H06_I_Jan into structure SEG
Reading H06_I_Feb into structure SEG
Reading H06_I_Mar into structure SEG
Reading H06_I_Apr into structure SEG
Reading H06_I_May into structure SEG
Reading H06_I_Jun into structure SEG
Reading H06_I_Jul into structure SEG
Reading H06_I_Aug into structure SEG
Reading H06_I_Sep into structure SEG
Reading H06_I_Oct into structure SEG
Reading H06_I_Nov into structure SEG
Reading H06_I_Dec into structure SEG
Reading H06_D_Jan into structure SEG
Reading H06_D_Feb into structure SEG
Reading H06_D_Mar into structure SEG
Reading H06_D_Apr into structure SEG
Reading H06_D_May into structure SEG
Reading H06_D_Jun into structure SEG
Reading H06_D_Jul into structure SEG
Reading H06_D_Aug into structure SEG
Reading H06_D_Sep into structure SEG
Reading H06_D_Oct into structure SEG
Reading H06_D_Nov into structure SEG
Reading H06_D_Dec into structure SEG
Reading H06_purpose into structure SEG
Reading H06_I_mem_F into structure SEG
Reading H06_D_mem_F into structure SEG
Reading H06_I_mem_L into structure SEG
Reading H06_D_mem_L into structure SEG
Reading ID into structure NTOPO
Reading ID_next into structure NTOPO
Reading is_lake into structure NTOPO
Reading lake_type into structure NTOPO
Check total intersected hydrologic model hrus
1) sum of overlaps= 337479
2) size of data= 337479
1) and 2) identical. Should be good to go
2000 1 1 0 0
opening file: /home/newvol/newvoltest.h.2000-01-01-00000.nc
Exceeded negative runoff tolerance: HRU = 305003 runoff = -9999.0000000000000
shr_mpi_abort/FATAL ERROR: mpi_route/main_routing/basin2reach/exceeded negative runoff tolerance for HRU 305003
How do we decide the initial value of varname_H06_I_Jan (I have for my testcase directly given 50 for all months). HRU 305003 is my reservoir HRU does this mean that I need to give a different value of the parameter or could it be due to some other issue?
The monthly input can initially be set as an approximate estimate for reservoir inflow. For example, the average discharge might be around 50 cms in January and 200 cms in July. I see this as an engineering formulation, where some level of iteration is needed to fine-tune these parameters as part of your study.
Regarding the error, I think it may be due to missing values (such as -9999 in your case) or other issues with the input file. Are all your values positive (for evaporation, for example)? Do you have any fill values other than -9999, or should we let the code handle them automatically? For example, the runoff for the lake, although not used, should not be set to Fill values; maybe that is the issue.
@nmizukami, perhaps you can add more insight here. Also, should we move this discussion to a dedicated thread or another platform if available?
Sure. I have created a mail thread and sent it to you on @usask.ca mail id. Let's move the discussion to that thread. Thankyou
sorry, but it is fine to continue conversation here. make sure that it is documented in one place. I might come back to this later.
@nmizukami, I was referring to this discussion section. Since this is more of an application-related topic, it might be better suited there. I believe there's a way to convert this issue into a discussion thread. I am fine to continue here as well.
I am not sure if you could convert (i have not used discussion much), but I am sure you can link and refer to each other. At this point, maybe i am fine with using this and maybe next time. And this is is a kind of issue-ish.
@PrateekSharma99 I'm not entirely sure where the issue might be coming from, but I suspect it could be related to the lake's runoff. In the current mizuRoute implementation, runoff is still considered for lakes and reservoirs. You might try setting the lake's runoff to zero instead of leaving it as missing values. Also, it looks like you're using the remapping of gridded runoff fields to subbasins. Could the issue be coming from the remapping file for runoff? Alternatively, you can provide runoff for each subbasin and turn the remapping section to false or fully comment it in the control file.
Thank you for the response, and apologies for the late reply. As suggested, I remade and rechecked the entire files starting from scratch, following fill values as -9999. I was able to resolve the issue. The main cause for this was the missing 305003 HRU I'd in the final weight file. The model was trying to remap the runoff for it but was returning -9999 due to missing value.
I tried re-runs, but I am stuck with a new problem. Although I am figuring, I thought I should share it here.
log.err
--------------------------------------------------------------------------
At line 478 of file /mizuRoute-cesm-coupling.n02_v2.1.2/route/build/src/lake_route.f90
Fortran runtime error: Allocatable argument 'netopo_in' is not allocated
Error termination. Backtrace:
#0 0x620507 in __lake_route_module_MOD_lake_route
at /mizuRoute-cesm-coupling.n02_v2.1.2/route/build/src/lake_route.f90:478
#1 0x674b94 in __main_route_module_MOD_route_network._omp_fn.0
at /mizuRoute-cesm-coupling.n02_v2.1.2/route/build/src/main_route.f90:307
#2 0x2b0bf7f08bf1 in GOMP_parallel
at ../.././libgomp/parallel.c:178
#3 0x670c9b in route_network
at /mizuRoute-cesm-coupling.n02_v2.1.2/route/build/src/main_route.f90:295
#4 0x673a10 in __main_route_module_MOD_main_route
at /mizuRoute-cesm-coupling.n02_v2.1.2/route/build/src/main_route.f90:186
#5 0x6b70b7 in __mpi_process_MOD_mpi_route
at /mizuRoute-cesm-coupling.n02_v2.1.2/route/build/src/mpi_process.f90:1273
#6 0x72659b in route_runoff
at /mizuRoute-cesm-coupling.n02_v2.1.2/route/build/src/standalone/route_runoff.f90:81
#7 0x72672c in main
at /mizuRoute-cesm-coupling.n02_v2.1.2/route/build/src/standalone/route_runoff.f90:11
The log.out file give the following
---- Read river network data ---
Reading area into structure HRU
Reading ID into structure HRU2SEG
Reading ID into structure HRU2SEG
Reading length into structure SEG
Reading slope into structure SEG
Reading lake_vol into structure SEG
Reading H06_alpha into structure SEG
Reading H06_envfact into structure SEG
Reading lake_vol into structure SEG
Reading H06_c1 into structure SEG
Reading H06_c2 into structure SEG
Reading H06_exponent into structure SEG
Reading H06_denominator into structure SEG
Reading H06_c_compare into structure SEG
Reading H06_frac_Sdead into structure SEG
Reading H06_E_rel_init into structure SEG
Reading H06_I_Jan into structure SEG
Reading H06_I_Feb into structure SEG
Reading H06_I_Mar into structure SEG
Reading H06_I_Apr into structure SEG
Reading H06_I_May into structure SEG
Reading H06_I_Jun into structure SEG
Reading H06_I_Jul into structure SEG
Reading H06_I_Aug into structure SEG
Reading H06_I_Sep into structure SEG
Reading H06_I_Oct into structure SEG
Reading H06_I_Nov into structure SEG
Reading H06_I_Dec into structure SEG
Reading H06_D_Jan into structure SEG
Reading H06_D_Feb into structure SEG
Reading H06_D_Mar into structure SEG
Reading H06_D_Apr into structure SEG
Reading H06_D_May into structure SEG
Reading H06_D_Jun into structure SEG
Reading H06_D_Jul into structure SEG
Reading H06_D_Aug into structure SEG
Reading H06_D_Sep into structure SEG
Reading H06_D_Oct into structure SEG
Reading H06_D_Nov into structure SEG
Reading H06_D_Dec into structure SEG
Reading H06_purpose into structure SEG
Reading H06_I_mem_F into structure SEG
Reading H06_D_mem_F into structure SEG
Reading H06_I_mem_L into structure SEG
Reading H06_D_mem_L into structure SEG
Reading ID into structure NTOPO
Reading ID_next into structure NTOPO
Reading is_lake into structure NTOPO
Reading lake_type into structure NTOPO
Check total intersected hydrologic model hrus
1) sum of overlaps= 337449
2) size of data= 337449
1) and 2) identical. Should be good to go
2000 1 2 0 0
opening file: /output/newvol/newvoltest.h.2000-01-02-00000.nc
110000000.00000000 0.84999999999999998 -9999.0000000000000 110000000.00000000 0.10000000000000001 0.90000000000000002 2.0000000000000000 5.0000000000000000 0.0000000000000000
Hi @PrateekSharma99, it is great to hear that you dig into the mapping file and figured out the problem. For new problem, I believe it is UH allocation issue when you use routing methods other than IRF. see #522. You could pull the most recent version of cesm-coupling version, hope this will be resolved. You might need small control file adjustments depending on how old your version is
While using the volume control, I faced an issue wherein it said that calendar variables were not defined by me. The error was as follows:
---- calendar ---
calendar used for simulation and history output is the same as runoff input
calendar used in runoff input will be read from ILDAS_runoff_cal_17.txt
---- time units ---
time_unit for history files will be the same as runoff input
time_unit used in runoff input will be read from runoff_cal_17.txt
---- runoff unit ---
runoff unit is provided as: mm/day
---- output/simulation time steps ---
simulation time step <dt_qsim>: 86400.0
history file freqeuncy <newFileFrequency>: single
history output freqeuncy <outputFrequency>: 1
shr_mpi_abort/FATAL ERROR: init_data/init_inFile_pop/inFile_pop/time. No units attribute exist nor provided by user in ro_time_units in control file`
I was using this
`<fname_qsim> runoff_cal_17.txt ! name of netCDF (lat/lon runoff grid)
<vname_qsim> Runoff ! variable name of HRU runoff
<vname_evapo> Evap_tavg ! name of HRU evaporation variable
<vname_precip> TotalPrecip_tavg ! name of HRU precipitation variable
<vname_time> time ! name of time variable in the runoff file
<dname_time> time ! name of time dimension
<dname_xlon> lon ! name of x(j) dimension
<dname_ylat> lat ! name of y(i) dimension
<units_qsim> mm/day ! units of runoff
<dt_qsim> 86400 ! time interval of the runoff
<input_fillvalue> 0 !
! DEFINE WATER MANAGEMENT FILE
! ----------------------------------
<fname_wm> Barna_TEST.nc ! name of netCDF containing the HRU runoff
!<vname_flux_wm> Injection ! name of HRU runoff variable
<vname_vol_wm> TargS ! name of HRU runoff variable
<vname_time_wm> time ! name of time variable in the runoff file
<dname_time_wm> time ! name of time dimension
<vname_segid_wm> seg_id ! name of routing hrus
<dname_segid_wm> seg_id ! name of routing hrus dimensions
! ****************************************************************************************************************************
After adding the calendar variables,
<ro_time_units> days !
<ro_calendar> standard !
I am facing this issue:
---- calendar ---
calendar used for simulation and history output is the same as runoff input
calendar used in runoff input is provided in control file: standard
However, this will be overwritten the one read from ILDAS_runoff_cal_17.txt
---- time units ---
time_unit for history files will be the same as runoff input
time_unit in runoff input is provided in control file: days
---- runoff unit ---
runoff unit is provided as: mm/day
---- output/simulation time steps ---
simulation time step <dt_qsim>: 86400.0
history file freqeuncy <newFileFrequency>: single
history output freqeuncy <outputFrequency>: 1
shr_mpi_abort/FATAL ERROR: init_data/init_inFile_pop/inFile_pop/get_nc_dim_len/[No such file or directory; file=/mizu_test/input/‰HDF]
I have kept the time dimension the same as that of the runoff. Earlier, I was only using one reservoir, i.e., providing volume control for only 1 reservoir. It occurred to me that it could be an issue of no data available for the rest of the reservoirs! So I also tried it by providing input values for all the reservoirs. Currently, I am not able to figure out as to what is the root cause behind the error. Any suggestions would be great. Thank You
I see the error message
shr_mpi_abort/FATAL ERROR: init_data/init_inFile_pop/inFile_pop/get_nc_dim_len/[No such file or directory; file=/mizu_test/input/‰HDF]
do you have some file(s) detected by ls /mizu_test/input/‰HDF?
Just noticed based on your log, water management netcdf name is Barna_TEST.nc, but it is ‰HDF in log. But this strange string might be coming from runoff netcdf.
wondering what is inside runoff_cal_17.txt?
also did you put
`<fname_qsim> runoff_cal_17.txt ! name of netCDF (lat/lon runoff grid)
instead of
<fname_qsim> runoff_cal_17.txt ! name of netCDF (lat/lon runoff grid)
You could try specifying runoff netcdf name (with wildcard if you have multiple netcdfs)
Given the information you provided, the problem seems to be just that files are not specified correctly.
Echoing @nmizukami — if you're not using the latest version of mizuRoute from the cesm-coupling branch, that might be the issue. The ability to read the .txt input file was reintroduced only recently, and I vaguely recall this error being related to that functionality being previously disabled.
To work around this, you could try specifying the NetCDF file directly (e.g., runoff_cal_17.nc), or use a wildcard pattern if multiple files are present (e.g., runoff_cal_17_198?.nc) as @nmizukami mentioned. Alternatively, compiling the most recent version of the source code might resolve the issue.
Is this resolved? can this be closed? @PrateekSharma99 @ShervanGharari ?
Thank you for helping me resolve the issue. Currently, I’m implementing the water management module in mizuRoute. While running the model with water management options enabled, I encountered the following error:
shr_mpi_abort/FATAL ERROR: problem reading variable ID for lake target volume
The config file is as follows: `
! DEFINE RUNOFF FILE ! ---------------------------------- <fname_qsim> ILDAS_runoff_cal_17.txt ! name of netCDF (lat/lon runoff grid) <vname_qsim> Runoff ! variable name of HRU runoff <vname_evapo> Evap_tavg ! name of HRU evaporation variable <vname_precip> TotalPrecip_tavg ! name of HRU precipitation variable <vname_time> time ! name of time variable in the runoff file <dname_time> time ! name of time dimension <dname_xlon> lon ! name of x(j) dimension <dname_ylat> lat ! name of y(i) dimension <units_qsim> mm/day ! units of runoff <dt_qsim> 86400 ! time interval of the runoff !<ro_time_units> days ! !<ro_calendar> gregorian ! <input_fillvalue> 0 ! ! DEFINE WATER MANAGEMENT FILE ! ---------------------------------- <fname_wm> one.txt ! name of netCDF containing the HRU runoff <vname_flux_wm> abs_inj ! name of HRU runoff variable <vname_vol_wm> target_vol ! name of HRU runoff variable <vname_time_wm> time ! name of time variable in the runoff file <dname_time_wm> time ! name of time dimension <vname_segid_wm> seg_id ! name of routing hrus <dname_segid_wm> seg_id ! name of routing hrus dimensions ! **************************************************************************************************************************** ! **************************************************************************************************************************** ! DEFINE RUNOFF MAPPING FILE ! ---------------------------------- <is_remap> T ! logical to indicate runnoff needs to be mapped to river network HRU <fname_remap> Resv_Merit_weight_final.nc ! name of netCDF for HM_HRU-RN_HRU mapping data <vname_hruid_in_remap> polyid ! variable name of RN_HRU in the mapping file <vname_weight> weight ! variable name of areal weights of overlapping HM_HUs for each RN_HRU <vname_i_index> i_index ! name of ylat index <vname_j_index> j_index ! name of xlon index <vname_num_qhru> overlaps ! name of variable containing numbers of runoff HRUs within each river network HRU <dname_hru_remap> polyid ! dimension name of RN_HRU (in the mapping file) <dname_data_remap> data ! dimension name of ragged HM_HRU ************************* ! Spatially constant parameter Namelist name ! --------------------------- <param_nml> param.nml.default ! namelist parameters ! **************************************************************************************************************************** ! Dictionary to map variable names ! --------------------------- <varname_area> area ! name of variable holding hru area <varname_length> length ! name of variable holding segment length <varname_slope> slope ! name of variable holding segment slope <varname_HRUid> seg_id ! name of variable holding HRU id <varname_hruSegId> seg_id ! name of variable holding the stream segment below each HRU <varname_segId> seg_id ! name of variable holding the ID of each stream segment <varname_downSegId> ID_next ! name of variable holding the ID of the next downstream segment <varname_islake> is_lake ! <varname_lakeModelType> lake_type ! if all reservoirs are natural <varname_H06_Smax> lake_vol ! <varname_H06_S_ini> lake_vol ! <varname_H06_alpha> H06_alpha ! <varname_H06_envfact> H06_envfact ! <varname_H06_c1> H06_c1 ! <varname_H06_c2> H06_c2 ! <varname_H06_exponent> H06_exponent ! <varname_H06_denominator> H06_denominator ! <varname_H06_c_compare> H06_c_compare ! <varname_H06_frac_Sdead> H06_frac_Sdead ! <varname_H06_I_mem_F> H06_I_mem_F ! <varname_H06_D_mem_F> H06_D_mem_F ! <varname_H06_I_mem_L> H06_I_mem_L ! <varname_H06_D_mem_L> H06_D_mem_L ! <varname_H06_E_rel_ini> H06_E_rel_init ! <varname_H06_purpose> H06_purpose ! <varname_H06_I_Jan> H06_I_Jan ! Monthly inflow <varname_H06_I_Feb> H06_I_Feb ! Monthly inflow <varname_H06_I_Mar> H06_I_Mar ! Monthly inflow <varname_H06_I_Apr> H06_I_Apr ! Monthly inflow <varname_H06_I_May> H06_I_May ! Monthly inflow <varname_H06_I_Jun> H06_I_Jun ! Monthly inflow <varname_H06_I_Jul> H06_I_Jul ! Monthly inflow <varname_H06_I_Aug> H06_I_Aug ! Monthly inflow <varname_H06_I_Sep> H06_I_Sep ! Monthly inflow <varname_H06_I_Oct> H06_I_Oct ! Monthly inflow <varname_H06_I_Nov> H06_I_Nov ! Monthly inflow <varname_H06_I_Dec> H06_I_Dec ! Monthly inflow <varname_H06_D_Jan> H06_D_Jan ! Monthly demand <varname_H06_D_Feb> H06_D_Feb ! Monthly demand <varname_H06_D_Mar> H06_D_Mar ! Monthly demand <varname_H06_D_Apr> H06_D_Apr ! Monthly demand <varname_H06_D_May> H06_D_May ! Monthly demand <varname_H06_D_Jun> H06_D_Jun ! Monthly demand <varname_H06_D_Jul> H06_D_Jul ! Monthly demand <varname_H06_D_Aug> H06_D_Aug ! Monthly demand <varname_H06_D_Sep> H06_D_Sep ! Monthly demand <varname_H06_D_Oct> H06_D_Oct ! Monthly demand <varname_H06_D_Nov> H06_D_Nov ! Monthly demand <varname_H06_D_Dec> H06_D_Dec ! Monthly demand ! **************************************************************************************************************************** ! **************************************************************************************************************************** ! **************************************************************************************************************************** `
In my current input file i.e. Network_topology_merit_with_lake_modified.nc I have following datasets:
` 🔧 Global Attributes:
📐 Dimensions:
- n: 104654
🧭 Coordinates:
- ID: (104654,), dtype=float64
📦 Data Variables:
- H06_alpha: ('n',), shape=(104654,), dtype=float64
- H06_envfact: ('n',), shape=(104654,), dtype=float64
- H06_c1: ('n',), shape=(104654,), dtype=float64
- H06_c2: ('n',), shape=(104654,), dtype=float64
- H06_exponent: ('n',), shape=(104654,), dtype=float64
- H06_denominator: ('n',), shape=(104654,), dtype=float64
- H06_c_compare: ('n',), shape=(104654,), dtype=float64
- H06_frac_Sdead: ('n',), shape=(104654,), dtype=float64
- H06_I_mem_F: ('n',), shape=(104654,), dtype=float64
- H06_D_mem_F: ('n',), shape=(104654,), dtype=float64
- H06_I_mem_L: ('n',), shape=(104654,), dtype=float64
- H06_D_mem_L: ('n',), shape=(104654,), dtype=float64
- H06_E_rel_init: ('n',), shape=(104654,), dtype=float64
- H06_purpose: ('n',), shape=(104654,), dtype=float64
- H06_I_Jan: ('n',), shape=(104654,), dtype=float64
- H06_I_Feb: ('n',), shape=(104654,), dtype=float64
- H06_I_Mar: ('n',), shape=(104654,), dtype=float64
- H06_I_Apr: ('n',), shape=(104654,), dtype=float64
- H06_I_May: ('n',), shape=(104654,), dtype=float64
- H06_I_Jun: ('n',), shape=(104654,), dtype=float64
- H06_I_Jul: ('n',), shape=(104654,), dtype=float64
- H06_I_Aug: ('n',), shape=(104654,), dtype=float64
- H06_I_Sep: ('n',), shape=(104654,), dtype=float64
- H06_I_Oct: ('n',), shape=(104654,), dtype=float64
- H06_I_Nov: ('n',), shape=(104654,), dtype=float64
- H06_I_Dec: ('n',), shape=(104654,), dtype=float64
- H06_D_Jan: ('n',), shape=(104654,), dtype=float64
- H06_D_Feb: ('n',), shape=(104654,), dtype=float64
- H06_D_Mar: ('n',), shape=(104654,), dtype=float64
- H06_D_Apr: ('n',), shape=(104654,), dtype=float64
- H06_D_May: ('n',), shape=(104654,), dtype=float64
- H06_D_Jun: ('n',), shape=(104654,), dtype=float64
- H06_D_Jul: ('n',), shape=(104654,), dtype=float64
- H06_D_Aug: ('n',), shape=(104654,), dtype=float64
- H06_D_Sep: ('n',), shape=(104654,), dtype=float64
- H06_D_Oct: ('n',), shape=(104654,), dtype=float64
- H06_D_Nov: ('n',), shape=(104654,), dtype=float64
- H06_D_Dec: ('n',), shape=(104654,), dtype=float64
- ID_next: ('n',), shape=(104654,), dtype=float64
- length: ('n',), shape=(104654,), dtype=float64
- area: ('n',), shape=(104654,), dtype=float64
- slope: ('n',), shape=(104654,), dtype=float64
- is_lake: ('n',), shape=(104654,), dtype=float64
- lake_vol: ('n',), shape=(104654,), dtype=float64
- lake_type: ('n',), shape=(104654,), dtype=float64
- seg_id: ('n',), shape=(104654,), dtype=int64 `
Further the water management file that I am using is of this structure:
' 🔧 Global Attributes:
- title: Water Management Input File for mizuRoute
- history: Created on 2025-05-01 14:02:20.835156
- source: Based on ILDAS runoff forcing and MERIT Hydro topology
📐 Dimensions:
- time: 27392
- seg_id: 223
🧭 Coordinates:
- time: (27392,), dtype=datetime64[ns]
- seg_id: (223,), dtype=int32
📦 Data Variables:
- abs_inj: ('time', 'seg_id'), shape=(27392, 223), dtype=float32
- target_vol: ('time', 'seg_id'), shape=(27392, 223), dtype=float32 ' Please let me know if you have any diagnostics of this error. The model works fine without volume control. I am following the workflow as done in https://github.com/ShervanGharari/mizuRoute_Diefenbaker/blob/main/pygmo_mizuRoute_Diefenbaker/Diefenbaker_temp/settings/Difenbaker.control.calibrate.tmp
Hi @PrateekSharma99, So the error message is from here. So your laketargvol variable name in netcdf is target_vol, which is not the same as default name (default name is LakeTargVol). You will have to specify your netcdf variable name in your control file or rename your netcdf variable name to the default name.
If you get shr_mpi_abort/FATAL ERROR, you should be able to find the line in the code where the code stops (you could do grep -i -r -w 'copy_message_here' * under route/build/src. good chance is you may be able to figure what is wrong.
We can keep this open till you get your model run without any errors. You can let us know when you think you can close this.
Good Afternoon The error still persists even after using the default names. Does the model expect all the seg_id that are in the river network file to be in the control file with LakeTargVol or only the one's with is_lake criteria == 1. Also the error mentions problem reading variable ID for LakeTargVol,
Do I need to have a target_volume variable in my river network file as well unless I want a jumpstart?
Hi, To answer your questions: 1- I don't know about the default names. MizuRoute does not have a default name for variables, each variables should be specific in the control file from its actual name in the NC files (runoff input, water management input, or network topology). 2- Let's say you have 10 lakes in your domain and you wish to have one of them simulated with a target volume. This is what is expected:
- In network topology, you need a variable that is zero for all the other lakes and segments except the segment (which is, of course, the lake) that you want to apply the target volume to.
! Specify which lakes should be target volume
<varname_LakeTargVol> var_name ! name of variable for target volume 1 for seg or lakes with target volume, else 0
.
.
.
- in the water management input files, you need to have a target volume variable with the ID of the semgnet you wish to apply target volume for.
! Specification of water management input variables
<fname_wm> name_of_file.nc or txt
.
<vname_vol_wm> name_of_var_that_include_Target_Vol
.
- If you want the volume in the lake to start from some initial values rather than zero on the first simulation, you can activate the general flag of the
is_vol_wm_jumpstartin your control file.
! General flags you need
<is_lake_sim> T
<is_vol_wm> T
<is_vol_wm_jumpstart> T
To clarify, you can always refer to read_control.f90 Hope this is helpful.
@nmizukami We can move to the discussion section of GitHub if you agree. This is beyond the issue regarding the source code, we can close this issue.
Hi @ShervanGharari , yes, sounds good to me. I looked at discussion again. If people have question, could post here - https://github.com/ESCOMP/mizuRoute/discussions/categories/q-a. @PrateekSharma99 , if you have further question, just post there.
Good Evening As @ShervanGharari suggested "The monthly input can initially be set as an approximate estimate for reservoir inflow. For example, the average discharge might be around 50 cms in January and 200 cms in July. I see this as an engineering formulation, where some level of iteration is needed to fine-tune these parameters as part of your study."
In the context of national- or large-scale modeling, is it appropriate to use a uniform approximation for monthly reservoir inflow across all reservoirs? Given the substantial variation in reservoir sizes, purposes, and catchment characteristics, I am concerned that such averaging may oversimplify system behavior and reduce realism.
Additionally, does mizuRoute support the assignment of distinct monthly inflow parameters for each individual reservoir? If not, is it methodologically sound to assume a single inflow approximation that performs adequately across all reservoirs, or would this lead to significant performance loss in diverse hydrological regimes?
Any clarification or insights on scalable parameterization strategies would be greatly appreciated.
@PrateekSharma99 The example I provided represents a single reservoir. For multiple reservoirs, the values can vary by month depending on each reservoir’s size, inflow, and outflow characteristics. So, to make it brief, each reservoir can have different Hansaki parameters (input/output values). Hope this answers your question. Let me know.
Good Morning. @ShervanGharari, while simulating reservoirs using Hanasaki parametrization, what could be the cause of zero volume i.e. dwvolume component in output as zero for a few reservoirs? For most of the reservoirs the volume seems to be following the trend but in my runs for some reservoirs I am getting zero (throughout the simulated temporal scale).
Hi @PrateekSharma99 I’m not sure what the issue could be without seeing the setup. Could you check whether the upstream segments have any discharge? Is it possible that the reservoir is being completely emptied due to some combination of parameter settings?