source: LMDZ6/trunk/libf/dyn3d_common/infotrac.F90 @ 5227

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