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