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

Last change on this file since 2878 was 2829, checked in by romain.vande, 3 years ago

Mars PCM:
Cleaning of phyredem0. Argument passed to the subroutines were unused.
RV

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