1 | MODULE co2condens_mod |
---|
2 | |
---|
3 | IMPLICIT NONE |
---|
4 | |
---|
5 | CONTAINS |
---|
6 | |
---|
7 | SUBROUTINE co2condens(ngrid,nlayer,nq,ptimestep, |
---|
8 | $ pcapcal,pplay,pplev,ptsrf,pt, |
---|
9 | $ pphi,pdt,pdu,pdv,pdtsrf,pu,pv,pq,pdq, |
---|
10 | $ piceco2,psolaralb,pemisurf, |
---|
11 | $ pdtc,pdtsrfc,pdpsrf,pduc,pdvc,pdqc, |
---|
12 | $ fluxsurf_sw,zls, |
---|
13 | $ zdqssed_co2,pcondicea_co2microp, |
---|
14 | $ zdtcloudco2) |
---|
15 | |
---|
16 | use tracer_mod, only: noms |
---|
17 | use surfdat_h, only: emissiv, phisfi |
---|
18 | use geometry_mod, only: latitude ! grid point latitudes (rad) |
---|
19 | use planete_h, only: obliquit |
---|
20 | use comcstfi_h, only: cpp, g, r, pi |
---|
21 | #ifndef MESOSCALE |
---|
22 | USE vertical_layers_mod, ONLY: bp |
---|
23 | #endif |
---|
24 | IMPLICIT NONE |
---|
25 | c======================================================================= |
---|
26 | c subject: |
---|
27 | c -------- |
---|
28 | c Condensation/sublimation of CO2 ice on the ground and in the |
---|
29 | c atmosphere |
---|
30 | c (Scheme described in Forget et al., Icarus, 1998) |
---|
31 | c |
---|
32 | c author: Francois Forget 1994-1996 ; updated 1996 -- 2018 |
---|
33 | c ------ |
---|
34 | c adapted to external CO2 ice clouds scheme by Deborah Bardet (2018) ' |
---|
35 | c |
---|
36 | c======================================================================= |
---|
37 | c |
---|
38 | c 0. Declarations : |
---|
39 | c ------------------ |
---|
40 | c |
---|
41 | include "callkeys.h" |
---|
42 | |
---|
43 | c----------------------------------------------------------------------- |
---|
44 | c Arguments : |
---|
45 | c --------- |
---|
46 | INTEGER,INTENT(IN) :: ngrid ! number of atmospheric columns |
---|
47 | INTEGER,INTENT(IN) :: nlayer ! number of vertical layers |
---|
48 | INTEGER,INTENT(IN) :: nq ! number of tracers |
---|
49 | |
---|
50 | REAL,INTENT(IN) :: ptimestep ! physics timestep (s) |
---|
51 | REAL,INTENT(IN) :: pcapcal(ngrid) |
---|
52 | REAL,INTENT(IN) :: pplay(ngrid,nlayer) !mid-layer pressure (Pa) |
---|
53 | REAL,INTENT(IN) :: pplev(ngrid,nlayer+1) ! inter-layer pressure (Pa) |
---|
54 | REAL,INTENT(IN) :: ptsrf(ngrid) ! surface temperature (K) |
---|
55 | REAL,INTENT(IN) :: pt(ngrid,nlayer) ! atmospheric temperature (K) |
---|
56 | REAL,INTENT(IN) :: pphi(ngrid,nlayer) ! geopotential (m2.s-2) |
---|
57 | REAL,INTENT(IN) :: pdt(ngrid,nlayer) ! tendency on temperature from |
---|
58 | ! previous physical processes (K/s) |
---|
59 | REAL,INTENT(IN) :: pdu(ngrid,nlayer) ! tendency on zonal wind (m/s2) |
---|
60 | ! from previous physical processes |
---|
61 | REAL,INTENT(IN) :: pdv(ngrid,nlayer) ! tendency on meridional wind (m/s2) |
---|
62 | ! from previous physical processes |
---|
63 | REAL,INTENT(IN) :: pdtsrf(ngrid) ! tendency on surface temperature from |
---|
64 | ! previous physical processes (K/s) |
---|
65 | REAL,INTENT(IN) :: pu(ngrid,nlayer) ! zonal wind (m/s) |
---|
66 | REAL,INTENT(IN) :: pv(ngrid,nlayer) ! meridional wind (m/s) |
---|
67 | REAL,INTENT(IN) :: pq(ngrid,nlayer,nq) ! tracers (../kg_air) |
---|
68 | REAL,INTENT(IN) :: pdq(ngrid,nlayer,nq) ! tendency on tracers from |
---|
69 | ! previous physical processes |
---|
70 | |
---|
71 | REAL,INTENT(IN) :: zdqssed_co2(ngrid) ! CO2 flux at the surface (kg.m-2.s-1) |
---|
72 | REAL,INTENT(IN) :: pcondicea_co2microp(ngrid,nlayer)! tendency due to CO2 condensation (kg/kg.s-1) |
---|
73 | REAL,INTENT(IN) :: zdtcloudco2(ngrid,nlayer) ! tendency on temperature due to latent heat |
---|
74 | |
---|
75 | REAL,INTENT(INOUT) :: piceco2(ngrid) ! CO2 ice on the surface (kg.m-2) |
---|
76 | REAL,INTENT(INOUT) :: psolaralb(ngrid,2) ! albedo of the surface |
---|
77 | REAL,INTENT(INOUT) :: pemisurf(ngrid) ! emissivity of the surface |
---|
78 | |
---|
79 | ! tendencies due to CO2 condensation/sublimation: |
---|
80 | REAL,INTENT(OUT) :: pdtc(ngrid,nlayer) ! tendency on temperature (K/s) |
---|
81 | REAL,INTENT(OUT) :: pdtsrfc(ngrid) ! tendency on surface temperature (K/s) |
---|
82 | REAL,INTENT(OUT) :: pdpsrf(ngrid) ! tendency on surface pressure (Pa/s) |
---|
83 | REAL,INTENT(OUT) :: pduc(ngrid,nlayer) ! tendency on zonal wind (m.s-2) |
---|
84 | REAL,INTENT(OUT) :: pdvc(ngrid,nlayer) ! tendency on meridional wind (m.s-2) |
---|
85 | REAL,INTENT(OUT) :: pdqc(ngrid,nlayer,nq) ! tendency on tracers |
---|
86 | |
---|
87 | ! added to calculate flux dependent albedo: |
---|
88 | REAL,intent(in) :: fluxsurf_sw(ngrid,2) |
---|
89 | real,intent(in) :: zls ! solar longitude (rad) |
---|
90 | |
---|
91 | c |
---|
92 | c Local variables : |
---|
93 | c ----------------- |
---|
94 | |
---|
95 | INTEGER i,j |
---|
96 | INTEGER l,ig,iq,icap |
---|
97 | REAL zt(ngrid,nlayer) |
---|
98 | REAL zcpi |
---|
99 | REAL ztcond (ngrid,nlayer+1) ! CO2 condensation temperature (atm) |
---|
100 | REAL ztcondsol(ngrid) ! CO2 condensation temperature (surface) |
---|
101 | REAL zdiceco2(ngrid) |
---|
102 | REAL zcondicea(ngrid,nlayer) ! condensation rate in layer l (kg/m2/s) |
---|
103 | REAL zcondices(ngrid) ! condensation rate on the ground (kg/m2/s) |
---|
104 | REAL zfallice(ngrid,nlayer+1) ! amount of ice falling from layer l (kg/m2/s) |
---|
105 | REAL zfallheat |
---|
106 | REAL zmflux(nlayer+1) |
---|
107 | REAL zu(nlayer),zv(nlayer) |
---|
108 | REAL zq(nlayer,nq),zq1(nlayer) |
---|
109 | REAL ztsrf(ngrid) |
---|
110 | REAL ztc(nlayer), ztm(nlayer+1) |
---|
111 | REAL zum(nlayer+1) , zvm(nlayer+1) |
---|
112 | REAL zqm(nlayer+1,nq),zqm1(nlayer+1) |
---|
113 | REAL masse(nlayer),w(nlayer+1) |
---|
114 | REAL Sm(nlayer),Smq(nlayer,nq),mixmas,qmix |
---|
115 | LOGICAL condsub(ngrid) |
---|
116 | |
---|
117 | real :: emisref(ngrid) |
---|
118 | |
---|
119 | c variable speciale diagnostique |
---|
120 | real tconda1(ngrid,nlayer) |
---|
121 | real tconda2(ngrid,nlayer) |
---|
122 | c REAL zdiceco2a(ngrid) ! for diagnostic only |
---|
123 | real zdtsig (ngrid,nlayer) |
---|
124 | real zdt (ngrid,nlayer) |
---|
125 | real vmr_co2(ngrid,nlayer) ! co2 volume mixing ratio |
---|
126 | ! improved_ztcond flag: If set to .true. (AND running with a 'co2' tracer) |
---|
127 | ! then condensation temperature is computed using partial pressure of CO2 |
---|
128 | logical,parameter :: improved_ztcond=.true. |
---|
129 | |
---|
130 | c local saved variables |
---|
131 | integer,save :: ico2 ! index of CO2 tracer |
---|
132 | real,save :: qco2min,qco2,mmean |
---|
133 | real,parameter :: latcond=5.9e5 ! (J/kg) Latent heat of solid CO2 ice |
---|
134 | real,parameter :: tcond1mb=136.27 ! condensation temperature (K) at 1 mbar |
---|
135 | real,parameter :: cpice=1000. ! (J.kg-1.K-1) specific heat of CO2 ice |
---|
136 | REAL,SAVE :: acond,bcond,ccond |
---|
137 | real,save :: m_co2, m_noco2, A , B |
---|
138 | |
---|
139 | LOGICAL,SAVE :: firstcall = .true. !,firstcall2=.true. |
---|
140 | |
---|
141 | c D.BARDET: to debug |
---|
142 | real ztc3D(ngrid,nlayer) |
---|
143 | REAL ztm3D(ngrid,nlayer) |
---|
144 | REAL zmflux3D(ngrid,nlayer) |
---|
145 | c---------------------------------------------------------------------- |
---|
146 | |
---|
147 | c Initialisation |
---|
148 | c -------------- |
---|
149 | c |
---|
150 | ! AS: firstcall OK absolute |
---|
151 | IF (firstcall) THEN |
---|
152 | |
---|
153 | bcond=1./tcond1mb |
---|
154 | ccond=cpp/(g*latcond) |
---|
155 | acond=r/latcond |
---|
156 | |
---|
157 | firstcall=.false. |
---|
158 | write(*,*) 'Newcondens: improved_ztcond=',improved_ztcond |
---|
159 | PRINT*,'In newcondens:Tcond(P=1mb)=',tcond1mb,' Lcond=',latcond |
---|
160 | PRINT*,'acond,bcond,ccond',acond,bcond,ccond |
---|
161 | |
---|
162 | ico2=0 |
---|
163 | |
---|
164 | if (tracer) then |
---|
165 | c Prepare Special treatment if one of the tracer is CO2 gas |
---|
166 | do iq=1,nq |
---|
167 | if (noms(iq).eq."co2") then |
---|
168 | ico2=iq |
---|
169 | m_co2 = 44.01E-3 ! CO2 molecular mass (kg/mol) |
---|
170 | m_noco2 = 33.37E-3 ! Non condensible mol mass (kg/mol) |
---|
171 | c Compute A and B coefficient use to compute |
---|
172 | c mean molecular mass Mair defined by |
---|
173 | c 1/Mair = q(ico2)/m_co2 + (1-q(ico2))/m_noco2 |
---|
174 | c 1/Mair = A*q(ico2) + B |
---|
175 | A =(1/m_co2 - 1/m_noco2) |
---|
176 | B=1/m_noco2 |
---|
177 | endif |
---|
178 | enddo |
---|
179 | c minimum CO2 mix. ratio below which mixing occur with layer above: |
---|
180 | qco2min =0.75 |
---|
181 | end if |
---|
182 | ENDIF ! of IF (firstcall) |
---|
183 | zcpi=1./cpp |
---|
184 | |
---|
185 | c |
---|
186 | c====================================================================== |
---|
187 | c Calcul of CO2 condensation sublimation |
---|
188 | c ============================================================ |
---|
189 | c |
---|
190 | c Used variable : |
---|
191 | c piceco2(ngrid) : amount of co2 ice on the ground (kg/m2) |
---|
192 | c zcondicea(ngrid,l): condensation rate in layer l (kg/m2/s) |
---|
193 | c zcondices(ngrid): condensation rate on the ground (kg/m2/s) |
---|
194 | c zfallice(ngrid,l):amount of ice falling from layer l (kg/m2/s) |
---|
195 | c |
---|
196 | c pdtc(ngrid,nlayer) : dT/dt due to cond/sub |
---|
197 | c |
---|
198 | c |
---|
199 | c Tendencies set to 0 (except pdtc) |
---|
200 | c ------------------------------------- |
---|
201 | DO l=1,nlayer |
---|
202 | DO ig=1,ngrid |
---|
203 | zcondicea(ig,l) = 0. |
---|
204 | zfallice(ig,l) = 0. |
---|
205 | pduc(ig,l) = 0 |
---|
206 | pdvc(ig,l) = 0 |
---|
207 | END DO |
---|
208 | END DO |
---|
209 | |
---|
210 | DO iq=1,nq |
---|
211 | DO l=1,nlayer |
---|
212 | DO ig=1,ngrid |
---|
213 | pdqc(ig,l,iq) = 0 |
---|
214 | END DO |
---|
215 | END DO |
---|
216 | END DO |
---|
217 | |
---|
218 | DO ig=1,ngrid |
---|
219 | zfallice(ig,nlayer+1) = 0. |
---|
220 | zcondices(ig) = 0. |
---|
221 | pdtsrfc(ig) = 0. |
---|
222 | pdpsrf(ig) = 0. |
---|
223 | condsub(ig) = .false. |
---|
224 | zdiceco2(ig) = 0. |
---|
225 | ENDDO |
---|
226 | zfallheat=0 |
---|
227 | |
---|
228 | c ************************* |
---|
229 | c ATMOSPHERIC CONDENSATION |
---|
230 | c ************************* |
---|
231 | |
---|
232 | c Compute CO2 Volume mixing ratio |
---|
233 | c ------------------------------- |
---|
234 | if (improved_ztcond.and.(ico2.ne.0)) then |
---|
235 | DO l=1,nlayer |
---|
236 | DO ig=1,ngrid |
---|
237 | qco2=pq(ig,l,ico2)+pdq(ig,l,ico2)*ptimestep |
---|
238 | c Mean air molecular mass = 1/(q(ico2)/m_co2 + (1-q(ico2))/m_noco2) |
---|
239 | mmean=1/(A*qco2 +B) |
---|
240 | vmr_co2(ig,l) = qco2*mmean/m_co2 |
---|
241 | ENDDO |
---|
242 | ENDDO |
---|
243 | else |
---|
244 | DO l=1,nlayer |
---|
245 | DO ig=1,ngrid |
---|
246 | vmr_co2(ig,l)=0.95 |
---|
247 | ENDDO |
---|
248 | ENDDO |
---|
249 | end if |
---|
250 | |
---|
251 | IF (.NOT. co2clouds) then |
---|
252 | c forecast of atmospheric temperature zt and frost temperature ztcond |
---|
253 | c -------------------------------------------------------------------- |
---|
254 | |
---|
255 | DO l=1,nlayer |
---|
256 | DO ig=1,ngrid |
---|
257 | zt(ig,l)=pt(ig,l)+ pdt(ig,l)*ptimestep |
---|
258 | ! ztcond(ig,l)=1./(bcond-acond*log(.0095*pplay(ig,l))) |
---|
259 | if (pplay(ig,l).ge.1e-4) then |
---|
260 | ztcond(ig,l)= |
---|
261 | & 1./(bcond-acond*log(.01*vmr_co2(ig,l)*pplay(ig,l))) |
---|
262 | else |
---|
263 | ztcond(ig,l)=0.0 !mars Monica |
---|
264 | endif |
---|
265 | ENDDO |
---|
266 | ENDDO |
---|
267 | |
---|
268 | ztcond(:,nlayer+1)=ztcond(:,nlayer) |
---|
269 | |
---|
270 | c Condensation/sublimation in the atmosphere |
---|
271 | c ------------------------------------------ |
---|
272 | c (calcul of zcondicea , zfallice and pdtc) |
---|
273 | c |
---|
274 | DO l=nlayer , 1, -1 |
---|
275 | DO ig=1,ngrid |
---|
276 | pdtc(ig,l)=0. |
---|
277 | IF((zt(ig,l).LT.ztcond(ig,l)).or.(zfallice(ig,l+1).gt.0))THEN |
---|
278 | condsub(ig)=.true. |
---|
279 | IF (zfallice(ig,l+1).gt.0) then |
---|
280 | zfallheat=zfallice(ig,l+1)* |
---|
281 | & (pphi(ig,l+1)-pphi(ig,l) + |
---|
282 | & cpice*(ztcond(ig,l+1)-ztcond(ig,l)))/latcond |
---|
283 | ELSE |
---|
284 | zfallheat=0. |
---|
285 | ENDIF |
---|
286 | pdtc(ig,l)=(ztcond(ig,l) - zt(ig,l))/ptimestep |
---|
287 | zcondicea(ig,l)=(pplev(ig,l)-pplev(ig,l+1)) |
---|
288 | & *ccond*pdtc(ig,l)- zfallheat |
---|
289 | c Case when the ice from above sublimes entirely |
---|
290 | c """"""""""""""""""""""""""""""""""""""""""""""" |
---|
291 | IF (zfallice(ig,l+1).lt.- zcondicea(ig,l)) then |
---|
292 | pdtc(ig,l)=(-zfallice(ig,l+1)+zfallheat)/ |
---|
293 | & (ccond*(pplev(ig,l)-pplev(ig,l+1))) |
---|
294 | zcondicea(ig,l)= -zfallice(ig,l+1) |
---|
295 | END IF |
---|
296 | |
---|
297 | zfallice(ig,l) = zcondicea(ig,l)+zfallice(ig,l+1) |
---|
298 | END IF |
---|
299 | ENDDO |
---|
300 | ENDDO |
---|
301 | |
---|
302 | ELSE |
---|
303 | |
---|
304 | DO ig=1,ngrid |
---|
305 | zfallice(ig,1) = zdqssed_co2(ig) |
---|
306 | ENDDO |
---|
307 | DO l=nlayer , 1, -1 |
---|
308 | DO ig=1,ngrid |
---|
309 | zcondicea(ig,l) = pcondicea_co2microp(ig,l)* |
---|
310 | & (pplev(ig,l) - pplev(ig,l+1))/g |
---|
311 | ENDDO |
---|
312 | ENDDO |
---|
313 | DO l=nlayer, 1, -1 |
---|
314 | DO ig=1, ngrid |
---|
315 | zt(ig,l)=pt(ig,l)+ pdt(ig,l)*ptimestep |
---|
316 | pdtc(ig,l)=0. |
---|
317 | ENDDO |
---|
318 | ENDDO |
---|
319 | ENDIF ! if not co2clouds |
---|
320 | |
---|
321 | call WRITEdiagfi(ngrid,"pdtc_atm", |
---|
322 | & "temperature tendency due to CO2 condensation", |
---|
323 | & " ",3,pdtc) |
---|
324 | |
---|
325 | call WRITEdiagfi(ngrid,"zcondicea", |
---|
326 | & "", |
---|
327 | & " ",3,zcondicea) |
---|
328 | |
---|
329 | call WRITEdiagfi(ngrid,"zfallice", |
---|
330 | & "", |
---|
331 | & " ",2,zfallice(ngrid,1)) |
---|
332 | |
---|
333 | c ************************* |
---|
334 | c SURFACE CONDENSATION |
---|
335 | c ************************* |
---|
336 | |
---|
337 | c forecast of ground temperature ztsrf and frost temperature ztcondsol |
---|
338 | c -------------------------------------------------------------------- |
---|
339 | DO ig=1,ngrid |
---|
340 | ztcondsol(ig)= |
---|
341 | & 1./(bcond-acond*log(.01*vmr_co2(ig,1)*pplev(ig,1))) |
---|
342 | ztsrf(ig) = ptsrf(ig) + pdtsrf(ig)*ptimestep |
---|
343 | ENDDO |
---|
344 | |
---|
345 | c |
---|
346 | c Condensation/sublimation on the ground |
---|
347 | c -------------------------------------- |
---|
348 | c (compute zcondices and pdtsrfc) |
---|
349 | c |
---|
350 | DO ig=1,ngrid |
---|
351 | IF(latitude(ig).lt.0) THEN |
---|
352 | ! Southern hemisphere |
---|
353 | icap=2 |
---|
354 | ELSE |
---|
355 | ! Northern hemisphere |
---|
356 | icap=1 |
---|
357 | ENDIF |
---|
358 | |
---|
359 | c |
---|
360 | c Loop on where we have condensation/ sublimation |
---|
361 | IF ((ztsrf(ig) .LT. ztcondsol(ig)) .OR. ! ground cond |
---|
362 | $ (zfallice(ig,1).NE.0.) .OR. ! falling snow |
---|
363 | $ ((ztsrf(ig) .GT. ztcondsol(ig)) .AND. ! ground sublim. |
---|
364 | $ ((piceco2(ig)+zfallice(ig,1)*ptimestep) .NE. 0.))) THEN |
---|
365 | condsub(ig) = .true. |
---|
366 | |
---|
367 | IF (zfallice(ig,1).gt.0) then |
---|
368 | zfallheat=zfallice(ig,1)* |
---|
369 | & (pphi(ig,1)- phisfi(ig) + |
---|
370 | & cpice*(ztcond(ig,1)-ztcondsol(ig)))/latcond |
---|
371 | ELSE |
---|
372 | zfallheat=0. |
---|
373 | ENDIF |
---|
374 | |
---|
375 | c condensation or partial sublimation of CO2 ice |
---|
376 | c """"""""""""""""""""""""""""""""""""""""""""""" |
---|
377 | zcondices(ig)=pcapcal(ig)*(ztcondsol(ig)-ztsrf(ig)) |
---|
378 | & /(latcond*ptimestep) - zfallheat |
---|
379 | pdtsrfc(ig) = (ztcondsol(ig) - ztsrf(ig))/ptimestep |
---|
380 | |
---|
381 | c If the entire CO_2 ice layer sublimes |
---|
382 | c """""""""""""""""""""""""""""""""""""""""""""""""""" |
---|
383 | c (including what has just condensed in the atmosphere) |
---|
384 | |
---|
385 | IF((piceco2(ig)/ptimestep+zfallice(ig,1)).LE. |
---|
386 | & -zcondices(ig))THEN |
---|
387 | zcondices(ig) = -piceco2(ig)/ptimestep - zfallice(ig,1) |
---|
388 | pdtsrfc(ig)=(latcond/pcapcal(ig))* |
---|
389 | & (zcondices(ig)+zfallheat) |
---|
390 | END IF |
---|
391 | |
---|
392 | c Changing CO2 ice amount and pressure : |
---|
393 | c """""""""""""""""""""""""""""""""""" |
---|
394 | |
---|
395 | zdiceco2(ig) = zcondices(ig) + zfallice(ig,1) |
---|
396 | piceco2(ig) = piceco2(ig) + zdiceco2(ig)*ptimestep |
---|
397 | pdpsrf(ig) = -zdiceco2(ig)*g |
---|
398 | |
---|
399 | IF(ABS(pdpsrf(ig)*ptimestep).GT.pplev(ig,1)) THEN |
---|
400 | PRINT*,'STOP in condens' |
---|
401 | PRINT*,'condensing more than total mass' |
---|
402 | PRINT*,'Grid point ',ig |
---|
403 | PRINT*,'Ps = ',pplev(ig,1) |
---|
404 | PRINT*,'d Ps = ',pdpsrf(ig) |
---|
405 | STOP |
---|
406 | ENDIF |
---|
407 | END IF ! if there is condensation/sublimmation |
---|
408 | ENDDO ! of DO ig=1,ngrid |
---|
409 | |
---|
410 | c ******************************************************************** |
---|
411 | c Surface albedo and emissivity of the surface below the snow (emisref) |
---|
412 | c ******************************************************************** |
---|
413 | |
---|
414 | ! Check that amont of CO2 ice is not problematic |
---|
415 | DO ig=1,ngrid |
---|
416 | if(.not.piceco2(ig).ge.0.) THEN |
---|
417 | if(piceco2(ig).le.-5.e-8) print*, |
---|
418 | $ 'WARNING newcondens piceco2(',ig,')=', piceco2(ig) |
---|
419 | piceco2(ig)=0. |
---|
420 | endif |
---|
421 | ENDDO |
---|
422 | |
---|
423 | ! Set albedo and emissivity of the surface |
---|
424 | ! ---------------------------------------- |
---|
425 | CALL albedocaps(zls,ngrid,piceco2,psolaralb,emisref) |
---|
426 | |
---|
427 | ! set pemisurf() to emissiv when there is bare surface (needed for co2snow) |
---|
428 | DO ig=1,ngrid |
---|
429 | if (piceco2(ig).eq.0) then |
---|
430 | pemisurf(ig)=emissiv |
---|
431 | endif |
---|
432 | ENDDO |
---|
433 | |
---|
434 | ! firstcall2=.false. |
---|
435 | c *************************************************************** |
---|
436 | c Correction to account for redistribution between sigma or hybrid |
---|
437 | c layers when changing surface pressure (and warming/cooling |
---|
438 | c of the CO2 currently changing phase). |
---|
439 | c ************************************************************* |
---|
440 | |
---|
441 | DO ig=1,ngrid |
---|
442 | if (condsub(ig)) then |
---|
443 | do l=1,nlayer |
---|
444 | ztc(l) =zt(ig,l) +pdtc(ig,l) *ptimestep |
---|
445 | zu(l) =pu(ig,l) +pdu( ig,l) *ptimestep |
---|
446 | zv(l) =pv(ig,l) +pdv( ig,l) *ptimestep |
---|
447 | do iq=1,nq |
---|
448 | zq(l,iq)=pq(ig,l,iq)+pdq(ig,l,iq)*ptimestep |
---|
449 | enddo |
---|
450 | end do |
---|
451 | |
---|
452 | c Mass fluxes through the sigma levels (kg.m-2.s-1) (>0 when up) |
---|
453 | c """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
---|
454 | |
---|
455 | zmflux(1) = -zcondices(ig) |
---|
456 | DO l=1,nlayer |
---|
457 | zmflux(l+1) = zmflux(l) -zcondicea(ig,l) |
---|
458 | #ifndef MESOSCALE |
---|
459 | & + (bp(l)-bp(l+1))*(zfallice(ig,1)-zmflux(1)) |
---|
460 | c zmflux set to 0 if very low to avoid: top layer is disappearing in v1ld |
---|
461 | if (abs(zmflux(l+1)).lt.1E-13.OR.bp(l+1).eq.0.) zmflux(l+1)=0. |
---|
462 | #else |
---|
463 | if (abs(zmflux(l+1)).lt.1E-13) zmflux(l+1)=0. |
---|
464 | #endif |
---|
465 | END DO |
---|
466 | |
---|
467 | c Mass of each layer |
---|
468 | c ------------------ |
---|
469 | DO l=1,nlayer |
---|
470 | masse(l)=(pplev(ig,l) - pplev(ig,l+1))/g |
---|
471 | END DO |
---|
472 | |
---|
473 | |
---|
474 | c Corresponding fluxes for T,U,V,Q |
---|
475 | c """""""""""""""""""""""""""""""" |
---|
476 | |
---|
477 | c averaging operator for TRANSPORT |
---|
478 | c """""""""""""""""""""""""""""""" |
---|
479 | c Value transfert at the surface interface when condensation |
---|
480 | c sublimation: |
---|
481 | ztm(1) = ztsrf(ig) + pdtsrfc(ig)*ptimestep |
---|
482 | zum(1) = 0 |
---|
483 | zvm(1) = 0 |
---|
484 | do iq=1,nq |
---|
485 | zqm(1,iq)=0. ! most tracer do not condense ! |
---|
486 | enddo |
---|
487 | c Special case if one of the tracer is CO2 gas |
---|
488 | if (ico2.ne.0) zqm(1,ico2)=1. ! flux is 100% CO2 |
---|
489 | |
---|
490 | c Van Leer scheme: |
---|
491 | DO l=1,nlayer+1 |
---|
492 | w(l)=-zmflux(l)*ptimestep |
---|
493 | END DO |
---|
494 | call vl1d(nlayer,ztc,2.,masse,w,ztm) |
---|
495 | call vl1d(nlayer,zu ,2.,masse,w,zum) |
---|
496 | call vl1d(nlayer,zv ,2.,masse,w,zvm) |
---|
497 | do iq=1,nq |
---|
498 | do l=1,nlayer |
---|
499 | zq1(l)=zq(l,iq) |
---|
500 | enddo |
---|
501 | zqm1(1)=zqm(1,iq) |
---|
502 | call vl1d(nlayer,zq1,2.,masse,w,zqm1) |
---|
503 | do l=2,nlayer |
---|
504 | zq( l,iq)=zq1(l) |
---|
505 | zqm(l,iq)=zqm1(l) |
---|
506 | enddo |
---|
507 | enddo |
---|
508 | |
---|
509 | c Surface condensation affects low winds |
---|
510 | if (zmflux(1).lt.0) then |
---|
511 | zum(1)= zu(1) * (w(1)/masse(1)) |
---|
512 | zvm(1)= zv(1) * (w(1)/masse(1)) |
---|
513 | if (w(1).gt.masse(1)) then ! ensure numerical stability |
---|
514 | zum(1)= (zu(1)-zum(2))*masse(1)/w(1) + zum(2) |
---|
515 | zvm(1)= (zv(1)-zvm(2))*masse(1)/w(1) + zvm(2) |
---|
516 | end if |
---|
517 | end if |
---|
518 | |
---|
519 | ztm(nlayer+1)= ztc(nlayer) ! should not be used, but... |
---|
520 | zum(nlayer+1)= zu(nlayer) ! should not be used, but... |
---|
521 | zvm(nlayer+1)= zv(nlayer) ! should not be used, but... |
---|
522 | do iq=1,nq |
---|
523 | zqm(nlayer+1,iq)= zq(nlayer,iq) |
---|
524 | enddo |
---|
525 | |
---|
526 | #ifdef MESOSCALE |
---|
527 | !!!! AS: This part must be commented in the mesoscale model |
---|
528 | !!!! AS: ... to avoid instabilities. |
---|
529 | !!!! AS: you have to compile with -DMESOSCALE to do so |
---|
530 | #else |
---|
531 | c Tendencies on T, U, V, Q |
---|
532 | c """""""""""""""""""""""" |
---|
533 | DO l=1,nlayer |
---|
534 | IF(.not. co2clouds) THEN |
---|
535 | c Tendencies on T |
---|
536 | zdtsig(ig,l) = (1/masse(l)) * |
---|
537 | & ( zmflux(l)*(ztm(l) - ztc(l)) |
---|
538 | & - zmflux(l+1)*(ztm(l+1) - ztc(l)) |
---|
539 | & + zcondicea(ig,l)*(ztcond(ig,l)-ztc(l)) ) |
---|
540 | ELSE |
---|
541 | zdtsig(ig,l) = (1/masse(l)) * |
---|
542 | & ( zmflux(l)*(ztm(l) - ztc(l)) |
---|
543 | & - zmflux(l+1)*(ztm(l+1) - ztc(l))) |
---|
544 | ENDIF |
---|
545 | c D.BARDET: for diagnotics |
---|
546 | zmflux3D(ig,l)=zmflux(l) |
---|
547 | ztm3D(ig,l)=ztm(l) |
---|
548 | ztc3D(ig,l)=ztc(l) |
---|
549 | |
---|
550 | pdtc(ig,l) = pdtc(ig,l) + zdtsig(ig,l) |
---|
551 | |
---|
552 | c Tendencies on U |
---|
553 | pduc(ig,l) = (1/masse(l)) * |
---|
554 | & ( zmflux(l)*(zum(l) - zu(l)) |
---|
555 | & - zmflux(l+1)*(zum(l+1) - zu(l)) ) |
---|
556 | |
---|
557 | |
---|
558 | c Tendencies on V |
---|
559 | pdvc(ig,l) = (1/masse(l)) * |
---|
560 | & ( zmflux(l)*(zvm(l) - zv(l)) |
---|
561 | & - zmflux(l+1)*(zvm(l+1) - zv(l)) ) |
---|
562 | |
---|
563 | END DO |
---|
564 | |
---|
565 | #endif |
---|
566 | |
---|
567 | c Tendencies on Q |
---|
568 | do iq=1,nq |
---|
569 | ! if (noms(iq).eq.'co2') then |
---|
570 | if (iq.eq.ico2) then |
---|
571 | c SPECIAL Case when the tracer IS CO2 : |
---|
572 | DO l=1,nlayer |
---|
573 | pdqc(ig,l,iq)= (1/masse(l)) * |
---|
574 | & ( zmflux(l)*(zqm(l,iq) - zq(l,iq)) |
---|
575 | & - zmflux(l+1)*(zqm(l+1,iq) - zq(l,iq)) |
---|
576 | & + zcondicea(ig,l)*(zq(l,iq)-1.) ) |
---|
577 | END DO |
---|
578 | else |
---|
579 | DO l=1,nlayer |
---|
580 | pdqc(ig,l,iq)= (1/masse(l)) * |
---|
581 | & ( zmflux(l)*(zqm(l,iq) - zq(l,iq)) |
---|
582 | & - zmflux(l+1)*(zqm(l+1,iq) - zq(l,iq)) |
---|
583 | & + zcondicea(ig,l)*zq(l,iq) ) |
---|
584 | END DO |
---|
585 | end if |
---|
586 | enddo |
---|
587 | |
---|
588 | end if ! if (condsub) |
---|
589 | END DO ! loop on ig |
---|
590 | |
---|
591 | c *************************************************************** |
---|
592 | c CO2 snow / clouds scheme |
---|
593 | c *************************************************************** |
---|
594 | |
---|
595 | call co2snow(ngrid,nlayer,ptimestep,emisref,condsub,pplev, |
---|
596 | & zcondicea,zcondices,zfallice,pemisurf) |
---|
597 | |
---|
598 | c *************************************************************** |
---|
599 | c Ecriture des diagnostiques |
---|
600 | c *************************************************************** |
---|
601 | |
---|
602 | c DO l=1,nlayer |
---|
603 | c DO ig=1,ngrid |
---|
604 | c Taux de cond en kg.m-2.pa-1.s-1 |
---|
605 | c tconda1(ig,l)=zcondicea(ig,l)/(pplev(ig,l)-pplev(ig,l+1)) |
---|
606 | c Taux de cond en kg.m-3.s-1 |
---|
607 | c tconda2(ig,l)=tconda1(ig,l)*pplay(ig,l)*g/(r*pt(ig,l)) |
---|
608 | c END DO |
---|
609 | c END DO |
---|
610 | c call WRITEDIAGFI(ngrid,'tconda1', |
---|
611 | c &'Taux de condensation CO2 atmospherique /Pa', |
---|
612 | c & 'kg.m-2.Pa-1.s-1',3,tconda1) |
---|
613 | c call WRITEDIAGFI(ngrid,'tconda2', |
---|
614 | c &'Taux de condensation CO2 atmospherique /m', |
---|
615 | c & 'kg.m-3.s-1',3,tconda2) |
---|
616 | |
---|
617 | ! output falling co2 ice in 1st layer: |
---|
618 | ! call WRITEDIAGFI(ngrid,'fallice', |
---|
619 | ! &'Precipitation of co2 ice', |
---|
620 | ! & 'kg.m-2.s-1',2,zfallice(1,1)) |
---|
621 | |
---|
622 | #ifndef MESOSCALE |
---|
623 | ! Extra special case for surface temperature tendency pdtsrfc: |
---|
624 | ! we want to fix the south pole temperature to CO2 condensation temperature |
---|
625 | if (caps.and.(obliquit.lt.27.)) then |
---|
626 | ! check if last grid point is the south pole |
---|
627 | if (abs(latitude(ngrid)-(-pi/2.)).lt.1.e-5) then |
---|
628 | ! NB: Updated surface pressure, at grid point 'ngrid', is |
---|
629 | ! ps(ngrid)=pplev(ngrid,1)+pdpsrf(ngrid)*ptimestep |
---|
630 | ! write(*,*) "newcondens: South pole: latitude(ngrid)=", |
---|
631 | ! & latitude(ngrid) |
---|
632 | ztcondsol(ngrid)= |
---|
633 | & 1./(bcond-acond*log(.01*vmr_co2(ngrid,1)* |
---|
634 | & (pplev(ngrid,1)+pdpsrf(ngrid)*ptimestep))) |
---|
635 | pdtsrfc(ngrid)=(ztcondsol(ngrid)-ztsrf(ngrid))/ptimestep |
---|
636 | endif |
---|
637 | endif |
---|
638 | #endif |
---|
639 | |
---|
640 | END SUBROUTINE co2condens |
---|
641 | |
---|
642 | |
---|
643 | |
---|
644 | c ***************************************************************** |
---|
645 | SUBROUTINE vl1d(nlayer,q,pente_max,masse,w,qm) |
---|
646 | c |
---|
647 | c |
---|
648 | c Operateur de moyenne inter-couche pour calcul de transport type |
---|
649 | c Van-Leer " pseudo amont " dans la verticale |
---|
650 | c q,w sont des arguments d'entree pour le s-pg .... |
---|
651 | c masse : masse de la couche Dp/g |
---|
652 | c w : masse d'atm ``transferee'' a chaque pas de temps (kg.m-2) |
---|
653 | c pente_max = 2 conseillee |
---|
654 | c |
---|
655 | c |
---|
656 | c -------------------------------------------------------------------- |
---|
657 | IMPLICIT NONE |
---|
658 | |
---|
659 | c |
---|
660 | c |
---|
661 | c |
---|
662 | c Arguments: |
---|
663 | c ---------- |
---|
664 | integer nlayer |
---|
665 | real masse(nlayer),pente_max |
---|
666 | REAL q(nlayer),qm(nlayer+1) |
---|
667 | REAL w(nlayer+1) |
---|
668 | c |
---|
669 | c Local |
---|
670 | c --------- |
---|
671 | c |
---|
672 | INTEGER l |
---|
673 | c |
---|
674 | real dzq(nlayer),dzqw(nlayer),adzqw(nlayer),dzqmax |
---|
675 | real sigw, Mtot, MQtot |
---|
676 | integer m |
---|
677 | c integer ismax,ismin |
---|
678 | |
---|
679 | |
---|
680 | c On oriente tout dans le sens de la pression |
---|
681 | c W > 0 WHEN DOWN !!!!!!!!!!!!! |
---|
682 | |
---|
683 | do l=2,nlayer |
---|
684 | dzqw(l)=q(l-1)-q(l) |
---|
685 | adzqw(l)=abs(dzqw(l)) |
---|
686 | enddo |
---|
687 | |
---|
688 | do l=2,nlayer-1 |
---|
689 | if(dzqw(l)*dzqw(l+1).gt.0.) then |
---|
690 | dzq(l)=0.5*(dzqw(l)+dzqw(l+1)) |
---|
691 | else |
---|
692 | dzq(l)=0. |
---|
693 | endif |
---|
694 | dzqmax=pente_max*min(adzqw(l),adzqw(l+1)) |
---|
695 | dzq(l)=sign(min(abs(dzq(l)),dzqmax),dzq(l)) |
---|
696 | enddo |
---|
697 | |
---|
698 | dzq(1)=0. |
---|
699 | dzq(nlayer)=0. |
---|
700 | |
---|
701 | do l = 1,nlayer-1 |
---|
702 | |
---|
703 | c Regular scheme (transfered mass < layer mass) |
---|
704 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
705 | if(w(l+1).gt.0. .and. w(l+1).le.masse(l+1)) then |
---|
706 | sigw=w(l+1)/masse(l+1) |
---|
707 | qm(l+1)=(q(l+1)+0.5*(1.-sigw)*dzq(l+1)) |
---|
708 | else if(w(l+1).le.0. .and. -w(l+1).le.masse(l)) then |
---|
709 | sigw=w(l+1)/masse(l) |
---|
710 | qm(l+1)=(q(l)-0.5*(1.+sigw)*dzq(l)) |
---|
711 | |
---|
712 | c Extended scheme (transfered mass > layer mass) |
---|
713 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
714 | else if(w(l+1).gt.0.) then |
---|
715 | m=l+1 |
---|
716 | Mtot = masse(m) |
---|
717 | MQtot = masse(m)*q(m) |
---|
718 | do while ((m.lt.nlayer).and.(w(l+1).gt.(Mtot+masse(m+1)))) |
---|
719 | m=m+1 |
---|
720 | Mtot = Mtot + masse(m) |
---|
721 | MQtot = MQtot + masse(m)*q(m) |
---|
722 | end do |
---|
723 | if (m.lt.nlayer) then |
---|
724 | sigw=(w(l+1)-Mtot)/masse(m+1) |
---|
725 | qm(l+1)= (1/w(l+1))*(MQtot + (w(l+1)-Mtot)* |
---|
726 | & (q(m+1)+0.5*(1.-sigw)*dzq(m+1)) ) |
---|
727 | else |
---|
728 | w(l+1) = Mtot |
---|
729 | qm(l+1) = Mqtot / Mtot |
---|
730 | write(*,*) 'top layer is disapearing !' |
---|
731 | stop |
---|
732 | end if |
---|
733 | else ! if(w(l+1).lt.0) |
---|
734 | m = l-1 |
---|
735 | Mtot = masse(m+1) |
---|
736 | MQtot = masse(m+1)*q(m+1) |
---|
737 | if (m.gt.0) then ! because some compilers will have problems |
---|
738 | ! evaluating masse(0) |
---|
739 | do while ((m.gt.0).and.(-w(l+1).gt.(Mtot+masse(m)))) |
---|
740 | m=m-1 |
---|
741 | Mtot = Mtot + masse(m+1) |
---|
742 | MQtot = MQtot + masse(m+1)*q(m+1) |
---|
743 | if (m.eq.0) exit |
---|
744 | end do |
---|
745 | endif |
---|
746 | if (m.gt.0) then |
---|
747 | sigw=(w(l+1)+Mtot)/masse(m) |
---|
748 | qm(l+1)= (-1/w(l+1))*(MQtot + (-w(l+1)-Mtot)* |
---|
749 | & (q(m)-0.5*(1.+sigw)*dzq(m)) ) |
---|
750 | else |
---|
751 | qm(l+1)= (-1/w(l+1))*(MQtot + (-w(l+1)-Mtot)*qm(1)) |
---|
752 | end if |
---|
753 | end if |
---|
754 | enddo |
---|
755 | |
---|
756 | c boundary conditions (not used in newcondens !!) |
---|
757 | c qm(nlayer+1)=0. |
---|
758 | c if(w(1).gt.0.) then |
---|
759 | c qm(1)=q(1) |
---|
760 | c else |
---|
761 | c qm(1)=0. |
---|
762 | c end if |
---|
763 | |
---|
764 | END SUBROUTINE vl1d |
---|
765 | |
---|
766 | END MODULE co2condens_mod |
---|