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

Last change on this file since 2987 was 2714, checked in by aslmd, 2 years ago

Print tendencies in diagfi.nc and small correction

File size: 13.9 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 :: genericconddE ! Heat from generic condensation (W.m-2)
118!$OMP THREADPRIVATE(genericconddE)
119
120      real,dimension(:),allocatable,save :: H2Omaxcol ! Maximum possible H2O column amount (at 100% saturation) (kg.m-2).
121!$OMP THREADPRIVATE(H2Omaxcol)
122     
123CONTAINS
124
125!======================================================================
126SUBROUTINE phys_state_var_init(nqtot)
127
128IMPLICIT NONE
129
130        integer,intent(in) :: nqtot
131
132!  Parametres de l'Orographie a l'Echelle Sous-Maille (OESM):
133!
134!zmea(:)   ! orographie moyenne
135!zstd(:)   ! deviation standard de l'OESM
136!zsig(:)   ! pente de l'OESM
137!zgam(:)   ! anisotropie de l'OESM
138!zthe(:)   ! orientation de l'OESM
139!zpic(:)   ! Maximum de l'OESM
140!zval(:)   ! Minimum de l'OESM
141!rugoro(:) ! longueur de rugosite de l'OESM
142
143        ALLOCATE(phisfi(klon))
144        ALLOCATE(tsurf(klon))
145        ALLOCATE(tsoil(klon,nsoilmx))
146        ALLOCATE(albedo(klon,L_NSPECTV))
147        ALLOCATE(albedo_equivalent(klon))
148        ALLOCATE(albedo_equivalent1(klon))
149        ALLOCATE(albedo_snow_SPECTV(L_NSPECTV))
150        ALLOCATE(albedo_co2_ice_SPECTV(L_NSPECTV))
151        ALLOCATE(albedo_bareground(klon))
152        ALLOCATE(rnat(klon))
153        ALLOCATE(emis(klon))
154        ALLOCATE(dtrad(klon,klev))
155        ALLOCATE(fluxrad_sky(klon))
156        ALLOCATE(fluxrad(klon))
157        ALLOCATE(capcal(klon))
158        ALLOCATE(fluxgrd(klon))
159        ALLOCATE(fluxgrdocean(klon))
160        ALLOCATE(qsurf(klon,nqtot))
161        ALLOCATE(q2(klon,klev+1))
162        ALLOCATE(ztprevious(klon,klev))
163        ALLOCATE(zuprevious(klon,klev))
164        ALLOCATE(cloudfrac(klon,klev))
165        ALLOCATE(totcloudfrac(klon))
166        ALLOCATE(hice(klon))
167        ALLOCATE(qsurf_hist(klon,nqtot))
168        ALLOCATE(reffrad(klon,klev,naerkind))
169        ALLOCATE(nueffrad(klon,klev,naerkind))
170        ALLOCATE(ice_initial(klon))
171        ALLOCATE(ice_min(klon))
172        ALLOCATE(fluxsurf_lw(klon))
173        ALLOCATE(fluxsurf_lw1(klon))
174        ALLOCATE(fluxsurf_sw(klon))
175        ALLOCATE(fluxsurf_sw1(klon))
176        ALLOCATE(fluxsurfabs_sw(klon))
177        ALLOCATE(fluxtop_lw(klon))
178        ALLOCATE(fluxtop_lw1(klon))
179        ALLOCATE(fluxabs_sw(klon))
180        ALLOCATE(fluxabs_sw1(klon))
181        ALLOCATE(fluxtop_dn(klon))
182        ALLOCATE(fluxdyn(klon))
183        ALLOCATE(OLR_nu(klon,L_NSPECTI))
184        ALLOCATE(OSR_nu(klon,L_NSPECTV))
185        ALLOCATE(GSR_nu(klon,L_NSPECTV))
186        ALLOCATE(int_dtaui(klon,klev,L_NSPECTI))
187        ALLOCATE(int_dtauv(klon,klev,L_NSPECTV))
188        ALLOCATE(sensibFlux(klon))
189        ALLOCATE(zdtlw(klon,klev))
190        ALLOCATE(zdtsw(klon,klev))
191        ALLOCATE(tau_col(klon))
192        ALLOCATE(pctsrf_sic(klon))
193        ALLOCATE(tslab(klon,noceanmx))
194        ALLOCATE(tsea_ice(klon))
195        ALLOCATE(sea_ice(klon))
196        ALLOCATE(zmasq(klon))
197        ALLOCATE(knindex(klon))
198        ALLOCATE(dEzdiff(klon,klev))
199        ALLOCATE(dEdiff(klon))
200        ALLOCATE(dEdiffs(klon))
201        ALLOCATE(dEzRadsw(klon,klev))
202        ALLOCATE(dEzRadlw(klon,klev))
203        ALLOCATE(madjdE(klon))
204        ALLOCATE(madjdEz(klon,klev))
205        ALLOCATE(lscaledE(klon))
206        ALLOCATE(lscaledEz(klon,klev))
207        ALLOCATE(genericconddE(klon))
208        ALLOCATE(H2Omaxcol(klon))
209        ! This is defined in comsaison_h
210        ALLOCATE(mu0(klon))
211        ALLOCATE(fract(klon))
212         ! This is defined in radcommon_h
213        ALLOCATE(glat(klon))
214        ALLOCATE(albedodat(klon))
215        ALLOCATE(zmea(klon))
216        ALLOCATE(zstd(klon))
217        ALLOCATE(zsig(klon))
218        ALLOCATE(zgam(klon))
219        ALLOCATE(zthe(klon))
220        !allocate(l0(klon))
221        allocate(wstar(klon))
222        allocate(ustar(klon))
223        allocate(tstar(klon))
224        allocate(hfmax_th(klon))
225        allocate(zmax_th(klon))
226        ! allocate arrays in "nonoro_gwd_ran_mod"
227        call ini_nonoro_gwd_ran(klon,klev)
228END SUBROUTINE phys_state_var_init
229
230!======================================================================
231SUBROUTINE phys_state_var_end
232
233IMPLICIT NONE
234
235        DEALLOCATE(tsurf)
236        DEALLOCATE(tsoil)
237        DEALLOCATE(albedo)
238        DEALLOCATE(albedo_equivalent)
239        DEALLOCATE(albedo_equivalent1)
240        DEALLOCATE(albedo_snow_SPECTV)
241        DEALLOCATE(albedo_co2_ice_SPECTV)
242        DEALLOCATE(albedo_bareground)
243        DEALLOCATE(rnat)
244        DEALLOCATE(emis)
245        DEALLOCATE(dtrad)
246        DEALLOCATE(fluxrad_sky)
247        DEALLOCATE(fluxrad)
248        DEALLOCATE(capcal)
249
250        DEALLOCATE(fluxgrd)
251        DEALLOCATE(fluxgrdocean)
252        DEALLOCATE(qsurf)
253        DEALLOCATE(q2)
254        DEALLOCATE(ztprevious)
255        DEALLOCATE(zuprevious)
256        DEALLOCATE(cloudfrac)
257        DEALLOCATE(totcloudfrac)
258        DEALLOCATE(hice)
259        DEALLOCATE(qsurf_hist)
260        DEALLOCATE(reffrad)
261        DEALLOCATE(nueffrad)
262        DEALLOCATE(ice_initial)
263        DEALLOCATE(ice_min)
264        DEALLOCATE(fluxsurf_lw)
265        DEALLOCATE(fluxsurf_lw1)
266        DEALLOCATE(fluxsurf_sw)
267        DEALLOCATE(fluxsurf_sw1)
268        DEALLOCATE(fluxsurfabs_sw)
269        DEALLOCATE(fluxtop_lw)
270        DEALLOCATE(fluxtop_lw1)
271        DEALLOCATE(fluxabs_sw)
272        DEALLOCATE(fluxabs_sw1)
273        DEALLOCATE(fluxtop_dn)
274        DEALLOCATE(fluxdyn)
275        DEALLOCATE(OLR_nu)
276        DEALLOCATE(OSR_nu)
277        DEALLOCATE(GSR_nu)
278        DEALLOCATE(int_dtaui)
279        DEALLOCATE(int_dtauv)
280        DEALLOCATE(sensibFlux)
281        DEALLOCATE(zdtlw)
282        DEALLOCATE(zdtsw)
283        DEALLOCATE(tau_col)
284        DEALLOCATE(pctsrf_sic)
285        DEALLOCATE(tslab)
286        DEALLOCATE(tsea_ice)
287        DEALLOCATE(sea_ice)
288        DEALLOCATE(zmasq)
289        DEALLOCATE(knindex)
290        DEALLOCATE(dEzdiff)
291        DEALLOCATE(dEdiff)
292        DEALLOCATE(dEdiffs)
293        DEALLOCATE(dEzRadsw)
294        DEALLOCATE(dEzRadlw)
295        DEALLOCATE(madjdE)
296        DEALLOCATE(madjdEz)
297        DEALLOCATE(lscaledE)
298        DEALLOCATE(lscaledEz)
299        DEALLOCATE(genericconddE)
300        DEALLOCATE(H2Omaxcol)       
301        DEALLOCATE(mu0)
302        DEALLOCATE(fract)
303        DEALLOCATE(glat)
304        DEALLOCATE(phisfi)
305        DEALLOCATE(albedodat)
306        DEALLOCATE(zmea)
307        DEALLOCATE(zstd)
308        DEALLOCATE(zsig)
309        DEALLOCATE(zgam)
310        DEALLOCATE(zthe)
311        !deallocate(l0)
312        deallocate(wstar)
313        deallocate(ustar)
314        deallocate(tstar)
315        deallocate(hfmax_th)
316        deallocate(zmax_th)
317        ! deallocate arrays in "nonoro_gwd_ran_mod"
318        call end_nonoro_gwd_ran
319
320END SUBROUTINE phys_state_var_end
321
322      END MODULE phys_state_var_mod
Note: See TracBrowser for help on using the repository browser.