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

fixed_several_issues #129

Merged
merged 3 commits into from
Sep 4, 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
8 changes: 4 additions & 4 deletions configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Example configuration files are provided in this directory. To build and run the
| 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 |
| nash_storage_subsurface | *double* | | | parameter_adjustable | | Nash Config param - secondary reservoir |
| giuh_ordinates | *double* | | | parameter_adjustable | | Giuh ordinates in dt time steps |
| 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` |
| 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 | *double* | | meters [m] | parameter_adjustable | surface runoff | Nash Config param; reservoir surface storage; default is zero storage |
| 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) |
Expand All @@ -40,7 +40,7 @@ Example configuration files are provided in this directory. To build and run the
| 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 |
| soil_layer_depths | 1D array | | meters [m] | parameter_adjustable | AET | an array of depths from the surface. Example, soil_layer_depths=0.1,0.4,1.0,2.0
| soil_layer_depths | 1D array (*double*) | | meters [m] | parameter_adjustable | AET | an array of depths from the surface. Example, soil_layer_depths=0.1,0.4,1.0,2.0
| is_sft_coupled | *boolean* | True, true or 1 | | coupling parameter | `ice_fraction-based runoff` | when `CFE coupled to SoilFreezeThaw`|

## Infiltration excess runoff options in CFE
Expand Down
28 changes: 27 additions & 1 deletion src/bmi_cfe.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,12 @@ int read_init_config_cfe(const char* config_file, cfe_state_struct* model)
if (strcmp(param_key, "K_nash_subsurface") == 0 || strcmp(param_key, "K_nash") == 0) {
model->K_nash_subsurface = strtod(param_value, NULL);
is_K_nash_subsurface_set = TRUE;
// Check if units are present and print warning if missing from config file
if ((param_units == NULL) || (strlen(param_units) < 1)) {
#if CFE_DEBUG >= 1
printf ("WARNING: [units] expected for '%s' in config file. [1/hour]\n", param_key);
#endif
}
continue;
}
if (strcmp(param_key, "K_lf") == 0) {
Expand Down Expand Up @@ -802,6 +808,11 @@ int read_init_config_cfe(const char* config_file, cfe_state_struct* model)
if (strcmp(param_key, "K_nash_surface") == 0) {
model->nash_surface_params.K_nash = strtod(param_value, NULL);
is_K_nash_surface_set = TRUE;
if ((param_units == NULL) || (strlen(param_units) < 1)) {
#if CFE_DEBUG >= 1
printf ("WARNING: [units] expected for '%s' in config file. [1/hour]\n", param_key);
#endif
}
continue;
}
if (strcmp(param_key, "nsubsteps_nash_surface") == 0) {
Expand All @@ -812,16 +823,31 @@ int read_init_config_cfe(const char* config_file, cfe_state_struct* model)
if (strcmp(param_key, "nash_storage_surface") == 0) {
nash_storage_surface_string_val = strdup(param_value);
is_nash_storage_surface_set = TRUE;
if ((param_units == NULL) || (strlen(param_units) < 1)) {
#if CFE_DEBUG >= 1
printf ("WARNING: [units] expected for '%s' in config file. [m]\n", param_key);
#endif
}
continue;
}
if (strcmp(param_key, "Kinf_nash_surface") == 0) {
model->nash_surface_params.K_infiltration = strtod(param_value, NULL);
is_K_infiltration_nash_surface_set = TRUE;
if ((param_units == NULL) || (strlen(param_units) < 1)) {
#if CFE_DEBUG >= 1
printf ("WARNING: [units] expected for '%s' in config file. [1/hour]\n", param_key);
#endif
}
continue;
}
if (strcmp(param_key, "retention_depth_nash_surface") == 0) {
model->nash_surface_params.retention_depth = strtod(param_value, NULL);
is_retention_depth_nash_surface_set = TRUE;
if ((param_units == NULL) || (strlen(param_units) < 1)) {
#if CFE_DEBUG >= 1
printf ("WARNING: [units] expected for '%s' in config file. [m]\n", param_key);
#endif
ajkhattak marked this conversation as resolved.
Show resolved Hide resolved
}
continue;
}

Expand Down Expand Up @@ -1956,7 +1982,7 @@ static int Get_value_ptr (Bmi *self, const char *name, void **dest)
if (strcmp (name, "RAIN_RATE") == 0) { //jmframe: Seems unnecessary to have rain rate as an output variable.
cfe_state_struct *cfe_ptr;
cfe_ptr = (cfe_state_struct *) self->data;
*dest = (void*)&cfe_ptr->aorc.precip_kg_per_m2;
*dest = (void*)&cfe_ptr->timestep_rainfall_input_m;
return BMI_SUCCESS;
}

Expand Down
Loading