source: LMDZ6/branches/LMDZ-tracers/libf/misc/trac_types_mod.F90 @ 4448

Last change on this file since 4448 was 3852, checked in by dcugnet, 3 years ago

Extension of the tracers management.

The tracers files can be:

1) "traceur.def": old format, with:

  • the number of tracers on the first line
  • one line for each tracer: <tracer name> <hadv> <vadv> [<parent name>]

2) "tracer.def": new format with one section each model component.
3) "tracer_<name>.def": new format with a single section.

The formats 2 and 3 reading is driven by the "type_trac" key, which can be a

coma-separated list of components.

  • Format 2: read the sections from the "tracer.def" file.
  • format 3: read one section each "tracer_<section name>.def" file.
  • the first line of a section is "&<section name>
  • the other lines start with a tracer name followed by <key>=<val> pairs.
  • the "default" tracer name is reserved ; the other tracers of the section inherit its <key>=<val>, except for the keys that are redefined locally.

This format helps keeping the tracers files compact, thanks to the "default"
special tracer and the three levels of factorization:

  • on the tracers names: a tracer name can be a coma-separated list of tracers => all the tracers of the list have the same <key>=<val> properties
  • on the parents names: the value of the "parent" property can be a coma-separated list of tracers => only possible for geographic tagging tracers
  • on the phases: the property "phases" is [g](l][s] (gas/liquid/solid)

Read information is stored in the vector "tracers(:)", of derived type "tra".

"isotopes_params.def" is a similar file, with one section each isotopes family.
It contains a database of isotopes properties ; if there are second generation
tracers (isotopes), the corresponding sections are read.

Read information is stored in the vector "isotopes(:)", of derived type "iso".

The "getKey" function helps to get the values of the parameters stored in
"tracers" or "isotopes".

File size: 4.7 KB
Line 
1MODULE trac_types_mod
2
3!=== TRACERS DESCRIPTOR DERIVED TYPE AND ASSOCIATED ROUTINES INTERFACES =======================================================
4  PRIVATE
5  PUBLIC :: tra, iso, db, kys
6!------------------------------------------------------------------------------------------------------------------------------
7  TYPE kys                                                           !=== TYPE FOR A SET OF KEYS ASSOCIATED TO AN ELEMENT
8    CHARACTER(LEN=256)              :: name                          !--- Tracer name
9    CHARACTER(LEN=256), ALLOCATABLE :: key(:)                        !--- Keys string list
10    CHARACTER(LEN=256), ALLOCATABLE :: val(:)                        !--- Corresponding values string list
11  END TYPE kys
12!------------------------------------------------------------------------------------------------------------------------------
13  TYPE tra                                                           !=== TYPE FOR SINGLE TRACER
14    CHARACTER(LEN=256)   :: name = ''                                !--- Name
15    CHARACTER(LEN=256)   :: nam1 = ''                                !--- Generation 1 ancestor name
16    CHARACTER(LEN=256)   :: prnt = ''                                !--- Parent name
17    CHARACTER(LEN=256)   :: lnam = ''                                !--- Long name (with adv. scheme)
18    CHARACTER(LEN=256)   :: type = 'tracer'                          !--- Type (so far: 'tracer'/'tag')
19    CHARACTER(LEN=256)   :: phas = 'g'                               !--- Phase ('g'as/'l'iquid/'s'olid)
20    CHARACTER(LEN=256)   :: comp                                     !--- Coma-separated list of components (Ex: lmdz,inca)
21    INTEGER              :: iadv = 10                                !--- Advection scheme used
22    INTEGER              :: igen = 1                                 !--- Generation number (>=1)
23    INTEGER              :: itr  = 0                                 !--- Index in tr_seri (0: not in physics)
24    INTEGER              :: iprnt = 0                                !--- Parent index
25    INTEGER, ALLOCATABLE :: idesc(:)                                 !--- Descendants index (in growing generation order)
26    INTEGER              :: ndesc = 0                                !--- Number of descendants (all generations)
27    INTEGER              :: nchld = 0                                !--- Number of childs    (first generation)
28    INTEGER              :: iso_igr = 0                              !--- Isotopes group index in isotopes(:)
29    INTEGER              :: iso_num = 0                              !--- Isotope  name  index in isotopes(iso_igr)%trac(:)
30    INTEGER              :: iso_zon = 0                              !--- Isotope  zone  index in isotopes(iso_igr)%zone(:)
31    INTEGER              :: iso_pha = 0                              !--- Isotope  phase index in isotopes(iso_igr)%phas
32    TYPE(kys)            :: keys                                     !--- <key>=<val> pairs vector
33  END TYPE tra
34!------------------------------------------------------------------------------------------------------------------------------
35  TYPE db                                                            !=== TYPE FOR TRACERS SECTION
36    CHARACTER(LEN=256)     :: name                                   !--- Section name
37    TYPE(tra), ALLOCATABLE :: trac(:)                                !--- Tracers descriptors
38  END TYPE db
39!------------------------------------------------------------------------------------------------------------------------------
40  TYPE iso                                                           !=== TYPE FOR ISOTOPES FAMILY DESCENDING ON TRACER "prnt"
41    CHARACTER(LEN=256)              :: prnt                          !--- Isotopes family name (parent tracer name ; ex: H2O)
42    LOGICAL                         :: check=.FALSE.                 !--- Triggering of the checking routines
43    TYPE(kys),          ALLOCATABLE :: keys(:)                       !--- Isotopes keys/values pairs list (length: niso)
44    CHARACTER(LEN=256), ALLOCATABLE :: trac(:)                       !--- Isotopes + tagging tracers list (length: nitr)
45    CHARACTER(LEN=256), ALLOCATABLE :: zone(:)                       !--- Geographic tagging zones names list
46    CHARACTER(LEN=256)              :: phas = 'g'                    !--- Phases list: [g][l][s]
47    INTEGER                         :: niso=0, nzon=0, nitr=0, npha=0!--- Number of isotopes, zones, total isotopes and phases
48    INTEGER,            ALLOCATABLE :: iTraPha(:,:)   ! (iqiso)      !--- Idx in "trac(1:niso)" = f(name(1:nitr)),phas)
49    INTEGER,            ALLOCATABLE :: iZonIso(:,:)   ! (index_trac) !--- Idx in "trac(1:nitr)" = f(zone, name(1:niso))
50  END TYPE iso
51
52END MODULE trac_types_mod
Note: See TracBrowser for help on using the repository browser.