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

Last change on this file since 2090 was 1770, checked in by aslmd, 7 years ago

LMDZ.MARS setting the stage for maybe fixing nesting in the LMD_MM_MARS 1. add the possibility to deallocate common modules with subroutines

File size: 2.3 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
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  ! variables (FC: built in firstcall in soil.F)
17  REAL,SAVE,ALLOCATABLE :: tsoil(:,:)       ! sub-surface temperatures (K)
18  real,save,allocatable :: mthermdiff(:,:)  ! (FC) mid-layer thermal diffusivity
19  real,save,allocatable :: thermdiff(:,:)   ! (FC) inter-layer thermal diffusivity
20  real,save,allocatable :: coefq(:)         ! (FC) q_{k+1/2} coefficients
21  real,save,allocatable :: coefd(:,:)       ! (FC) d_k coefficients
22  real,save,allocatable :: alph(:,:)        ! (FC) alpha_k coefficients
23  real,save,allocatable :: beta(:,:)        ! beta_k coefficients
24  real,save :: mu
25
26contains
27
28  subroutine ini_comsoil_h(ngrid)
29 
30  implicit none
31  integer,intent(in) :: ngrid ! number of atmospheric columns
32 
33    allocate(layer(nsoilmx)) !soil layer depths
34    allocate(mlayer(0:nsoilmx-1)) ! soil mid-layer depths
35    allocate(inertiedat(ngrid,nsoilmx)) ! soil thermal inertia
36 
37    allocate(tsoil(ngrid,nsoilmx)) ! soil temperatures
38
39    allocate(mthermdiff(ngrid,0:nsoilmx-1))
40    allocate(thermdiff(ngrid,nsoilmx-1))
41    allocate(coefq(0:nsoilmx-1))
42    allocate(coefd(ngrid,nsoilmx-1))
43    allocate(alph(ngrid,nsoilmx-1))
44    allocate(beta(ngrid,nsoilmx-1))
45
46 
47  end subroutine ini_comsoil_h
48
49
50  subroutine end_comsoil_h
51
52  implicit none
53
54    if (allocated(layer)) deallocate(layer)
55    if (allocated(mlayer)) deallocate(mlayer)
56    if (allocated(inertiedat)) deallocate(inertiedat)
57    if (allocated(tsoil)) deallocate(tsoil)
58    if (allocated(mthermdiff)) deallocate(mthermdiff)
59    if (allocated(thermdiff)) deallocate(thermdiff)
60    if (allocated(coefq)) deallocate(coefq)
61    if (allocated(coefd)) deallocate(coefd)
62    if (allocated(alph)) deallocate(alph)
63    if (allocated(beta)) deallocate(beta)
64
65  end subroutine end_comsoil_h
66
67end module comsoil_h
Note: See TracBrowser for help on using the repository browser.