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

Last change on this file since 3249 was 3230, checked in by llange, 2 years ago

Mars PCM

  • Move soil_tifeedback into a module waterice_tifeedback_mod.F90
  • The flag to call tifeedback has been changed from "tifeedback" to surfaceice_tifeedback for clarity
  • Add the possibility to change the thermal inertia while pore ices is forming in the soil: to do so, use the flag poreice_tifeedback. The computation is done in waterice_tifeedback_mod.F90.

For now, surfaceice_tifeedback and poreice_tifeedback can not be called together, we might think about how to merge later.
LL

File size: 5.2 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)
34real,    save, allocatable, dimension(:,:,:,:) :: qsoil                ! subsurface tracers (kg/m^3 of regol)
35integer, parameter :: nqsoil = 3                                       ! number of subsurface tracers, only three when working with water
36integer, parameter :: igcm_h2o_vap_soil = 1
37integer, parameter :: igcm_h2o_ice_soil = 2
38integer, parameter :: igcm_h2o_vap_ads  = 3
39REAL, parameter :: porosity_reg  = 0.45
40!$OMP THREADPRIVATE(adsorption_soil,qsoil,choice_ads)
41
42!=======================================================================
43contains
44!=======================================================================
45
46subroutine ini_comsoil_h(ngrid,nslope)
47
48implicit none
49
50integer,intent(in) :: ngrid  ! number of atmospheric columns
51integer,intent(in) :: nslope ! number of sub grid slopes
52
53allocate(layer(nsoilmx)) !soil layer depths
54allocate(mlayer(0:nsoilmx - 1)) ! soil mid-layer depths
55allocate(inertiedat(ngrid,nsoilmx)) ! soil thermal inertia for present climate
56allocate(inertiesoil(ngrid,nsoilmx,nslope)) ! soil thermal inertia
57allocate(tsoil(ngrid,nsoilmx,nslope)) ! soil temperatures
58allocate(mthermdiff(ngrid,0:nsoilmx - 1,nslope))
59allocate(thermdiff(ngrid,nsoilmx - 1,nslope))
60allocate(coefq(0:nsoilmx - 1))
61allocate(coefd(ngrid,nsoilmx - 1,nslope))
62allocate(alph(ngrid,nsoilmx - 1,nslope))
63allocate(beta(ngrid,nsoilmx - 1,nslope))
64allocate(flux_geo(ngrid,nslope))
65allocate(qsoil(ngrid,nsoilmx,nqsoil,nslope))
66
67END SUBROUTINE ini_comsoil_h
68
69!=======================================================================
70SUBROUTINE end_comsoil_h
71
72implicit none
73
74if (allocated(layer)) deallocate(layer)
75if (allocated(mlayer)) deallocate(mlayer)
76if (allocated(inertiedat)) deallocate(inertiedat)
77if (allocated(inertiesoil)) deallocate(inertiesoil)
78if (allocated(tsoil)) deallocate(tsoil)
79if (allocated(mthermdiff)) deallocate(mthermdiff)
80if (allocated(thermdiff)) deallocate(thermdiff)
81if (allocated(coefq)) deallocate(coefq)
82if (allocated(coefd)) deallocate(coefd)
83if (allocated(alph)) deallocate(alph)
84if (allocated(beta)) deallocate(beta)
85if (allocated(flux_geo)) deallocate(flux_geo)
86if (allocated(qsoil))  deallocate(qsoil)
87
88END SUBROUTINE end_comsoil_h
89
90!=======================================================================
91SUBROUTINE ini_comsoil_h_slope_var(ngrid,nslope)
92
93implicit none
94
95integer,intent(in) :: ngrid  ! number of atmospheric columns
96integer,intent(in) :: nslope ! number of sub grid slopes
97
98allocate(tsoil(ngrid,nsoilmx,nslope)) ! soil temperatures
99allocate(inertiesoil(ngrid,nsoilmx,nslope)) ! soil thermal inertia
100allocate(mthermdiff(ngrid,0:nsoilmx - 1,nslope))
101allocate(thermdiff(ngrid,nsoilmx - 1,nslope))
102allocate(coefd(ngrid,nsoilmx - 1,nslope))
103allocate(alph(ngrid,nsoilmx - 1,nslope))
104allocate(beta(ngrid,nsoilmx - 1,nslope))
105allocate(flux_geo(ngrid,nslope))
106allocate(qsoil(ngrid,nsoilmx,nqsoil,nslope))
107
108END SUBROUTINE ini_comsoil_h_slope_var
109
110!=======================================================================
111SUBROUTINE end_comsoil_h_slope_var
112
113implicit none
114
115if (allocated(tsoil)) deallocate(tsoil)
116if (allocated(inertiesoil)) deallocate(inertiesoil)
117if (allocated(mthermdiff)) deallocate(mthermdiff)
118if (allocated(thermdiff)) deallocate(thermdiff)
119if (allocated(coefd)) deallocate(coefd)
120if (allocated(alph)) deallocate(alph)
121if (allocated(beta)) deallocate(beta)
122if (allocated(flux_geo)) deallocate(flux_geo)
123if (allocated(qsoil))  deallocate(qsoil)
124
125END SUBROUTINE end_comsoil_h_slope_var
126
127END MODULE comsoil_h
Note: See TracBrowser for help on using the repository browser.