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

Last change on this file since 2800 was 2616, checked in by romain.vande, 3 years ago

LMDZ_MARS RV : Open_MP;
Put all the "save" variables as "!$OMP THREADPRIVATE" in phymars.
The code can now be tested, see README for more info

File size: 2.5 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!$OMP THREADPRIVATE(layer,mlayer,inertiedat,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
28!$OMP THREADPRIVATE(tsoil,mthermdiff,thermdiff,coefq,coefd,alph,beta,mu )
29
30contains
31
32  subroutine ini_comsoil_h(ngrid)
33 
34  implicit none
35  integer,intent(in) :: ngrid ! number of atmospheric columns
36 
37    allocate(layer(nsoilmx)) !soil layer depths
38    allocate(mlayer(0:nsoilmx-1)) ! soil mid-layer depths
39    allocate(inertiedat(ngrid,nsoilmx)) ! soil thermal inertia
40 
41    allocate(tsoil(ngrid,nsoilmx)) ! soil temperatures
42
43    allocate(mthermdiff(ngrid,0:nsoilmx-1))
44    allocate(thermdiff(ngrid,nsoilmx-1))
45    allocate(coefq(0:nsoilmx-1))
46    allocate(coefd(ngrid,nsoilmx-1))
47    allocate(alph(ngrid,nsoilmx-1))
48    allocate(beta(ngrid,nsoilmx-1))
49
50 
51  end subroutine ini_comsoil_h
52
53
54  subroutine end_comsoil_h
55
56  implicit none
57
58    if (allocated(layer)) deallocate(layer)
59    if (allocated(mlayer)) deallocate(mlayer)
60    if (allocated(inertiedat)) deallocate(inertiedat)
61    if (allocated(tsoil)) deallocate(tsoil)
62    if (allocated(mthermdiff)) deallocate(mthermdiff)
63    if (allocated(thermdiff)) deallocate(thermdiff)
64    if (allocated(coefq)) deallocate(coefq)
65    if (allocated(coefd)) deallocate(coefd)
66    if (allocated(alph)) deallocate(alph)
67    if (allocated(beta)) deallocate(beta)
68
69  end subroutine end_comsoil_h
70
71end module comsoil_h
Note: See TracBrowser for help on using the repository browser.