From 5d4338f960828a966f2f5372f84bc4f03fdbf60e Mon Sep 17 00:00:00 2001 From: Ahmad Jan Date: Thu, 29 Aug 2024 13:34:30 -0400 Subject: [PATCH 1/3] fixed issues #58 and #69. RAIN_RATE in units of m. --- src/bmi_cfe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bmi_cfe.c b/src/bmi_cfe.c index c7200b3..fa749fd 100644 --- a/src/bmi_cfe.c +++ b/src/bmi_cfe.c @@ -1956,7 +1956,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; } From 23c2343a692b20291d4080865bdf0d67843c3033 Mon Sep 17 00:00:00 2001 From: AJKhattak-NOAA Date: Thu, 29 Aug 2024 13:43:56 -0400 Subject: [PATCH 2/3] Update README.md fixes issue #124 --- configs/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/README.md b/configs/README.md index f3036f4..66ec2da 100644 --- a/configs/README.md +++ b/configs/README.md @@ -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) | @@ -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 From 123378a9114fde14c7b340ae30f657cc9c864a0a Mon Sep 17 00:00:00 2001 From: Ahmad Jan Date: Thu, 29 Aug 2024 14:13:06 -0400 Subject: [PATCH 3/3] fixed issue #125, added warnings when a variable from the config file is missing units. --- src/bmi_cfe.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/bmi_cfe.c b/src/bmi_cfe.c index fa749fd..edbef4d 100644 --- a/src/bmi_cfe.c +++ b/src/bmi_cfe.c @@ -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) { @@ -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) { @@ -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 + } continue; }