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

Last change on this file since 2947 was 2942, checked in by llange, 21 months ago

Mars PCM
Add the possibility to use a different thermal inertia (field
'inertiesoil') than inertiedat in the PCM (for paleoclimate studies). By defaut, if there is not
inertiesoil, inertiedat is used. Soil_tifeedback still work with
inertiedat
Newstart adapted, start2archive will be modified by Romain
Vandemeulebrouck.
LL

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