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

Last change on this file since 1618 was 1543, checked in by emillour, 9 years ago

All models: Further adaptations to keep up with changes in LMDZ5 concerning
physics/dynamics separation:

  • dyn3d:
  • adapted gcm.F so that all physics initializations are now done in iniphysiq.
  • dyn3dpar:
  • adapted gcm.F so that all physics initializations are now done in iniphysiq.
  • updated calfis_p.F to follow up with changes.
  • copied over updated "bands.F90" from LMDZ5.
  • dynphy_lonlat:
  • calfis_p.F90, mod_interface_dyn_phys.F90, follow up of changes in phy_common/mod_* routines
  • phy_common:
  • added "geometry_mod.F90" to store information about the grid (replaces phy*/comgeomphy.F90) and give variables friendlier names: rlond => longitude , rlatd => latitude, airephy => cell_area, cuphy => dx , cvphy => dy
  • added "physics_distribution_mod.F90"
  • updated "mod_grid_phy_lmdz.F90", "mod_phys_lmdz_mpi_data.F90", "mod_phys_lmdz_para.F90", "mod_phys_lmdz_mpi_transfert.F90", "mod_grid_phy_lmdz.F90", "mod_phys_lmdz_omp_data.F90", "mod_phys_lmdz_omp_transfert.F90", "write_field_phy.F90" and "ioipsl_getin_p_mod.F90" to LMDZ5 versions.
  • phy[venus/titan/mars/std]:
  • removed "init_phys_lmdz.F90", "comgeomphy.F90"; adapted routines to use geometry_mod (longitude, latitude, cell_area, etc.)

EM

