source: LMDZ6/trunk/libf/dyn3d_common/infotrac.f90 @ 5475

Last change on this file since 5475 was 5475, checked in by dcugnet, 6 hours ago

Restore revisions 5216 and 5234, which were canceled at revision 5237:
Remove INCA retro-compatibility with "traceur.def" ("tracer.def" should be used instead).
"is_master" variable is not introduced in infotrac (no longer precompiled) because CPP_PARA is needed.

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:keywords set to Id
File size: 26.9 KB
Line 
1!$Id: infotrac.f90 5475 2025-01-14 23:23:34Z dcugnet $
2!
3MODULE infotrac
4
5   USE       strings_mod, ONLY: msg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse, strCount, strIdx
6   USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers,  addPhase,  addKey, iH2O,  &
7       isoSelect,  indexUpdate, isot_type, testTracersFiles, isotope,  delPhase,  getKey, tran0, &
8       isoKeys, isoName, isoZone, isoPhas, processIsotopes,  isoCheck, itZonIso,  nbIso,         &
9          niso,   ntiso,   nzone,   nphas,   maxTableWidth,  iqIsoPha, iqWIsoPha, ixIso, new2oldH2O, newHNO3, oldHNO3
10   IMPLICIT NONE
11
12   PRIVATE
13
14   !=== FOR TRACERS:
15   PUBLIC :: init_infotrac                                 !--- Initialization of the tracers
16   PUBLIC :: tracers, type_trac                            !--- Full tracers database, tracers type keyword
17   PUBLIC :: nqtot,   nbtr,   nqo,   nqCO2,   nqtottr      !--- Main dimensions
18   PUBLIC :: conv_flg, pbl_flg                             !--- Convection & boundary layer activation keys
19   PUBLIC :: new2oldH2O, newHNO3, oldHNO3                  !--- For backwards compatibility in dynetat0
20   PUBLIC :: addPhase, delPhase                            !--- Add/remove the phase from the name of a tracer
21
22   !=== FOR ISOTOPES: General
23   PUBLIC :: isot_type, nbIso                              !--- Derived type, full isotopes families database + nb of families
24   PUBLIC :: isoSelect, ixIso                              !--- Isotopes family selection tool + selected family index
25   !=== FOR ISOTOPES: Specific to water
26   PUBLIC :: iH2O                                          !--- Value of "ixIso" for "H2O" isotopes class
27   PUBLIC :: min_qParent, min_qMass, min_ratio             !--- Min. values for various isotopic quantities
28   !=== FOR ISOTOPES: Depending on the selected isotopes family
29   PUBLIC :: isotope                                       !--- Selected isotopes database (argument of getKey)
30   PUBLIC :: isoKeys, isoName, isoZone, isoPhas            !--- Isotopes keys & names, tagging zones names, phases
31   PUBLIC ::    niso,   ntiso,   nzone,   nphas            !--- Number of   "   "
32   PUBLIC :: itZonIso                                      !--- Index "it" in "isoName(1:niso)" = f(tagging idx, isotope idx)
33   PUBLIC :: iqIsoPha                                      !--- Index "iq" in "qx"              = f(isotope idx,   phase idx)
34   PUBLIC :: isoCheck                                      !--- Run isotopes checking routines
35   !=== FOR BOTH TRACERS AND ISOTOPES
36   PUBLIC :: getKey                                        !--- Get a key from "tracers" or "isotope"
37
38!=== CONVENTIONS FOR TRACERS NUMBERS:
39!  |--------------------+-----------------------+-----------------+---------------+----------------------------|
40!  | water in different |    water tagging      |  water isotopes | other tracers | additional tracers moments |
41!  | phases: H2O_[glsrb]|      isotopes         |                 |               |  for higher order schemes  |
42!  |--------------------+-----------------------+-----------------+---------------+----------------------------|
43!  |                    |                       |                 |               |                            |
44!  |<--     nqo      -->|<-- nqo*niso* nzone -->|<-- nqo*niso  -->|<--  nbtr   -->|<--        (nmom)        -->|         
45!  |                    |                                         |                                            |
46!  |                    |<-- nqo*niso*(nzone+1)  =   nqo*ntiso -->|<--    nqtottr = nbtr + nmom             -->|
47!  |                                                                              = nqtot - nqo*(ntiso+1)      |
48!  |                                                                                                           |
49!  |<--                        nqtrue  =  nbtr + nqo*(ntiso+1)                 -->|                            |
50!  |                                                                                                           |
51!  |<--                        nqtot   =  nqtrue + nmom                                                     -->|
52!  |                                                                                                           |
53!  |-----------------------------------------------------------------------------------------------------------|
54!  NOTES FOR THIS TABLE:
55!  * Used "niso", "nzone" and "ntiso" are components of "isotopes(ip)" for water (isotopes(ip)%parent == 'H2O'),
56!    since water is so far the sole tracers family, except passive CO2, removed from the main tracers table.
57!  * For water, "nqo" is equal to the more general field "isotopes(ip)%nphas".
58!  * "niso", "nzone", "ntiso", "nphas" are defined for other isotopic tracers families, if any.
59!
60!=== DERIVED TYPE EMBEDDING MOST OF THE TRACERS-RELATED QUANTITIES (LENGTH: nqtot)
61!    Each entry is accessible using "%" sign.
62!  |-------------+------------------------------------------------------+-------------+------------------------+
63!  |  entry      | Meaning                                              | Former name | Possible values        |
64!  |-------------+------------------------------------------------------+-------------+------------------------+
65!  | name        | Name (short)                                         | tname       |                        |
66!  | keys        | key/val pairs accessible with "getKey" routine       | /           |                        |
67!  | gen0Name    | Name of the 1st generation ancestor                  | /           |                        |
68!  | parent      | Name of the parent                                   | /           |                        |
69!  | longName    | Long name (with adv. scheme suffix) for outputs      | ttext       |                        |
70!  | type        | Type (so far: tracer or tag)                         | /           | tracer,tag             |
71!  | phase       | Phases list ("g"as / "l"iquid / "s"olid              |             | [g|l|s|r|b]            |
72!  |             |              "r"(cloud) / "b"lowing)                 | /           |                        |
73!  | component   | Name(s) of the merged/cumulated section(s)           | /           | coma-separated names   |
74!  | iGeneration | Generation (>=1)                                     | /           |                        |
75!  | iqParent    | Index of the parent tracer                           | iqpere      | 1:nqtot                |
76!  | iqDescen    | Indexes of the childs       (all generations)        | iqfils      | 1:nqtot                |
77!  | nqDescen    | Number of the descendants   (all generations)        | nqdesc      | 1:nqtot                |
78!  | nqChildren  | Number of childs            (1st generation only)    | nqfils      | 1:nqtot                |
79!  | iadv        | Advection scheme number                              | iadv        | 1,2,10-20(exc.15,19),30|
80!  | isAdvected  | Advected tracers flag (.TRUE. if iadv >= 0)          | /           | nqtrue  .TRUE. values  |
81!  | isInPhysics | Tracers not extracted from the main table in physics | /           | nqtottr .TRUE. values  |
82!  | iso_iGroup  | Isotopes group index in isotopes(:)                  | /           | 1:nbIso                |
83!  | iso_iName   | Isotope  name  index in isotopes(iso_iGroup)%trac(:) | iso_indnum  | 1:niso                 |
84!  | iso_iZone   | Isotope  zone  index in isotopes(iso_iGroup)%zone(:) | zone_num    | 1:nzone                |
85!  | iso_iPhas   | Isotope  phase index in isotopes(iso_iGroup)%phas(:) | phase_num   | 1:nphas                |
86!  +-------------+------------------------------------------------------+-------------+------------------------+
87!
88!=== DERIVED TYPE EMBEDDING MOST OF THE ISOTOPES-RELATED QUANTITIES (LENGTH: nbIso, NUMBER OF ISOTOPES FAMILIES)
89!    Each entry is accessible using "%" sign.
90!  |-----------------+--------------------------------------------------+--------------------+-----------------+
91!  |  entry | length | Meaning                                          |    Former name     | Possible values |
92!  |-----------------+--------------------------------------------------+--------------------+-----------------+
93!  | parent          | Parent tracer (isotopes family name)             |                    |                 |
94!  | keys   | niso   | Isotopes keys/values pairs list + number         |                    |                 |
95!  | trac   | ntiso  | Isotopes + tagging tracers list + number         | / | ntraciso       |                 |
96!  | zone   | nzone  | Geographic tagging zones   list + number         | / | ntraceurs_zone |                 |
97!  | phase  | nphas  | Phases                     list + number         |                    | [g|l|s|r|b] 1:5 |
98!  | iqIsoPha        | Index in "qx"           = f(name(1:ntiso)),phas) | iqiso              | 1:nqtot         |
99!  | itZonIso        | Index in "trac(1:ntiso)"= f(zone, name(1:niso))  | index_trac         | 1:ntiso         |
100!  +-----------------+--------------------------------------------------+--------------------+-----------------+
101
102   REAL, PARAMETER :: min_qParent = 1.e-30, min_qMass = 1.e-18, min_ratio = 1.e-16 ! MVals et CRisi
103
104   !=== DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES
105   INTEGER, SAVE :: nqtot                                       !--- Tracers nb in dynamics (incl. higher moments + H2O)
106   INTEGER, SAVE :: nbtr                                        !--- Tracers nb in physics  (excl. higher moments + H2O)
107   INTEGER, SAVE :: nqo                                         !--- Number of water phases
108   INTEGER, SAVE :: nqtottr                                     !--- Number of tracers passed to phytrac (TO BE DELETED ?)
109   INTEGER, SAVE :: nqCO2                                       !--- Number of tracers of CO2  (ThL)
110   CHARACTER(LEN=maxlen), SAVE :: type_trac                     !--- Keyword for tracers type(s)
111
112   !=== VARIABLES FOR INCA
113   INTEGER, SAVE, ALLOCATABLE :: conv_flg(:), pbl_flg(:)        !--- Convection / boundary layer activation (nbtr)
114
115CONTAINS
116
117SUBROUTINE init_infotrac
118   USE iniprint_mod_h
119   USE control_mod, ONLY: planet_type
120   USE lmdz_reprobus_wrappers, ONLY: Init_chem_rep_trac
121   USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_INCA, CPPKEY_REPROBUS, CPPKEY_STRATAER
122   USE dimensions_mod, ONLY: iim, jjm, llm, ndm
123IMPLICIT NONE
124!==============================================================================================================================
125!
126!   Auteur:  P. Le Van /L. Fairhead/F.Hourdin
127!   -------
128!
129!   Modifications:
130!   --------------
131!   05/94: F.Forget      Modif special traceur
132!   02/02: M-A Filiberti Lecture de traceur.def
133!   01/22: D. Cugnet     Nouveaux tracer.def et tracer_*.def + encapsulation (types trac_type et isot_type)
134!
135!   Objet:
136!   ------
137!   GCM LMD nouvelle grille
138!
139!==============================================================================================================================
140!   ... modification de l'integration de q ( 26/04/94 ) ....
141!------------------------------------------------------------------------------------------------------------------------------
142! Declarations:
143
144
145!------------------------------------------------------------------------------------------------------------------------------
146! Local variables
147   INTEGER, ALLOCATABLE :: hadv(:), vadv(:)                          !--- Horizontal/vertical transport scheme number
148   INTEGER, ALLOCATABLE :: had (:), hadv_inca(:), conv_flg_inca(:), &!--- Variables specific to INCA
149                           vad (:), vadv_inca(:),  pbl_flg_inca(:)
150   CHARACTER(LEN=8), ALLOCATABLE :: solsym_inca(:)                   !--- Tracers names for INCA
151   INTEGER :: nqINCA
152   CHARACTER(LEN=2)      ::   suff(9)                                !--- Suffixes for schemes of order 3 or 4 (Prather)
153   CHARACTER(LEN=3)      :: descrq(30)                               !--- Advection scheme description tags
154   CHARACTER(LEN=maxlen) :: msg1, texp, ttp, nam, val                !--- Strings for messages and expanded tracers type
155   INTEGER :: fType                                                  !--- Tracers description file type ; 0: none
156                                                                     !--- 1/2/3: "traceur.def"/"tracer.def"/"tracer_*.def"
157   INTEGER :: nqtrue                                                 !--- Tracers nb from tracer.def (no higher order moments)
158   INTEGER :: iad                                                    !--- Advection scheme number
159   INTEGER :: iq, jq, nt, im, nm, ig                                 !--- Indexes and temporary variables
160   LOGICAL :: lerr
161   TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:)
162   TYPE(trac_type), POINTER             :: t1, t(:)
163   CHARACTER(LEN=maxlen),   ALLOCATABLE :: types_trac(:)             !--- Keywords for tracers type(s), parsed version
164   CHARACTER(LEN=*), PARAMETER :: modname="init_infotrac"
165!------------------------------------------------------------------------------------------------------------------------------
166! Initialization :
167!------------------------------------------------------------------------------------------------------------------------------
168   suff          = ['x ','y ','z ','xx','xy','xz','yy','yz','zz']
169   descrq( 1:30) =  '   '
170   descrq( 1: 2) = ['LMV','BAK']
171   descrq(10:20) = ['VL1','VLP','FH1','FH2','VLH','   ','PPM','PPS','PPP','   ','SLP']
172   descrq(30)    =  'PRA'
173
174   CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
175   IF(strCount(type_trac, '|', nt)) CALL abort_gcm(modname, 'Could''nt parse the "type_trac" string with delimiter "|"', 1)
176   IF(nt >= 3) CALL abort_gcm(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
177   IF(strParse(type_trac, '|', types_trac, n=nt)) CALL abort_gcm(modname, "couldn't parse "//'"type_trac"', 1)
178   IF(nt == 2) type_trac = types_trac(2) ! TO BE DELETED SOON
179
180   CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
181
182!##############################################################################################################################
183   IF(.TRUE.) THEN                                                   !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac  ####
184!##############################################################################################################################
185   !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION
186   msg1 = 'For type_trac = "'//TRIM(type_trac)//'":'
187   SELECT CASE(type_trac)
188      CASE('inca'); CALL msg(TRIM(msg1)//' coupling with INCA chemistry model',        modname)
189      CASE('inco'); CALL msg(TRIM(msg1)//' coupling jointly with INCA and CO2 cycle',  modname)
190      CASE('repr'); CALL msg(TRIM(msg1)//' coupling with REPROBUS chemistry model',    modname)
191      CASE('co2i'); CALL msg(TRIM(msg1)//' you have chosen to run with CO2 cycle',     modname)
192      CASE('coag'); CALL msg(TRIM(msg1)//' tracers are treated for COAGULATION tests', modname)
193      CASE('lmdz'); CALL msg(TRIM(msg1)//' tracers are treated in LMDZ only',          modname)
194      CASE DEFAULT; CALL abort_gcm(modname,'type_trac='//TRIM(type_trac)//' not possible yet.',1)
195   END SELECT
196
197   !--- COHERENCE TEST BETWEEN "type_trac" AND PREPROCESSING KEYS
198   SELECT CASE(type_trac)
199      CASE('inca', 'inco')
200         IF(.NOT.CPPKEY_INCA)     CALL abort_gcm(modname, 'You must add cpp key INCA and compile with INCA code', 1)
201      CASE('repr')
202         IF(.NOT.CPPKEY_REPROBUS) CALL abort_gcm(modname, 'You must add cpp key REPROBUS and compile with REPROBUS code', 1)
203      CASE('coag')
204         IF(.NOT.CPPKEY_STRATAER) CALL abort_gcm(modname, 'You must add cpp key StratAer and compile with StratAer code', 1)
205   END SELECT
206!##############################################################################################################################
207   END IF
208!##############################################################################################################################
209
210!==============================================================================================================================
211! 0) DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE AND READ IT
212!==============================================================================================================================
213   texp = type_trac                                                  !=== EXPANDED (WITH "|" SEPARATOR) "type_trac"
214   IF(texp == 'inco') texp = 'co2i|inca'
215   IF(texp /= 'lmdz') texp = 'lmdz|'//TRIM(texp)
216   IF(testTracersFiles(modname, texp, fType, .TRUE.)) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
217   ttp = type_trac; IF(fType /= 1) ttp = texp
218   !---------------------------------------------------------------------------------------------------------------------------
219   IF(fType == 0) CALL abort_gcm(modname, 'Missing "traceur.def", "tracer.def" or "tracer_<keyword>.def tracers file.',1)
220   !---------------------------------------------------------------------------------------------------------------------------
221   IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac)) &         !=== FOUND OLD STYLE INCA "traceur.def"
222      CALL abort_gcm(modname, 'retro-compatibility with old-style INCA traceur.def files has been disabled.', 1)
223   !---------------------------------------------------------------------------------------------------------------------------
224
225!##############################################################################################################################
226   IF(readTracersFiles(ttp, lRepr=type_trac == 'repr')) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
227!##############################################################################################################################
228
229!==============================================================================================================================
230! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
231!==============================================================================================================================
232   nqtrue = SIZE(tracers)                                                                               !--- "true" tracers
233   nqo    =      COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%name)     == 'H2O')     !--- Water phases
234   nbtr = nqtrue-COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%gen0Name) == 'H2O')     !--- Passed to phytrac
235   nqCO2  =      COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
236   IF(CPPKEY_INCA) &
237   nqINCA =      COUNT(tracers(:)%component == 'inca')
238   IF(CPPKEY_REPROBUS) CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)
239
240!==============================================================================================================================
241! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen).
242!==============================================================================================================================
243   IF(getKey('hadv', hadv, ky=tracers(:)%keys)) CALL abort_gcm(modname, 'missing key "hadv"', 1)
244   IF(getKey('vadv', vadv, ky=tracers(:)%keys)) CALL abort_gcm(modname, 'missing key "vadv"', 1)
245   DO iq = 1, nqtrue
246      IF( hadv(iq)<20 .OR. (ANY(hadv(iq)==[20,30]) .AND. hadv(iq)==vadv(iq)) ) CYCLE
247      WRITE(msg1,'("The choice hadv=",i0,", vadv=",i0,a)')hadv(iq),vadv(iq),' for "'//TRIM(tracers(iq)%name)//'" is not available'
248      CALL abort_gcm(modname, TRIM(msg1), 1)
249   END DO
250   nqtot =    COUNT( hadv< 20 .AND. vadv< 20 ) &                     !--- No additional tracer
251         +  4*COUNT( hadv==20 .AND. vadv==20 ) &                     !--- 3  additional tracers
252         + 10*COUNT( hadv==30 .AND. vadv==30 )                       !--- 9  additional tracers
253
254   !--- More tracers due to the choice of advection scheme => assign total number of tracers
255   IF( nqtot /= nqtrue ) THEN
256      CALL msg('The choice of advection scheme for one or more tracers makes it necessary to add tracers')
257      CALL msg('The number of true tracers is '//TRIM(int2str(nqtrue)))
258      CALL msg('The total number of tracers needed is '//TRIM(int2str(nqtot)))
259   END IF
260
261!==============================================================================================================================
262! 3) Determine the advection scheme choice for water and tracers "iadv" and the fields long name, isAdvected.
263!     iadv = 1    "LMDZ-specific humidity transport" (for H2O vapour)          LMV
264!     iadv = 2    backward                           (for H2O liquid)          BAK
265!     iadv = 14   Van-Leer + specific humidity, modified by Francis Codron     VLH
266!     iadv = 10   Van-Leer (chosen for vapour and liquid water)                VL1
267!     iadv = 11   Van-Leer for hadv and PPM version (Monotonic) for vadv       VLP
268!     iadv = 12   Frederic Hourdin I                                           FH1
269!     iadv = 13   Frederic Hourdin II                                          FH2
270!     iadv = 16   Monotonic         PPM (Collela & Woodward 1984)              PPM
271!     iadv = 17   Semi-monotonic    PPM (overshoots allowed)                   PPS
272!     iadv = 18   Definite positive PPM (overshoots and undershoots allowed)   PPP
273!     iadv = 20   Slopes                                                       SLP
274!     iadv = 30   Prather                                                      PRA
275!
276!        In array q(ij,l,iq) : iq = 1/2[/3]    for vapour/liquid[/ice] water
277!        And optionaly:        iq = 3[4],nqtot for other tracers
278!==============================================================================================================================
279   ALLOCATE(ttr(nqtot))
280   jq = nqtrue+1; tracers(:)%iadv = -1
281   DO iq = 1, nqtrue
282      t1 => tracers(iq)
283
284      !--- VERIFY THE CHOICE OF ADVECTION SCHEME
285      iad = -1
286      IF(hadv(iq)     ==    vadv(iq)    ) iad = hadv(iq)
287      IF(hadv(iq)==10 .AND. vadv(iq)==16) iad = 11
288      WRITE(msg1,'("Bad choice of advection scheme for ",a,": hadv = ",i0,", vadv = ",i0)')TRIM(t1%name), hadv(iq), vadv(iq)
289      IF(iad == -1) CALL abort_gcm(modname, msg1, 1)
290
291      !--- SET FIELDS longName, iadv, isAdvected, isInPhysics
292      t1%longName   = t1%name; IF(iad > 0) t1%longName=TRIM(t1%name)//descrq(iad)
293      t1%iadv       = iad
294      t1%isAdvected = iad >= 0
295      t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz' !=== MORE EXCEPTIONS ? CO2i, SURSAT CLOUD H2O
296      ttr(iq)       = t1
297
298      !--- DEFINE THE HIGHER ORDER TRACERS, IF ANY
299      nm = 0
300      IF(iad == 20) nm = 3                                           !--- 2nd order scheme
301      IF(iad == 30) nm = 9                                           !--- 3rd order scheme
302      IF(nm == 0) CYCLE                                              !--- No higher moments
303      ttr(jq+1:jq+nm)             = t1
304      ttr(jq+1:jq+nm)%name        = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
305      ttr(jq+1:jq+nm)%gen0Name    = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
306      ttr(jq+1:jq+nm)%parent      = [ (TRIM(t1%parent)  //'-'//TRIM(suff(im)), im=1, nm) ]
307      ttr(jq+1:jq+nm)%longName    = [ (TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
308      ttr(jq+1:jq+nm)%iadv        = [ (-iad,    im=1, nm) ]
309      ttr(jq+1:jq+nm)%isAdvected  = [ (.FALSE., im=1, nm) ]
310      jq = jq + nm
311   END DO
312   DEALLOCATE(hadv, vadv)
313   CALL MOVE_ALLOC(FROM=ttr, TO=tracers)
314
315   !--- SET FIELDS iqParent, iqDescen, nqDescen, nqChildren
316   IF(indexUpdate(tracers)) CALL abort_gcm(modname, 'problem with tracers indices update', 1)
317
318   !=== TEST ADVECTION SCHEME
319   DO iq = 1, nqtot ; t1 => tracers(iq)
320      iad = t1%iadv
321      ig  = t1%iGeneration
322      nam = t1%name
323      val = 'iadv='//TRIM(int2str(iad))
324
325      !--- ONLY TESTED VALUES FOR TRACERS FOR NOW:               iadv = 14, 10 (and 0 for non-transported tracers)
326      IF(ALL([10,14,0] /= iad)) CALL abort_gcm(modname, TRIM(val)//' has not been tested yet ; 10 or 14 only are allowed !', 1)
327
328      !--- ONLY TESTED VALUES SO FAR FOR PARENTS HAVING CHILDREN: iadv = 14, 10 (PARENTS: TRACERS OF GENERATION 0)
329      IF(ALL([10,14] /= iad) .AND. ig == 0 .AND. ANY(tracers(:)%parent==nam)) &
330         CALL abort_gcm(modname, TRIM(val)//' is not implemented for parents ; 10 or 14 only are allowed !', 1)
331
332      !--- ONLY TESTED VALUES SO FAR FOR DESCENDANTS (TRACERS OF GENERATION > 0): iadv = 10 ; WATER VAPOUR: iadv = 14
333      lerr = iad /= 10 .AND. ig > 0;                     IF(lerr) tracers(iq)%iadv = 10
334      CALL msg('WARNING! '//TRIM(val)//  ' not implemented for children. Setting iadv=10 for "'//TRIM(nam)//'"', modname, lerr)
335      lerr = iad == 14 .AND. nam /= addPhase('H2O','g'); IF(lerr) tracers(iq)%iadv = 10
336      CALL msg('WARNING! '//TRIM(val)//' is valid for water vapour only. Setting iadv=10 for "'//TRIM(nam)//'"', modname, lerr)
337   END DO
338
339   !=== READ PHYSICAL PARAMETERS FOR ISOTOPES ; DONE HERE BECAUSE dynetat0 AND iniacademic NEED "tnat" AND "alpha_ideal"
340   niso = 0; nzone = 0; nphas = nqo; ntiso = 0; isoCheck = .FALSE.
341   IF(processIsotopes()) CALL abort_gcm(modname, 'problem when processing isotopes parameters', 1)
342
343   !--- Convection / boundary layer activation for all tracers
344   IF(.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
345   IF(.NOT.ALLOCATED( pbl_flg)) ALLOCATE( pbl_flg(nbtr));  pbl_flg(1:nbtr) = 1
346
347   !--- Note: nqtottr can differ from nbtr when nmom/=0
348   nqtottr = nqtot - COUNT(delPhase(tracers%gen0Name) == 'H2O' .AND. tracers%component == 'lmdz')
349   IF(COUNT(tracers%iso_iName == 0) - COUNT(delPhase(tracers%name) == 'H2O' .AND. tracers%component == 'lmdz') /= nqtottr) &
350      CALL abort_gcm(modname, 'problem with the computation of nqtottr', 1)
351
352   !=== DISPLAY THE RESULTS
353   IF(.NOT..TRUE.) RETURN
354   CALL msg('nqo    = '//TRIM(int2str(nqo)),    modname)
355   CALL msg('nbtr   = '//TRIM(int2str(nbtr)),   modname)
356   CALL msg('nqtrue = '//TRIM(int2str(nqtrue)), modname)
357   CALL msg('nqtot  = '//TRIM(int2str(nqtot)),  modname)
358   CALL msg('niso   = '//TRIM(int2str(niso)),   modname)
359   CALL msg('ntiso  = '//TRIM(int2str(ntiso)),  modname)
360   CALL msg('nqCO2  = '//TRIM(int2str(nqCO2)),  modname, CPPKEY_INCA)
361   CALL msg('nqINCA = '//TRIM(int2str(nqINCA)), modname, CPPKEY_INCA)
362   t => tracers
363   CALL msg('Information stored in '//TRIM(modname)//': ', modname)
364   IF(dispTable('isssssssiiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',      &
365                              'iAdv', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],     &
366      cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component),                         &
367      cat([(iq, iq=1, nqtot)], t%iadv, t%iGeneration, t%iqParent, t%nqDescen, t%nqChildren, t%iso_iGroup,  &
368                  t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname))   &
369      CALL abort_gcm(modname, "problem with the tracers table content", 1)
370   CALL msg('No isotopes identified.', modname, nbIso == 0)
371   IF(nbIso == 0) RETURN
372   CALL msg('For isotopes family "H2O":', modname)
373   CALL msg('  isoKeys%name = '//strStack(isoKeys%name), modname)
374   CALL msg('  isoName = '//strStack(isoName),      modname)
375   CALL msg('  isoZone = '//strStack(isoZone),      modname)
376   CALL msg('  isoPhas = '//TRIM(isoPhas),          modname)
377
378END SUBROUTINE init_infotrac
379
380END MODULE infotrac
Note: See TracBrowser for help on using the repository browser.