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

Add calibratable parameters to bmi_topmodel.c #28

Closed
SnowHydrology opened this issue Mar 16, 2022 · 3 comments · Fixed by #29
Closed

Add calibratable parameters to bmi_topmodel.c #28

SnowHydrology opened this issue Mar 16, 2022 · 3 comments · Fixed by #29
Assignees
Labels
enhancement New feature or request

Comments

@SnowHydrology
Copy link

Current behavior

TOPMODEL reads in parameter values from params.dat. If you want to change parameter values, you need to edit that file.

Expected behavior

A recent pull request in the ngen repo gives Nextgen the ability to change parameter values. This means we can use the model engine to override parameter values from params.dat. To do this, we'll need to edit bmi_topmodel.c to include calibratable parameters. We should follow the updated bmi_cfe.c file as a template: https://github.com/NOAA-OWP/cfe/blob/master/src/bmi_cfe.c

Steps to perform

  1. Identify all parameters to add
  2. Add #define PARAM_VAR_NAME_COUNT
  3. Add static const char *param_var_names[PARAM_VAR_NAME_COUNT] and static const char *param_var_types[PARAM_VAR_NAME_COUNT]
  4. Update static int Get_value_ptr to include all added parameters

Parameters to include

The following vars are included in params.dat (thanks @madMatchstick for the table!)

Variable Datatype Limits Units Role Process Description
subcat char 256 info_string character title of subcatment; often same as model title
szm double meters parameter_fixed rainfall-runoff exponential scaling parameter for the decline of transmissivity with increase in storage deficit; units of depth
t0 double ln(meters^2) parameter_fixed areal average of ln(a/tanB)
td double hours parameter_adjustable rainfall-runoff unsaturated zone time delay per unit storage deficit
chv double meters/hour parameter_fixed overland flow average channel flow velocity
rv double meters/hour parameter_fixed overland flow internal overland flow routing velocity
srmax double meters parameter_adjustable rainfall-runoff maximum root zone storage deficit
Q0 double meters/hour state initial subsurface flow per unit area
sr0 double meters state initial root zone storage deficit below field capacity
infex int Boolean option green-ampt set to 1 to call subroutine to do infiltration excess calcs; not usually appropriate in catchments where Topmodel is applicable (shallow highly permeable soils); default to 0
xk0 double meters/hour parameter_adjustable rainfall-runoff surface soil hydraulic conductivity
hf double meters parameter_adjustable green-ampt wetting front suction for G&A soln.
dth double parameter_adjustable green-ampt water content change across the wetting front; dimensionless
@SnowHydrology SnowHydrology added the enhancement New feature or request label Mar 16, 2022
@SnowHydrology SnowHydrology self-assigned this Mar 16, 2022
@SnowHydrology
Copy link
Author

@xfeng2021, can you look at the table above and let me know which parameters you'd like added?

@xfeng2021
Copy link

I forwarded the table with the list of parameters to you. Thanks.

@hellkite500
Copy link
Member

hellkite500 commented Mar 16, 2022

Also, a few more details on implementing/updating the BMI components can be found in NOAA-OWP/cfe#44

You can verbatim copy this commit content from these commits
NOAA-OWP/cfe@cacb838
NOAA-OWP/cfe@85ec486

Then just implement for the specific names these commits
NOAA-OWP/cfe@cd65034
NOAA-OWP/cfe@316f767

This assumes that set_value works similarly to CFE's set_value in which it uses get_value_ptr to implement the function. If it doesn't, adjust accordingly, but make sure that get_var_type is properly implemented for parameters you wish to expose this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants