source: trunk/LMDZ.MARS/libf/phymars/phyredem.F90 @ 2887

Last change on this file since 2887 was 2887, checked in by llange, 22 months ago

Mars PCM
Include geothermal flux as boundary conditions when solving the
diffusion equation for the soil temperature
By default, the geothermal flux is set to 0. To have geothermal flux >
0., it must be specified in the startfi. (I suggest to use a value of
30e-3 in this case)
Will be use with the PEM for studies of "paleosubsurfaces"
LL

File size: 11.0 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)
10! create physics restart file and write time-independent variables
11  use comsoil_h, only: inertiedat, volcapa, mlayer
12  use geometry_mod, only: cell_area
13  use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, &
14                       z0_default, albedice, emisice, emissiv, &
15                       iceradius, dtemisice, phisfi, z0,   &
16                       hmons,summit,base,watercaptag
17  use dimradmars_mod, only: tauvis
18  use iostart, only : open_restartphy, close_restartphy, &
19                      put_var, put_field, length
20  use mod_grid_phy_lmdz, only : klon_glo
21  use planete_h, only: aphelie, emin_turb, lmixmin, obliquit, &
22                       peri_day, periheli, year_day
23  use comcstfi_h, only: g, mugaz, omeg, rad, rcp
24  use time_phylmdz_mod, only: daysec
25  implicit none
26 
27  character(len=*), intent(in) :: filename
28  real,intent(in) :: lonfi(ngrid)
29  real,intent(in) :: latfi(ngrid)
30  integer,intent(in) :: nsoil
31  integer,intent(in) :: ngrid
32  integer,intent(in) :: nlay
33  integer,intent(in) :: nq
34  real,intent(in) :: phystep
35  real,intent(in) :: day_ini
36  real,intent(in) :: time
37  real,intent(in) :: airefi(ngrid)
38  real,intent(in) :: alb(ngrid)
39  real,intent(in) :: ith(ngrid,nsoil)
40
41  real :: tab_cntrl(length) ! nb "length=100" defined in iostart module
42  integer :: ig
43  real :: watercaptag_tmp(ngrid)
44 
45  ! Create physics start file
46  call open_restartphy(filename)
47 
48  ! Build tab_cntrl(:) array
49  tab_cntrl(:)=0.0
50  !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
51  ! Fill control array tab_cntrl(:) with parameters for this run
52  !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
53  ! Informations on the physics grid
54  tab_cntrl(1) = float(klon_glo)  ! total number of nodes on physics grid
55  tab_cntrl(2) = float(nlay) ! number of atmospheric layers
56  tab_cntrl(3) = day_ini + int(time)      ! initial day
57  tab_cntrl(4) = time -int(time)          ! initial time of day
58
59  ! Informations about Mars, used by dynamics and physics
60  tab_cntrl(5) = rad      ! radius of Mars (m) ~3397200
61  tab_cntrl(6) = omeg     ! rotation rate (rad.s-1)
62  tab_cntrl(7) = g        ! gravity (m.s-2) ~3.72
63  tab_cntrl(8) = mugaz    ! Molar mass of the atmosphere (g.mol-1) ~43.49
64  tab_cntrl(9) = rcp      !  = r/cp  ~0.256793 (=kappa dans dynamique)
65  tab_cntrl(10) = daysec  ! length of a sol (s)  ~88775
66
67  tab_cntrl(11) = phystep  ! time step in the physics
68  tab_cntrl(12) = 0.
69  tab_cntrl(13) = 0.
70
71  ! Informations about Mars, only for physics
72  tab_cntrl(14) = year_day  ! length of year (sols) ~668.6
73  tab_cntrl(15) = periheli  ! min. Sun-Mars distance (Mkm) ~206.66
74  tab_cntrl(16) = aphelie   ! max. SUn-Mars distance (Mkm) ~249.22
75  tab_cntrl(17) = peri_day  ! date of perihelion (sols since N. spring)
76  tab_cntrl(18) = obliquit  ! Obliquity of the planet (deg) ~23.98
77
78  ! Boundary layer and turbulence
79  tab_cntrl(19) = z0_default   ! default surface roughness (m) ~0.01
80  tab_cntrl(20) = lmixmin   ! mixing length ~100
81  tab_cntrl(21) = emin_turb ! minimal energy ~1.e-8
82
83  ! Optical properties of polar caps and ground emissivity
84  tab_cntrl(22) = albedice(1)  ! Albedo of northern cap ~0.5
85  tab_cntrl(23) = albedice(2)  ! Albedo of southern cap ~0.5
86  tab_cntrl(24) = emisice(1)   ! Emissivity of northern cap ~0.95
87  tab_cntrl(25) = emisice(2)   ! Emissivity of southern cap ~0.95
88  tab_cntrl(26) = emissiv      ! Emissivity of martian soil ~.95
89  tab_cntrl(31) = iceradius(1) ! mean scat radius of CO2 snow (north)
90  tab_cntrl(32) = iceradius(2) ! mean scat radius of CO2 snow (south)
91  tab_cntrl(33) = dtemisice(1) ! time scale for snow metamorphism (north)
92  tab_cntrl(34) = dtemisice(2) ! time scale for snow metamorphism (south)
93
94  ! dust aerosol properties
95  tab_cntrl(27) = tauvis      ! mean visible optical depth
96
97  ! Soil properties:
98  tab_cntrl(35) = volcapa ! soil volumetric heat capacity
99
100  ! Write the controle array
101  call put_var("controle","Control parameters",tab_cntrl)
102 
103  ! Write the mid-layer depths
104  call put_var("soildepth","Soil mid-layer depth",mlayer)
105 
106  ! Write longitudes
107  call put_field("longitude","Longitudes of physics grid",lonfi)
108 
109  ! Write latitudes
110  call put_field("latitude","Latitudes of physics grid",latfi)
111 
112  ! Write mesh areas
113  call put_field("area","Mesh area",cell_area)
114 
115  ! Write surface geopotential
116  call put_field("phisfi","Geopotential at the surface",phisfi)
117 
118  ! Write surface albedo
119  call put_field("albedodat","Albedo of bare ground",alb)
120 
121  ! Subgrid topogaphy variables
122  call put_field("ZMEA","Relief: mean relief",zmea)
123  call put_field("ZSTD","Relief: standard deviation",zstd)
124  call put_field("ZSIG","Relief: sigma parameter",zsig)
125  call put_field("ZGAM","Relief: gamma parameter",zgam)
126  call put_field("ZTHE","Relief: theta parameter",zthe)
127  call put_field("hmons","Relief: hmons parameter (summit - base)",hmons)
128  call put_field("summit","Relief: altitude from the aeroid of the summit of the highest subgrid topography",summit)
129  call put_field("base","Relief: altitude from the aeroid of the base of the highest subgrid topography",base)
130     
131  ! Soil thermal inertia
132  call put_field("inertiedat","Soil thermal inertia",ith)
133 
134  ! Surface roughness length
135  call put_field("z0","Surface roughness length",z0)
136 
137  do ig=1,ngrid
138    if(watercaptag(ig)) then
139       watercaptag_tmp(ig)=1
140    else
141       watercaptag_tmp(ig)=0
142    endif
143  enddo
144
145  call put_field("watercaptag","Infinite water reservoir",watercaptag_tmp)
146
147  ! Close file
148  call close_restartphy
149 
150end subroutine physdem0
151
152subroutine physdem1(filename,nsoil,ngrid,nlay,nq, &
153                    phystep,time,tsurf,tsoil,albedo,emis,q2,qsurf,&
154                    tauscaling,totcloudfrac,wstar, &
155                    watercap)
156  ! write time-dependent variable to restart file
157  use iostart, only : open_restartphy, close_restartphy, &
158                      put_var, put_field
159  use tracer_mod, only: noms ! tracer names
160  use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd
161  use compute_dtau_mod, only: dtau
162  use dust_rad_adjust_mod, only: dust_rad_adjust_prev,dust_rad_adjust_next
163  use dust_param_mod, only: dustscaling_mode
164  use comsoil_h,only: flux_geo
165  implicit none
166 
167  include "callkeys.h"
168 
169  character(len=*),intent(in) :: filename
170  integer,intent(in) :: nsoil
171  integer,intent(in) :: ngrid
172  integer,intent(in) :: nlay
173  integer,intent(in) :: nq
174  real,intent(in) :: phystep
175  real,intent(in) :: time
176  real,intent(in) :: tsurf(ngrid)
177  real,intent(in) :: tsoil(ngrid,nsoil)
178  real,intent(in) :: albedo(ngrid,2)
179  real,intent(in) :: emis(ngrid)
180  real,intent(in) :: q2(ngrid,nlay+1)
181  real,intent(in) :: qsurf(ngrid,nq)
182  real,intent(in) :: tauscaling(ngrid)
183  real,intent(in) :: totcloudfrac(ngrid)
184  real,intent(in) :: wstar(ngrid)
185  real,intent(in) :: watercap(ngrid)
186 
187  integer :: iq
188  character(len=30) :: txt ! to store some text
189  ! indexes of water vapour & water ice tracers (if any):
190  integer :: i_h2o_vap=0
191  integer :: i_h2o_ice=0
192  integer :: i_hdo_vap=0
193  integer :: i_hdo_ice=0
194
195 
196  ! Open file
197  call open_restartphy(filename)
198 
199  ! First variable to write must be "Time", in order to correctly
200  ! set time counter in file
201  call put_var("Time","Temps de simulation",time)
202
203  ! Water ice layer
204  call put_field("watercap","H2O ice cover",watercap,time)
205 
206  ! Surface temperature
207  call put_field("tsurf","Surface temperature",tsurf,time)
208 
209  ! Soil temperature
210  call put_field("tsoil","Soil temperature",tsoil,time)
211 
212  ! Albedo of the surface
213  call put_field("albedo","Surface albedo",albedo(:,1),time)
214 
215  ! Emissivity of the surface
216  call put_field("emis","Surface emissivity",emis,time)
217 
218  ! Planetary Boundary Layer
219  call put_field("q2","pbl wind variance",q2,time)
220
221  ! Sub-grid cloud fraction
222  call put_field("totcloudfrac","Total cloud fraction",totcloudfrac,time)
223 
224  ! Dust conversion factor
225  ! Only to be read by newstart to convert to actual dust values
226  ! Or by any user who wants to reconstruct dust, opacity from the start files.
227  call put_field("tauscaling","dust conversion factor",tauscaling,time)
228
229  ! Radiative scaling coefficients
230  if (dustscaling_mode==2) then
231    call put_field("dust_rad_adjust_prev", &
232                   "radiative dust adjustement factor prev. sol", &
233                   dust_rad_adjust_prev,time)
234    call put_field("dust_rad_adjust_next", &
235                   "radiative dust adjustement factor next sol", &
236                   dust_rad_adjust_next,time)
237  endif
238 
239  if (dustinjection.gt.0) then
240    call put_field("dtau","dust opacity difference between GCM and scenario",&
241                   dtau,time)
242  endif
243
244  if (calltherm) then
245    call put_field("wstar","Max vertical velocity in thermals",wstar,time)
246  endif
247
248  ! Tracers on the surface
249  ! preliminary stuff: look for water vapour & water ice tracers (if any)
250  do iq=1,nq
251    if (noms(iq).eq."h2o_vap") then
252      i_h2o_vap=iq
253    endif
254    if (noms(iq).eq."h2o_ice") then
255      i_h2o_ice=iq
256    endif
257
258  ! look for HDO vapour & HDO ice tracers (if any)
259    if (noms(iq).eq."hdo_vap") then
260      i_hdo_vap=iq
261    endif
262    if (noms(iq).eq."hdo_ice") then
263      i_hdo_ice=iq
264    endif
265  enddo
266
267 
268  if (nq.gt.0) then
269    do iq=1,nq
270      txt=noms(iq)
271      ! Exception: there is no water vapour surface tracer
272      if (txt.eq."h2o_vap") then
273        write(*,*)"physdem1: skipping water vapour tracer"
274        if (i_h2o_ice.eq.i_h2o_vap) then
275          ! then there is no "water ice" tracer; but still
276          ! there is some water ice on the surface
277          write(*,*)"          writing water ice instead"
278          txt="h2o_ice"
279        else
280          ! there is a "water ice" tracer which has been / will be
281          ! delt with in due time
282          cycle
283        endif ! of if (igcm_h2o_ice.eq.igcm_h2o_vap)
284      endif ! of if (txt.eq."h2o_vap")
285
286      if (txt.eq."hdo_vap") then
287        write(*,*)"physdem1: skipping HDO vapour tracer"
288        if (i_hdo_ice.eq.i_hdo_vap) then
289          ! then there is no "water ice" tracer; but still
290          ! there is some water ice on the surface
291          write(*,*)"          writing HDO ice instead"
292          txt="hdo_ice"
293        else
294          ! there is a "water ice" tracer which has been / will be
295          ! delt with in due time
296          cycle
297        endif ! of if (igcm_hdo_ice.eq.igcm_hdo_vap)
298      endif ! of if (txt.eq."hdo_vap")
299
300      ! co2_ice has been added to qsurf(:,igcm_co2) in co2condens4micro
301      if (txt.eq."co2_ice") then
302        write(*,*)"physdem1: skipping co2_ice tracer"
303        cycle
304      end if     
305
306      call put_field(trim(txt),"tracer on surface",qsurf(:,iq),time)
307    enddo
308  endif
309
310  ! Non-orographic gavity waves
311  if (calllott_nonoro) then
312     call put_field("du_nonoro_gwd","Zonal wind tendency due to GW",du_nonoro_gwd,time)
313     call put_field("dv_nonoro_gwd","Meridional wind tendency due to GW",dv_nonoro_gwd,time)
314  endif
315
316
317  ! Geothermal Flux
318     call put_field('flux_geo','Geothermal flux',flux_geo,time)
319  ! Close file
320  call close_restartphy
321 
322end subroutine physdem1
323
324end module phyredem
Note: See TracBrowser for help on using the repository browser.