GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/lsc_scav.F90 Lines: 0 93 0.0 %
Date: 2023-06-30 12:51:15 Branches: 0 56 0.0 %

Line Branch Exec Source
1
!$Id $
2
3
SUBROUTINE lsc_scav(pdtime,it,iflag_lscav, aerosol,  &
4
                    oliq,flxr,flxs,rneb,beta_fisrt,  &
5
                    beta_v1,pplay,paprs,t,tr_seri,   &
6
                    d_tr_insc,d_tr_bcscav,d_tr_evap,qPrls)
7
  USE ioipsl
8
  USE dimphy
9
  USE mod_grid_phy_lmdz
10
  USE mod_phys_lmdz_para
11
  USE traclmdz_mod
12
  USE infotrac_phy,ONLY : nbtr
13
  USE iophy
14
  IMPLICIT NONE
15
!=====================================================================
16
! Objet : depot humide (lessivage et evaporation) de traceurs
17
! Inspired by routines of Olivier Boucher (mars 1998)
18
! author R. Pilon 10 octobre 2012
19
! last modification 16/01/2013 (reformulation partie evaporation)
20
!=====================================================================
21
22
  include "chem.h"
23
  include "YOMCST.h"
24
  include "YOECUMF.h"
25
26
! inputs
27
  REAL,INTENT(IN)                        :: pdtime ! time step (s)
28
  INTEGER,INTENT(IN)                     :: it     ! tracer number
29
  INTEGER,INTENT(IN)                     :: iflag_lscav ! LS scavenging param: 3=Reddy_Boucher2004, 4=3+RPilon.
30
  REAL,DIMENSION(klon,klev+1),INTENT(IN) :: flxr     ! flux precipitant de pluie
31
  REAL,DIMENSION(klon,klev+1),INTENT(IN) :: flxs     ! flux precipitant de neige
32
  REAL,INTENT(IN)                        :: oliq ! contenu en eau liquide dans le nuage (kg/kg)
33
  REAL,DIMENSION(klon,klev),INTENT(IN)   :: rneb
34
  REAL,DIMENSION(klon,klev),INTENT(IN)   :: pplay    ! pression
35
  REAL,DIMENSION(klon,klev+1),INTENT(IN) :: paprs    ! pression
36
  REAL,DIMENSION(klon,klev),INTENT(IN)   :: t        ! temperature
37
! tracers
38
  LOGICAL,DIMENSION(nbtr), INTENT(IN)         :: aerosol
39
  REAL,DIMENSION(klon,klev,nbtr),INTENT(IN)   :: tr_seri        ! q de traceur
40
  REAL,DIMENSION(klon,klev),INTENT(IN)        :: beta_fisrt     ! taux de conversion de l'eau cond
41
  REAL,DIMENSION(klon,klev),INTENT(OUT)       :: beta_v1        ! -- (originale version)
42
  REAL,DIMENSION(klon)                        :: his_dh         ! tendance de traceur integre verticalement
43
  REAL,DIMENSION(klon,klev,nbtr),INTENT(OUT)  :: d_tr_insc      ! tendance du traceur
44
  REAL,DIMENSION(klon,klev,nbtr),INTENT(OUT)  :: d_tr_bcscav  ! tendance de traceur
45
  REAL,DIMENSION(klon,klev,nbtr),INTENT(OUT)  :: d_tr_evap
46
  REAL,DIMENSION(klon,nbtr),INTENT(OUT)       :: qPrls      !jyg: concentration tra dans pluie LS a la surf.
47
  REAL :: dxin,dxev                              ! tendance temporaire de traceur incloud
48
  REAL,DIMENSION(klon,klev) :: dxbc       ! tendance temporaire de traceur bc
49
50
!  variables locales
51
 LOGICAL,SAVE :: debut=.TRUE.
52
!$OMP THREADPRIVATE(debut)
53
!
54
  REAL,PARAMETER :: henry=1.4  ! constante de Henry en mol/l/atm ~1.4 for gases
55
  REAL           :: henry_t    !  constante de Henry a T t  (mol/l/atm)
56
  REAL,PARAMETER :: kk=2900.   ! coefficient de dependence en T (K)
57
  REAL :: f_a     !  rapport de la phase aqueuse a la phase gazeuse
58
  REAL :: beta    !  taux de conversion de l'eau en pluie
59
60
  INTEGER :: i, k
61
  REAL,DIMENSION(klon,klev)    :: scav  !  water liquid content / fraction aqueuse du constituant
62
  REAL,DIMENSION(klon,klev)    :: zrho
63
  REAL,DIMENSION(klon,klev)    :: zdz
64
  REAL,DIMENSION(klon,klev)    :: zmass ! layer mass
65
66
  REAL           :: frac_ev       ! cste pour la reevaporation : dropplet shrinking
67
!  frac_ev = frac_gas ou frac_aer
68
  REAL,PARAMETER :: frac_gas=1.0  ! cste pour la reevaporation pour les gaz
