wiki:Tags/196/ExternalisationParameters/TechnicalModifications

Version 2 (modified by dsolyga, 12 years ago) (diff)

--

Technical modifications

This page summarizes the choices and the modifications done for the externalization of the parameters.

Global Specifications

We tried to respect as soon as possible the structure of the code.

Three folders over five were affected by the modifications : src_parameters, src_sechiba and src_stomate.

We regroup all the files containing parameters in src_parameters. We rewrite some parts of the code in order not to have explicit references to indexes to some PFTs (like agricultural ones).

We delete all the multiple definitions of some parameters like pi or the terrestrial radius R_Earth.

Finally, we gave names to some coefficents intervening in equations and externalized them.

The main changings are detailed below :

Src_parameters

Originally, this folder was organized in 4 files called constantes.f90, constantes_co2.f90, constantes_veg.f90 and constantes_soil.f90.

The last three files were mixed up with stomate_constants.f90 to give pft_parameters.f90 and constantes_mtc.f90. These new files make the initialization and the overwriting of the pft-parameters.

All the default values for the pft-parameters are in constantes_mtc.f90.

constantes.f90 contains all the physical constants used by ORCHIDEE and (for the moment) the rest of the externalized parameters (scalar and no-pfts-sized arrays).

Src_sechiba

We add a new module called qsat_moisture.f90. This module regroups the routines for the calculation of qsat (previously in constantes_veg.f90).
intersurf.f90 reads the number of PFTs and the parameters values chosen by the user.
We put the routines get_vegcorr and get_soilcorr in slowproc.f90. We correct the following bug in the Olson classification (subroutine get_vegcorr) :

    ! 78 warm C3 woody savanna
    vegcorr(78,:) = &
         & (/0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, 0.0/)
    ! 79 warm C4 woody savanna
    vegcorr(79,:) = &
         & (/0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, 0.0/)

The good formulation is :

    ! 78 warm C3 woody savanna
    vegcorr(78,:) = &
         & (/0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, 0.0/)
    ! 79 warm C4 woody savanna
    vegcorr(79,:) = &
         & (/0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0/)

Src_stomate

