source: trunk/LMDZ.COMMON/libf/evolution/soil_pem_ini.F90 @ 2909

Last change on this file since 2909 was 2895, checked in by llange, 2 years ago

PEM
Soil temperature initialisation has been updated
Conf_PEM improved by adding some options to the users (thermal regolith depend on the pressure, depth of the subsurface layers, etc.)
Minor edits then (+ svn update with RV had some issues, so there are some "artefact changes" ...)
LL

File size: 3.6 KB
Line 
1      subroutine soil_pem_ini(ngrid,nsoil,therm_i,tsurf,tsoil)
2
3
4      use comsoil_h_PEM, only: layer_PEM, mlayer_PEM,  &
5                          mthermdiff_PEM, thermdiff_PEM, coefq_PEM, &
6                          coefd_PEM, mu_PEM,alph_PEM,beta_PEM,fluxgeo
7      use comsoil_h,only: volcapa
8      implicit none
9
10!-----------------------------------------------------------------------
11!  Author: LL
12!  Purpose: Compute soil temperature using an implict 1st order scheme, stationnary solution
13
14!  Note: depths of layers and mid-layers, soil thermal inertia and
15!        heat capacity are commons in comsoil_PEM.h
16!-----------------------------------------------------------------------
17
18#include "dimensions.h"
19
20!-----------------------------------------------------------------------
21!  arguments
22!  ---------
23!  inputs:
24      integer,intent(in) :: ngrid       ! number of (horizontal) grid-points
25      integer,intent(in) :: nsoil       ! number of soil layers 
26      real,intent(in) :: therm_i(ngrid,nsoil) ! thermal inertia [SI]
27      real,intent(in) :: tsurf(ngrid)   ! surface temperature [K]
28
29! outputs:
30      real,intent(inout) :: tsoil(ngrid,nsoil) ! soil (mid-layer) temperature [K]
31! local variables:
32      integer ig,ik,iloop     
33
34! 0. Initialisations and preprocessing step
35
36   
37! 0.1 Build mthermdiff_PEM(:), the mid-layer thermal diffusivities
38      do ig=1,ngrid
39        do ik=0,nsoil-1
40          mthermdiff_PEM(ig,ik)=therm_i(ig,ik+1)*therm_i(ig,ik+1)/volcapa   
41        enddo
42      enddo
43
44! 0.2 Build thermdiff(:), the "interlayer" thermal diffusivities
45      do ig=1,ngrid
46        do ik=1,nsoil-1
47      thermdiff_PEM(ig,ik)=((layer_PEM(ik)-mlayer_PEM(ik-1))*mthermdiff_PEM(ig,ik) &
48                     +(mlayer_PEM(ik)-layer_PEM(ik))*mthermdiff_PEM(ig,ik-1))  &
49                         /(mlayer_PEM(ik)-mlayer_PEM(ik-1))
50        enddo
51      enddo
52
53! 0.3 Build coefficients mu_PEM, q_{k+1/2}, d_k, alph_PEMa_k and capcal
54      ! mu_PEM
55      mu_PEM=mlayer_PEM(0)/(mlayer_PEM(1)-mlayer_PEM(0))
56
57      ! q_{1/2}
58      coefq_PEM(:) = 0.
59        ! q_{k+1/2}
60
61      do ig=1,ngrid
62        ! d_k
63        do ik=1,nsoil-1
64          coefd_PEM(ig,ik)=thermdiff_PEM(ig,ik)/(mlayer_PEM(ik)-mlayer_PEM(ik-1))
65        enddo
66       
67        ! alph_PEM_{N-1}
68        alph_PEM(ig,nsoil-1)=coefd_PEM(ig,nsoil-1)/                      &
69                       (coefq_PEM(nsoil-1)+coefd_PEM(ig,nsoil-1))
70        ! alph_PEM_k
71        do ik=nsoil-2,1,-1
72          alph_PEM(ig,ik)=coefd_PEM(ig,ik)/(coefq_PEM(ik)+coefd_PEM(ig,ik+1)*    &
73                                   (1.-alph_PEM(ig,ik+1))+coefd_PEM(ig,ik))
74        enddo
75
76      enddo ! of do ig=1,ngrid
77
78
79
80!  1. Compute beta_PEM coefficients
81! Bottom layer, beta_PEM_{N-1}
82      do ig=1,ngrid
83        beta_PEM(ig,nsoil-1)=coefq_PEM(nsoil-1)*tsoil(ig,nsoil)          &
84                        /(coefq_PEM(nsoil-1)+coefd_PEM(ig,nsoil-1)) &
85                 +  fluxgeo/(coefq_PEM(nsoil-1)+coefd_PEM(ig,nsoil-1))
86      enddo
87! Other layers
88      do ik=nsoil-2,1,-1
89        do ig=1,ngrid
90          beta_PEM(ig,ik)=(coefq_PEM(ik)*tsoil(ig,ik+1)+                 &
91                      coefd_PEM(ig,ik+1)*beta_PEM(ig,ik+1))/             &
92                      (coefq_PEM(ik)+coefd_PEM(ig,ik+1)*(1.0-alph_PEM(ig,ik+1)) &
93                       +coefd_PEM(ig,ik))
94        enddo
95      enddo
96
97!  2. Compute soil temperatures
98do iloop = 1,10 !just convergence
99! First layer:
100        do ig=1,ngrid
101          tsoil(ig,1)=(tsurf(ig)+mu_PEM*beta_PEM(ig,1)* & 
102                                  thermdiff_PEM(ig,1)/mthermdiff_PEM(ig,0))/ &
103                   (1.+mu_PEM*(1.0-alph_PEM(ig,1))*&
104                    thermdiff_PEM(ig,1)/mthermdiff_PEM(ig,0))
105! Other layers:
106          do ik=1,nsoil-1
107            tsoil(ig,ik+1)=alph_PEM(ig,ik)*tsoil(ig,ik)+beta_PEM(ig,ik)
108          enddo
109        enddo
110     
111enddo ! iloop
112      end
113
Note: See TracBrowser for help on using the repository browser.