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

Last change on this file since 4026 was 4026, checked in by tbertrand, 41 hours ago

PLUTO PCM:
Adding Paleo options for Triton from Pluto.old
TB

File size: 19.8 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, used by dynamics and physics
99  tab_cntrl(5) = rad      ! radius
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, 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! tracers
230  if (nq>0) then
231    do iq=1,nq
232      call put_field(nid_restart,noms(iq),"tracer on surface",qsurf(:,iq))
233    enddo
234  endif ! of if (nq>0)
235
236! close file
237      CALL close_restartphy(nid_restart)
238!$OMP BARRIER
239
240end subroutine physdem1
241
242subroutine physdem0pal(filename,lonfi,latfi,nsoil,ngrid,nlay,nq, &
243                         phystep,day_ini,time,airefi, &
244                         alb,pzmea,pzstd,pzsig,pzgam,pzthe, &
245                         oblipal,eccpal,tpalnew,adjustnew, &
246                         phisfipal,peri_daypal)
247! create physics restart file and write time-independent variables
248  use comsoil_h, only: volcapa, mlayer
249  use geometry_mod, only: cell_area
250  use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, &
251                       emisice, emissiv,             &
252                       iceradius, dtemisice, phisfi
253  use iostart, only : create_restartphy, open_restartphy, close_restartphy, &
254                      put_var, put_field, length, ldscrpt, ndscrpt
255  use mod_grid_phy_lmdz, only : klon_glo
256  use planete_mod, only: year_day, periastr, apoastr, peri_day, &
257                         obliquit, z0, lmixmin, emin_turb
258  use comcstfi_mod, only: rad, omeg, g, mugaz, rcp
259  use time_phylmdz_mod, only: daysec
260
261  implicit none
262
263  character(len=*), intent(in) :: filename
264  real,intent(in) :: lonfi(ngrid)
265  real,intent(in) :: latfi(ngrid)
266  integer,intent(in) :: nsoil
267  integer,intent(in) :: ngrid
268  integer,intent(in) :: nlay
269  integer,intent(in) :: nq
270  real,intent(in) :: phystep
271  real,intent(in) :: day_ini
272  real,intent(in) :: time
273  real,intent(in) :: airefi(ngrid)
274  real,intent(in) :: alb(ngrid)
275  real,intent(in) :: pzmea(ngrid)
276  real,intent(in) :: pzstd(ngrid)
277  real,intent(in) :: pzsig(ngrid)
278  real,intent(in) :: pzgam(ngrid)
279  real,intent(in) :: pzthe(ngrid)
280  real,intent(in) :: oblipal,peri_daypal,eccpal ! change of obliquity/periday/eccentricity
281  real,intent(in) :: tpalnew ! change of time for paleo run
282  real,intent(in) :: adjustnew ! change in N2 ice albedo
283  real,intent(in) :: phisfipal(ngrid) ! change of geopotential for paleo run
284  real            :: peripal,aphepal ! change of perihelion/aphelion from eccentricity
285
286  character(ndscrpt), dimension(ldscrpt), parameter :: dscrpt_tab_cntrl = (/ &
287      "(1)  Number of atmospheric columns in physics     ", &
288      "(2)  Number of atmospheric layers                 ", &
289      "(3)  Final day                                    ", &
290      "(4)  Final time of day                            ", &
291      "(5)  Planet radius (m)                            ", &
292      "(6)  Rotation rate (rad.s-1)                      ", &
293      "(7)  Gravity (m.s-2)                              ", &
294      "(8)  Molar mass of the atmosphere (g.mol-1)       ", &
295      "(9)  = r/Cp           (=kappa in the dynamics)    ", &
296      "(10) Length of a solar day (s)                    ", &
297      "(11) Physics time step (s)                        ", &
298      "(12) -                                            ", &
299      "(13) -                                            ", &
300      "(14) Length of year (in solar days)               ", &
301      "(15) Minimum star-planet distance (AU)            ", &
302      "(16) Maximum star-planet distance (AU)            ", &
303      "(17) Date of periastro (sols since N. spring)     ", &
304      "(18) Obliquity of the planet (deg)                ", &
305      "(19) Default surface roughness (m)                ", &
306      "(20) -                                            ", &
307      "(21) -                                            ", &
308      "(22) -                                            ", &
309      "(23) -                                            ", &
310      "(24) Emissivity of northern cap ~0.95             ", &
311      "(25) Emissivity of southern cap ~0.95             ", &
312      "(26) Emissivity of martian soil ~.95              ", &
313      "(27) -                                            ", &
314      "(28) -                                            ", &
315      "(29) -                                            ", &
316      "(30) -                                            ", &
317      "(31) Mean scat radius of CO2 snow (north)         ", &
318      "(32) Mean scat radius of CO2 snow (south)         ", &
319      "(33) Time scale for snow metamorphism (north)     ", &
320      "(34) Time scale for snow metamorphism (south)     ", &
321      "(35) Soil volumetric heat capacity                "/)
322  real :: tab_cntrl(length) ! nb "length=100" defined in iostart module
323
324  write(*,*) "change of eccentricity, ecc=",eccpal                                   
325  peripal=(periastr+apoastr)/2.*(1-eccpal)                                           
326  aphepal=(periastr+apoastr)/2.*(1+eccpal)                                           
327  write(*,*) "check peri old/new=",periastr,peripal                                 
328  write(*,*) "check aphe old/new=",apoastr,aphepal                                   
329  write(*,*) "check a old/new=",apoastr+periastr,aphepal+peripal
330
331  ! Create physics start file
332  call create_restartphy(filename,nid_restart)
333
334! tab_cntrl() contains run parameters
335  tab_cntrl(:)=0 ! initialization
336!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
337! Fill control array tab_cntrl(:) with paramleters for this run
338!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
339! Informations on the physics grid
340  tab_cntrl(1) = float(klon_glo)  ! number of nodes on physics grid
341  tab_cntrl(2) = float(nlay) ! number of atmospheric layers
342  tab_cntrl(3) = day_ini + int(time)         ! final day
343  tab_cntrl(4) = time -int(time)            ! final time of day
344
345! Informations, used by dynamics and physics
346  tab_cntrl(5) = rad      ! radius
347  tab_cntrl(6) = omeg     ! rotation rate (rad.s-1)
348  tab_cntrl(7) = g        ! gravity (m.s-2) ~3.72
349  tab_cntrl(8) = mugaz    ! Molar mass of the atmosphere (g.mol-1) ~43.49
350  tab_cntrl(9) = rcp      !  = r/cp  ~0.256793 (=kappa dans dynamique)
351  tab_cntrl(10) = daysec  ! length of a sol (s)  ~88775
352
353  tab_cntrl(11) = phystep  ! time step in the physics
354  tab_cntrl(12) = 0.
355  tab_cntrl(13) = 0.
356
357! Informations, only for physics
358  tab_cntrl(14) = year_day  ! length of year (sols) ~668.6
359  tab_cntrl(15) = peripal  ! min. star-planet distance (AU)
360  tab_cntrl(16) = aphepal   ! max. star-planet distance (AU)
361  tab_cntrl(17) = peri_daypal  ! date of periastron (sols since N. spring)
362  tab_cntrl(18) = oblipal  ! Obliquity of the planet (deg) ~23.98
363
364! Boundary layer and turbulence
365  tab_cntrl(19) = z0        ! surface roughness (m) ~0.01
366  tab_cntrl(20) = tpalnew   
367  tab_cntrl(21) = adjustnew
368
369! Optical properties of polar caps and ground emissivity
370  tab_cntrl(24) = emisice(1)   ! Emissivity of northern cap ~0.95
371  tab_cntrl(25) = emisice(2)   ! Emissivity of southern cap ~0.95
372  tab_cntrl(26) = emissiv      ! Emissivity of martian soil ~.95
373  tab_cntrl(31) = iceradius(1) ! mean scat radius of N2 snow (north)
374  tab_cntrl(32) = iceradius(2) ! mean scat radius of N2 snow (south)
375  tab_cntrl(33) = dtemisice(1) ! time scale for snow metamorphism (north)
376  tab_cntrl(34) = dtemisice(2) ! time scale for snow metamorphism (south)
377
378  tab_cntrl(28) = 0.
379  tab_cntrl(29) = 0.
380  tab_cntrl(30) = 0.
381! Soil properties:
382  tab_cntrl(35) = volcapa ! soil volumetric heat capacity
383
384  call put_var(nid_restart,"controle","Control parameters",tab_cntrl)
385
386  ! Write the controle array descriptor
387  call put_var(nid_restart,"controle_descriptor",&
388               "Description of control parameters",dscrpt_tab_cntrl)
389
390  ! Write the mid-layer depths
391  call put_var(nid_restart,"soildepth","Soil mid-layer depth",mlayer)
392
393  ! Write longitudes
394  call put_field(nid_restart,"longitude","Longitudes of physics grid",lonfi)
395
396  ! Write latitudes
397  call put_field(nid_restart,"latitude","Latitudes of physics grid",latfi)
398
399  ! Write mesh areas
400  call put_field(nid_restart,"area","Mesh area",cell_area)
401
402  ! Write surface geopotential
403  call put_field(nid_restart,"phisfi","Geopotential at the surface",phisfipal)
404
405  ! Write surface albedo
406  !call put_field(nid_restart,"albedodat","Albedo of bare ground",alb)
407
408  ! Subgrid topogaphy variables
409  call put_field(nid_restart,"ZMEA","Relief: mean relief",zmea)
410  call put_field(nid_restart,"ZSTD","Relief: standard deviation",zstd)
411  call put_field(nid_restart,"ZSIG","Relief: sigma parameter",zsig)
412  call put_field(nid_restart,"ZGAM","Relief: gamma parameter",zgam)
413  call put_field(nid_restart,"ZTHE","Relief: theta parameter",zthe)
414
415  ! Close file
416  call close_restartphy(nid_restart)
417
418end subroutine physdem0pal
419
420subroutine physdem1pal(filename,nsoil,ngrid,nlay,nq, &
421                    phystep,time,tsurf,tsoil,inertiesoil, &
422                    emis,alb,q2,qsurf,n2frac, &
423                    oblipal,eccpal,tpalnew,adjustnew,phisfipal,peri_daypal)
424  ! write time-dependent variable to restart file
425  use iostart, only : open_restartphy, close_restartphy, &
426                      put_var, put_field
427  use tracer_h, only: noms
428
429  implicit none
430
431  character(len=*),intent(in) :: filename
432  integer,intent(in) :: nsoil
433  integer,intent(in) :: ngrid
434  integer,intent(in) :: nlay
435  integer,intent(in) :: nq
436  real,intent(in) :: phystep
437  real,intent(in) :: time
438  real,intent(in) :: tsurf(ngrid)
439  real,intent(in) :: tsoil(ngrid,nsoil)
440  real,intent(in) :: emis(ngrid)
441  real,intent(in) :: alb(ngrid)
442  real,intent(in) :: n2frac(ngrid)
443  real,intent(in) :: inertiesoil(ngrid,nsoil)
444  real,intent(in) :: q2(ngrid,nlay+1)
445  real,intent(in) :: qsurf(ngrid,nq)
446  real,intent(in) :: oblipal,peri_daypal,eccpal ! change of obliquity/periday/eccentricity
447  real,intent(in) :: tpalnew ! change of time for paleo run
448  real,intent(in) :: adjustnew ! change in N2 ice albedo
449  real,intent(in) :: phisfipal(ngrid) ! change of geopotential for paleo run
450  real            :: peripal,aphepal ! change of perihelion/aphelion from eccentricity
451
452  integer :: iq
453
454  ! Open file
455  call open_restartphy(filename, nid_restart)
456
457  ! First variable to write must be "Time", in order to correctly
458  ! set time counter in file
459  !call put_var("Time","Temps de simulation",time)
460
461  ! Surface temperature
462  call put_field(nid_restart,"tsurf","Surface temperature",tsurf)
463
464  ! Soil inertia
465  call put_field(nid_restart,"inertiedat","Soil thermal inertia",inertiesoil)
466
467  ! Soil temperature
468  call put_field(nid_restart,"tsoil","Soil temperature",tsoil)
469
470  ! Emissivity of the surface
471  call put_field(nid_restart,"emis","Surface emissivity",emis)
472
473  ! Albedo of the surface
474  call put_field(nid_restart,"albedodat","Albedo of bare ground",alb)
475
476  !n2 fraction on the surface
477  call put_field(nid_restart,"n2frac","N2 ice fraction on the surface",n2frac)
478
479  ! Planetary Boundary Layer
480  call put_field(nid_restart,"q2","pbl wind variance",q2)
481
482! tracers
483  if (nq>0) then
484    do iq=1,nq
485      call put_field(nid_restart,noms(iq),"tracer on surface",qsurf(:,iq))
486    enddo
487  endif ! of if (nq>0)
488
489! close file
490      CALL close_restartphy(nid_restart)
491!$OMP BARRIER
492
493end subroutine physdem1pal
494
495end module phyredem
Note: See TracBrowser for help on using the repository browser.