SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
soil_temp_arp.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! #########
6  SUBROUTINE soil_temp_arp(PTSTEP,PA,PB,PC,PGAMMAT,PTDEEP,PSODELX,PTG)
7 ! ############################################################
8 !
9 !!**** *SOIL_TEMP_ARP*
10 !
11 !! PURPOSE
12 !! -------
13 ! This subroutine solves the ARPEGE 1-d surface and deep force-restore
14 ! 'PTG' using the backward-difference scheme (implicit) as in soil_heatdiff.
15 ! The eqs are solved rapidly by taking advantage of the
16 ! fact that the matrix is tridiagonal. Soln to the eqs:
17 !
18 ! dTi S1
19 ! --- = Ct -- (Gi - Gi+1)
20 ! dt Si
21 !
22 ! with | G1 = Rn-H-LE
23 ! |
24 ! | 2Pi 1
25 ! | Gi = ------ -------------- (Ti-1 - Ti)
26 ! | Ct*Day S1 (Si-1 + Si)
27 !
28 !
29 ! where Si = pulsation depth, i=1 is the surface
30 !
31 !!** METHOD
32 !! ------
33 !
34 ! Direct calculation
35 !
36 !! EXTERNAL
37 !! --------
38 !
39 ! None
40 !!
41 !! IMPLICIT ARGUMENTS
42 !! ------------------
43 !!
44 !! USE MODD_SURF_PAR
45 !! USE MODI_TRIDIAG_GROUND
46 !!
47 !! REFERENCE
48 !! ---------
49 !!
50 !! AUTHOR
51 !! ------
52 !! B. Decharme * Meteo-France *
53 !!
54 !! MODIFICATIONS
55 !! -------------
56 !! Original 21/01/09 B. Decharme
57 !
58 !-------------------------------------------------------------------------------
59 !
60 !* 0. DECLARATIONS
61 ! ------------
62 !
63 USE modd_csts, ONLY : xpi, xday
64 !
65 USE modd_surf_par, ONLY : xundef
66 !
67 USE modi_tridiag_ground
68 !
69 !
70 USE yomhook ,ONLY : lhook, dr_hook
71 USE parkind1 ,ONLY : jprb
72 !
73 IMPLICIT NONE
74 !
75 !
76 REAL, INTENT(IN) :: ptstep ! Model time step (s)
77 !
78 REAL, DIMENSION(:), INTENT(IN) :: pa,pb,pc ! terms for the linearization of Ts(t)
79 !
80 REAL, DIMENSION(:), INTENT(IN) :: ptdeep, pgammat
81 ! PTDEEP = Deep soil temperature (prescribed)
82 ! which models heating/cooling from
83 ! below the diurnal wave penetration
84 ! (surface temperature) depth.
85 ! PGAMMAT = Deep soil heat transfer coefficient:
86 ! assuming homogeneous soil so that
87 ! this can be prescribed in units of
88 ! (1/days): associated time scale with
89 ! PTDEEP.
90 REAL, DIMENSION(:), INTENT (IN) :: psodelx ! Pulsation for each layer (Only used if LTEMP_ARP=True)
91 !
92 REAL, DIMENSION(:,:), INTENT(INOUT) :: ptg
93 ! PTG = soil temperature (K)
94 !
95 !
96 !* 0.2 declarations of local variables
97 !
98 INTEGER :: jj ! Loop counter
99 !
100 INTEGER :: inlvld ! Number of points and grid layers
101 !
102 REAL, DIMENSION(SIZE(PTG,1),SIZE(PTG,2)) :: ztgm, zfrcv, zamtrx, zbmtrx, &
103  zcmtrx, zlambda, zalpha
104 REAL(KIND=JPRB) :: zhook_handle
105 !
106 !-------------------------------------------------------------------------------
107 !
108 ! Initialize local variables:
109 !
110 IF (lhook) CALL dr_hook('SOIL_TEMP_ARP',0,zhook_handle)
111 inlvld = SIZE(ptg(:,:),2)
112 !
113 ztgm(:,:) = ptg(:,:)
114 !
115 zfrcv(:,:) = 0.0
116 zamtrx(:,:) = 0.0
117 zbmtrx(:,:) = 0.0
118 zcmtrx(:,:) = 0.0
119 zalpha(:,:) = 0.0
120 zlambda(:,:) = 0.0
121 !
122 !-------------------------------------------------------------------------------
123 !
124 ! Calculate tri-diagonal matrix coefficients:
125 !
126 !
127 DO jj=1,inlvld-1
128  zalpha(:,jj) = psodelx(jj)*xday/(ptstep*psodelx(1)*2.0*xpi)
129  zlambda(:,jj) = 1.0/(psodelx(1)*(psodelx(jj)+psodelx(jj+1)))
130 ENDDO
131 zalpha(:,inlvld) = psodelx(inlvld)*xday/(ptstep*psodelx(1)*2.0*xpi)
132 !
133 !-------------------------------------------------------------------------------
134 !
135 ! Upper BC
136 !
137 zamtrx(:,1) = 0.0
138 zbmtrx(:,1) = pa(:)+(2.0*xpi/xday)*(1.0/(psodelx(1)*(psodelx(1)+psodelx(2)))-1.0)
139 zcmtrx(:,1) = -2.0*xpi/(xday*psodelx(1)*(psodelx(1)+psodelx(2)))
140 zfrcv(:,1) = pb(:)*ztgm(:,1)+pc(:)-2.0*xpi*ztgm(:,2)/xday
141 !
142 !
143 ! Interior Grid
144 !
145 DO jj=2,inlvld-1
146  zamtrx(:,jj) = -zlambda(:,jj-1)
147  zbmtrx(:,jj) = zalpha(:,jj) + zlambda(:,jj-1) + zlambda(:,jj)
148  zcmtrx(:,jj) = -zlambda(:,jj)
149  zfrcv(:,jj) = zalpha(:,jj)*ztgm(:,jj)
150 ENDDO
151 !
152 ! Lower BC: 2 currently accounted for, Either zero flux
153 ! or a fixed temperature 'TDEEP'
154 !
155 zamtrx(:,inlvld) = -zlambda(:,inlvld-1)
156 zcmtrx(:,inlvld) = 0.0
157 !
158 WHERE(ptdeep(:) /= xundef .AND. pgammat(:) /= xundef)
159  zbmtrx(:,inlvld) = zalpha(:,inlvld) + zlambda(:,inlvld-1) + ptstep*pgammat(:)/xday
160  zfrcv(:,inlvld) = zalpha(:,inlvld)*ztgm(:,inlvld) + ptstep*pgammat(:)*ptdeep(:)/xday
161 ELSEWHERE
162  zbmtrx(:,inlvld) = zalpha(:,inlvld) + zlambda(:,inlvld-1)
163  zfrcv(:,inlvld) = zalpha(:,inlvld)*ztgm(:,inlvld)
164 END WHERE
165 !
166 !-------------------------------------------------------------------------------
167 !
168 ! Compute ZTGM (solution vector)
169 ! used for systems of equations involving tridiagonal
170 ! matricies.
171 !
172  CALL tridiag_ground(zamtrx,zbmtrx,zcmtrx,zfrcv,ztgm)
173 !
174 ! Update values in time:
175 !
176 ptg(:,:) = ztgm(:,:)
177 !
178 IF (lhook) CALL dr_hook('SOIL_TEMP_ARP',1,zhook_handle)
179 !
180 !-------------------------------------------------------------------------------
181 !
182 END SUBROUTINE soil_temp_arp
subroutine tridiag_ground(PA, PB, PC, PY, PX)
subroutine soil_temp_arp(PTSTEP, PA, PB, PC, PGAMMAT, PTDEEP, PSODELX, PTG)