Changeset 4389 for LMDZ6/trunk/libf/dyn3d_common
- Timestamp:
- Jan 23, 2023, 11:28:51 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3d_common/infotrac.F90
r4358 r4389 4 4 5 5 USE strings_mod, ONLY: msg, fmsg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse 6 USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers, setGeneration, itZonIso, n bIso, tran0, delPhase, &7 getKey, isot_type, readIsotopesFile, isotope, maxTableWidth, iqIsoPha, ntiso, ixIso, addPhase, &8 indexUpdate, isoSelect, isoPhas, isoZone, isoName, isoKeys, iH2O, isoCheck, nphas, nzone, niso6 USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers, setGeneration, itZonIso, nzone, tran0, isoZone, & 7 delPhase, niso, getKey, isot_type, readIsotopesFile, isotope, maxTableWidth, iqIsoPha, nphas, ixIso, isoPhas, & 8 addPhase, iH2O, nbIso, isoSelect, testTracersFiles, isoKeys, indexUpdate, isoCheck, nzone, ntiso, isoName 9 9 IMPLICIT NONE 10 10 … … 13 13 !=== FOR TRACERS: 14 14 PUBLIC :: init_infotrac !--- Initialization of the tracers 15 PUBLIC :: tracers, type_trac , types_trac!--- Full tracers database, tracers type keyword15 PUBLIC :: tracers, type_trac !--- Full tracers database, tracers type keyword 16 16 PUBLIC :: nqtot, nbtr, nqo, nqCO2, nqtottr !--- Main dimensions 17 17 PUBLIC :: conv_flg, pbl_flg !--- Convection & boundary layer activation keys … … 104 104 nqtottr, & !--- Number of tracers passed to phytrac (TO BE DELETED ?) 105 105 nqCO2 !--- Number of tracers of CO2 (ThL) 106 CHARACTER(LEN=maxlen), SAVE :: type_trac !--- Keyword for tracers type(s) 107 CHARACTER(LEN=maxlen), SAVE, ALLOCATABLE :: types_trac(:) !--- Keyword for tracers type(s), parsed version 106 CHARACTER(LEN=maxlen), SAVE :: type_trac !--- Keyword for tracers type 108 107 109 108 !=== VARIABLES FOR INCA … … 152 151 CHARACTER(LEN=2) :: suff(9) !--- Suffixes for schemes of order 3 or 4 (Prather) 153 152 CHARACTER(LEN=3) :: descrq(30) !--- Advection scheme description tags 154 CHARACTER(LEN=maxlen) :: msg1 !--- String for messages153 CHARACTER(LEN=maxlen) :: msg1, texp, ttp !--- Strings for messages and expanded tracers type 155 154 INTEGER :: fType !--- Tracers description file type ; 0: none 156 155 !--- 1/2/3: "traceur.def"/"tracer.def"/"tracer_*.def" … … 158 157 INTEGER :: iad !--- Advection scheme number 159 158 INTEGER :: ic, iq, jq, it, nt, im, nm, iz, k !--- Indexes and temporary variables 160 LOGICAL :: lerr, ll , lRepr159 LOGICAL :: lerr, ll 161 160 CHARACTER(LEN=1) :: p 162 161 TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:) … … 174 173 175 174 CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname) 176 IF(strParse(type_trac, '|', types_trac, n=nt)) CALL abort_gcm(modname,'can''t parse "type_trac = '//TRIM(type_trac)//'"',1) 177 178 !--------------------------------------------------------------------------------------------------------------------------- 179 DO it = 1, nt !--- nt>1=> "type_trac": coma-separated keywords list 180 !--------------------------------------------------------------------------------------------------------------------------- 181 !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION 182 msg1 = 'For type_trac = "'//TRIM(types_trac(it))//'":' 183 SELECT CASE(types_trac(it)) 184 CASE('inca'); CALL msg(TRIM(msg1)//' coupling with INCA chemistry model', modname) 185 CASE('inco'); CALL msg(TRIM(msg1)//' coupling jointly with INCA and CO2 cycle', modname) 186 CASE('repr'); CALL msg(TRIM(msg1)//' coupling with REPROBUS chemistry model', modname) 187 CASE('co2i'); CALL msg(TRIM(msg1)//' you have chosen to run with CO2 cycle', modname) 188 CASE('coag'); CALL msg(TRIM(msg1)//' tracers are treated for COAGULATION tests', modname) 189 CASE('lmdz'); CALL msg(TRIM(msg1)//' tracers are treated in LMDZ only', modname) 190 CASE DEFAULT; CALL abort_gcm(modname,'type_trac='//TRIM(types_trac(it))//' not possible yet.',1) 191 END SELECT 192 193 !--- COHERENCE TEST BETWEEN "type_trac" AND PREPROCESSING KEYS 194 SELECT CASE(types_trac(it)) 195 CASE('inca', 'inco') 175 176 !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION 177 msg1 = 'For type_trac = "'//TRIM(type_trac)//'":' 178 SELECT CASE(type_trac) 179 CASE('inca'); CALL msg(TRIM(msg1)//' coupling with INCA chemistry model', modname) 180 CASE('inco'); CALL msg(TRIM(msg1)//' coupling jointly with INCA and CO2 cycle', modname) 181 CASE('repr'); CALL msg(TRIM(msg1)//' coupling with REPROBUS chemistry model', modname) 182 CASE('co2i'); CALL msg(TRIM(msg1)//' you have chosen to run with CO2 cycle', modname) 183 CASE('coag'); CALL msg(TRIM(msg1)//' tracers are treated for COAGULATION tests', modname) 184 CASE('lmdz'); CALL msg(TRIM(msg1)//' tracers are treated in LMDZ only', modname) 185 CASE DEFAULT; CALL abort_gcm(modname,'type_trac='//TRIM(type_trac)//' not possible yet.',1) 186 END SELECT 187 188 !--- COHERENCE TEST BETWEEN "type_trac" AND PREPROCESSING KEYS 189 SELECT CASE(type_trac) 190 CASE('inca', 'inco') 196 191 #ifndef INCA 197 198 #endif 199 192 CALL abort_gcm(modname, 'You must add cpp key INCA and compile with INCA code', 1) 193 #endif 194 CASE('repr') 200 195 #ifndef REPROBUS 201 202 #endif 203 196 CALL abort_gcm(modname, 'You must add cpp key REPROBUS and compile with REPROBUS code', 1) 197 #endif 198 CASE('coag') 204 199 #ifndef CPP_StratAer 205 CALL abort_gcm(modname, 'You must add cpp key StratAer and compile with StratAer code', 1) 206 #endif 207 END SELECT 208 209 !--------------------------------------------------------------------------------------------------------------------------- 210 END DO 211 !--------------------------------------------------------------------------------------------------------------------------- 212 213 nqCO2 = COUNT( [ANY(types_trac == 'inco') .OR. (ANY(types_trac == 'co2i') .AND. ANY(types_trac == 'inca'))] ) 200 CALL abort_gcm(modname, 'You must add cpp key StratAer and compile with StratAer code', 1) 201 #endif 202 END SELECT 203 204 nqCO2 = COUNT( [type_trac == 'inco', type_trac == 'co2i'] ) 214 205 215 206 !============================================================================================================================== 216 207 ! 1) Get the numbers of: true (first order only) tracers "nqtrue", water tracers "nqo" (vapor/liquid/solid) 217 208 !============================================================================================================================== 218 lRepr = ANY(types_trac(:) == 'repr') 219 IF(readTracersFiles(type_trac, fType, lRepr)) CALL abort_gcm(modname, 'problem with tracers file(s)',1) 209 texp = type_trac !=== EXPANDED VERSION OF "type_trac", WITH "|" SEPARATOR 210 IF(texp == 'inco') texp = 'co2i|inca' 211 IF(texp /= 'lmdz') texp = 'lmdz|'//TRIM(texp) 212 213 !=== DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE 214 IF(testTracersFiles(modname, texp, fType, .TRUE.)) CALL abort_gcm(modname, 'problem with tracers file(s)',1) 215 ttp = type_trac; IF(fType /= 1) ttp = texp 216 217 IF(readTracersFiles(ttp, type_trac == 'repr')) CALL abort_gcm(modname, 'problem with tracers file(s)',1) 220 218 !--------------------------------------------------------------------------------------------------------------------------- 221 219 IF(fType == 0) CALL abort_gcm(modname, 'Missing tracers file: "traceur.def", "tracer.def" or "tracer_<keyword>.def file.',1) 222 220 !--------------------------------------------------------------------------------------------------------------------------- 223 IF(fType == 1 .AND. ANY(['inca','inco'] == type_trac)) THEN !=== FOUND OLD STYLE INCA "traceur.def" (single type_trac)221 IF(fType == 1 .AND. ANY(['inca','inco']==type_trac)) THEN !=== FOUND OLD STYLE INCA "traceur.def" 224 222 !--------------------------------------------------------------------------------------------------------------------------- 225 223 #ifdef INCA … … 233 231 CALL init_transport(solsym_inca, conv_flg_inca, pbl_flg_inca, hadv_inca, vadv_inca) 234 232 ALLOCATE(ttr(nqtrue)) 235 ttr(1:nqo+nqCO2) 236 ttr(1 : nqo )%component 237 ttr(1+nqo:nqCO2+nqo )%component 238 ttr(1+nqo+nqCO2:nqtrue)%component 239 ttr(1+nqo :nqtrue)%name 240 ttr(1+nqo+nqCO2:nqtrue)%parent 241 ttr(1+nqo+nqCO2:nqtrue)%phase 233 ttr(1:nqo+nqCO2) = tracers 234 ttr(1 : nqo )%component = 'lmdz' 235 ttr(1+nqo:nqCO2+nqo )%component = 'co2i' 236 ttr(1+nqo+nqCO2:nqtrue)%component = 'inca' 237 ttr(1+nqo :nqtrue)%name = [('CO2 ', k=1, nqCO2), solsym_inca] 238 ttr(1+nqo+nqCO2:nqtrue)%parent = tran0 239 ttr(1+nqo+nqCO2:nqtrue)%phase = 'g' 242 240 lerr = getKey('hadv', had, ky=tracers(:)%keys) 243 241 lerr = getKey('vadv', vad, ky=tracers(:)%keys) 244 hadv(1:nqo ) = had(:); hadv(nqo+1:nqtrue) = hadv_inca245 vadv(1:nqo ) = vad(:); vadv(nqo+1:nqtrue) = vadv_inca242 hadv(1:nqo+nqCO2) = had(:); hadv(1+nqo+nqCO2:nqtrue) = hadv_inca 243 vadv(1:nqo+nqCO2) = vad(:); vadv(1+nqo+nqCO2:nqtrue) = vadv_inca 246 244 CALL MOVE_ALLOC(FROM=ttr, TO=tracers) 247 CALL setGeneration(tracers) !--- SET FIELDS %iGeneration, %gen0Name245 IF(setGeneration(tracers)) CALL abort_gcm(modname,'See above',1) !- SET FIELDS %iGeneration, %gen0Name 248 246 DEALLOCATE(had, hadv_inca, vad, vadv_inca, conv_flg_inca, pbl_flg_inca, solsym_inca) 249 247 #endif
Note: See TracChangeset
for help on using the changeset viewer.