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

Last change on this file since 2863 was 2863, checked in by llange, 23 months ago

PEM
H2O adsorption is now computed. Total mass of H2o adsorbded is written in the restart_PEM.
+Minor fixes and edit
LL & RV

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