We delete stomate_constants.f90 in order to move its parameters in src_parameters. The too-specific parameters were moved to stomate_data.f90.
Due to Fortran language restrictions (we can't allocate a field of a structure), we have to delete the following structures in ORCHIDEE (previously in stomate_constants.f90:

! type declaration for photosynthesis
  TYPE t_photo_type
    REAL(r_std), DIMENSION(nvm)                  :: t_max_a
    REAL(r_std), DIMENSION(nvm)                  :: t_max_b
    REAL(r_std), DIMENSION(nvm)                  :: t_max_c
    REAL(r_std), DIMENSION(nvm)                  :: t_opt_a
    REAL(r_std), DIMENSION(nvm)                  :: t_opt_b
    REAL(r_std), DIMENSION(nvm)                  :: t_opt_c
    REAL(r_std), DIMENSION(nvm)                  :: t_min_a
    REAL(r_std), DIMENSION(nvm)                  :: t_min_b
    REAL(r_std), DIMENSION(nvm)                  :: t_min_c
  END TYPE t_photo_type

and :

! type declaration for phenology
  TYPE pheno_type
    REAL(r_std), DIMENSION(nvm,3)                :: gdd
    REAL(r_std), DIMENSION(nvm)                  :: ngd
    REAL(r_std), DIMENSION(nvm)                  :: ncdgdd_temp
    REAL(r_std), DIMENSION(nvm)                  :: hum_frac
    REAL(r_std), DIMENSION(nvm)                  :: lowgpp_time
    REAL(r_std), DIMENSION(nvm)                  :: leaffall
    REAL(r_std), DIMENSION(nvm)                  :: leafagecrit
    REAL(r_std)                       :: tau_hum_month
    REAL(r_std)                       :: tau_hum_week
    REAL(r_std)                       :: tau_t2m_month
    REAL(r_std)                       :: tau_t2m_week
    REAL(r_std)                       :: tau_tsoil_month
    REAL(r_std)                       :: tau_soilhum_month
    REAL(r_std)                       :: tau_gpp_week
    REAL(r_std)                       :: tau_gdd
    REAL(r_std)                       :: tau_ngd
    REAL(r_std)                       :: tau_longterm
    REAL(r_std), DIMENSION(nvm)                  :: lai_initmin
    CHARACTER(len=6), DIMENSION(nvm)            :: pheno_model
    CHARACTER(len=6), DIMENSION(nvm)            :: senescence_type
    REAL(r_std), DIMENSION(nvm,3)                :: senescence_temp
    REAL(r_std), DIMENSION(nvm)                  :: senescence_hum
    REAL(r_std), DIMENSION(nvm)                  :: nosenescence_hum
    REAL(r_std), DIMENSION(nvm)                  :: max_turnover_time
    REAL(r_std), DIMENSION(nvm)                  :: min_leaf_age_for_senescence
    REAL(r_std), DIMENSION(nvm)                  :: min_turnover_time
!-
    REAL(r_std), DIMENSION(nvm)                  :: hum_min_time
  END TYPE pheno_type

We replace the structures by individuals arrays.

During our validations on fluxnet sites, we modified the herbivory model and the formulation for the variable "black_carbon". In stomate_season.f90, we replace :

    DO j = 2,nvm
       !
       IF ( natural(j) ) THEN
          !
          WHERE ( nlflong_nat(:) .GT. zero )
             consumption(:) = hvc1 * nlflong_nat(:) ** hvc2
             herbivores(:,j) = one_year * green_age(:) * nlflong_nat(:) / consumption(:)
          ELSEWHERE
             herbivores(:,j) = 100000.
          ENDWHERE
          !
       ELSE
          !
          herbivores(:,j) = 100000.
          !
       ENDIF
       !
    ENDDO

by :

     DO j = 2,nvm
       !
       IF ( natural(j) ) THEN
          !
          WHERE ( nlflong_nat(:,j) .GT. zero )
             consumption(:) = hvc1 * nlflong_nat(:,j) ** hvc2
             herbivores(:,j) = one_year * green_age(:,j) * nlflong_nat(:,j) / consumption(:)
          ELSEWHERE
             herbivores(:,j) = 100000.
          ENDWHERE
          !
       ELSE
          !
          herbivores(:,j) = 100000.
          !
       ENDIF
       !
    ENDDO  

in order to make herbivores more pft-specific. For "black_carbon", we relaced the following line

 black_carbon(:) = &
                  black_carbon(:) + bcfrac(:) * residue(:) 

by :

 black_carbon(:) = &
                  black_carbon(:) + bcfrac(:) * residue(:) * veget_max(:,j)

In both cases, when we add a new PFT on the same surface, the consumption of herbivory and the quantity of black carbon was doubled ! That's why we change the formulations of these two sub-models.

JULY 2011

The most part of the externalized parameters which were still in src_sechiba are in src_parameters now.

SUMMARY OF THE CHANGES

I summarize the modifications and the features of the externalized version of ORCHIDEE :

  • 3 bugs corrected : black_carbon(lpj_fire), herbivores(season) and routine get_vegcorr(slowproc)
  • 3 new modules : pft_parameters, constantes_mtc and qsat_moisture
  • 4 modules deleted : constantes_soil, constantes_co2, constantes_veg and stomate_constants
  • ext_coeff replace in all the code ext_coef and ext_coeff
  • type phenology deleted : because we can't use the attribute ALLOCATABLE for a field in a structure
  • Rewrite the explicit referenced to PFTs :(IF j==12 .OR. j==13) replaced by IF(.NOT. natural(j)) => adapte code for a generic number of PFTs
  • Add the function getin_p for characters array
  • Delete multi definitions for Earth radius, pi, min_sechiba, min_stomate
  • Unify parameters definitions for weather and ORCHIDEE : the values used by weather are the same used by ORCHIDEE.
  • Create Labels for all new externalized parameters and add Config Units for the previous parameters

  • Configuration of the number of PFTs : from 2 to X

  • Configuration of the values of some 400 parameters without having to recompile the code.
  • SCRIPTS : design new default files

Delete unused parameters :

Choices made

I try to regroup all the externalized parameters in src_parameters.

For the pft_parameters : they have to be allocated and some are used by many modules. Moreover, I want to have a flag called IMPOSE_PARAM which controls the reading of the parameters.

If Someone wants to go back to the standard values, this flag has to be set to TRUE.
I think also the module pft_parameters as the symetric module of constantes_mtc. With constantes_mtc.f90, we have only one file to modify to add a new metaclass and we can track more easily the changes made to the values.

For the other parameters, I want to avoid multiple definitions as some parameters are used by different modules.

I regroup also these parameters because of the flag IMPOSE_PARAM.

The other advantages is that we can distinguish variables from parameters in the code and that we have a

better readibility of the code (personal point of view). But this is incomfort for some people, we can dispatch

again the parameters (except the pft-parameters ones).

NEED TO BE DISCUSSED BEFORE THE TAG