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

Last change on this file since 3026 was 2952, checked in by romain.vande, 20 months ago

Mars PCM + newstart + start_archive: Correct writing of variables inertiesoil and fluxgeo following r2919 and r2942
RV

File size: 4.1 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,inertiesoil,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    allocate(flux_geo(ngrid,nslope))
87 
88  end subroutine ini_comsoil_h_slope_var
89
90
91  subroutine end_comsoil_h_slope_var
92
93  implicit none
94
95    if (allocated(tsoil)) deallocate(tsoil)
96    if (allocated(inertiesoil)) deallocate(inertiesoil)
97    if (allocated(mthermdiff)) deallocate(mthermdiff)
98    if (allocated(thermdiff)) deallocate(thermdiff)
99    if (allocated(coefd)) deallocate(coefd)
100    if (allocated(alph)) deallocate(alph)
101    if (allocated(beta)) deallocate(beta)
102    if (allocated(flux_geo)) deallocate(flux_geo)
103
104  end subroutine end_comsoil_h_slope_var
105
106end module comsoil_h
Note: See TracBrowser for help on using the repository browser.