1 | ! |
---|
2 | ! $Header: /home/cvsroot/LMDZ4/libf/phylmd/soil.F,v 1.1.1.1 2004/05/19 12:53:09 lmdzadmin Exp $ |
---|
3 | ! |
---|
4 | SUBROUTINE soil(ptimestep, knon, ptsrf, ptsoil, |
---|
5 | s pcapcal, pfluxgrd) |
---|
6 | |
---|
7 | c======================================================================= |
---|
8 | c |
---|
9 | c Auteur: Frederic Hourdin 30/01/92 |
---|
10 | c ------- |
---|
11 | c |
---|
12 | c objet: computation of : the soil temperature evolution |
---|
13 | c ------ the surfacic heat capacity "Capcal" |
---|
14 | c the surface conduction flux pcapcal |
---|
15 | c |
---|
16 | c |
---|
17 | c Method: implicit time integration |
---|
18 | c ------- |
---|
19 | c Consecutive ground temperatures are related by: |
---|
20 | c T(k+1) = C(k) + D(k)*T(k) (1) |
---|
21 | c the coefficients C and D are computed at the t-dt time-step. |
---|
22 | c Routine structure: |
---|
23 | c 1)new temperatures are computed using (1) |
---|
24 | c 2)C and D coefficients are computed from the new temperature |
---|
25 | c profile for the t+dt time-step |
---|
26 | c 3)the coefficients A and B are computed where the diffusive |
---|
27 | c fluxes at the t+dt time-step is given by |
---|
28 | c Fdiff = A + B Ts(t+dt) |
---|
29 | c or Fdiff = F0 + Capcal (Ts(t+dt)-Ts(t))/dt |
---|
30 | c with F0 = A + B (Ts(t)) |
---|
31 | c Capcal = B*dt |
---|
32 | c |
---|
33 | c Interface: |
---|
34 | c ---------- |
---|
35 | c |
---|
36 | c Arguments: |
---|
37 | c ---------- |
---|
38 | c ptimestep physical timestep (s) |
---|
39 | c ptsrf(klon) surface temperature at time-step t (K) |
---|
40 | c ptsoil(klon,nsoilmx) temperature inside the ground (K) |
---|
41 | c pcapcal(klon) surfacic specific heat (W*m-2*s*K-1) |
---|
42 | c pfluxgrd(klon) surface diffusive flux from ground (Wm-2) |
---|
43 | c |
---|
44 | c======================================================================= |
---|
45 | c declarations: |
---|
46 | c ------------- |
---|
47 | |
---|
48 | use dimphy |
---|
49 | IMPLICIT NONE |
---|
50 | #include "YOMCST.h" |
---|
51 | #include "dimsoil.h" |
---|
52 | #include "clesphys.h" |
---|
53 | |
---|
54 | c----------------------------------------------------------------------- |
---|
55 | c arguments |
---|
56 | c --------- |
---|
57 | |
---|
58 | REAL ptimestep |
---|
59 | INTEGER knon |
---|
60 | REAL ptsrf(klon),ptsoil(klon,nsoilmx) |
---|
61 | REAL pcapcal(klon),pfluxgrd(klon) |
---|
62 | |
---|
63 | c----------------------------------------------------------------------- |
---|
64 | c local arrays |
---|
65 | c ------------ |
---|
66 | |
---|
67 | INTEGER ig,jk |
---|
68 | REAL zdz2(nsoilmx),z1(klon) |
---|
69 | REAL min_period,dalph_soil |
---|
70 | REAL ztherm_i(klon) |
---|
71 | |
---|
72 | c local saved variables: |
---|
73 | c ---------------------- |
---|
74 | REAL dz1(nsoilmx),dz2(nsoilmx) |
---|
75 | REAL,allocatable :: zc(:,:),zd(:,:) |
---|
76 | REAL lambda |
---|
77 | SAVE dz1,dz2,zc,zd,lambda |
---|
78 | LOGICAL firstcall |
---|
79 | SAVE firstcall |
---|
80 | |
---|
81 | DATA firstcall/.true./ |
---|
82 | |
---|
83 | c----------------------------------------------------------------------- |
---|
84 | c Depthts: |
---|
85 | c -------- |
---|
86 | |
---|
87 | REAL fz,rk,fz1,rk1,rk2 |
---|
88 | fz(rk)=fz1*(dalph_soil**rk-1.)/(dalph_soil-1.) |
---|
89 | pfluxgrd(:) = 0. |
---|
90 | |
---|
91 | DO ig = 1, knon |
---|
92 | ztherm_i(ig) = inertie |
---|
93 | ENDDO |
---|
94 | |
---|
95 | IF (firstcall) THEN |
---|
96 | |
---|
97 | allocate(zc(klon,nsoilmx),zd(klon,nsoilmx)) |
---|
98 | |
---|
99 | c----------------------------------------------------------------------- |
---|
100 | c ground levels |
---|
101 | c grnd=z/l where l is the skin depth of the diurnal cycle: |
---|
102 | c -------------------------------------------------------- |
---|
103 | |
---|
104 | c VENUS : A REVOIR !!!! |
---|
105 | min_period=20000. ! en secondes |
---|
106 | dalph_soil=2. ! rapport entre les epaisseurs de 2 couches succ. |
---|
107 | |
---|
108 | OPEN(99,file='soil.def',status='old',form='formatted',err=9999) |
---|
109 | READ(99,*) min_period |
---|
110 | READ(99,*) dalph_soil |
---|
111 | PRINT*,'Discretization for the soil model' |
---|
112 | PRINT*,'First level e-folding depth',min_period, |
---|
113 | s ' dalph',dalph_soil |
---|
114 | CLOSE(99) |
---|
115 | 9999 CONTINUE |
---|
116 | |
---|
117 | c la premiere couche represente un dixieme de cycle diurne |
---|
118 | fz1=sqrt(min_period/3.14) |
---|
119 | |
---|
120 | DO jk=1,nsoilmx |
---|
121 | rk1=jk |
---|
122 | rk2=jk-1 |
---|
123 | dz2(jk)=fz(rk1)-fz(rk2) |
---|
124 | ENDDO |
---|
125 | DO jk=1,nsoilmx-1 |
---|
126 | rk1=jk+.5 |
---|
127 | rk2=jk-.5 |
---|
128 | dz1(jk)=1./(fz(rk1)-fz(rk2)) |
---|
129 | ENDDO |
---|
130 | lambda=fz(.5)*dz1(1) |
---|
131 | PRINT*,'full layers, intermediate layers (seconds)' |
---|
132 | DO jk=1,nsoilmx |
---|
133 | rk=jk |
---|
134 | rk1=jk+.5 |
---|
135 | rk2=jk-.5 |
---|
136 | PRINT *,'fz=', |
---|
137 | . fz(rk1)*fz(rk2)*3.14,fz(rk)*fz(rk)*3.14 |
---|
138 | ENDDO |
---|
139 | firstcall =.false. |
---|
140 | |
---|
141 | ELSE !--not firstcall |
---|
142 | c----------------------------------------------------------------------- |
---|
143 | c Computation of the soil temperatures using the Cgrd and Dgrd |
---|
144 | c coefficient computed at the previous time-step: |
---|
145 | c ----------------------------------------------- |
---|
146 | |
---|
147 | c surface temperature |
---|
148 | DO ig=1,knon |
---|
149 | ptsoil(ig,1)=(lambda*zc(ig,1)+ptsrf(ig))/ |
---|
150 | s (lambda*(1.-zd(ig,1))+1.) |
---|
151 | ENDDO |
---|
152 | |
---|
153 | c other temperatures |
---|
154 | DO jk=1,nsoilmx-1 |
---|
155 | DO ig=1,knon |
---|
156 | ptsoil(ig,jk+1)=zc(ig,jk)+zd(ig,jk)*ptsoil(ig,jk) |
---|
157 | ENDDO |
---|
158 | ENDDO |
---|
159 | |
---|
160 | ENDIF !--not firstcall |
---|
161 | c----------------------------------------------------------------------- |
---|
162 | c Computation of the Cgrd and Dgrd coefficient for the next step: |
---|
163 | c --------------------------------------------------------------- |
---|
164 | |
---|
165 | DO jk=1,nsoilmx |
---|
166 | zdz2(jk)=dz2(jk)/ptimestep |
---|
167 | ENDDO |
---|
168 | |
---|
169 | DO ig=1,knon |
---|
170 | z1(ig)=zdz2(nsoilmx)+dz1(nsoilmx-1) |
---|
171 | zc(ig,nsoilmx-1)= |
---|
172 | $ zdz2(nsoilmx)*ptsoil(ig,nsoilmx)/z1(ig) |
---|
173 | zd(ig,nsoilmx-1)=dz1(nsoilmx-1)/z1(ig) |
---|
174 | ENDDO |
---|
175 | |
---|
176 | DO jk=nsoilmx-1,2,-1 |
---|
177 | DO ig=1,knon |
---|
178 | z1(ig)=1./(zdz2(jk)+dz1(jk-1)+dz1(jk) |
---|
179 | $ *(1.-zd(ig,jk))) |
---|
180 | zc(ig,jk-1)= |
---|
181 | s (ptsoil(ig,jk)*zdz2(jk)+dz1(jk)*zc(ig,jk)) |
---|
182 | $ *z1(ig) |
---|
183 | zd(ig,jk-1)=dz1(jk-1)*z1(ig) |
---|
184 | ENDDO |
---|
185 | ENDDO |
---|
186 | |
---|
187 | c----------------------------------------------------------------------- |
---|
188 | c computation of the surface diffusive flux from ground and |
---|
189 | c calorific capacity of the ground: |
---|
190 | c --------------------------------- |
---|
191 | |
---|
192 | DO ig=1,knon |
---|
193 | pfluxgrd(ig)=ztherm_i(ig)*dz1(1)* |
---|
194 | s (zc(ig,1)+(zd(ig,1)-1.)*ptsoil(ig,1)) |
---|
195 | pcapcal(ig)=ztherm_i(ig)* |
---|
196 | s (dz2(1)+ptimestep*(1.-zd(ig,1))*dz1(1)) |
---|
197 | z1(ig)=lambda*(1.-zd(ig,1))+1. |
---|
198 | pcapcal(ig)=pcapcal(ig)/z1(ig) |
---|
199 | pfluxgrd(ig) = pfluxgrd(ig) |
---|
200 | s + pcapcal(ig) * (ptsoil(ig,1) * z1(ig) |
---|
201 | $ - lambda * zc(ig,1) |
---|
202 | $ - ptsrf(ig)) |
---|
203 | s /ptimestep |
---|
204 | ENDDO |
---|
205 | |
---|
206 | RETURN |
---|
207 | END |
---|