69
  REAL           :: frac_aer      ! cste pour la reevaporation pour les particules
70
  REAL,DIMENSION(klon,klev) :: deltaP     ! P(i+1)-P(i)
71
  REAL,DIMENSION(klon,klev) :: beta_ev    !  dP/P(i+1)
72
73
!  101.325  m3/l x Pa/atm
74
!  R        Pa.m3/mol/K
75
!   cste de dissolution pour le depot humide
76
  REAL,SAVE :: frac_fine_scav
77
  REAL,SAVE :: frac_coar_scav
78
!$OMP THREADPRIVATE(frac_fine_scav, frac_coar_scav)
79
80
! below-cloud scav variables
81
! aerosol : alpha_r=0.001, gas 0.001  (Pruppacher & Klett 1967)
82
  REAL,SAVE :: alpha_r  !  coefficient d'impaction pour la pluie
83
  REAL,SAVE :: alpha_s  !  coefficient d'impaction pour la neige
84
  REAL,SAVE :: R_r      !  mean raindrop radius (m)
85
  REAL,SAVE :: R_s      !  mean snow crystal radius (m)
86
!$OMP THREADPRIVATE(alpha_r, alpha_s, R_r, R_s)
87
  REAL           :: pr, ps, ice, water
88
!  REAL :: conserv
89
!
90
!
91
  IF (debut) THEN
92
!
93
      alpha_r=0.001        !  coefficient d'impaction pour la pluie
94
      alpha_s=0.01         !  coefficient d'impaction pour la neige
95
      R_r=0.001            !  mean raindrop radius (m)
96
      R_s=0.001            !  mean snow crystal radius (m)
97
      frac_fine_scav=0.7
98
      frac_coar_scav=0.7
99
!     Droplet size shrinks by evap
100
      frac_aer=0.5
101
!
102
      OPEN(99,file='lsc_scav_param.data',status='old', &
103
                form='formatted',err=9999)
104
      READ(99,*,end=9998)  alpha_r
105
      READ(99,*,end=9998)  alpha_s
106
      READ(99,*,end=9998)  R_r
107
      READ(99,*,end=9998)  R_s
108
      READ(99,*,end=9998)  frac_fine_scav
109
      READ(99,*,end=9998)  frac_coar_scav
110
      READ(99,*,end=9998)  frac_aer
111
9998  CONTINUE
112
      CLOSE(99)
113
9999  CONTINUE
114
115
   print*,'alpha_r',alpha_r
116
   print*,'alpha_s',alpha_s
117
   print*,'R_r',R_r
118
   print*,'R_s',R_s
119
   print*,'frac_fine_scav',frac_fine_scav
120
   print*,'frac_coar_scav',frac_coar_scav
121
   print*,'frac_aer ev',frac_aer
122
!
123
  ENDIF !(debut)
124
!!!!!!!!!!!!!!!!!!!!!!!!!!!
125
!
126
! initialization
127
  dxin=0.
128
  dxev=0.
129
  beta_ev=0.
130
131
  DO i=1,klon
132
   his_dh(i)=0.
133
  ENDDO
134
135
  DO k=1,klev
136
   DO i=1, klon
137
    dxbc(i,k)=0.
138
    beta_v1(i,k)=0.
139
    deltaP(i,k)=0.
140
   ENDDO
141
  ENDDO
142
143
!  pressure and size of the layer
144
  DO k=klev, 1, -1
145
   DO i=1, klon
146
     zrho(i,k)=pplay(i,k)/t(i,k)/RD
147
     zdz(i,k)=(paprs(i,k)-paprs(i,k+1))/zrho(i,k)/RG
148
     zmass(i,k)=(paprs(i,k)-paprs(i,k+1))/RG
149
   ENDDO
150
  ENDDO
151
152
!jyg<
153
!! Temporary correction: all non-aerosol tracers are dealt with in the same way.
154
!! Should be updated once it has been decided how gases should be dealt with.
155
  IF (aerosol(it)) THEN
156
      frac_ev=frac_aer
157
  ELSE                                                !  gas
158
      frac_ev=frac_gas
159
  ENDIF
160
!
161
!jyg<
162
  IF (aerosol(it)) THEN ! aerosol
163
    DO k=1, klev
164
      DO i=1, klon
165
       scav(i,k)=frac_fine_scav
166
      ENDDO
167
    ENDDO
168
  ELSE                  ! gas
169
    DO k=1, klev
170
      DO i=1, klon
171
       henry_t=henry*exp(-kk*(1./298.-1./t(i,k)))    !  mol/l/atm
172
       f_a=henry_t/101.325*R*t(i,k)*oliq*zrho(i,k)/rho_water
173
       scav(i,k)=f_a/(1.+f_a)
174
      ENDDO
175
    ENDDO
176
  ENDIF
177
178
  DO k=klev-1, 1, -1
