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

Last change on this file since 2893 was 2888, checked in by llange, 2 years ago

PEM

  • Following r-2886-5, debugging some issues ( conservation of H2O, water_reservoir not initialized, info_pem which was not working)
  • Cleaning of some redundant routines (e.g., stopping criterion of the PEM) and variables renamed (e.g., alpha_criterion now transofrmed in ice_criterion)
  • Ice table subroutine is now in a module and recalled "compute_ice_table_equilibrium" (v.s. dynamic ice table, efforts ongoing)
  • Abort_pem introduced to avoid just stopping the pem with raw "stop" in the codes
  • conf_pem has been improved so that values are not hard coded (e.g., geothermal flux, mass of water_reservoir)
  • Regolith thermal properties updated in a cleaner way

(Not atomic commit, sorry)
LL & RV

File size: 5.1 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
67  ! Close file
68  call close_restartphy
69 
70end subroutine pemdem0
71
72subroutine pemdem1(filename,year_iter,nsoil_PEM,ngrid,nslope, &
73                    tsoil_slope_PEM,inertiesoil_slope_PEM,ice_table, &
74                    m_co2_regolith,m_h2o_regolith,water_reservoir)
75
76
77  ! write time-dependent variable to restart file
78  use iostart_PEM, only : open_restartphy, close_restartphy, &
79                      put_var, put_field
80
81  use comsoil_h_PEM, only: mlayer_PEM,fluxgeo,inertiedat_PEM,soil_pem
82  USE temps_mod_evol, ONLY: year_PEM
83               
84  implicit none
85 
86#ifndef CPP_STD
87  include "callkeys.h"
88#endif
89 
90  character(len=*),intent(in) :: filename
91  integer,intent(in) :: nsoil_PEM
92  integer,intent(in) :: ngrid
93  real,intent(IN) :: tsoil_slope_PEM(ngrid,nsoil_PEM,nslope) !under mesh bining according to slope
94  real,intent(IN) :: inertiesoil_slope_PEM(ngrid,nsoil_PEM,nslope) !under mesh bining according to slope
95  real,intent(IN) :: ice_table(ngrid,nslope) !under mesh bining according to slope
96  integer,intent(IN) :: nslope
97  real,intent(in) :: m_co2_regolith(ngrid,nsoil_PEM,nslope)
98  real,intent(in) :: m_h2o_regolith(ngrid,nsoil_PEM,nslope)
99  real,intent(in) :: water_reservoir(ngrid)
100  integer :: islope
101  CHARACTER*2 :: num 
102  integer, intent(IN) :: year_iter
103
104  real :: year_tot
105 
106  integer :: iq
107  character(len=30) :: txt ! to store some text
108  ! indexes of water vapour & water ice tracers (if any):
109
110  year_tot=real(year_iter+year_PEM)
111  print *, "Year of simulation=", year_tot 
112
113  ! Open file
114  call open_restartphy(filename)
115 
116  ! First variable to write must be "Time", in order to correctly
117  ! set time counter in file
118  call put_var("Time","Year of simulation",year_tot)
119  call put_field('water_reservoir','water_reservoir', &
120           water_reservoir,year_tot)
121  call put_field("water_reservoir","water_reservoir", &
122                 water_reservoir,year_tot)
123
124    if(soil_pem) then
125 
126  ! Multidimensionnal variables (undermesh slope statistics)
127DO islope=1,nslope
128  write(num,fmt='(i2.2)') islope
129  call put_field("tsoil_PEM_slope"//num,"Soil temperature by slope type", &
130                 tsoil_slope_PEM(:,:,islope),year_tot)
131  call put_field("TI_PEM_slope"//num,"Soil Thermal Inertia by slope type", &
132                 inertiesoil_slope_PEM(:,:,islope),year_tot)
133
134 call put_field("mco2_reg_ads_slope"//num, "Mass of co2 adsorbded in the regolith", &
135                    m_co2_regolith(:,:,islope), year_tot)
136  call put_field("mh2o_reg_ads_slope"//num, "Mass of h2o adsorbded in the regolith", &
137                    m_h2o_regolith(:,:,islope), year_tot)
138
139ENDDO
140
141  call put_field("ice_table","Depth of ice table", &
142                 ice_table,year_tot)
143
144  call put_field("inertiedat_PEM","Thermal inertie of PEM ", &
145                 inertiedat_PEM,year_tot)
146
147   endif !soil_pem
148
149  ! Close file
150  call close_restartphy
151 
152end subroutine pemdem1
153
154end module pemredem
Note: See TracBrowser for help on using the repository browser.