wiki:Documentation/UserGuide/NewFlag

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

Name changed from NewFlag to HowTo/NewFlag

How to add a new flag

Declare the new flag

For consistency reasons new flags are to be declared in a structure. First, you need to declare the new flag as a logical in ../modeles/ORCHIDEE/src_parameter/constantes.f90 in the existing control type block. Variables declared in constantes.f90 are global

TYPE control_type
   LOGICAL :: ok_NameOfNewFlag      !! Explanation of new flag
END TYPE control_type

Next, you store the flags in a common variable named 'control'. This is done in ../modeles/ORCHIDEE/src_sechiba/sechiba.f90 in the subroutine sechiba_init

control%ok_NameOfNewFlag = control_in%ok_NameOfNewFlag


Read the flag from the parameter file

The flag can be read in the routine where you need it, if the flag is shared among routines you can read it in the first common routine. Quite a few flags that control the flow of th emodel are read in intersurf.f90 in the subroutine intsurf_config. Document the flag using the default keywords (see below). An example is shown for the flag called control%ok_functional_allocation

!Config Key  = STOMATE_FUNCTIONAL_ALLOCATION
!Config Desc = use Friedlingstein etal. 1999 or Zaehle et al 2010 for allocation
!Config Def  = n
!Config Help = set to TRUE if functional allocation is to be activated
!
control_flags%ok_functional_allocation = .FALSE.
CALL getin_p('STOMATE_FUNCTIONAL_ALLOCATION',control_flags%ok_functional_allocation)
WRITE(*,*) 'Allocation is based on plant structure: ',control_flags%ok_functional_allocation