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

Last change on this file since 2176 was 2133, checked in by jvatant, 6 years ago

Fic a bug in r2131 the writediagfi cannot be called
in RT routines because of the iradia it goes crazy with outputs freq ...
--JVO

File size: 10.4 KB
RevLine 
[1835]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
[1883]19      use turb_mod, only: q2,sensibFlux,wstar,ustar,tstar,hfmax_th,zmax_th
20
[1835]21      real,allocatable,dimension(:,:),save :: ztprevious ! Previous loop Atmospheric Temperature (K)
22! Useful for Dynamical Heating calculation.
23      real,allocatable,dimension(:,:),save :: zuprevious
[1883]24!$OMP THREADPRIVATE(ztprevious,zuprevious)
25
[1835]26      real, dimension(:),allocatable,save ::  tsurf                ! Surface temperature (K).
27      real, dimension(:,:),allocatable,save ::  tsoil              ! Sub-surface temperatures (K).
28      real, dimension(:,:),allocatable,save :: albedo              ! Surface Spectral albedo. By MT2015.
29      real, dimension(:),allocatable,save :: albedo_equivalent     ! Spectral Mean albedo.
30      real, dimension(:),allocatable,save :: albedo_snow_SPECTV    ! Snow Spectral albedo.
31      real, dimension(:),allocatable,save :: albedo_co2_ice_SPECTV ! CO2 ice Spectral albedo.
32!$OMP THREADPRIVATE(tsurf,tsoil,albedo,albedo_equivalent,albedo_snow_SPECTV,albedo_co2_ice_SPECTV)
33
34      real,dimension(:),allocatable,save :: albedo_bareground ! Bare Ground Albedo. By MT 2015.
35      real,dimension(:),allocatable,save :: rnat              ! Defines the type of the grid (ocean,continent,...). By BC.
36!$OMP THREADPRIVATE(albedo_bareground,rnat)
37
38      real,dimension(:),allocatable,save :: emis        ! Thermal IR surface emissivity.
39      real,dimension(:,:),allocatable,save :: dtrad     ! Net atmospheric radiative heating rate (K.s-1).
40      real,dimension(:),allocatable,save :: fluxrad_sky ! Radiative flux from sky absorbed by surface (W.m-2).
41      real,dimension(:),allocatable,save :: fluxrad     ! Net radiative surface flux (W.m-2).
42      real,dimension(:),allocatable,save :: capcal      ! Surface heat capacity (J m-2 K-1).
43      real,dimension(:),allocatable,save :: fluxgrd     ! Surface conduction flux (W.m-2).
44      real,dimension(:,:),allocatable,save :: qsurf     ! Tracer on surface (e.g. kg.m-2).
[1883]45!$OMP THREADPRIVATE(emis,dtrad,fluxrad_sky,fluxrad,capcal,fluxgrd,qsurf)
[1835]46
47      ! FOR DIAGNOSTIC :
48
49      real,dimension(:),allocatable,save :: fluxsurf_lw     ! Incident Long Wave (IR) surface flux (W.m-2).
50      real,dimension(:),allocatable,save :: fluxsurf_sw     ! Incident Short Wave (stellar) surface flux (W.m-2).
51      real,dimension(:),allocatable,save :: fluxsurfabs_sw  ! Absorbed Short Wave (stellar) flux by the surface (W.m-2).
[1883]52!$OMP THREADPRIVATE(fluxsurf_lw,fluxsurf_sw,fluxsurfabs_sw)
53
[1835]54      real,dimension(:),allocatable,save :: fluxtop_lw      ! Outgoing LW (IR) flux to space (W.m-2).
55      real,dimension(:),allocatable,save :: fluxabs_sw      ! Absorbed SW (stellar) flux (W.m-2).
56      real,dimension(:),allocatable,save :: fluxtop_dn      ! Incoming SW (stellar) radiation at the top of the atmosphere (W.m-2).
57      real,dimension(:),allocatable,save :: fluxdyn         ! Horizontal heat transport by dynamics (W.m-2).
[1883]58!$OMP THREADPRIVATE(fluxtop_lw,fluxabs_sw,fluxtop_dn,fluxdyn)
59
[1835]60      real,dimension(:,:),allocatable,save :: OLR_nu        ! Outgoing LW radiation in each band (Normalized to the band width (W/m2/cm-1)).
61      real,dimension(:,:),allocatable,save :: OSR_nu        ! Outgoing SW radiation in each band (Normalized to the band width (W/m2/cm-1)).
62      real,dimension(:,:),allocatable,save :: zdtlw         ! LW heating tendencies (K/s).
63      real,dimension(:,:),allocatable,save :: zdtsw         ! SW heating tendencies (K/s).
64      !real,dimension(:),allocatable,save :: sensibFlux      ! Turbulent flux given by the atmosphere to the surface (W.m-2).
[1883]65!$OMP THREADPRIVATE(OLR_nu,OSR_nu,zdtlw,zdtsw)
[1835]66
[2133]67      real,dimension(:,:,:),allocatable,save :: int_dtauv   ! VI optical thickness of layers within narrowbands for diags ().
68      real,dimension(:,:,:),allocatable,save :: int_dtaui   ! IR optical thickness of layers within narrowbands for diags ().
69!$OMP THREADPRIVATE(int_dtaui,int_dtauv)
70
[1835]71      real,allocatable,dimension(:),save :: tau_col ! Total Aerosol Optical Depth.
72      real,allocatable,save :: hice(:) ! Oceanic Ice height. by BC
73!$OMP THREADPRIVATE(tau_col,hice)
74
75      real,allocatable,dimension(:,:),save :: cloudfrac  ! Fraction of clouds (%).
76      real,allocatable,dimension(:),save :: totcloudfrac ! Column fraction of clouds (%).
77!$OMP THREADPRIVATE(cloudfrac,totcloudfrac)
78
79      real,allocatable,dimension(:,:),save :: qsurf_hist
80      real,allocatable,dimension(:,:,:),save :: nueffrad ! Aerosol effective radius variance. By RW
[1883]81!$OMP THREADPRIVATE(qsurf_hist,nueffrad)
[1835]82
83      real,allocatable,dimension(:),save :: ice_initial
84      real,allocatable,dimension(:),save :: ice_min
[1883]85!$OMP THREADPRIVATE(ice_initial,ice_min)
[1835]86
87      real, dimension(:),allocatable,save ::  pctsrf_sic
88      real, dimension(:,:),allocatable,save :: tslab
89      real, dimension(:),allocatable,save ::  tsea_ice
90      real, dimension(:),allocatable,save :: sea_ice
91      real, dimension(:),allocatable,save :: zmasq
92      integer, dimension(:),allocatable,save ::knindex
93      real,allocatable,dimension(:,:,:),save :: reffrad
[1883]94!$OMP THREADPRIVATE(pctsrf_sic,tslab,tsea_ice,sea_ice,zmasq,knindex,reffrad)
[1842]95     
[1835]96CONTAINS
97
98!======================================================================
[1842]99SUBROUTINE phys_state_var_init(nqtot)
[1835]100
101IMPLICIT NONE
102
[1883]103        integer,intent(in) :: nqtot
[1842]104
[1835]105!  Parametres de l'Orographie a l'Echelle Sous-Maille (OESM):
106!
107!zmea(:)   ! orographie moyenne
108!zstd(:)   ! deviation standard de l'OESM
109!zsig(:)   ! pente de l'OESM
110!zgam(:)   ! anisotropie de l'OESM
111!zthe(:)   ! orientation de l'OESM
112!zpic(:)   ! Maximum de l'OESM
113!zval(:)   ! Minimum de l'OESM
114!rugoro(:) ! longueur de rugosite de l'OESM
115        print*,'klon',klon,'klev',klev
116        ALLOCATE(phisfi(klon))
117        ALLOCATE(tsurf(klon))
118        ALLOCATE(tsoil(klon,nsoilmx))
119        ALLOCATE(albedo(klon,L_NSPECTV))
120        ALLOCATE(albedo_equivalent(klon))
121        ALLOCATE(albedo_snow_SPECTV(L_NSPECTV))
122        ALLOCATE(albedo_co2_ice_SPECTV(L_NSPECTV))
123        ALLOCATE(albedo_bareground(klon))
124        ALLOCATE(rnat(klon))
125        ALLOCATE(emis(klon))
126        ALLOCATE(dtrad(klon,klev))
127        ALLOCATE(fluxrad_sky(klon))
128        ALLOCATE(fluxrad(klon))
129        ALLOCATE(capcal(klon))
130        ALLOCATE(fluxgrd(klon))
131        ALLOCATE(qsurf(klon,nqtot))
132        ALLOCATE(q2(klon,klev+1))
133        ALLOCATE(ztprevious(klon,klev))
134        ALLOCATE(zuprevious(klon,klev))
135        ALLOCATE(cloudfrac(klon,klev))
136        ALLOCATE(totcloudfrac(klon))
137        ALLOCATE(hice(klon))
138        ALLOCATE(qsurf_hist(klon,nqtot))
139        ALLOCATE(reffrad(klon,klev,naerkind))
140        ALLOCATE(nueffrad(klon,klev,naerkind))
141        ALLOCATE(ice_initial(klon))
142        ALLOCATE(ice_min(klon))
143        ALLOCATE(fluxsurf_lw(klon))
144        ALLOCATE(fluxsurf_sw(klon))
145        ALLOCATE(fluxsurfabs_sw(klon))
146        ALLOCATE(fluxtop_lw(klon))
147        ALLOCATE(fluxabs_sw(klon))
148        ALLOCATE(fluxtop_dn(klon))
149        ALLOCATE(fluxdyn(klon))
150        ALLOCATE(OLR_nu(klon,L_NSPECTI))
151        ALLOCATE(OSR_nu(klon,L_NSPECTV))
[2133]152        ALLOCATE(int_dtaui(klon,klev,L_NSPECTI))
153        ALLOCATE(int_dtauv(klon,klev,L_NSPECTV))
[1835]154        ALLOCATE(sensibFlux(klon))
155        ALLOCATE(zdtlw(klon,klev))
156        ALLOCATE(zdtsw(klon,klev))
157        ALLOCATE(tau_col(klon))
158        ALLOCATE(pctsrf_sic(klon))
159        ALLOCATE(tslab(klon,noceanmx))
160        ALLOCATE(tsea_ice(klon))
161        ALLOCATE(sea_ice(klon))
162        ALLOCATE(zmasq(klon))
163        ALLOCATE(knindex(klon))
164        ! This is defined in comsaison_h
165        ALLOCATE(mu0(klon))
166        ALLOCATE(fract(klon))
167         ! This is defined in radcommon_h
168        ALLOCATE(glat(klon))
169        ALLOCATE(albedodat(klon))
170        ALLOCATE(zmea(klon))
171        ALLOCATE(zstd(klon))
172        ALLOCATE(zsig(klon))
173        ALLOCATE(zgam(klon))
174        ALLOCATE(zthe(klon))
175        !allocate(l0(klon))
176        allocate(wstar(klon))
177        allocate(ustar(klon))
178        allocate(tstar(klon))
179        allocate(hfmax_th(klon))
180        allocate(zmax_th(klon))
181
182END SUBROUTINE phys_state_var_init
183
184!======================================================================
185SUBROUTINE phys_state_var_end
186
187IMPLICIT NONE
188
189        DEALLOCATE(tsurf)
190        DEALLOCATE(tsoil)
191        DEALLOCATE(albedo)
192        DEALLOCATE(albedo_equivalent)
193        DEALLOCATE(albedo_snow_SPECTV)
194        DEALLOCATE(albedo_co2_ice_SPECTV)
195        DEALLOCATE(albedo_bareground)
196        DEALLOCATE(rnat)
197        DEALLOCATE(emis)
198        DEALLOCATE(dtrad)
199        DEALLOCATE(fluxrad_sky)
200        DEALLOCATE(fluxrad)
201        DEALLOCATE(capcal)
202
203        DEALLOCATE(fluxgrd)
204        DEALLOCATE(qsurf)
205        DEALLOCATE(q2)
206        DEALLOCATE(ztprevious)
207        DEALLOCATE(zuprevious)
208        DEALLOCATE(cloudfrac)
209        DEALLOCATE(totcloudfrac)
210        DEALLOCATE(hice)
211        DEALLOCATE(qsurf_hist)
212        DEALLOCATE(reffrad)
213        DEALLOCATE(nueffrad)
214        DEALLOCATE(ice_initial)
215        DEALLOCATE(ice_min)
216        DEALLOCATE(fluxsurf_lw)
217        DEALLOCATE(fluxsurf_sw)
218        DEALLOCATE(fluxsurfabs_sw)
219        DEALLOCATE(fluxtop_lw)
220        DEALLOCATE(fluxabs_sw)
221        DEALLOCATE(fluxtop_dn)
222        DEALLOCATE(fluxdyn)
223        DEALLOCATE(OLR_nu)
224        DEALLOCATE(OSR_nu)
[2133]225        DEALLOCATE(int_dtaui)
226        DEALLOCATE(int_dtauv)
[1835]227        DEALLOCATE(sensibFlux)
228        DEALLOCATE(zdtlw)
229        DEALLOCATE(zdtsw)
230        DEALLOCATE(tau_col)
231        DEALLOCATE(pctsrf_sic)
232        DEALLOCATE(tslab)
233        DEALLOCATE(tsea_ice)
234        DEALLOCATE(sea_ice)
235        DEALLOCATE(zmasq)
236        DEALLOCATE(knindex)
237        DEALLOCATE(mu0)
238        DEALLOCATE(fract)
239        DEALLOCATE(glat)
240        DEALLOCATE(phisfi)
241        DEALLOCATE(albedodat)
242        DEALLOCATE(zmea)
243        DEALLOCATE(zstd)
244        DEALLOCATE(zsig)
245        DEALLOCATE(zgam)
246        DEALLOCATE(zthe)
247        !deallocate(l0)
248        deallocate(wstar)
249        deallocate(ustar)
250        deallocate(tstar)
251        deallocate(hfmax_th)
252        deallocate(zmax_th)
253
254
255END SUBROUTINE phys_state_var_end
256
257      END MODULE phys_state_var_mod
Note: See TracBrowser for help on using the repository browser.