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

Last change on this file since 3117 was 3115, checked in by llange, 2 years ago

Mars PCM

  • Introducing the possibily to compute water adsorption / desorption -routine soilwater.F90) -. FOR NOW IT WORKS ONLY IN 1D, DON'T TEST IN 3D (by default, adsorption is not called, if not specified in the callphys.def). By default, when using the adsorption, the number of subtimestep used in the water subimation scheme is 1 (otherwise, it crashes)
  • New grid for the soil layers (better resolution) as it is needed to solve the diffusion equations. It does not increase the CPU time.

PYM & LL

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