Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added retention_depth to calibrated params #123

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion realizations/realization_cfe_pet_surfnash.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
"soil_moisture_profile" : "sloth_smp"
},
"model_params": {
"Kinf_nash_surface": 0.04
"Kinf_nash_surface": 0.04,
"retention_depth_nash_surface": 0.1043
},
"uses_forcing_file": false
}
Expand Down
11 changes: 9 additions & 2 deletions src/bmi_cfe.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
#define STATE_VAR_NAME_COUNT 94 // must match var_info array size


#define PARAM_VAR_NAME_COUNT 18
#define PARAM_VAR_NAME_COUNT 19
// 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",
"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"
};

Expand All @@ -41,7 +42,7 @@ static const char *param_var_types[PARAM_VAR_NAME_COUNT] = {
"double", "double", "double", "double",
"double", "double", "double", "double",
"double","double","double", "double",
"int"
"double", "int"
};
//----------------------------------------------
// Put variable info into a struct to simplify
Expand Down Expand Up @@ -1931,6 +1932,12 @@ static int Get_value_ptr (Bmi *self, const char *name, void **dest)
return BMI_SUCCESS;
}

if (strcmp(name, "retention_depth_nash_surface") == 0) {
cfe_state_struct *cfe_ptr;
cfe_ptr = (cfe_state_struct *) self->data;
*dest = (void*)&cfe_ptr->nash_surface_params.retention_depth;
return BMI_SUCCESS;
}
/***********************************************************/
/*********** OUTPUT ***********************************/
/***********************************************************/
Expand Down
5 changes: 3 additions & 2 deletions test/main_unit_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,16 +393,17 @@ main(int argc, const char *argv[]){
printf("\nTEST BMI MODEL PARAMETERS\n*************************\n");

//Set number of params -- UPDATE if params changed
#define PARAM_COUNT 18
#define PARAM_COUNT 19

// 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] = {
"maxsmc", "satdk", "slope", "b", "Klf",
"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",
"Kinf_nash_surface", "retention_depth_nash_surface",
"N_nash_subsurface"};

double test_set_value = 4.2;
double test_get_value = 0.0;
int test_set_value_int = 5;
Expand Down
Loading