source: trunk/LMDZ.PLUTO/libf/phypluto/phyredem.F90 @ 3917

Last change on this file since 3917 was 3910, checked in by tbertrand, 4 months ago

Pluto PCM:

  • adding option to use N2 ice fractional maps (n2frac) read in the startfi.nc
  • adding option in newstart to correct (tsurf and tsoil) for too warm or too cold N2-free (correct_t_non2) or N2-rich (correct_t_n2) patches

TB

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