source: LMDZ6/trunk/libf/phylmd/infotrac_phy.F90 @ 4071

Last change on this file since 4071 was 4071, checked in by dcugnet, 2 years ago
  • Fix for unadvected tracers (iadv==0)
  • The key %isH2Ofamily, from the derived type "trac_type", is replaced with the more general

key %isInPhysics, which is TRUE for tracers both in "qx" and "tr_seri".

Currently, FALSE for tracers descending on H2O (isotopes and tagging tracers included). Could be set to FALSE
for interactive CO2 (type_trac=='inco') or ice supersaturated cloud content (tranfered to "rneb_seri")

File size: 7.3 KB
Line 
1
2! $Id: $
3
4MODULE infotrac_phy
5
6! Infotrac for physics; for now contains the same information as infotrac for
7! the dynamics (could be further cleaned) and is initialized using values
8! provided by the dynamics
9
10  USE readTracFiles_mod, ONLY: trac_type, maxlen, delPhase
11
12! nqtot : total number of tracers and higher order of moment, water vapor and liquid included
13  INTEGER, SAVE :: nqtot
14!$OMP THREADPRIVATE(nqtot)
15
16!CR: on ajoute le nombre de traceurs de l eau
17  INTEGER, SAVE :: nqo
18!$OMP THREADPRIVATE(nqo)
19
20! nbtr : number of tracers not including higher order of moment or water vapor or liquid
21!        number of tracers used in the physics
22  INTEGER, SAVE :: nbtr
23!$OMP THREADPRIVATE(nbtr)
24
25  INTEGER, SAVE :: nqtottr
26!$OMP THREADPRIVATE(nqtottr)
27
28! ThL : number of CO2 tracers   ModThL
29  INTEGER, SAVE :: nqCO2
30!$OMP THREADPRIVATE(nqCO2)
31
32#ifdef CPP_StratAer
33  !=== SPECIFIC TO STRATOSPHERIC AEROSOLS (CK/OB)
34  INTEGER, SAVE ::  nbtr_bin, nbtr_sulgas         !--- number of aerosols bins and sulfur gases for StratAer model
35!$OMP THREADPRIVATE(nbtr_bin, nbtr_sulgas)
36  INTEGER, SAVE ::  id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat
37!$OMP THREADPRIVATE(id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat)
38#endif
39
40! Tracers parameters
41  TYPE(trac_type), TARGET, ALLOCATABLE, SAVE :: tracers(:)
42!$OMP THREADPRIVATE(tracers)
43
44! conv_flg(it)=0 : convection desactivated for tracer number it
45  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE  :: conv_flg
46!$OMP THREADPRIVATE(conv_flg)
47
48! pbl_flg(it)=0  : boundary layer diffusion desactivaded for tracer number it
49  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE  :: pbl_flg
50!$OMP THREADPRIVATE(pbl_flg)
51
52  CHARACTER(len=4),SAVE :: type_trac
53!$OMP THREADPRIVATE(type_trac)
54  CHARACTER(len=8),DIMENSION(:),ALLOCATABLE, SAVE :: solsym
55!$OMP THREADPRIVATE(solsym)
56   
57    ! CRisi: cas particulier des isotopes
58    LOGICAL,SAVE :: ok_isotopes,ok_iso_verif,ok_isotrac,ok_init_iso
59!$OMP THREADPRIVATE(ok_isotopes,ok_iso_verif,ok_isotrac,ok_init_iso)
60    INTEGER :: niso_possibles   
61    PARAMETER ( niso_possibles=5)
62    real, DIMENSION (niso_possibles),SAVE :: tnat,alpha_ideal
63!$OMP THREADPRIVATE(tnat,alpha_ideal)
64    LOGICAL, DIMENSION(niso_possibles),SAVE ::  use_iso
65!$OMP THREADPRIVATE(use_iso)
66    INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE ::  iqiso ! donne indice iq en fn de (ixt,phase)
67!$OMP THREADPRIVATE(iqiso)
68    INTEGER, ALLOCATABLE, DIMENSION(:), SAVE ::  iso_indnum ! donne numéro iso entre 1 et niso effectif en fn de nqtot
69!$OMP THREADPRIVATE(iso_indnum)
70    INTEGER, DIMENSION(niso_possibles), SAVE :: indnum_fn_num ! donne indice entre entre 1 et niso en fonction du numéro d isotope entre 1 et niso_possibles
71!$OMP THREADPRIVATE(indnum_fn_num)
72    INTEGER, ALLOCATABLE, DIMENSION(:,:), SAVE ::  index_trac ! numéro ixt en fn izone, indnum entre 1 et niso
73!$OMP THREADPRIVATE(index_trac)
74    INTEGER,SAVE :: niso,ntraceurs_zone,ntraciso
75!$OMP THREADPRIVATE(niso,ntraceurs_zone,ntraciso)
76
77CONTAINS
78
79  SUBROUTINE init_infotrac_phy(nqtot_,nqo_,nbtr_,nqtottr_,nqCO2_,tracers_,type_trac_,&
80                               conv_flg_,pbl_flg_,solsym_,&
81                               ok_isotopes_,ok_iso_verif_,ok_isotrac_,&
82                               ok_init_iso_,niso_possibles_,tnat_,&
83                               alpha_ideal_,use_iso_,iqiso_,iso_indnum_,&
84                               indnum_fn_num_,index_trac_,&
85                               niso_,ntraceurs_zone_,ntraciso_)
86
87    ! transfer information on tracers from dynamics to physics
88    USE print_control_mod, ONLY: prt_level, lunout
89    IMPLICIT NONE
90
91    INTEGER,INTENT(IN) :: nqtot_
92    INTEGER,INTENT(IN) :: nqo_
93    INTEGER,INTENT(IN) :: nbtr_
94    INTEGER,INTENT(IN) :: nqtottr_
95    INTEGER,INTENT(IN) :: nqCO2_
96    TYPE(trac_type), INTENT(IN) :: tracers_(nqtot_) ! tracers descriptors
97    CHARACTER(len=*),INTENT(IN) :: type_trac_
98    INTEGER,INTENT(IN) :: conv_flg_(nbtr_)
99    INTEGER,INTENT(IN) :: pbl_flg_(nbtr_)
100    CHARACTER(len=*),INTENT(IN) :: solsym_(nbtr_)
101    ! Isotopes:
102    LOGICAL,INTENT(IN) :: ok_isotopes_
103    LOGICAL,INTENT(IN) :: ok_iso_verif_
104    LOGICAL,INTENT(IN) :: ok_isotrac_
105    LOGICAL,INTENT(IN) :: ok_init_iso_
106    INTEGER,INTENT(IN) :: niso_possibles_
107    REAL,INTENT(IN) :: tnat_(niso_possibles_)
108    REAL,INTENT(IN) :: alpha_ideal_(niso_possibles_)
109    LOGICAL,INTENT(IN) :: use_iso_(niso_possibles_)
110    INTEGER,INTENT(IN) :: iqiso_(ntraciso_,nqo_)
111    INTEGER,INTENT(IN) :: iso_indnum_(nqtot_)
112    INTEGER,INTENT(IN) :: indnum_fn_num_(niso_possibles_)
113    INTEGER,INTENT(IN) :: index_trac_(ntraceurs_zone_,niso_)
114    INTEGER,INTENT(IN) :: niso_
115    INTEGER,INTENT(IN) :: ntraceurs_zone_
116    INTEGER,INTENT(IN) :: ntraciso_
117
118    INTEGER :: iq, itr
119    CHARACTER(LEN=maxlen), ALLOCATABLE :: tnames(:)
120    CHARACTER(LEN=maxlen) :: modname="init_infotrac_phy"
121
122    nqtot=nqtot_
123    nqo=nqo_
124    nbtr=nbtr_
125    nqCO2=nqCO2_
126    nqtottr=nqtottr_
127    ALLOCATE(tracers(nqtot)); tracers(:) = tracers_(:)
128#ifdef CPP_StratAer
129    IF (type_trac == 'coag') THEN
130      nbtr_bin    = COUNT([(tracers(iq)%name(1:3)=='BIN', iq=1, nqtot)])
131      nbtr_sulgas = COUNT([(tracers(iq)%name(1:3)=='GAS', iq=1, nqtot)])
132      tnames = PACK(tracers(:)%name, MASK=tracers(:)%isInPhysics)
133      id_BIN01_strat = strIdx(tnames, 'BIN01'   )
134      id_OCS_strat   = strIdx(tnames, 'GASOSC'  )
135      id_SO2_strat   = strIdx(tnames, 'GASSO2'  )
136      id_H2SO4_strat = strIdx(tnames, 'GASH2SO4')
137      id_TEST_strat  = strIdx(tnames, 'GASTEST' )
138      WRITE(lunout,*)'nbtr_bin       =', nbtr_bin
139      WRITE(lunout,*)'nbtr_sulgas    =', nbtr_sulgas
140      WRITE(lunout,*)'id_BIN01_strat =', id_BIN01_strat
141      WRITE(lunout,*)'id_OCS_strat   =',   id_OCS_strat
142      WRITE(lunout,*)'id_SO2_strat   =',   id_SO2_strat
143      WRITE(lunout,*)'id_H2SO4_strat =', id_H2SO4_strat
144      WRITE(lunout,*)'id_TEST_strat  =',  id_TEST_strat
145    END IF
146#endif
147    type_trac = type_trac_
148    ALLOCATE(conv_flg(nbtr))
149    conv_flg(:)=conv_flg_(:)
150    ALLOCATE(pbl_flg(nbtr))
151    pbl_flg(:)=pbl_flg_(:)
152    ALLOCATE(solsym(nbtr))
153    solsym(:)=solsym_(:)
154     
155    IF(prt_level.ge.1) THEN
156      write(lunout,*) TRIM(modname)//": nqtot,nqo,nbtr,nqCO2",nqtot,nqo,nbtr,nqCO2
157    ENDIF
158   
159    ! Isotopes:
160   
161    ! First check that the "niso_possibles" has the correct value
162    IF (niso_possibles.ne.niso_possibles_) THEN
163      CALL abort_physic(modname,&
164           "wrong value for parameter niso_possibles in infotrac_phy",1)
165    ENDIF
166   
167    ok_isotopes=ok_isotopes_
168    ok_iso_verif=ok_iso_verif_
169    ok_isotrac=ok_isotrac_
170    ok_init_iso=ok_init_iso_
171   
172    niso=niso_
173    ntraceurs_zone=ntraceurs_zone_
174    ntraciso=ntraciso_
175   
176    IF (ok_isotopes) THEN
177      tnat(:)=tnat_(:)
178      alpha_ideal(:)=alpha_ideal_(:)
179      use_iso(:)=use_iso_(:)
180   
181      ALLOCATE(iqiso(ntraciso,nqo))
182      iqiso(:,:)=iqiso_(:,:)
183      ALLOCATE(iso_indnum(nqtot))
184      iso_indnum(:)=iso_indnum_(:)
185     
186      indnum_fn_num(:)=indnum_fn_num_(:)
187     
188      ALLOCATE(index_trac(ntraceurs_zone,niso))
189      index_trac(:,:)=index_trac_(:,:)
190    ENDIF ! of IF(ok_isotopes)
191
192    WRITE(*,*) 'infotrac_phy 207: nqtottr=',nqtottr
193    WRITE(*,*) 'ntraciso,niso=',ntraciso,niso
194#ifdef ISOVERIF
195    ! DC: the "1" will be replaced by iH2O (H2O isotopes group index)
196    WRITE(*,*) 'iso_iName=',PACK(tracers(:)%iso_iName, MASK=tracers(:)%iso_iGroup==1)
197#endif
198
199  END SUBROUTINE init_infotrac_phy
200
201END MODULE infotrac_phy
Note: See TracBrowser for help on using the repository browser.