source: trunk/LMDZ.COMMON/libf/evolution/pemredem.F90 @ 2825

Last change on this file since 2825 was 2794, checked in by llange, 3 years ago

MARS PEM:

  • Add a PEMETAT0 that read "startfi_pem.nc"
  • Add the soil in the model: soil temperature, thermal properties, ice table
  • Add a routine that compute CO2 + H2O adsorption
  • Minor corrections in PEM.F90

LL

File size: 4.0 KB
Line 
1module pemredem
2
3implicit none
4
5contains
6
7subroutine pemdem0(filename,lonfi,latfi,cell_area,nsoil_PEM,ngrid, &
8                         day_ini,time,nslope,def_slope,subslope_dist)
9! create physics restart file and write time-independent variables
10!  use comsoil_h, only: inertiedat, volcapa, mlayer
11  use comsoil_h_PEM, only: mlayer_PEM,fluxgeo,inertiedat_PEM
12  use iostart_PEM, only : open_restartphy, close_restartphy, &
13                      put_var, put_field, length
14  use mod_grid_phy_lmdz, only : klon_glo
15  use planete_h, only: aphelie, emin_turb, lmixmin, obliquit, &
16                       peri_day, periheli, year_day
17  use comcstfi_h, only: g, mugaz, omeg, rad, rcp
18  use time_phylmdz_mod, only: daysec
19  implicit none
20 
21  character(len=*), intent(in) :: filename
22  real,intent(in) :: lonfi(ngrid)
23  real,intent(in) :: latfi(ngrid)
24  integer,intent(in) :: nsoil_PEM
25  integer,intent(in) :: ngrid
26  real,intent(in) :: day_ini
27  real,intent(in) :: time
28  real, intent(in) :: cell_area(ngrid) !boundaries for bining of the slopes
29  integer,intent(in) :: nslope
30  real, intent(in) :: def_slope(nslope+1) !boundaries for bining of the slopes
31  real, intent(in) :: subslope_dist(ngrid,nslope) !undermesh statistics
32
33
34 
35  ! Create physics start file
36  call open_restartphy(filename)
37 
38  ! Write the mid-layer depths
39  call put_var("soildepth","Soil mid-layer depth",mlayer_PEM)
40 
41  ! Write longitudes
42  call put_field("longitude","Longitudes of physics grid",lonfi)
43 
44  ! Write latitudes
45  call put_field("latitude","Latitudes of physics grid",latfi)
46 
47  ! Write mesh areas
48  call put_field("area","Mesh area",cell_area)
49     
50  ! Multidimensionnal variables (nogcm undermesh slope statistics)
51  call put_var("def_slope","slope criterium stages",def_slope)
52  call put_field("subslope_dist","under mesh slope distribution",subslope_dist)
53
54  call put_var("FluxGeo","Geothermal Flux (W/m^2)",fluxgeo)
55
56  ! Close file
57  call close_restartphy
58 
59end subroutine pemdem0
60
61subroutine pemdem1(filename,time,nsoil_PEM,ngrid,nslope, &
62                    tsoil_slope_PEM,inertiesoil_slope_PEM,ice_table,m_co2_regolith)
63  ! write time-dependent variable to restart file
64  use iostart_PEM, only : open_restartphy, close_restartphy, &
65                      put_var, put_field
66
67  use comsoil_h_PEM, only: mlayer_PEM,fluxgeo,inertiedat_PEM
68               
69  implicit none
70 
71  include "callkeys.h"
72 
73  character(len=*),intent(in) :: filename
74  integer,intent(in) :: nsoil_PEM
75  integer,intent(in) :: ngrid
76  real,intent(in) :: time
77  real,intent(IN) :: tsoil_slope_PEM(ngrid,nsoil_PEM,nslope) !under mesh bining according to slope
78  real,intent(IN) :: inertiesoil_slope_PEM(ngrid,nsoil_PEM,nslope) !under mesh bining according to slope
79  real,intent(IN) :: ice_table(ngrid,nslope) !under mesh bining according to slope
80  integer,intent(IN) :: nslope
81  real,intent(in) :: m_co2_regolith(ngrid,nsoil_PEM,nslope)
82  integer :: islope
83  CHARACTER*2 :: num 
84
85 
86  integer :: iq
87  character(len=30) :: txt ! to store some text
88  ! indexes of water vapour & water ice tracers (if any):
89
90 
91
92  ! Open file
93  call open_restartphy(filename)
94 
95  ! First variable to write must be "Time", in order to correctly
96  ! set time counter in file
97  call put_var("Time","Temps de simulation",time)
98 
99 
100 
101  ! Multidimensionnal variables (undermesh slope statistics)
102DO islope=1,nslope
103  write(num,fmt='(i2.2)') islope
104  call put_field("tsoil_PEM_slope"//num,"Soil temperature by slope type", &
105                 tsoil_slope_PEM(:,:,islope),time)
106  call put_field("TI_PEM_slope"//num,"Soil Thermal Inertia by slope type", &
107                 inertiesoil_slope_PEM(:,:,islope),time)
108
109  call put_field("mco2_reg_ads_slope"//num, "Mass of co2 adsorbded in the regolith", &
110                    m_co2_regolith(:,:,islope), time)
111
112ENDDO
113
114  call put_field("ice_table","Depth of ice table", &
115                 ice_table,time)
116
117  call put_field("inertiedat_PEM","Thermal inertie of PEM ", &
118                 inertiedat_PEM,time)
119
120
121  ! Close file
122  call close_restartphy
123 
124end subroutine pemdem1
125
126end module pemredem
Note: See TracBrowser for help on using the repository browser.