File size: 8.1 KB
Line 
1!
2! $Id: $
3!
4module phyredem
5
6implicit none
7
8contains
9
10subroutine physdem0(filename,lonfi,latfi,nsoil,ngrid,nlay,nq, &
11                         phystep,day_ini,time,airefi, &
12                         alb,ith,pzmea,pzstd,pzsig,pzgam,pzthe)
13! create physics restart file and write time-independent variables
14  use infotrac, only: nqtot, tname
15  use comsoil_h, only: inertiedat, volcapa, mlayer
16  use geometry_mod, only: cell_area
17  use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, &
18                       z0_default, albedice, emisice, emissiv, &
19                       iceradius, dtemisice, phisfi, z0
20  use dimradmars_mod, only: tauvis
21  use iostart, only : open_restartphy, close_restartphy, &
22                      put_var, put_field, length
23  use mod_grid_phy_lmdz, only : klon_glo
24  use planete_h, only: aphelie, emin_turb, lmixmin, obliquit, &
25                       peri_day, periheli, year_day
26  use comcstfi_h, only: g, mugaz, omeg, rad, rcp
27  use time_phylmdz_mod, only: daysec
28
29  implicit none
30 
31  character(len=*), intent(in) :: filename
32  real,intent(in) :: lonfi(ngrid)
33  real,intent(in) :: latfi(ngrid)
34  integer,intent(in) :: nsoil
35  integer,intent(in) :: ngrid
36  integer,intent(in) :: nlay
37  integer,intent(in) :: nq
38  real,intent(in) :: phystep
39  real,intent(in) :: day_ini
40  real,intent(in) :: time
41  real,intent(in) :: airefi(ngrid)
42  real,intent(in) :: alb(ngrid)
43  real,intent(in) :: ith(ngrid,nsoil)
44  real,intent(in) :: pzmea(ngrid)
45  real,intent(in) :: pzstd(ngrid)
46  real,intent(in) :: pzsig(ngrid)
47  real,intent(in) :: pzgam(ngrid)
48  real,intent(in) :: pzthe(ngrid)
49 
50  real :: tab_cntrl(length) ! nb "length=100" defined in iostart module
51 
52  ! Create physics start file
53  call open_restartphy(filename)
54 
55  ! Build tab_cntrl(:) array
56  tab_cntrl(:)=0.0
57  !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
58  ! Fill control array tab_cntrl(:) with parameters for this run
59  !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
60  ! Informations on the physics grid
61  tab_cntrl(1) = float(klon_glo)  ! total number of nodes on physics grid
62  tab_cntrl(2) = float(nlay) ! number of atmospheric layers
63  tab_cntrl(3) = day_ini + int(time)      ! initial day
64  tab_cntrl(4) = time -int(time)          ! initial time of day
65
66  ! Informations about Mars, used by dynamics and physics
67  tab_cntrl(5) = rad      ! radius of Mars (m) ~3397200
68  tab_cntrl(6) = omeg     ! rotation rate (rad.s-1)
69  tab_cntrl(7) = g        ! gravity (m.s-2) ~3.72
70  tab_cntrl(8) = mugaz    ! Molar mass of the atmosphere (g.mol-1) ~43.49
71  tab_cntrl(9) = rcp      !  = r/cp  ~0.256793 (=kappa dans dynamique)
72  tab_cntrl(10) = daysec  ! length of a sol (s)  ~88775
73
74  tab_cntrl(11) = phystep  ! time step in the physics
75  tab_cntrl(12) = 0.
76  tab_cntrl(13) = 0.
77
78  ! Informations about Mars, only for physics
79  tab_cntrl(14) = year_day  ! length of year (sols) ~668.6
80  tab_cntrl(15) = periheli  ! min. Sun-Mars distance (Mkm) ~206.66
81  tab_cntrl(16) = aphelie   ! max. SUn-Mars distance (Mkm) ~249.22
82  tab_cntrl(17) = peri_day  ! date of perihelion (sols since N. spring)
83  tab_cntrl(18) = obliquit  ! Obliquity of the planet (deg) ~23.98
84
85  ! Boundary layer and turbulence
86  tab_cntrl(19) = z0_default   ! default surface roughness (m) ~0.01
87  tab_cntrl(20) = lmixmin   ! mixing length ~100
88  tab_cntrl(21) = emin_turb ! minimal energy ~1.e-8
89
90  ! Optical properties of polar caps and ground emissivity
91  tab_cntrl(22) = albedice(1)  ! Albedo of northern cap ~0.5
92  tab_cntrl(23) = albedice(2)  ! Albedo of southern cap ~0.5
93  tab_cntrl(24) = emisice(1)   ! Emissivity of northern cap ~0.95
94  tab_cntrl(25) = emisice(2)   ! Emissivity of southern cap ~0.95
95  tab_cntrl(26) = emissiv      ! Emissivity of martian soil ~.95
96  tab_cntrl(31) = iceradius(1) ! mean scat radius of CO2 snow (north)
97  tab_cntrl(32) = iceradius(2) ! mean scat radius of CO2 snow (south)
98  tab_cntrl(33) = dtemisice(1) ! time scale for snow metamorphism (north)
99  tab_cntrl(34) = dtemisice(2) ! time scale for snow metamorphism (south)
100
101  ! dust aerosol properties
102  tab_cntrl(27) = tauvis      ! mean visible optical depth
103
104  ! Soil properties:
105  tab_cntrl(35) = volcapa ! soil volumetric heat capacity
106
107  ! Write the controle array
108  call put_var("controle","Control parameters",tab_cntrl)
109 
110  ! Write the mid-layer depths
111  call put_var("soildepth","Soil mid-layer depth",mlayer)
112 
113  ! Write longitudes
114  call put_field("longitude","Longitudes of physics grid",lonfi)
115 
116  ! Write latitudes
117  call put_field("latitude","Latitudes of physics grid",latfi)
118 
119  ! Write mesh areas
120  call put_field("area","Mesh area",cell_area)
121 
122  ! Write surface geopotential
123  call put_field("phisfi","Geopotential at the surface",phisfi)
124 
125  ! Write surface albedo
126  call put_field("albedodat","Albedo of bare ground",alb)
127 
128  ! Subgrid topogaphy variables
129  call put_field("ZMEA","Relief: mean relief",zmea)
130  call put_field("ZSTD","Relief: standard deviation",zstd)
131  call put_field("ZSIG","Relief: sigma parameter",zsig)
132  call put_field("ZGAM","Relief: gamma parameter",zgam)
133  call put_field("ZTHE","Relief: theta parameter",zthe)
134 
135  ! Soil thermal inertia
136  call put_field("inertiedat","Soil thermal inertia",ith)
137 
138  ! Surface roughness length
139  call put_field("z0","Surface roughness length",z0)
140 
141  ! Close file
142  call close_restartphy
143 
144end subroutine physdem0
145
146subroutine physdem1(filename,nsoil,ngrid,nlay,nq, &
147                    phystep,time,tsurf,tsoil,co2ice,emis,q2,qsurf,&
148                    tauscaling)
149  ! write time-dependent variable to restart file
150  use iostart, only : open_restartphy, close_restartphy, &
151                      put_var, put_field
152  use infotrac, only: nqtot, tname
153  implicit none
154  character(len=*),intent(in) :: filename
155  integer,intent(in) :: nsoil
156  integer,intent(in) :: ngrid
157  integer,intent(in) :: nlay
158  integer,intent(in) :: nq
159  real,intent(in) :: phystep
160  real,intent(in) :: time
161  real,intent(in) :: tsurf(ngrid)
162  real,intent(in) :: tsoil(ngrid,nsoil)
163  real,intent(in) :: co2ice(ngrid)
164  real,intent(in) :: emis(ngrid)
165  real,intent(in) :: q2(ngrid,nlay+1)
166  real,intent(in) :: qsurf(ngrid,nq)
167  real,intent(in) :: tauscaling(ngrid)
168 
169  integer :: iq
170  character(len=30) :: txt ! to store some text
171  ! indexes of water vapour & water ice tracers (if any):
172  integer :: i_h2o_vap=0
173  integer :: i_h2o_ice=0
174
175 
176  ! Open file
177  call open_restartphy(filename)
178 
179  ! First variable to write must be "Time", in order to correctly
180  ! set time counter in file
181  call put_var("Time","Temps de simulation",time)
182 
183  ! CO2 ice layer
184  call put_field("co2ice","CO2 ice cover",co2ice,time)
185 
186  ! Surface temperature
187  call put_field("tsurf","Surface temperature",tsurf,time)
188 
189  ! Soil temperature
190  call put_field("tsoil","Soil temperature",tsoil,time)
191 
192  ! Emissivity of the surface
193  call put_field("emis","Surface emissivity",emis,time)
194 
195  ! Planetary Boundary Layer
196  call put_field("q2","pbl wind variance",q2,time)
197 
198  ! Dust conversion factor
199  ! Only to be read by newstart to convert to actual dust values
200  ! Or by any user who wants to reconstruct dust, opacity from the start files.
201  call put_field("tauscaling","dust conversion factor",tauscaling,time)
202
203  ! Tracers on the surface
204  ! preliminary stuff: look for water vapour & water ice tracers (if any)
205  do iq=1,nq
206    if (tname(iq).eq."h2o_vap") then
207      i_h2o_vap=iq
208    endif
209    if (tname(iq).eq."h2o_ice") then
210      i_h2o_ice=iq
211    endif
212  enddo
213 
214  if (nq.gt.0) then
215    do iq=1,nq
216      txt=tname(iq)
217      ! Exception: there is no water vapour surface tracer
218      if (txt.eq."h2o_vap") then
219        write(*,*)"physdem1: skipping water vapour tracer"
220        if (i_h2o_ice.eq.i_h2o_vap) then
221          ! then there is no "water ice" tracer; but still
222          ! there is some water ice on the surface
223          write(*,*)"          writing water ice instead"
224          txt="h2o_ice"
225        else
226          ! there is a "water ice" tracer which has been / will be
227          ! delt with in due time
228          cycle
229        endif ! of if (igcm_h2o_ice.eq.igcm_h2o_vap)
230      endif ! of if (txt.eq."h2o_vap")
231      call put_field(trim(txt),"tracer on surface",qsurf(:,iq),time)
232    enddo
233  endif
234 
235  ! Close file
236  call close_restartphy
237 
238end subroutine physdem1
239
240end module phyredem
Note: See TracBrowser for help on using the repository browser.