diff --git a/configs/README.md b/configs/README.md
index 5c3134d..55f86b7 100644
--- a/configs/README.md
+++ b/configs/README.md
@@ -39,7 +39,7 @@ Example configuration files are provided in this directory. To build and run the
| K_nash_surface1 | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | Nash Config param for surface runoff |
| nash_storage_surface1 | 1D array (*double*) | | meters [m] | parameter_adjustable | surface runoff | Nash Config param; reservoir surface storage; default is zero storage |
| nsubsteps_nash_surface1 | *int* | | | parameter_adjustable | surface runoff | optional (default = 10); number of subtimstep for Nash runoff |
-| Kinf_nash_surface*,1 | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | optional (default = 0.05); storage fraction per hour that moves from reservoirs to soil |
+| Kinf_nash_surface*,1 | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | optional (default = 0.001); storage fraction per hour that moves from reservoirs to soil |
| retention_depth_nash_surface*,1 | *double* | | m | parameter_adjustable | surface runoff | optional (default = 0.001); water retention depth threshold (only applied to the first reservoir) |
| a_Xinanjiang_inflection_point_parameter* | *double* | | | parameter_adjustable | infiltration excess runoff | when `surface_water_partitioning_scheme=Xinanjiang` |
| b_Xinanjiang_shape_parameter* | *double* | | | parameter_adjustable | infiltration excess runoff | when `surface_water_partitioning_scheme=Xinanjiang` |
diff --git a/include/bmi_cfe.h b/include/bmi_cfe.h
index 5a18db7..5e9c5d2 100644
--- a/include/bmi_cfe.h
+++ b/include/bmi_cfe.h
@@ -86,6 +86,7 @@ struct cfe_state_struct {
int surface_runoff_scheme; // options: giuh-based runoff and nash cascade-based runoff
+ double nwm_ponded_depth_m;
// ***********************************************************
// ******************* Dynamic allocations *******************
// ***********************************************************
diff --git a/realizations/realization_cfe_pet_surfgiuh.json b/realizations/realization_cfe_pet_surfgiuh.json
index 0bfc418..e33b0a0 100644
--- a/realizations/realization_cfe_pet_surfgiuh.json
+++ b/realizations/realization_cfe_pet_surfgiuh.json
@@ -19,7 +19,8 @@
"Q_OUT",
"POTENTIAL_ET",
"ACTUAL_ET",
- "SOIL_STORAGE"
+ "SOIL_STORAGE",
+ "NWM_PONDED_DEPTH"
],
"modules": [
{
diff --git a/realizations/realization_cfe_pet_surfnash.json b/realizations/realization_cfe_pet_surfnash.json
index dc9b955..b7da7e1 100644
--- a/realizations/realization_cfe_pet_surfnash.json
+++ b/realizations/realization_cfe_pet_surfnash.json
@@ -19,7 +19,8 @@
"Q_OUT",
"POTENTIAL_ET",
"ACTUAL_ET",
- "SOIL_STORAGE"
+ "SOIL_STORAGE",
+ "NWM_PONDED_DEPTH"
],
"modules": [
{
diff --git a/src/bmi_cfe.c b/src/bmi_cfe.c
index c23c22a..b7dbd8f 100644
--- a/src/bmi_cfe.c
+++ b/src/bmi_cfe.c
@@ -20,9 +20,9 @@
#define CFE_DEBUG 0
#define INPUT_VAR_NAME_COUNT 5
-#define OUTPUT_VAR_NAME_COUNT 14
+#define OUTPUT_VAR_NAME_COUNT 15
-#define STATE_VAR_NAME_COUNT 94 // must match var_info array size
+#define STATE_VAR_NAME_COUNT 95 // must match var_info array size
#define PARAM_VAR_NAME_COUNT 18
@@ -178,8 +178,10 @@ Variable var_info[] = {
// -------------------------------------------
{ 91, "soil_moisture_profile", "double", 1},
{ 92, "soil_layer_depths_m", "double", 1},
- { 93, "max_rootzone_layer", "int", 1},
+ { 93, "max_rootzone_layer", "int", 1},
//--------------------------------------------
+ { 94, "nwm_ponded_depth", "double", 1},
+
};
int i = 0;
@@ -200,7 +202,8 @@ static const char *output_var_names[OUTPUT_VAR_NAME_COUNT] = {
"GW_STORAGE",
"SOIL_STORAGE",
"SOIL_STORAGE_CHANGE",
- "SURF_RUNOFF_SCHEME"
+ "SURF_RUNOFF_SCHEME",
+ "NWM_PONDED_DEPTH"
};
static const char *output_var_types[OUTPUT_VAR_NAME_COUNT] = {
@@ -217,7 +220,8 @@ static const char *output_var_types[OUTPUT_VAR_NAME_COUNT] = {
"double",
"double",
"double",
- "int"
+ "int",
+ "double"
};
static const int output_var_item_count[OUTPUT_VAR_NAME_COUNT] = {
@@ -234,6 +238,7 @@ static const int output_var_item_count[OUTPUT_VAR_NAME_COUNT] = {
1,
1,
1,
+ 1,
1
};
@@ -251,7 +256,8 @@ static const char *output_var_units[OUTPUT_VAR_NAME_COUNT] = {
"m",
"m",
"m",
- "none"
+ "none",
+ "m"
};
static const int output_var_grids[OUTPUT_VAR_NAME_COUNT] = {
@@ -268,6 +274,7 @@ static const int output_var_grids[OUTPUT_VAR_NAME_COUNT] = {
0,
0,
0,
+ 0,
0
};
@@ -285,7 +292,8 @@ static const char *output_var_locations[OUTPUT_VAR_NAME_COUNT] = {
"node",
"node",
"node",
- "none"
+ "none",
+ "node"
};
// Don't forget to update Get_value/Get_value_at_indices (and setter) implementation if these are adjusted
@@ -1141,9 +1149,9 @@ int read_init_config_cfe(const char* config_file, cfe_state_struct* model)
}
if (is_K_infiltration_nash_surface_set == FALSE) {
#if CFE_DEBUG >= 1
- printf("Config param 'Kinf_nash_surface' not found in config file, default value is 0.05 [1/hr] \n");
+ printf("Config param 'Kinf_nash_surface' not found in config file, default value is 0.001 [1/hr] \n");
#endif
- model->nash_surface_params.K_infiltration = 0.05; // used in the runon infiltration
+ model->nash_surface_params.K_infiltration = 0.001; // used in the runon infiltration
}
if (is_retention_depth_nash_surface_set == FALSE) {
#if CFE_DEBUG >= 1
@@ -1547,6 +1555,17 @@ static int Update (Bmi *self)
// Advance the model time
cfe_ptr->current_time_step += 1;
+ // compute NWM ponded depth, which is assumed to be the leftover water in the GIUH/NASH queue
+ cfe_ptr->nwm_ponded_depth_m = 0.0;
+ if (cfe_ptr->surface_runoff_scheme == GIUH) {
+ for(i=0;inum_giuh_ordinates;i++)
+ cfe_ptr->nwm_ponded_depth_m += cfe_ptr->runoff_queue_m_per_timestep[i];
+ }
+ else if (cfe_ptr->surface_runoff_scheme == NASH_CASCADE) {
+ for(i=0;inash_surface_params.N_nash;i++)
+ cfe_ptr->nwm_ponded_depth_m += cfe_ptr->nash_surface_params.nash_storage[i];
+ }
+
return BMI_SUCCESS;
}
@@ -2050,7 +2069,12 @@ static int Get_value_ptr (Bmi *self, const char *name, void **dest)
return BMI_SUCCESS;
}
-
+ if (strcmp (name, "NWM_PONDED_DEPTH") == 0) {
+ cfe_state_struct *cfe_ptr;
+ cfe_ptr = (cfe_state_struct *) self->data;
+ *dest = (void*)&cfe_ptr->nwm_ponded_depth_m;
+ return BMI_SUCCESS;
+ }
/***********************************************************/
/*********** INPUT ***********************************/
/***********************************************************/