source: trunk/LMDZ.TITAN/libf/phytitan/phys_state_var_mod.F90 @ 3026

Last change on this file since 3026 was 2793, checked in by emillour, 2 years ago

Titan physics:
Fix some OpenMP typos and inconsistencies spoted when compiling (even without OpenMP) on Irene.
Some further run-time checking in debug mode might be needed to ensure everything is indeed OK for OpenMP.
EM

File size: 8.5 KB
Line 
1!
2! $Id: phys_state_var_mod.F90 1670 2012-10-17 08:42:04Z idelkadi $
3!
4      MODULE phys_state_var_mod
5! Variables sauvegardees pour le startphy.nc
6!======================================================================
7!
8!
9!======================================================================
10! Declaration des variables
11      USE dimphy, only : klon,klev
12      use comchem_h, only: nkim
13      USE callkeys_mod, only: callchim
14      USE comsoil_h, only : nsoilmx
15      use comsaison_h, only: mu0, fract
16      use radcommon_h, only: gzlat, gzlat_ig, Cmk
17      USE radinc_h, only : L_NSPECTI, L_NSPECTV,naerkind
18      use surfdat_h, only: phisfi, albedodat,  &
19                        zmea, zstd, zsig, zgam, zthe
20      use turb_mod, only: q2,sensibFlux,wstar,ustar,tstar,hfmax_th,zmax_th
21
22      real,allocatable,dimension(:,:),save :: ztprevious ! Previous loop Atmospheric Temperature (K)
23! Useful for Dynamical Heating calculation.
24      real,allocatable,dimension(:,:),save :: zuprevious
25!$OMP THREADPRIVATE(ztprevious,zuprevious)
26
27      real, dimension(:),allocatable,save ::  tsurf                ! Surface temperature (K).
28      real, dimension(:,:),allocatable,save ::  tsoil              ! Sub-surface temperatures (K).
29      real, dimension(:,:),allocatable,save :: albedo              ! Surface Spectral albedo. By MT2015.
30      real, dimension(:),allocatable,save :: albedo_equivalent     ! Spectral Mean albedo.
31
32!$OMP THREADPRIVATE(tsurf,tsoil,albedo,albedo_equivalent)
33
34      real,dimension(:),allocatable,save :: albedo_bareground ! Bare Ground Albedo. By MT 2015.
35
36!$OMP THREADPRIVATE(albedo_bareground)
37
38       real, dimension(:), allocatable, save       :: tankCH4    ! Depth of surface methane tank (m)
39!$OMP THREADPRIVATE(tankCH4)
40
41      real,dimension(:),allocatable,save :: emis        ! Thermal IR surface emissivity.
42      real,dimension(:,:),allocatable,save :: dtrad     ! Net atmospheric radiative heating rate (K.s-1).
43      real,dimension(:),allocatable,save :: fluxrad_sky ! Radiative flux from sky absorbed by surface (W.m-2).
44      real,dimension(:),allocatable,save :: fluxrad     ! Net radiative surface flux (W.m-2).
45      real,dimension(:),allocatable,save :: capcal      ! Surface heat capacity (J m-2 K-1).
46      real,dimension(:),allocatable,save :: fluxgrd     ! Surface conduction flux (W.m-2).
47      real,dimension(:,:),allocatable,save :: qsurf     ! Tracer on surface (e.g. kg.m-2).
48!$OMP THREADPRIVATE(emis,dtrad,fluxrad_sky,fluxrad,capcal,fluxgrd,qsurf)
49
50      ! FOR DIAGNOSTIC :
51
52      real,dimension(:),allocatable,save :: fluxsurf_lw     ! Incident Long Wave (IR) surface flux (W.m-2).
53      real,dimension(:),allocatable,save :: fluxsurf_sw     ! Incident Short Wave (stellar) surface flux (W.m-2).
54      real,dimension(:),allocatable,save :: fluxsurfabs_sw  ! Absorbed Short Wave (stellar) flux by the surface (W.m-2).
55!$OMP THREADPRIVATE(fluxsurf_lw,fluxsurf_sw,fluxsurfabs_sw)
56
57      real,dimension(:),allocatable,save :: fluxtop_lw      ! Outgoing LW (IR) flux to space (W.m-2).
58      real,dimension(:),allocatable,save :: fluxabs_sw      ! Absorbed SW (stellar) flux (W.m-2).
59      real,dimension(:),allocatable,save :: fluxtop_dn      ! Incoming SW (stellar) radiation at the top of the atmosphere (W.m-2).
60      real,dimension(:),allocatable,save :: fluxdyn         ! Horizontal heat transport by dynamics (W.m-2).
61!$OMP THREADPRIVATE(fluxtop_lw,fluxabs_sw,fluxtop_dn,fluxdyn)
62
63      real,dimension(:,:),allocatable,save :: OLR_nu        ! Outgoing LW radiation in each band (Normalized to the band width (W/m2/cm-1)).
64      real,dimension(:,:),allocatable,save :: OSR_nu        ! Outgoing SW radiation in each band (Normalized to the band width (W/m2/cm-1)).
65      real,dimension(:,:),allocatable,save :: zdtlw         ! LW heating tendencies (K/s).
66      real,dimension(:,:),allocatable,save :: zdtsw         ! SW heating tendencies (K/s).
67      !real,dimension(:),allocatable,save :: sensibFlux      ! Turbulent flux given by the atmosphere to the surface (W.m-2).
68!$OMP THREADPRIVATE(OLR_nu,OSR_nu,zdtlw,zdtsw)
69
70      real,dimension(:,:,:),allocatable,save :: int_dtauv   ! VI optical thickness of layers within narrowbands for diags ().
71      real,dimension(:,:,:),allocatable,save :: int_dtaui   ! IR optical thickness of layers within narrowbands for diags ().
72!$OMP THREADPRIVATE(int_dtaui,int_dtauv)
73
74      real,allocatable,dimension(:,:),save :: qsurf_hist
75!$OMP THREADPRIVATE(qsurf_hist)
76
77      ! For chemistry
78      real, dimension(:,:,:), allocatable, save   :: dycchi  ! NB : Only for chem tracers. Saved since chemistry is not called every step.
79!$OMP THREADPRIVATE(dycchi)
80 
81CONTAINS
82
83!======================================================================
84SUBROUTINE phys_state_var_init(nqtot)
85
86IMPLICIT NONE
87
88        integer,intent(in) :: nqtot
89
90!  Parametres de l'Orographie a l'Echelle Sous-Maille (OESM):
91!
92!zmea(:)   ! orographie moyenne
93!zstd(:)   ! deviation standard de l'OESM
94!zsig(:)   ! pente de l'OESM
95!zgam(:)   ! anisotropie de l'OESM
96!zthe(:)   ! orientation de l'OESM
97!zpic(:)   ! Maximum de l'OESM
98!zval(:)   ! Minimum de l'OESM
99!rugoro(:) ! longueur de rugosite de l'OESM
100        print*,'klon',klon,'klev',klev
101        ALLOCATE(tsurf(klon))
102        ALLOCATE(tsoil(klon,nsoilmx))
103        ALLOCATE(albedo(klon,L_NSPECTV))
104        ALLOCATE(albedo_equivalent(klon))
105        ALLOCATE(albedo_bareground(klon))
106        ALLOCATE(emis(klon))
107        ALLOCATE(dtrad(klon,klev))
108        ALLOCATE(fluxrad_sky(klon))
109        ALLOCATE(fluxrad(klon))
110        ALLOCATE(capcal(klon))
111        ALLOCATE(fluxgrd(klon))
112        ALLOCATE(qsurf(klon,nqtot))
113        ALLOCATE(q2(klon,klev+1))
114        ALLOCATE(tankCH4(klon))
115        ALLOCATE(ztprevious(klon,klev))
116        ALLOCATE(zuprevious(klon,klev))
117        ALLOCATE(qsurf_hist(klon,nqtot))
118        ALLOCATE(fluxsurf_lw(klon))
119        ALLOCATE(fluxsurf_sw(klon))
120        ALLOCATE(fluxsurfabs_sw(klon))
121        ALLOCATE(fluxtop_lw(klon))
122        ALLOCATE(fluxabs_sw(klon))
123        ALLOCATE(fluxtop_dn(klon))
124        ALLOCATE(fluxdyn(klon))
125        ALLOCATE(OLR_nu(klon,L_NSPECTI))
126        ALLOCATE(OSR_nu(klon,L_NSPECTV))
127        ALLOCATE(sensibFlux(klon))
128        ALLOCATE(zdtlw(klon,klev))
129        ALLOCATE(zdtsw(klon,klev))
130        ALLOCATE(int_dtaui(klon,klev,L_NSPECTI))
131        ALLOCATE(int_dtauv(klon,klev,L_NSPECTV))
132        allocate(dycchi(klon,klev,nkim))
133        ! This is defined in comsaison_h
134        ALLOCATE(mu0(klon))
135        ALLOCATE(fract(klon))
136         ! This is defined in radcommon_h
137        ALLOCATE(gzlat(klon,klev))
138        ALLOCATE(gzlat_ig(klev))
139        ALLOCATE(Cmk(klev))
140        ! This is defined in surfdat_h
141        ALLOCATE(albedodat(klon))
142        ALLOCATE(phisfi(klon))
143        ALLOCATE(zmea(klon))
144        ALLOCATE(zstd(klon))
145        ALLOCATE(zsig(klon))
146        ALLOCATE(zgam(klon))
147        ALLOCATE(zthe(klon))
148        ! This is defined in turb_mod
149        allocate(wstar(klon))
150        allocate(ustar(klon))
151        allocate(tstar(klon))
152        allocate(hfmax_th(klon))
153        allocate(zmax_th(klon))
154
155END SUBROUTINE phys_state_var_init
156
157!======================================================================
158SUBROUTINE phys_state_var_end
159
160IMPLICIT NONE
161
162        DEALLOCATE(tsurf)
163        DEALLOCATE(tsoil)
164        DEALLOCATE(albedo)
165        DEALLOCATE(albedo_equivalent)
166        DEALLOCATE(albedo_bareground)
167        DEALLOCATE(emis)
168        DEALLOCATE(dtrad)
169        DEALLOCATE(fluxrad_sky)
170        DEALLOCATE(fluxrad)
171        DEALLOCATE(capcal)
172        DEALLOCATE(fluxgrd)
173        DEALLOCATE(qsurf)
174        DEALLOCATE(q2)
175        DEALLOCATE(tankCH4)
176        DEALLOCATE(ztprevious)
177        DEALLOCATE(zuprevious)
178        DEALLOCATE(qsurf_hist)
179        DEALLOCATE(fluxsurf_lw)
180        DEALLOCATE(fluxsurf_sw)
181        DEALLOCATE(fluxsurfabs_sw)
182        DEALLOCATE(fluxtop_lw)
183        DEALLOCATE(fluxabs_sw)
184        DEALLOCATE(fluxtop_dn)
185        DEALLOCATE(fluxdyn)
186        DEALLOCATE(OLR_nu)
187        DEALLOCATE(OSR_nu)
188        DEALLOCATE(sensibFlux)
189        DEALLOCATE(zdtlw)
190        DEALLOCATE(zdtsw)
191        DEALLOCATE(int_dtaui)
192        DEALLOCATE(int_dtauv)
193        DEALLOCATE(dycchi)
194        DEALLOCATE(mu0)
195        DEALLOCATE(fract)
196        DEALLOCATE(gzlat)
197        DEALLOCATE(gzlat_ig)
198        DEALLOCATE(Cmk)
199        DEALLOCATE(phisfi)
200        DEALLOCATE(albedodat)
201        DEALLOCATE(zmea)
202        DEALLOCATE(zstd)
203        DEALLOCATE(zsig)
204        DEALLOCATE(zgam)
205        DEALLOCATE(zthe)
206        deallocate(wstar)
207        deallocate(ustar)
208        deallocate(tstar)
209        deallocate(hfmax_th)
210        deallocate(zmax_th)
211
212
213END SUBROUTINE phys_state_var_end
214
215      END MODULE phys_state_var_mod
Note: See TracBrowser for help on using the repository browser.