source: trunk/LMDZ.GENERIC/libf/phystd/phys_state_var_mod.F90 @ 2613

Last change on this file since 2613 was 2550, checked in by emillour, 3 years ago

Generic GCM:
Some OpenMP fixes in routines initracer.F, nonoro_gwd_ran_mod.F90,
phys_state_var_mod.F90 and sugas_corrk.F90
EM

File size: 13.7 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 comsoil_h, only : nsoilmx
13      use comsaison_h, only: mu0, fract
14      use radcommon_h, only: glat
15      use slab_ice_h, only : noceanmx
16      USE radinc_h, only : L_NSPECTI, L_NSPECTV,naerkind
17      use surfdat_h, only: phisfi, albedodat,  &
18                        zmea, zstd, zsig, zgam, zthe
19      use turb_mod, only: q2,sensibFlux,wstar,ustar,tstar,hfmax_th,zmax_th
20      use nonoro_gwd_ran_mod, only: ini_nonoro_gwd_ran, end_nonoro_gwd_ran
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      real, dimension(:),allocatable,save :: albedo_equivalent1     ! Spectral Mean albedo clear sky.
32      real, dimension(:),allocatable,save :: albedo_snow_SPECTV    ! Snow Spectral albedo.
33      real, dimension(:),allocatable,save :: albedo_co2_ice_SPECTV ! CO2 ice Spectral albedo.
34!$OMP THREADPRIVATE(tsurf,tsoil,albedo,albedo_equivalent,albedo_equivalent1,albedo_snow_SPECTV,albedo_co2_ice_SPECTV)
35
36      real,dimension(:),allocatable,save :: albedo_bareground ! Bare Ground Albedo. By MT 2015.
37      real,dimension(:),allocatable,save :: rnat              ! Defines the type of the grid (ocean,continent,...). By BC.
38!$OMP THREADPRIVATE(albedo_bareground,rnat)
39
40      real,dimension(:),allocatable,save :: emis        ! Thermal IR surface emissivity.
41      real,dimension(:,:),allocatable,save :: dtrad     ! Net atmospheric radiative heating rate (K.s-1).
42      real,dimension(:),allocatable,save :: fluxrad_sky ! Radiative flux from sky absorbed by surface (W.m-2).
43      real,dimension(:),allocatable,save :: fluxrad     ! Net radiative surface flux (W.m-2).
44      real,dimension(:),allocatable,save :: capcal      ! Surface heat capacity (J m-2 K-1).
45      real,dimension(:),allocatable,save :: fluxgrd     ! Surface conduction flux (W.m-2).
46      real,dimension(:,:),allocatable,save :: qsurf     ! Tracer on surface (e.g. kg.m-2).
47!$OMP THREADPRIVATE(emis,dtrad,fluxrad_sky,fluxrad,capcal,fluxgrd,qsurf)
48
49      ! FOR DIAGNOSTIC :
50
51      real,dimension(:),allocatable,save :: fluxsurf_lw     ! Incident Long Wave (IR) surface flux (W.m-2).
52      real,dimension(:),allocatable,save :: fluxsurf_lw1     ! Incident Long Wave (IR) surface flux (W.m-2) clear sky.
53      real,dimension(:),allocatable,save :: fluxsurf_sw     ! Incident Short Wave (stellar) surface flux (W.m-2).
54      real,dimension(:),allocatable,save :: fluxsurf_sw1     ! Incident Short Wave (stellar) surface flux (W.m-2) clear sky.
55      real,dimension(:),allocatable,save :: fluxsurfabs_sw  ! Absorbed Short Wave (stellar) flux by the surface (W.m-2).
56!$OMP THREADPRIVATE(fluxsurf_lw,fluxsurf_lw1,fluxsurf_sw,fluxsurf_sw1,fluxsurfabs_sw)
57
58      real,dimension(:),allocatable,save :: fluxtop_lw      ! Outgoing LW (IR) flux to space (W.m-2).
59      real,dimension(:),allocatable,save :: fluxtop_lw1      ! Outgoing LW (IR) flux to space (W.m-2) clear sky.
60      real,dimension(:),allocatable,save :: fluxabs_sw      ! Absorbed SW (stellar) flux (W.m-2).
61      real,dimension(:),allocatable,save :: fluxabs_sw1      ! Absorbed SW (stellar) flux (W.m-2) clear sky.
62      real,dimension(:),allocatable,save :: fluxtop_dn      ! Incoming SW (stellar) radiation at the top of the atmosphere (W.m-2).
63      real,dimension(:),allocatable,save :: fluxdyn         ! Horizontal heat transport by dynamics (W.m-2).
64!$OMP THREADPRIVATE(fluxtop_lw,fluxtop_lw1,fluxabs_sw,fluxabs_sw1,fluxtop_dn,fluxdyn)
65
66      real,dimension(:,:),allocatable,save :: OLR_nu        ! Outgoing LW radiation in each band (Normalized to the band width (W/m2/cm-1)).
67      real,dimension(:,:),allocatable,save :: OSR_nu        ! Outgoing SW radiation in each band (Normalized to the band width (W/m2/cm-1)).
68      real,dimension(:,:),allocatable,save :: GSR_nu        ! Surface SW (or 'Ground' SW) radiation in each band (Normalized to the band width (W/m2/cm-1)).
69      real,dimension(:,:),allocatable,save :: zdtlw         ! LW heating tendencies (K/s).
70      real,dimension(:,:),allocatable,save :: zdtsw         ! SW heating tendencies (K/s).
71      !real,dimension(:),allocatable,save :: sensibFlux      ! Turbulent flux given by the atmosphere to the surface (W.m-2).
72!$OMP THREADPRIVATE(OLR_nu,OSR_nu,GSR_nu,zdtlw,zdtsw)
73
74      real,dimension(:,:,:),allocatable,save :: int_dtauv   ! VI optical thickness of layers within narrowbands for diags ().
75      real,dimension(:,:,:),allocatable,save :: int_dtaui   ! IR optical thickness of layers within narrowbands for diags ().
76!$OMP THREADPRIVATE(int_dtaui,int_dtauv)
77
78      real,allocatable,dimension(:),save :: tau_col ! Total Aerosol Optical Depth.
79      real,allocatable,save :: hice(:) ! Oceanic Ice height. by BC
80!$OMP THREADPRIVATE(tau_col,hice)
81
82      real,allocatable,dimension(:,:),save :: cloudfrac  ! Fraction of clouds (%).
83      real,allocatable,dimension(:),save :: totcloudfrac ! Column fraction of clouds (%).
84!$OMP THREADPRIVATE(cloudfrac,totcloudfrac)
85
86      real,allocatable,dimension(:,:),save :: qsurf_hist
87      real,allocatable,dimension(:,:,:),save :: nueffrad ! Aerosol effective radius variance. By RW
88!$OMP THREADPRIVATE(qsurf_hist,nueffrad)
89
90      real,allocatable,dimension(:),save :: ice_initial
91      real,allocatable,dimension(:),save :: ice_min
92!$OMP THREADPRIVATE(ice_initial,ice_min)
93
94      real,dimension(:),allocatable,save ::  pctsrf_sic
95      real,dimension(:,:),allocatable,save :: tslab        ! Slab_ocean temperature (K)
96      real,dimension(:),allocatable,save ::  tsea_ice      ! Sea ice temperature (K)
97      real,dimension(:),allocatable,save :: sea_ice
98      real,dimension(:),allocatable,save :: zmasq
99      integer,dimension(:),allocatable,save ::knindex
100      real,allocatable,dimension(:,:,:),save :: reffrad
101      real,dimension(:), allocatable,save :: fluxgrdocean  ! Surface conduction flux (W.m-2) with slab_ocean.
102!$OMP THREADPRIVATE(pctsrf_sic,tslab,tsea_ice,sea_ice,zmasq,knindex,reffrad,fluxgrdocean)
103
104      real,dimension(:,:),allocatable,save :: dEzdiff   ! Turbulent diffusion heating (W.m-2)
105      real,dimension(:),allocatable,save :: dEdiff      ! Integrated turbulent diffusion heating (W.m-2)
106      real,dimension(:),allocatable,save :: dEdiffs
107      real,dimension(:,:),allocatable,save :: dEzRadsw  ! Radiative heating (W.m-2)
108      real,dimension(:,:),allocatable,save :: dEzRadlw  ! Radiative heating (W.m-2)
109!$OMP THREADPRIVATE(dEzdiff,dEdiff,dEdiffs,dEzRadsw,dEzRadlw)
110
111      real,dimension(:),allocatable,save :: madjdE      ! Heat from moistadj (W.m-2)
112      real,dimension(:,:),allocatable,save :: madjdEz   ! Heat from moistadj (W.m-2)
113      real,dimension(:),allocatable,save :: lscaledE    ! Heat from largescale (W.m-2)
114      real,dimension(:,:),allocatable,save :: lscaledEz ! Heat from largescale (W.m-2)
115!$OMP THREADPRIVATE(madjdE,madjdEz,lscaledE,lscaledEz)
116     
117      real,dimension(:),allocatable,save :: H2Omaxcol ! Maximum possible H2O column amount (at 100% saturation) (kg.m-2).
118!$OMP THREADPRIVATE(H2Omaxcol)
119     
120CONTAINS
121
122!======================================================================
123SUBROUTINE phys_state_var_init(nqtot)
124
125IMPLICIT NONE
126
127        integer,intent(in) :: nqtot
128
129!  Parametres de l'Orographie a l'Echelle Sous-Maille (OESM):
130!
131!zmea(:)   ! orographie moyenne
132!zstd(:)   ! deviation standard de l'OESM
133!zsig(:)   ! pente de l'OESM
134!zgam(:)   ! anisotropie de l'OESM
135!zthe(:)   ! orientation de l'OESM
136!zpic(:)   ! Maximum de l'OESM
137!zval(:)   ! Minimum de l'OESM
138!rugoro(:) ! longueur de rugosite de l'OESM
139
140        ALLOCATE(phisfi(klon))
141        ALLOCATE(tsurf(klon))
142        ALLOCATE(tsoil(klon,nsoilmx))
143        ALLOCATE(albedo(klon,L_NSPECTV))
144        ALLOCATE(albedo_equivalent(klon))
145        ALLOCATE(albedo_equivalent1(klon))
146        ALLOCATE(albedo_snow_SPECTV(L_NSPECTV))
147        ALLOCATE(albedo_co2_ice_SPECTV(L_NSPECTV))
148        ALLOCATE(albedo_bareground(klon))
149        ALLOCATE(rnat(klon))
150        ALLOCATE(emis(klon))
151        ALLOCATE(dtrad(klon,klev))
152        ALLOCATE(fluxrad_sky(klon))
153        ALLOCATE(fluxrad(klon))
154        ALLOCATE(capcal(klon))
155        ALLOCATE(fluxgrd(klon))
156        ALLOCATE(fluxgrdocean(klon))
157        ALLOCATE(qsurf(klon,nqtot))
158        ALLOCATE(q2(klon,klev+1))
159        ALLOCATE(ztprevious(klon,klev))
160        ALLOCATE(zuprevious(klon,klev))
161        ALLOCATE(cloudfrac(klon,klev))
162        ALLOCATE(totcloudfrac(klon))
163        ALLOCATE(hice(klon))
164        ALLOCATE(qsurf_hist(klon,nqtot))
165        ALLOCATE(reffrad(klon,klev,naerkind))
166        ALLOCATE(nueffrad(klon,klev,naerkind))
167        ALLOCATE(ice_initial(klon))
168        ALLOCATE(ice_min(klon))
169        ALLOCATE(fluxsurf_lw(klon))
170        ALLOCATE(fluxsurf_lw1(klon))
171        ALLOCATE(fluxsurf_sw(klon))
172        ALLOCATE(fluxsurf_sw1(klon))
173        ALLOCATE(fluxsurfabs_sw(klon))
174        ALLOCATE(fluxtop_lw(klon))
175        ALLOCATE(fluxtop_lw1(klon))
176        ALLOCATE(fluxabs_sw(klon))
177        ALLOCATE(fluxabs_sw1(klon))
178        ALLOCATE(fluxtop_dn(klon))
179        ALLOCATE(fluxdyn(klon))
180        ALLOCATE(OLR_nu(klon,L_NSPECTI))
181        ALLOCATE(OSR_nu(klon,L_NSPECTV))
182        ALLOCATE(GSR_nu(klon,L_NSPECTV))
183        ALLOCATE(int_dtaui(klon,klev,L_NSPECTI))
184        ALLOCATE(int_dtauv(klon,klev,L_NSPECTV))
185        ALLOCATE(sensibFlux(klon))
186        ALLOCATE(zdtlw(klon,klev))
187        ALLOCATE(zdtsw(klon,klev))
188        ALLOCATE(tau_col(klon))
189        ALLOCATE(pctsrf_sic(klon))
190        ALLOCATE(tslab(klon,noceanmx))
191        ALLOCATE(tsea_ice(klon))
192        ALLOCATE(sea_ice(klon))
193        ALLOCATE(zmasq(klon))
194        ALLOCATE(knindex(klon))
195        ALLOCATE(dEzdiff(klon,klev))
196        ALLOCATE(dEdiff(klon))
197        ALLOCATE(dEdiffs(klon))
198        ALLOCATE(dEzRadsw(klon,klev))
199        ALLOCATE(dEzRadlw(klon,klev))
200        ALLOCATE(madjdE(klon))
201        ALLOCATE(madjdEz(klon,klev))
202        ALLOCATE(lscaledE(klon))
203        ALLOCATE(lscaledEz(klon,klev))
204        ALLOCATE(H2Omaxcol(klon))
205        ! This is defined in comsaison_h
206        ALLOCATE(mu0(klon))
207        ALLOCATE(fract(klon))
208         ! This is defined in radcommon_h
209        ALLOCATE(glat(klon))
210        ALLOCATE(albedodat(klon))
211        ALLOCATE(zmea(klon))
212        ALLOCATE(zstd(klon))
213        ALLOCATE(zsig(klon))
214        ALLOCATE(zgam(klon))
215        ALLOCATE(zthe(klon))
216        !allocate(l0(klon))
217        allocate(wstar(klon))
218        allocate(ustar(klon))
219        allocate(tstar(klon))
220        allocate(hfmax_th(klon))
221        allocate(zmax_th(klon))
222        ! allocate arrays in "nonoro_gwd_ran_mod"
223        call ini_nonoro_gwd_ran(klon,klev)
224END SUBROUTINE phys_state_var_init
225
226!======================================================================
227SUBROUTINE phys_state_var_end
228
229IMPLICIT NONE
230
231        DEALLOCATE(tsurf)
232        DEALLOCATE(tsoil)
233        DEALLOCATE(albedo)
234        DEALLOCATE(albedo_equivalent)
235        DEALLOCATE(albedo_equivalent1)
236        DEALLOCATE(albedo_snow_SPECTV)
237        DEALLOCATE(albedo_co2_ice_SPECTV)
238        DEALLOCATE(albedo_bareground)
239        DEALLOCATE(rnat)
240        DEALLOCATE(emis)
241        DEALLOCATE(dtrad)
242        DEALLOCATE(fluxrad_sky)
243        DEALLOCATE(fluxrad)
244        DEALLOCATE(capcal)
245
246        DEALLOCATE(fluxgrd)
247        DEALLOCATE(fluxgrdocean)
248        DEALLOCATE(qsurf)
249        DEALLOCATE(q2)
250        DEALLOCATE(ztprevious)
251        DEALLOCATE(zuprevious)
252        DEALLOCATE(cloudfrac)
253        DEALLOCATE(totcloudfrac)
254        DEALLOCATE(hice)
255        DEALLOCATE(qsurf_hist)
256        DEALLOCATE(reffrad)
257        DEALLOCATE(nueffrad)
258        DEALLOCATE(ice_initial)
259        DEALLOCATE(ice_min)
260        DEALLOCATE(fluxsurf_lw)
261        DEALLOCATE(fluxsurf_lw1)
262        DEALLOCATE(fluxsurf_sw)
263        DEALLOCATE(fluxsurf_sw1)
264        DEALLOCATE(fluxsurfabs_sw)
265        DEALLOCATE(fluxtop_lw)
266        DEALLOCATE(fluxtop_lw1)
267        DEALLOCATE(fluxabs_sw)
268        DEALLOCATE(fluxabs_sw1)
269        DEALLOCATE(fluxtop_dn)
270        DEALLOCATE(fluxdyn)
271        DEALLOCATE(OLR_nu)
272        DEALLOCATE(OSR_nu)
273        DEALLOCATE(GSR_nu)
274        DEALLOCATE(int_dtaui)
275        DEALLOCATE(int_dtauv)
276        DEALLOCATE(sensibFlux)
277        DEALLOCATE(zdtlw)
278        DEALLOCATE(zdtsw)
279        DEALLOCATE(tau_col)
280        DEALLOCATE(pctsrf_sic)
281        DEALLOCATE(tslab)
282        DEALLOCATE(tsea_ice)
283        DEALLOCATE(sea_ice)
284        DEALLOCATE(zmasq)
285        DEALLOCATE(knindex)
286        DEALLOCATE(dEzdiff)
287        DEALLOCATE(dEdiff)
288        DEALLOCATE(dEdiffs)
289        DEALLOCATE(dEzRadsw)
290        DEALLOCATE(dEzRadlw)
291        DEALLOCATE(madjdE)
292        DEALLOCATE(madjdEz)
293        DEALLOCATE(lscaledE)
294        DEALLOCATE(lscaledEz)
295        DEALLOCATE(H2Omaxcol)       
296        DEALLOCATE(mu0)
297        DEALLOCATE(fract)
298        DEALLOCATE(glat)
299        DEALLOCATE(phisfi)
300        DEALLOCATE(albedodat)
301        DEALLOCATE(zmea)
302        DEALLOCATE(zstd)
303        DEALLOCATE(zsig)
304        DEALLOCATE(zgam)
305        DEALLOCATE(zthe)
306        !deallocate(l0)
307        deallocate(wstar)
308        deallocate(ustar)
309        deallocate(tstar)
310        deallocate(hfmax_th)
311        deallocate(zmax_th)
312        ! deallocate arrays in "nonoro_gwd_ran_mod"
313        call end_nonoro_gwd_ran
314
315END SUBROUTINE phys_state_var_end
316
317      END MODULE phys_state_var_mod
Note: See TracBrowser for help on using the repository browser.