NOAA-OWP / noah-owp-modular

Modularized version of the NOAH-MP land surface model.
Other
9 stars 19 forks source link

Add support for calibratable parameters #95

Closed GreyREvenson closed 7 months ago

GreyREvenson commented 11 months ago

Purpose

This PR exposes the model's calibratable parameters via its BMI so that they can be calibrated via NextGen.

Additions

Calibratable parameters

The following parameters were added to the model's BMI:

Listings/functionality for the above parameters were added to the following BMI functions:

** FRZX and KDT were added because they are recalculated/reinitialized when setting SMCMAX, DKSAT and/or REFKDT. FRZX and KDT were added so that they may be included in the unit test program; they are not intended to be calibrated.

*** This PR adds SCAMAX to Noah-OWP-Modular because it is a NWM 3.0 calibratable parameter. SCAMAX was added as a member of parametersgrid_type (as a 2D allocatable array) and parameters_type (as a scalar) and associated initialization and 'transfer-in' and 'transfer-out' subroutines. The calculation of FSNO (i.e., snow covered area) was amended to follow WRF-Hydro's calculation as:

water%FSNO = parameters%SCAMAX * TANH( water%SNOWH /(2.5 * parameters%Z0 * FMELT))

param_items

The above parameters were not added to the input_items or output_items arrays within the BMI module. Instead, a new param_items array was created to hold these names. I believe this approach follows the examples of topmodel's BMI and cfe's BMI. param_item_count, param_location, and param_grid were also added to support BMI functionality associated with the added parameters. These new variables/arrays are declared as:

  ! calibratable parameter items
  integer, parameter                                                     :: param_item_count = 17     ! number of calibratable parameters
  character(len=BMI_MAX_VAR_NAME), dimension(param_item_count)           :: param_items = [character(len=BMI_MAX_VAR_NAME) :: "CWP","VCMX25","MP","MFSNO","RSURF_SNOW","HVT", & ! name of each calibratable parameter indexed by calibratable parameter number (i.e., 1 through param_item_count)
                                                                                                                              "BEXP","SMCMAX","FRZX","DKSAT","KDT","RSURF_EXP","REFKDT", &
                                                                                                                              "AXAJ","BXAJ","XXAJ","SLOPE"]
  character (len=BMI_MAX_LOCATION_NAME), dimension(param_item_count)     :: param_location = 'node'  ! location of each calibratable parameter (e.g., 'node' or 'edge') indexed by calibratable parameter number (default value is 'node')
  integer, dimension(param_item_count)                                   :: param_grid = 1           ! GridType%id (0 = scalar, 1 = 2D, 2 = 3D) associated each calibratable parameter indexed by calibratable parameter number (default value is 1)

Changes

The Noah-OWP-Modular unit test program (/test/noahowp_driver_test.f90) was refactored to facilitate testing of the calibratable parameters. The section of the unit test devoted to testing the get_value and set_value BMI functions will now print parameters that are necessarily recalculated when setting another parameter.

Testing

The refactored unit test program was executed and gave these results.

Notes

Below are 'calibratable parameters' that could not be found in Noah-OWP-Modular: