From 0dc07d2689e3bb3d999334080caeae86c8453557 Mon Sep 17 00:00:00 2001 From: Ahmad Jan Date: Thu, 5 Sep 2024 12:32:43 -0400 Subject: [PATCH 1/6] removed N_nash_subsurface bmi var, we don't calibrated it, updated readme --- configs/README.md | 14 +++++++------- src/bmi_cfe.c | 28 +++------------------------- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/configs/README.md b/configs/README.md index 66ec2da..fe8cffa 100644 --- a/configs/README.md +++ b/configs/README.md @@ -1,5 +1,5 @@ ## Configuration File -Example configuration files are provided in this directory. To build and run the given examples see the instructions [here](https://github.com/NOAA-OWP/cfe/blob/master/INSTALL.md). A detailed description of the parameters for model configuration (i.e., initialize/setup) is provided below. The asterisk (*) denotes calibratable parameters. +Example configuration files are provided in this directory. To build and run the given examples see the instructions [here](https://github.com/NOAA-OWP/cfe/blob/master/INSTALL.md). A detailed description of the parameters for model configuration (i.e., initialize/setup) is provided below. The asterisk (*) denotes calibratable parameters. The has (#) shows the parameters only used with the Nash Cascade-based runoff. | Variable | Datatype | Limits | Units | Role | Process | Description | | -------- | -------- | ------ | ----- | ---- | ------- | ----------- | @@ -28,12 +28,12 @@ Example configuration files are provided in this directory. To build and run the | verbosity | *int* | `0`-`3` | | optional | | prints various debug and bmi info (defaults to 0) | | surface_water_partitioning_scheme | *char* | `Xinanjiang` or `Schaake` | | parameter_adjustable | infiltraton excess | | | surface_runoff_scheme | *char* | GIUH or NASH_CASCADE | | parameter_adjustable | surface runoff | also supports 1 for GIUH and 2 for NASH_CASCADE; default is GIUH | -| N_nash_surface | *int* | | | parameter_adjustable | surface runoff | number of Nash reservoirs for surface runoff | -| K_nash_surface | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | Nash Config param for surface runoff | -| nash_storage_surface | 1D array (*double*) | | meters [m] | parameter_adjustable | surface runoff | Nash Config param; reservoir surface storage; default is zero storage | -| nsubsteps_nash_surface | *int* | | | parameter_adjustable | surface runoff | optional (default = 10); number of subtimstep for Nash runoff | -| Kinf_nash_surface | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | optional (default = 0.05); storage fraction per hour that moves from reservoirs to soil | -| retention_depth_nash_surface | *double* | | m | parameter_adjustable | surface runoff | optional (default = 0.001); water retention depth threshold (only applied to the first reservoir) | +| #N_nash_surface | *int* | | | parameter_adjustable | surface runoff | number of Nash reservoirs for surface runoff | +| #K_nash_surface | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | Nash Config param for surface runoff | +| #nash_storage_surface | 1D array (*double*) | | meters [m] | parameter_adjustable | surface runoff | Nash Config param; reservoir surface storage; default is zero storage | +| #nsubsteps_nash_surface | *int* | | | parameter_adjustable | surface runoff | optional (default = 10); number of subtimstep for Nash runoff | +| #*Kinf_nash_surface | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | optional (default = 0.05); storage fraction per hour that moves from reservoirs to soil | +| #*retention_depth_nash_surface | *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=1 | *double* | | | parameter_adjustable | infiltration excess runoff | when `surface_water_partitioning_scheme=Xinanjiang` | | *x_Xinanjiang_shape_parameter=1 | *double* | | | parameter_adjustable | infiltration excess runoff | when `surface_water_partitioning_scheme=Xinanjiang` | diff --git a/src/bmi_cfe.c b/src/bmi_cfe.c index edbef4d..aae2e7f 100644 --- a/src/bmi_cfe.c +++ b/src/bmi_cfe.c @@ -25,7 +25,7 @@ #define STATE_VAR_NAME_COUNT 94 // must match var_info array size -#define PARAM_VAR_NAME_COUNT 19 +#define PARAM_VAR_NAME_COUNT 18 // NOTE: If you update the params, also update the unit test in ../test/main_unit_test_bmi.c static const char *param_var_names[PARAM_VAR_NAME_COUNT] = { "maxsmc", "satdk", "slope", "b", "Klf", @@ -33,8 +33,7 @@ static const char *param_var_names[PARAM_VAR_NAME_COUNT] = { "satpsi","wltsmc","alpha_fc","refkdt", "a_Xinanjiang_inflection_point_parameter","b_Xinanjiang_shape_parameter","x_Xinanjiang_shape_parameter", "Kinf_nash_surface", - "retention_depth_nash_surface", - "N_nash_subsurface" + "retention_depth_nash_surface" }; static const char *param_var_types[PARAM_VAR_NAME_COUNT] = { @@ -42,7 +41,7 @@ static const char *param_var_types[PARAM_VAR_NAME_COUNT] = { "double", "double", "double", "double", "double", "double", "double", "double", "double","double","double", "double", - "double", "int" + "double" }; //---------------------------------------------- // Put variable info into a struct to simplify @@ -1956,13 +1955,6 @@ static int Get_value_ptr (Bmi *self, const char *name, void **dest) return BMI_SUCCESS; } - if (strcmp (name, "N_nash_subsurface") == 0) { - cfe_state_struct *cfe_ptr; - cfe_ptr = (cfe_state_struct *) self->data; - *dest = (void*)&cfe_ptr->N_nash_subsurface; - return BMI_SUCCESS; - } - if (strcmp (name, "Kinf_nash_surface") == 0) { cfe_state_struct *cfe_ptr; cfe_ptr = (cfe_state_struct *) self->data; @@ -2199,20 +2191,6 @@ static int Set_value (Bmi *self, const char *name, void *src) } - if (strcmp (name, "N_nash_subsurface") == 0) { - cfe_state_struct* cfe_ptr = (cfe_state_struct *) self->data; - - if( cfe_ptr->nash_storage_subsurface != NULL ) - free(cfe_ptr->nash_storage_subsurface); - cfe_ptr->nash_storage_subsurface = malloc(sizeof(double) * cfe_ptr->N_nash_subsurface); - - if( cfe_ptr->nash_storage_subsurface == NULL ) - return BMI_FAILURE; - - for (j = 0; j < cfe_ptr->N_nash_subsurface; j++) - cfe_ptr->nash_storage_subsurface[j] = 0.0; - } - if (strcmp (name, "storage_max_m") == 0) { cfe_state_struct* cfe_ptr = (cfe_state_struct *) self->data; cfe_ptr->gw_reservoir.storage_m = cfe_ptr->gw_reservoir.gw_storage * cfe_ptr->gw_reservoir.storage_max_m; From 109fe50bc971d2ad406e345073be6070a1a46344 Mon Sep 17 00:00:00 2001 From: Ahmad Jan Date: Thu, 5 Sep 2024 12:52:16 -0400 Subject: [PATCH 2/6] updated unittest. --- test/main_unit_test.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/test/main_unit_test.c b/test/main_unit_test.c index 71064dd..156d906 100644 --- a/test/main_unit_test.c +++ b/test/main_unit_test.c @@ -393,7 +393,7 @@ main(int argc, const char *argv[]){ printf("\nTEST BMI MODEL PARAMETERS\n*************************\n"); //Set number of params -- UPDATE if params changed -#define PARAM_COUNT 19 +#define PARAM_COUNT 18 // expected_param_names copied directly from param_var_names[PARAM_VAR_NAME_COUNT] in ../src/bmi_cfe.c static const char *expected_param_names[PARAM_COUNT] = { @@ -401,25 +401,13 @@ main(int argc, const char *argv[]){ "Kn", "Cgw", "expon", "max_gw_storage", "satpsi","wltsmc","alpha_fc","refkdt", "a_Xinanjiang_inflection_point_parameter","b_Xinanjiang_shape_parameter","x_Xinanjiang_shape_parameter", - "Kinf_nash_surface", "retention_depth_nash_surface", - "N_nash_subsurface"}; + "Kinf_nash_surface", "retention_depth_nash_surface"}; double test_set_value = 4.2; double test_get_value = 0.0; - int test_set_value_int = 5; - int test_get_value_int = 0; // Loop through params to test get and set for( int i = 0; i < PARAM_COUNT; i++ ) { - if(strcmp(expected_param_names[i], "N_nash_subsurface") == 0){ - status = model->set_value(model, expected_param_names[i], &test_set_value_int); - assert(status == BMI_SUCCESS); - status = model->get_value(model, expected_param_names[i], &test_get_value_int); - assert(status == BMI_SUCCESS); - assert(test_set_value_int == test_get_value_int); - printf(" get & set values match for parameter: %s \n", expected_param_names[i]); - } - else { status = model->set_value(model, expected_param_names[i], &test_set_value); //if (status == BMI_FAILURE)return BMI_FAILURE; assert(status == BMI_SUCCESS); @@ -427,7 +415,6 @@ main(int argc, const char *argv[]){ assert(status == BMI_SUCCESS); assert(test_set_value == test_get_value); printf(" get & set values match for parameter: %s \n", expected_param_names[i]); - } } // Test BMI: CONTROL FUNCTION update_until() From ede55adf61fbce9860e4551c70cad3bc1340bc4a Mon Sep 17 00:00:00 2001 From: AJKhattak-NOAA Date: Fri, 6 Sep 2024 11:11:55 -0400 Subject: [PATCH 3/6] Update configs/README.md Co-authored-by: Austin Raney --- configs/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configs/README.md b/configs/README.md index fe8cffa..3c5bf71 100644 --- a/configs/README.md +++ b/configs/README.md @@ -1,5 +1,12 @@ ## Configuration File -Example configuration files are provided in this directory. To build and run the given examples see the instructions [here](https://github.com/NOAA-OWP/cfe/blob/master/INSTALL.md). A detailed description of the parameters for model configuration (i.e., initialize/setup) is provided below. The asterisk (*) denotes calibratable parameters. The has (#) shows the parameters only used with the Nash Cascade-based runoff. +Example configuration files are provided in this directory. To build and run the given examples see the instructions [here](https://github.com/NOAA-OWP/cfe/blob/master/INSTALL.md). A detailed description of the parameters for model configuration (i.e., initialize/setup) is provided below. + + +**Key**: + +*: denotes parameter is calibratable + +1: denotes the parameters only used when `surface_runoff_scheme` is `NASH_CASCADE`. | Variable | Datatype | Limits | Units | Role | Process | Description | | -------- | -------- | ------ | ----- | ---- | ------- | ----------- | From 4d87f750abefa8cededb731119a4b5e5d647819d Mon Sep 17 00:00:00 2001 From: AJKhattak-NOAA Date: Fri, 6 Sep 2024 11:12:16 -0400 Subject: [PATCH 4/6] Update configs/README.md Co-authored-by: Austin Raney --- configs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/README.md b/configs/README.md index 3c5bf71..4de0b36 100644 --- a/configs/README.md +++ b/configs/README.md @@ -35,7 +35,7 @@ Example configuration files are provided in this directory. To build and run the | verbosity | *int* | `0`-`3` | | optional | | prints various debug and bmi info (defaults to 0) | | surface_water_partitioning_scheme | *char* | `Xinanjiang` or `Schaake` | | parameter_adjustable | infiltraton excess | | | surface_runoff_scheme | *char* | GIUH or NASH_CASCADE | | parameter_adjustable | surface runoff | also supports 1 for GIUH and 2 for NASH_CASCADE; default is GIUH | -| #N_nash_surface | *int* | | | parameter_adjustable | surface runoff | number of Nash reservoirs for surface runoff | +| N_nash_surface1 | *int* | | | parameter_adjustable | surface runoff | number of Nash reservoirs for surface runoff | | #K_nash_surface | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | Nash Config param for surface runoff | | #nash_storage_surface | 1D array (*double*) | | meters [m] | parameter_adjustable | surface runoff | Nash Config param; reservoir surface storage; default is zero storage | | #nsubsteps_nash_surface | *int* | | | parameter_adjustable | surface runoff | optional (default = 10); number of subtimstep for Nash runoff | From 4958ca3460d840e9a30b9fca62c50fad4065741d Mon Sep 17 00:00:00 2001 From: AJKhattak-NOAA Date: Fri, 6 Sep 2024 11:12:33 -0400 Subject: [PATCH 5/6] Update configs/README.md Co-authored-by: Austin Raney --- configs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/README.md b/configs/README.md index 4de0b36..2637f76 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_surface | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | Nash Config param for surface runoff | | #nash_storage_surface | 1D array (*double*) | | meters [m] | parameter_adjustable | surface runoff | Nash Config param; reservoir surface storage; default is zero storage | | #nsubsteps_nash_surface | *int* | | | parameter_adjustable | surface runoff | optional (default = 10); number of subtimstep for Nash runoff | -| #*Kinf_nash_surface | *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.05); storage fraction per hour that moves from reservoirs to soil | | #*retention_depth_nash_surface | *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=1 | *double* | | | parameter_adjustable | infiltration excess runoff | when `surface_water_partitioning_scheme=Xinanjiang` | From 62704f02fcd66afad72c2e7e6b9f7525f4b9204d Mon Sep 17 00:00:00 2001 From: AJKhattak-NOAA Date: Fri, 6 Sep 2024 11:22:30 -0400 Subject: [PATCH 6/6] Update README.md --- configs/README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/configs/README.md b/configs/README.md index 2637f76..5c3134d 100644 --- a/configs/README.md +++ b/configs/README.md @@ -12,23 +12,23 @@ Example configuration files are provided in this directory. To build and run the | -------- | -------- | ------ | ----- | ---- | ------- | ----------- | | forcing_file | *char* | 256 | | filename | | path to forcing inputs csv; set to `BMI` if passed via `bmi.set_value*()` | | soil_params.depth | *double* | | meters [m]| state | | soil depth | -| *soil_params.b | *double* | | | state | | beta exponent on Clapp-Hornberger (1978) soil water relations | -| *soil_params.satdk | *double* | | meters/second [m s-1] | state | | saturated hydraulic conductivity | -| *soil_params.satpsi | *double* | | meters [m] | state | | saturated capillary head | -| *soil_params.slop | *double* | | meters/meters [m/m]| state | | this factor (0-1) modifies the gradient of the hydraulic head at the soil bottom. 0=no-flow. | -| *soil_params.smcmax | *double* | | meters/meters [m/m] | state | | saturated soil moisture content | +| soil_params.b* | *double* | | | state | | beta exponent on Clapp-Hornberger (1978) soil water relations | +| soil_params.satdk* | *double* | | meters/second [m s-1] | state | | saturated hydraulic conductivity | +| soil_params.satpsi* | *double* | | meters [m] | state | | saturated capillary head | +| soil_params.slop* | *double* | | meters/meters [m/m]| state | | this factor (0-1) modifies the gradient of the hydraulic head at the soil bottom. 0=no-flow. | +| soil_params.smcmax* | *double* | | meters/meters [m/m] | state | | saturated soil moisture content | | soil_params.wltsmc | *double* | | meters/meters [m/m] | state | | wilting point soil moisture content | | soil_params.expon | *double* | | | parameter_adjustable | | optional; defaults to `1.0` | | soil_params.expon_secondary | *double* | | | parameter_adjustable | | optional; defaults to `1.0` | -| *max_gw_storage | *double* | | meters [m] | parameter_adjustable | | maximum storage in the conceptual reservoir | -| *Cgw | *double* | | meters/hour [m h-1] | parameter_adjustable | | the primary outlet coefficient | -| *expon | *double* | | | parameter_adjustable | | exponent parameter (1.0 for linear reservoir) | +| max_gw_storage* | *double* | | meters [m] | parameter_adjustable | | maximum storage in the conceptual reservoir | +| Cgw* | *double* | | meters/hour [m h-1] | parameter_adjustable | | the primary outlet coefficient | +| expon* | *double* | | | parameter_adjustable | | exponent parameter (1.0 for linear reservoir) | | gw_storage | *double* | | meters/meters [m/m] | parameter_adjustable | | initial condition for groundwater reservoir - it is the ground water as a decimal fraction of the maximum groundwater storage (max_gw_storage) for the initial timestep | | alpha_fc | *double* | | | parameter_adjustable | | field capacity | | soil_storage| *double* | | meters/meters [m/m] | parameter_adjustable | | initial condition for soil reservoir - it is the water in the soil as a decimal fraction of maximum soil water storage (smcmax * depth) for the initial timestep | | N_nash_subsurface | *int* | | | parameter_adjustable | | number of Nash lf reservoirs (optional, defaults to 2, ignored if storage values present) | | K_nash_subsurface | *double* | | 1/meters [m^-1] | parameter_adjustable | subsurface runoff | Nash Config param for lateral subsurface runoff | -| *K_lf | *double* | | | parameter_adjustable | | Nash Config param - primary reservoir | +| K_lf* | *double* | | | parameter_adjustable | | Nash Config param - primary reservoir | | nash_storage_subsurface | 1D array (*double*) | | | parameter_adjustable | | Nash Config param - secondary reservoir | | giuh_ordinates | 1D array (*double*) | | | parameter_adjustable | | Giuh ordinates in dt time steps | | num_timesteps | *int* | | | time_info | | set to `1` if `forcing_file=BMI` | @@ -36,14 +36,14 @@ Example configuration files are provided in this directory. To build and run the | surface_water_partitioning_scheme | *char* | `Xinanjiang` or `Schaake` | | parameter_adjustable | infiltraton excess | | | surface_runoff_scheme | *char* | GIUH or NASH_CASCADE | | parameter_adjustable | surface runoff | also supports 1 for GIUH and 2 for NASH_CASCADE; default is GIUH | | N_nash_surface1 | *int* | | | parameter_adjustable | surface runoff | number of Nash reservoirs for surface runoff | -| #K_nash_surface | *double* | | 1/hour [h^-1] | parameter_adjustable | surface runoff | Nash Config param for surface runoff | -| #nash_storage_surface | 1D array (*double*) | | meters [m] | parameter_adjustable | surface runoff | Nash Config param; reservoir surface storage; default is zero storage | -| #nsubsteps_nash_surface | *int* | | | parameter_adjustable | surface runoff | optional (default = 10); number of subtimstep for Nash runoff | +| 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 | -| #*retention_depth_nash_surface | *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=1 | *double* | | | parameter_adjustable | infiltration excess runoff | when `surface_water_partitioning_scheme=Xinanjiang` | -| *x_Xinanjiang_shape_parameter=1 | *double* | | | parameter_adjustable | infiltration excess runoff | when `surface_water_partitioning_scheme=Xinanjiang` | +| 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` | +| x_Xinanjiang_shape_parameter* | *double* | | | parameter_adjustable | infiltration excess runoff | when `surface_water_partitioning_scheme=Xinanjiang` | | urban_decimal_fraction | *double* | 0.0 - 1.0 | | parameter_adjustable | infiltration excess runoff | when `surface_water_partitioning_scheme=Xinanjiang` | | is_aet_rootzone | *boolean* | True, true or 1 | | coupling parameter | `rootzone-based AET` | when `CFE coupled to SoilMoistureProfile` | | max_rootzone_layer | *double* | | meters [m] | parameter_adjustable | AET | layer of the soil that is the maximum root zone depth. That is, the depth of the layer where the AET is drawn from |