load_parameters Subroutine

public subroutine load_parameters(met, air, ssnow, veg, climate, bgc, soil, canopy, rough, rad, sum_flux, bal, logn, vegparmnew, casabiome, casapool, casaflux, sum_casapool, sum_casaflux, casamet, casabal, phen, POP, spinup, EMSOIL, TFRZ, LUC_EXPT, POPLUC)

Defines the priority order of sources of parameter values for CABLE, determines the total number of patches over all grid cells, and writes parameter values to CABLE's parameter arrays.

WARNING: this needs reordering and tweaking to (a) remove the possibility of inconsistencies between the number of patches in the default parameter grid and a restart file, and (b) allow vegetation and soil type to be forced from the met file (this is more complicated than simply uncommenting the iveg and isoil reads from the met file - it requires the actual parameter values to be written after that read).

Order of processes:

  1. Load parameter values for each grid cell from default vegetation and soil types based on latitude and longitude. This includes determining the number of patches in each grid cell, and so the total number of patches.

  2. Allocate CABLE (and CASA's [+phenology], if used) variables now that the dimension of arrays is known - i.e. now that we know how many grid cells and patches there are.

    • WARNING: I think this allocation should happen after ALL parameter and restart information has been loaded. As it stands, I think there is the potential for the restart file to contain variables of a different dimension to what is declared here.
  3. Assign the loaded parameter values to CABLE's parameter variables

  4. [IF CASA is being used] Assign the CASA parameters from CABLE parameters

    • WARNING: again this should happen after the restart file and met file information has been used to define CABLE parameters, otherwise they could be out of sync.
  5. [IF CASA is being used] Initialise CASA state variables

  6. Check that the total number of patches in the restart file matches the total number of patches from the default grid (abort if not).

    • WARNING: if a restart file exists, it should define the total number of patches, not the default grid.
  7. Load initialisations and parameter values from restart file, and overwrite default values with these.

  8. Overwrite parameter values with any found in the met forcing file. This could be just a subset of parameters.

  9. Ensure the consistency of ice points between soil and vegetation

  10. Construct derived parameters and zero initialisations for the groundwater routine, regardless of where parameters and other initialisations have loaded from

  11. Check for basic inconsistencies in parameter values

  12. Write per-site parameter values to log file if requested

Arguments

Type IntentOptional Attributes Name
type(met_type), intent(inout) :: met
type(air_type), intent(inout) :: air
type(soil_snow_type), intent(out) :: ssnow
type(veg_parameter_type), intent(out) :: veg
type(climate_type), intent(inout) :: climate
type(bgc_pool_type), intent(out) :: bgc
type(soil_parameter_type), intent(out) :: soil
type(canopy_type), intent(out) :: canopy
type(roughness_type), intent(out) :: rough
type(radiation_type), intent(out) :: rad
type(sum_flux_type), intent(out) :: sum_flux
type(balances_type), intent(out) :: bal
integer, intent(in) :: logn
logical, intent(in) :: vegparmnew
type(casa_biome), intent(out) :: casabiome
type(casa_pool), intent(out) :: casapool
type(casa_flux), intent(out) :: casaflux
type(casa_pool), intent(out) :: sum_casapool
type(casa_flux), intent(out) :: sum_casaflux
type(casa_met), intent(out) :: casamet
type(casa_balance), intent(out) :: casabal
type(phen_variable), intent(out) :: phen
type(POP_TYPE), intent(inout) :: POP
logical, intent(in) :: spinup
real, intent(in) :: EMSOIL
real, intent(in) :: TFRZ
type(LUC_EXPT_TYPE), intent(inout) :: LUC_EXPT
type(POPLUC_TYPE), intent(inout) :: POPLUC