source: trunk/LMDZ.MARS/libf/phymars/comsoil_h.F90 @ 3400

Last change on this file since 3400 was 3272, checked in by llange, 8 months ago

Mars PCM
Adapt soil water to run with massive ice and not pore filling ice + constant diffusion coefficient
LL

File size: 5.5 KB
Line 
1MODULE comsoil_h
2
3implicit none
4
5! nsoilmx : number of subterranean layers
6integer, parameter :: nsoilmx = 57
7
8real, save, allocatable, dimension(:)     :: layer       ! soil layer depths
9real, save, allocatable, dimension(:)     :: mlayer      ! soil mid-layer depths
10real, save, allocatable, dimension(:,:)   :: inertiedat  ! soil thermal inertia for present climate
11real, save, allocatable, dimension(:,:,:) :: inertiesoil ! soil thermal inertia
12real, save                                :: volcapa     ! soil volumetric heat capacity
13! NB: volcapa is read from control(35) from physics start file
14!     in physdem (or set via tabfi, or initialized in soil_settings.F)
15
16!$OMP THREADPRIVATE(layer,mlayer,inertiedat,inertiesoil,volcapa)
17
18! Variables (FC: built in firstcall in soil.F)
19real, save, allocatable, dimension(:,:,:) :: tsoil      ! sub-surface temperatures (K)
20real, save, allocatable, dimension(:,:,:) :: mthermdiff ! (FC) mid-layer thermal diffusivity
21real, save, allocatable, dimension(:,:,:) :: thermdiff  ! (FC) inter-layer thermal diffusivity
22real, save, allocatable, dimension(:)     :: coefq      ! (FC) q_{k+1/2} coefficients
23real, save, allocatable, dimension(:,:,:) :: coefd      ! (FC) d_k coefficients
24real, save, allocatable, dimension(:,:,:) :: alph       ! (FC) alpha_k coefficients
25real, save, allocatable, dimension(:,:,:) :: beta       ! beta_k coefficients
26real, save, allocatable, dimension(:,:)   :: flux_geo   ! Geothermal Flux (W/m^2)
27real, save :: mu
28
29!$OMP THREADPRIVATE(tsoil,mthermdiff,thermdiff,coefq,coefd,alph,beta,mu,flux_geo)
30
31! Subsurface tracers:
32logical, save                                  :: adsorption_soil      ! boolean to call adosrption (or not)
33real,    save                                  :: choice_ads           ! Choice for adsorption isotherm (3 means no adsorption, see soilwater.F90)
34logical, save                                  :: ads_const_D          ! boolean to have constant diffusion coefficient
35logical, save                                  :: ads_massive_ice      ! boolean to have massive subsurface ice
36real,    save, allocatable, dimension(:,:,:,:) :: qsoil                ! subsurface tracers (kg/m^3 of regol)
37integer, parameter :: nqsoil = 3                                       ! number of subsurface tracers, only three when working with water
38integer, parameter :: igcm_h2o_vap_soil = 1
39integer, parameter :: igcm_h2o_ice_soil = 2
40integer, parameter :: igcm_h2o_vap_ads  = 3
41REAL, parameter :: porosity_reg  = 0.45
42!$OMP THREADPRIVATE(adsorption_soil,qsoil,choice_ads)
43!$OMP THREADPRIVATE(ads_const_D,ads_massive_ice)
44
45!=======================================================================
46contains
47!=======================================================================
48
49subroutine ini_comsoil_h(ngrid,nslope)
50
51implicit none
52
53integer,intent(in) :: ngrid  ! number of atmospheric columns
54integer,intent(in) :: nslope ! number of sub grid slopes
55
56allocate(layer(nsoilmx)) !soil layer depths
57allocate(mlayer(0:nsoilmx - 1)) ! soil mid-layer depths
58allocate(inertiedat(ngrid,nsoilmx)) ! soil thermal inertia for present climate
59allocate(inertiesoil(ngrid,nsoilmx,nslope)) ! soil thermal inertia
60allocate(tsoil(ngrid,nsoilmx,nslope)) ! soil temperatures
61allocate(mthermdiff(ngrid,0:nsoilmx - 1,nslope))
62allocate(thermdiff(ngrid,nsoilmx - 1,nslope))
63allocate(coefq(0:nsoilmx - 1))
64allocate(coefd(ngrid,nsoilmx - 1,nslope))
65allocate(alph(ngrid,nsoilmx - 1,nslope))
66allocate(beta(ngrid,nsoilmx - 1,nslope))
67allocate(flux_geo(ngrid,nslope))
68allocate(qsoil(ngrid,nsoilmx,nqsoil,nslope))
69
70END SUBROUTINE ini_comsoil_h
71
72!=======================================================================
73SUBROUTINE end_comsoil_h
74
75implicit none
76
77if (allocated(layer)) deallocate(layer)
78if (allocated(mlayer)) deallocate(mlayer)
79if (allocated(inertiedat)) deallocate(inertiedat)
80if (allocated(inertiesoil)) deallocate(inertiesoil)
81if (allocated(tsoil)) deallocate(tsoil)
82if (allocated(mthermdiff)) deallocate(mthermdiff)
83if (allocated(thermdiff)) deallocate(thermdiff)
84if (allocated(coefq)) deallocate(coefq)
85if (allocated(coefd)) deallocate(coefd)
86if (allocated(alph)) deallocate(alph)
87if (allocated(beta)) deallocate(beta)
88if (allocated(flux_geo)) deallocate(flux_geo)
89if (allocated(qsoil))  deallocate(qsoil)
90
91END SUBROUTINE end_comsoil_h
92
93!=======================================================================
94SUBROUTINE ini_comsoil_h_slope_var(ngrid,nslope)
95
96implicit none
97
98integer,intent(in) :: ngrid  ! number of atmospheric columns
99integer,intent(in) :: nslope ! number of sub grid slopes
100
101allocate(tsoil(ngrid,nsoilmx,nslope)) ! soil temperatures
102allocate(inertiesoil(ngrid,nsoilmx,nslope)) ! soil thermal inertia
103allocate(mthermdiff(ngrid,0:nsoilmx - 1,nslope))
104allocate(thermdiff(ngrid,nsoilmx - 1,nslope))
105allocate(coefd(ngrid,nsoilmx - 1,nslope))
106allocate(alph(ngrid,nsoilmx - 1,nslope))
107allocate(beta(ngrid,nsoilmx - 1,nslope))
108allocate(flux_geo(ngrid,nslope))
109allocate(qsoil(ngrid,nsoilmx,nqsoil,nslope))
110
111END SUBROUTINE ini_comsoil_h_slope_var
112
113!=======================================================================
114SUBROUTINE end_comsoil_h_slope_var
115
116implicit none
117
118if (allocated(tsoil)) deallocate(tsoil)
119if (allocated(inertiesoil)) deallocate(inertiesoil)
120if (allocated(mthermdiff)) deallocate(mthermdiff)
121if (allocated(thermdiff)) deallocate(thermdiff)
122if (allocated(coefd)) deallocate(coefd)
123if (allocated(alph)) deallocate(alph)
124if (allocated(beta)) deallocate(beta)
125if (allocated(flux_geo)) deallocate(flux_geo)
126if (allocated(qsoil))  deallocate(qsoil)
127
128END SUBROUTINE end_comsoil_h_slope_var
129
130END MODULE comsoil_h
Note: See TracBrowser for help on using the repository browser.