179
    DO i=1, klon
180
!  incloud scavenging
181
      IF (iflag_lscav .EQ. 4) THEN
182
        beta=beta_fisrt(i,k)*rneb(i,k)
183
      ELSE
184
        beta=flxr(i,k)-flxr(i,k+1)+flxs(i,k)-flxs(i,k+1)
185
        beta=beta/zmass(i,k)/oliq
186
        beta=MAX(0.,beta)
187
      ENDIF ! (iflag_lscav .eq. 4)
188
      beta_v1(i,k)=beta    !! for output
189
!
190
      dxin=tr_seri(i,k,it)*(exp(-scav(i,k)*beta*pdtime)-1.)
191
      his_dh(i)=his_dh(i)-dxin*zmass(i,k)/pdtime !  kg/m2/s
192
      d_tr_insc(i,k,it)=dxin                     !  kg/kg/timestep
193
194
!  below-cloud impaction
195
!jyg<
196
      IF (.NOT.aerosol(it)) THEN
197
        d_tr_bcscav(i,k,it)=0.
198
      ELSE
199
        pr=0.5*(flxr(i,k)+flxr(i,k+1))
200
        ps=0.5*(flxs(i,k)+flxs(i,k+1))
201
        water=pr*alpha_r/R_r/rho_water
202
        ice=ps*alpha_s/R_s/rho_ice
203
        dxbc(i,k)=-3./4.*tr_seri(i,k,it)*pdtime*(water+ice)
204
!      add tracers from below cloud scav in his_dh
205
        his_dh(i)=his_dh(i)-dxbc(i,k)*zmass(i,k)/pdtime !  kg/m2/s
206
        d_tr_bcscav(i,k,it)=dxbc(i,k)                   !  kg/kg/timestep
207
      ENDIF
208
209
!  reevaporation
210
      deltaP(i,k)=flxr(i,k+1)+flxs(i,k+1)-flxr(i,k)-flxs(i,k)
211
      deltaP(i,k)=max(deltaP(i,k),0.)
212
213
      IF (flxr(i,k+1)+flxs(i,k+1).GT.1.e-16) THEn
214
        beta_ev(i,k)=deltaP(i,k)/(flxr(i,k+1)+flxs(i,k+1))
215
      ELSE
216
        beta_ev(i,k)=0.
217
      ENDIF
218
219
      beta_ev(i,k)=max(min(1.,beta_ev(i,k)),0.)
220
221
!jyg
222
      IF (ABS(1.-(1.-frac_ev)*beta_ev(i,k)).GT.1.e-16) THEN
223
! remove tracers from precipitation owing to release by evaporation in his_dh
224
        dxev=frac_ev*beta_ev(i,k)*his_dh(i)*pdtime/zmass(i,k)/(1.-(1.-frac_ev)*beta_ev(i,k))
225
        his_dh(i)=his_dh(i)*(1.-frac_ev*beta_ev(i,k)/(1.-(1.-frac_ev)*beta_ev(i,k)))
226
      ELSE
227
        dxev=his_dh(i)*pdtime/zmass(i,k)
228
        his_dh(i)=0.
229
      ENDIF
230
!
231
!      print*,  k, 'beta_ev',beta_ev
232
! remove tracers from precipitation owing to release by evaporation in his_dh
233
!      dxev=frac_ev*deltaP(i,k)*pdtime * his_dh(i) /(zrho(i,k)*zdz(i,k))
234
!rplmd
235
!      dxev=frac_ev*deltaP(i,k)*his_dh(i) *pdtime/(zrho(i,k)*zdz(i,k))/max(flxr(i,k)+flxs(i,k),1.e-16)
236
237
      d_tr_evap(i,k,it)=dxev       !  kg/kg/timestep
238
!
239
    ENDDO
240
  ENDDO
241
!
242
  DO i = 1,klon
243
     qPrls(i,it) = his_dh(i)/max(flxr(i,1)+flxs(i,1),1.e-16)
244
  ENDDO
245
!
246
! test de conservation
247
!      conserv=0.
248
!      DO k= klev,1,-1
249
!        DO i=1, klon
250
!         conserv=conserv+d_tr_insc(i,k,it)*(paprs(i,k)-paprs(i,k+1))/RG &
251
!                +d_tr_bcscav(i,k,it)*(paprs(i,k)-paprs(i,k+1))/RG  &
252
!                +d_tr_evap(i,k,it)*(paprs(i,k)-paprs(i,k+1))/RG
253
!      if(it.eq.3) write(*,'(I2,2X,a,e20.12,2X,a,e20.12,2X,a,e20.12,2X,a,e20.12)'),&
254
!      k,'lsc conserv ',conserv,'insc',d_tr_insc(i,k,it),'bc',d_tr_bcscav(i,k,it),'ev',d_tr_evap(i,k,it)
255
!       ENDDO
256
!     ENDDO
257
258
END SUBROUTINE lsc_scav