source: trunk/LMDZ.GENERIC/libf/phystd/phyredem.F90

Last change on this file was 3515, checked in by emillour, 9 days ago

Generic PCM:
Add a controle_descriptor to restartfi.nc file, describing contents of the
controle array stored therein. Remove obsolete unused variables "lmixmin"
and "emin_turb" in the process.
EM

File size: 10.6 KB
Line 
1module phyredem
2
3implicit none
4
5contains
6
7subroutine physdem0(filename,lonfi,latfi,nsoil,ngrid,nlay,nq, &
8                         phystep,day_ini,time,airefi, &
9                         alb,ith,pzmea,pzstd,pzsig,pzgam,pzthe)
10! create physics restart file and write time-independent variables
11  use comsoil_h, only: volcapa, mlayer
12  use geometry_mod, only: cell_area
13  use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, &
14                       emisice, emissiv,             &
15                       iceradius, dtemisice, phisfi
16  use iostart, only : create_restartphy, close_restartphy, &
17                      put_var, put_field, length, ldscrpt, ndscrpt
18  use mod_grid_phy_lmdz, only : klon_glo
19  use planete_mod, only: year_day, periastr, apoastr, peri_day, &
20                         obliquit, z0
21  use comcstfi_mod, only: rad, omeg, g, mugaz, rcp
22  use time_phylmdz_mod, only: daysec
23
24  implicit none
25
26  character(len=*), intent(in) :: filename
27  real,intent(in) :: lonfi(ngrid)
28  real,intent(in) :: latfi(ngrid)
29  integer,intent(in) :: nsoil
30  integer,intent(in) :: ngrid
31  integer,intent(in) :: nlay
32  integer,intent(in) :: nq
33  real,intent(in) :: phystep
34  real,intent(in) :: day_ini
35  real,intent(in) :: time
36  real,intent(in) :: airefi(ngrid)
37  real,intent(in) :: alb(ngrid)
38  real,intent(in) :: ith(ngrid,nsoil)
39  real,intent(in) :: pzmea(ngrid)
40  real,intent(in) :: pzstd(ngrid)
41  real,intent(in) :: pzsig(ngrid)
42  real,intent(in) :: pzgam(ngrid)
43  real,intent(in) :: pzthe(ngrid)
44 
45  character(ndscrpt), dimension(ldscrpt), parameter :: dscrpt_tab_cntrl = (/ &
46      "(1)  Number of atmospheric columns in physics     ", &
47      "(2)  Number of atmospheric layers                 ", &
48      "(3)  Final day                                    ", &
49      "(4)  Final time of day                            ", &
50      "(5)  Planet radius (m)                            ", &
51      "(6)  Rotation rate (rad.s-1)                      ", &
52      "(7)  Gravity (m.s-2)                              ", &
53      "(8)  Molar mass of the atmosphere (g.mol-1)       ", &
54      "(9)  = r/Cp           (=kappa in the dynamics)    ", &
55      "(10) Length of a solar day (s)                    ", &
56      "(11) Physics time step (s)                        ", &
57      "(12) -                                            ", &
58      "(13) -                                            ", &
59      "(14) Length of year (in solar days)               ", &
60      "(15) Minimum star-planet distance (AU)            ", &
61      "(16) Maximum star-planet distance (AU)            ", &
62      "(17) Date of periastro (sols since N. spring)     ", &
63      "(18) Obliquity of the planet (deg)                ", &
64      "(19) Default surface roughness (m)                ", &
65      "(20) -                                            ", &
66      "(21) -                                            ", &
67      "(22) -                                            ", &
68      "(23) -                                            ", &
69      "(24) Emissivity of northern cap ~0.95             ", &
70      "(25) Emissivity of southern cap ~0.95             ", &
71      "(26) Emissivity of martian soil ~.95              ", &
72      "(27) -                                            ", &
73      "(28) -                                            ", &
74      "(29) -                                            ", &
75      "(30) -                                            ", &
76      "(31) Mean scat radius of CO2 snow (north)         ", &
77      "(32) Mean scat radius of CO2 snow (south)         ", &
78      "(33) Time scale for snow metamorphism (north)     ", &
79      "(34) Time scale for snow metamorphism (south)     ", &
80      "(35) Soil volumetric heat capacity                "/)
81  real :: tab_cntrl(length) ! nb "length=100" defined in iostart module
82 
83  ! Create physics start file
84  call create_restartphy(filename)
85
86! tab_cntrl() contains run parameters
87  tab_cntrl(:)=0 ! initialization
88!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
89! Fill control array tab_cntrl(:) with paramleters for this run
90!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
91! Informations on the physics grid
92  tab_cntrl(1) = float(klon_glo)  ! number of atmospheric columns in physics
93  tab_cntrl(2) = float(nlay) ! number of atmospheric layers
94  tab_cntrl(3) = day_ini + int(time)         ! final day
95  tab_cntrl(4) = time -int(time)            ! final time of day
96
97! Informations about the planet, used by dynamics and physics
98  tab_cntrl(5) = rad      ! planet radius (m)
99  tab_cntrl(6) = omeg     ! rotation rate (rad.s-1)
100  tab_cntrl(7) = g        ! gravity (m.s-2)
101  tab_cntrl(8) = mugaz    ! Molar mass of the atmosphere (g.mol-1)
102  tab_cntrl(9) = rcp      !  = r/cp  (=kappa in the dynamics)
103  tab_cntrl(10) = daysec  ! length of a solar day (s)
104
105  tab_cntrl(11) = phystep  ! physics time step (s)
106  tab_cntrl(12) = 0.
107  tab_cntrl(13) = 0.
108
109! Informations about the planet, only for physics
110  tab_cntrl(14) = year_day  ! length of year (in solar days)
111  tab_cntrl(15) = periastr  ! minimum star-planet distance (AU)
112  tab_cntrl(16) = apoastr   ! maximum star-planet distance (AU)
113  tab_cntrl(17) = peri_day  ! date of periastron (sols since N. spring)
114  tab_cntrl(18) = obliquit  ! Obliquity of the planet (deg)
115
116! Boundary layer and turbulence
117  tab_cntrl(19) = z0        ! surface roughness (m)
118!  tab_cntrl(20) = lmixmin   ! mixing length (m)
119!  tab_cntrl(21) = emin_turb ! minimal energy
120
121! Optical properties of polar caps and ground emissivity
122  tab_cntrl(24) = emisice(1)   ! Emissivity of northern cap ~0.95
123  tab_cntrl(25) = emisice(2)   ! Emissivity of southern cap ~0.95
124  tab_cntrl(26) = emissiv      ! Emissivity of martian soil ~.95
125  tab_cntrl(31) = iceradius(1) ! mean scat radius of CO2 snow (north)
126  tab_cntrl(32) = iceradius(2) ! mean scat radius of CO2 snow (south)
127  tab_cntrl(33) = dtemisice(1) ! time scale for snow metamorphism (north)
128  tab_cntrl(34) = dtemisice(2) ! time scale for snow metamorphism (south)
129
130  tab_cntrl(28) = 0.
131  tab_cntrl(29) = 0.
132  tab_cntrl(30) = 0.
133! Soil properties:
134  tab_cntrl(35) = volcapa ! soil volumetric heat capacity
135
136  ! Write the controle array
137  call put_var("controle","Control parameters",tab_cntrl)
138 
139  ! Write the controle array descriptor
140  call put_var("controle_descriptor",&
141               "Description of control parameters",dscrpt_tab_cntrl)
142 
143  ! Write the mid-layer depths
144  call put_var("soildepth","Soil mid-layer depth",mlayer)
145 
146  ! Write longitudes
147  call put_field("longitude","Longitudes of physics grid",lonfi)
148 
149  ! Write latitudes
150  call put_field("latitude","Latitudes of physics grid",latfi)
151 
152  ! Write mesh areas
153  call put_field("area","Mesh area",cell_area)
154 
155  ! Write surface geopotential
156  call put_field("phisfi","Geopotential at the surface",phisfi)
157 
158  ! Write surface albedo
159  call put_field("albedodat","Albedo of bare ground",alb)
160 
161  ! Subgrid topogaphy variables
162  call put_field("ZMEA","Relief: mean relief",zmea)
163  call put_field("ZSTD","Relief: standard deviation",zstd)
164  call put_field("ZSIG","Relief: sigma parameter",zsig)
165  call put_field("ZGAM","Relief: gamma parameter",zgam)
166  call put_field("ZTHE","Relief: theta parameter",zthe)
167 
168  ! Soil thermal inertia
169  call put_field("inertiedat","Soil thermal inertia",ith)
170 
171  ! Close file
172  call close_restartphy
173 
174end subroutine physdem0
175
176subroutine physdem1(filename,nsoil,ngrid,nlay,nq, &
177                    phystep,time,tsurf,tsoil,emis,albedo,q2,qsurf, &
178                    cloudfrac,totcloudfrac,hice, &
179                    rnat,pctsrf_sic,tslab,tsea_ice,tice,sea_ice)
180  ! write time-dependent variable to restart file
181  use iostart, only : open_restartphy, close_restartphy, &
182                      put_var, put_field
183  use tracer_h, only: noms
184  USE radinc_h, ONLY: L_NSPECTV
185!  use slab_ice_h, only: noceanmx
186  USE ocean_slab_mod, ONLY: nslay
187  use callkeys_mod, only: ok_slab_ocean, calllott_nonoro
188  use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd, &
189                                east_gwstress, west_gwstress
190
191  implicit none
192
193  character(len=*),intent(in) :: filename
194  integer,intent(in) :: nsoil
195  integer,intent(in) :: ngrid
196  integer,intent(in) :: nlay
197  integer,intent(in) :: nq
198  real,intent(in) :: phystep
199  real,intent(in) :: time
200  real,intent(in) :: tsurf(ngrid)
201  real,intent(in) :: tsoil(ngrid,nsoil)
202  real,intent(in) :: emis(ngrid)
203  real,intent(in) :: albedo(ngrid,L_NSPECTV)
204  real,intent(in) :: q2(ngrid,nlay+1)
205  real,intent(in) :: qsurf(ngrid,nq)
206  real,intent(in) :: cloudfrac(ngrid,nlay)
207  real,intent(in) :: totcloudfrac(ngrid)
208  real,intent(in) :: hice(ngrid)
209  real,intent(in) :: rnat(ngrid)
210  real,intent(in) :: pctsrf_sic(ngrid)
211  real,intent(in) :: tslab(ngrid,nslay)
212  real,intent(in) :: tsea_ice(ngrid)
213  real,intent(in) :: sea_ice(ngrid)
214  real,intent(in) :: tice(ngrid)
215
216  integer :: iq
217 
218  ! Open file
219  call open_restartphy(filename)
220
221  ! First variable to write must be "Time", in order to correctly
222  ! set time counter in file
223  !call put_var("Time","Temps de simulation",time)
224 
225  ! Surface temperature
226  call put_field("tsurf","Surface temperature",tsurf)
227 
228  ! Soil temperature
229  call put_field("tsoil","Soil temperature",tsoil)
230 
231  ! Emissivity of the surface
232  call put_field("emis","Surface emissivity",emis)
233 
234  ! Surface albedo (assume homegeneous spectral albedo for now)
235  call put_field("albedo","Surface albedo",albedo(:,1))
236 
237  ! Planetary Boundary Layer
238  call put_field("q2","pbl wind variance",q2)
239 
240! cloud fraction and sea ice (NB: these should be optional... to be improved)
241  call put_field("cloudfrac","Cloud fraction",cloudfrac)
242  call put_field("totcloudfrac","Total fraction",totcloudfrac)
243  call put_field("hice","Height of oceanic ice",hice)
244
245 !Slab ocean
246 if(ok_slab_ocean) then
247   call put_field("rnat","Nature of surface",rnat)
248   call put_field("pctsrf_sic","Pourcentage sea ice",pctsrf_sic)
249   call put_field("tslab","Temperature slab ocean",tslab)
250   call put_field("tsea_ice","Temperature of top layer (seaice or snow)",tsea_ice)
251   call put_field("tice","Temperature of seaice",tice)
252   call put_field("sea_ice","Sea ice mass",sea_ice)
253 endif!(ok_slab_ocean)
254
255! tracers
256  if (nq>0) then
257    do iq=1,nq
258      call put_field(noms(iq),"tracer on surface",qsurf(:,iq))
259    enddo
260  endif ! of if (nq>0)
261
262! Non-orographic gavity waves
263if (calllott_nonoro) then
264   call put_field("du_nonoro_gwd","Zonal wind tendency due to GW",du_nonoro_gwd)
265   call put_field("dv_nonoro_gwd","Meridional wind tendency due to GW",dv_nonoro_gwd)
266   call put_field("east_gwstress","Eastward stress profile due to GW",east_gwstress)
267   call put_field("west_gwstress","Westward stress profile due to GW",west_gwstress)
268endif
269
270! close file
271      CALL close_restartphy
272!$OMP BARRIER
273
274end subroutine physdem1
275
276end module phyredem
Note: See TracBrowser for help on using the repository browser.