source: trunk/LMDZ.MARS/libf/phymars/callsedim.F @ 380

Last change on this file since 380 was 358, checked in by aslmd, 14 years ago

LMDZ.MARS:


A FIRST VERSION WITH SCAVENGING
TRANSPARENT TO CASUAL USER
FOR WATER CYCLE FOLKS, SEE BELOW


[TN and AS solved conflicts due to r330 >> r357]


07/11/11 == JBM

Changed watercloud.F to call two separate routines,

simpleclouds.F or improvedclouds.F, which are a simplified and
full microphysical scheme for cloud formation, respectively.
Removed the tag called "improved" in watercloud.F, and added
another tag called "microphys" which is defined in callphys.F
instead. Changed routines: callkeys, inifis, physiq, watercloud.

Reimplemented the use of typical profiles of dust particle sizes

and CCNs in simpleclouds.F. Corrected the previously used
analytical CCN profile. Moved ccn_factor to simpleclouds.F,
which won't be used in the new microphysical scheme. Changed
routines: aeropacity, physiq, simpleclouds, watercloud.

Computed rdust at the end of callsedim instead of updatereffrad,

except at firstcall. Renamed rfall into rsedcloud and moved it
in simpleclouds. Moved nuice_sed to initracer.F and added it to
tracer.h. Changed routines: callsedim, physiq, tracer.h,
watercloud, initracer, simpleclouds, updatereffrad.

Added two tracers for the CCNs. Added the different tests in

initracer.F to make sure that, for example, microphys is not
used without doubleq, etc. Corrected an inconsistency in
callsedim.F, and changed the way r0 is updated. Changes
routines: callsedim, inifis, initracer, physiq, testphys1d,
tracer.h.

Added the ability to have a spatially variable density in

newsedim (same method as that used for the radius of
sedimentation). Required the addition of one input to newsedim,
which is the size of the density variable "rho". Changed
routines: callsedim, newsedim.

Added an output to aeropacity called "tauscaling", which is a

factor to convert dust_mass and dust_number to true quantities,
based on tauvis. Removed ccn and qdust from aeropacity, which
are obsolete now.

Wrote improvedcloud.F which includes all the microphysical

scheme, and connected it to the sedimentation scheme. Added and
changed routines: callsedim, physiq, growthrate, nuclea,
improvedclouds, initracer, watercloud, microphys.h.

07/11/11 == TN

Added CCN & dust tracers updates in physiq.F

Corrected a bug that can give negative CCN numbers, due to the
use of single precision values (only 6 decimals) whereas up to 10E+10
CCN can be formed or disappears...

Corrected physical bug that causes h2o_vap or h2o_ice

to be negative in improvedclouds.F.

Corrected physical bug that causes CCN & dust tracers

to be negative in improvedclouds.F when all ice sublimates and
releases dust

Added parameter contact mteta in callphys.def

Default value is still 0.95, see inifis.F

Changed tendancy computation for dust_number in improvedclouds.F

that was not the right one. Indeed, the scavenged dust_number tracer
is computed from the dust_mass one, and its tendancy before scavenging
must be taken into account to compute its scavenging's tendancy.

File size: 13.7 KB
Line 
1      SUBROUTINE callsedim(ngrid,nlay, ptimestep,
2     &                pplev,zlev, pt, rdust, rice,
3     &                rsedcloud,rhocloud,
4     &                pq, pdqfi, pdqsed,pdqs_sed,nq)
5      IMPLICIT NONE
6
7c=======================================================================
8c      Sedimentation of the  Martian aerosols
9c      depending on their density and radius
10c
11c      F.Forget 1999
12c
13c      Modified by J.-B. Madeleine 2010: Now includes the doubleq
14c        technique in order to have only one call to callsedim in
15c        physiq.F.
16c
17c=======================================================================
18
19c-----------------------------------------------------------------------
20c   declarations:
21c   -------------
22
23#include "dimensions.h"
24#include "dimphys.h"
25#include "comcstfi.h"
26#include "tracer.h"
27#include "callkeys.h"
28
29c
30c   arguments:
31c   ----------
32
33      INTEGER ngrid              ! number of horizontal grid points
34      INTEGER nlay               ! number of atmospheric layers
35      REAL ptimestep             ! physics time step (s)
36      REAL pplev(ngrid,nlay+1)   ! pressure at inter-layers (Pa)
37      REAL pt(ngrid,nlay)        ! temperature at mid-layer (K)
38      REAL zlev(ngrid,nlay+1)    ! altitude at layer boundaries
39c    Aerosol radius provided by the water ice microphysical scheme:
40      REAL rdust(ngrid,nlay)     ! Dust geometric mean radius (m)
41      REAL rice(ngrid,nlay)      ! Ice geometric mean radius (m)
42
43c    Traceurs :
44      integer nq             ! number of tracers
45      real pq(ngrid,nlay,nq)  ! tracers (kg/kg)
46      real pdqfi(ngrid,nlay,nq)  ! tendency before sedimentation (kg/kg.s-1)
47      real pdqsed(ngrid,nlay,nq) ! tendency due to sedimentation (kg/kg.s-1)
48      real pdqs_sed(ngrid,nq)    ! flux at surface (kg.m-2.s-1)
49     
50c   local:
51c   ------
52
53      REAL CBRT
54      EXTERNAL CBRT
55
56      INTEGER l,ig, iq
57
58      real zqi(ngridmx,nlayermx,nqmx) ! to locally store tracers
59      real masse (ngridmx,nlayermx) ! Layer mass (kg.m-2)
60      real epaisseur (ngridmx,nlayermx) ! Layer thickness (m)
61      real wq(ngridmx,nlayermx+1) ! displaced tracer mass (kg.m-2)
62      real r0(ngridmx,nlayermx) ! geometric mean radius used for
63                                !   sedimentation (m)
64      real r0dust(ngridmx,nlayermx) ! geometric mean radius used for
65                                    !   dust (m)
66      real r0ccn(ngridmx,nlayermx)  ! geometric mean radius used for
67                                    !   CCNs (m)
68c     Sedimentation radius of water ice
69      real rsedcloud(ngridmx,nlayermx)
70c     Cloud density (kg.m-3)
71      real rhocloud(ngridmx,nlayermx)
72
73
74c     Discrete size distributions (doubleq)
75c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76c       1) Parameters used to represent the changes in fall
77c          velocity as a function of particle size;
78      integer nr,ir
79      parameter (nr=12) !(nr=7) ! number of bins
80      real rd(nr),qr(ngridmx,nlayermx,nr)
81      real rdi(nr+1)    ! extreme and intermediate radii
82      real Sq(ngridmx,nlayermx)
83      real rdmin,rdmax,rdimin,rdimax
84      data rdmin/1.e-8/ !/1.e-7/
85      data rdmax/30.e-6/
86      data rdimin/1.e-10/
87      data rdimax/1e-4/
88      save rd, rdi
89
90c       2) Second size distribution for the log-normal integration
91c          (the mass mixing ratio is computed for each radius)
92
93      integer ninter, iint
94      parameter (ninter=4)  ! nombre de point entre chaque rayon rdi
95      real rr(ninter,nr)
96      save rr
97      integer radpower
98      real sigma0
99
100c       3) Other local variables used in doubleq
101
102      INTEGER idust_mass   ! index of tracer containing dust mass
103                           !   mix. ratio
104      INTEGER idust_number ! index of tracer containing dust number
105                           !   mix. ratio
106      INTEGER iccn_mass    ! index of tracer containing CCN mass
107                           !   mix. ratio
108      INTEGER iccn_number  ! index of tracer containing CCN number
109                           !   mix. ratio
110      SAVE idust_mass,idust_number
111      SAVE iccn_mass,iccn_number
112
113c     Firstcall:
114
115      LOGICAL firstcall
116      SAVE firstcall
117      DATA firstcall/.true./
118
119c    ** un petit test de coherence
120c       --------------------------
121
122      IF (firstcall) THEN
123         IF(ngrid.NE.ngridmx) THEN
124            PRINT*,'STOP dans callsedim'
125            PRINT*,'probleme de dimensions :'
126            PRINT*,'ngrid  =',ngrid
127            PRINT*,'ngridmx  =',ngridmx
128            STOP
129         ENDIF
130
131c       Doubleq: initialization
132        IF (doubleq) THEN
133         do ir=1,nr
134             rd(ir)= rdmin*(rdmax/rdmin)**(float(ir-1)/float(nr-1))
135         end do
136         rdi(1)=rdimin
137         do ir=2,nr
138           rdi(ir)= sqrt(rd(ir-1)*rd(ir))
139         end do
140         rdi(nr+1)=rdimax
141
142         do ir=1,nr
143           do iint=1,ninter
144             rr(iint,ir)=
145     &        rdi(ir)*
146     &        (rdi(ir+1)/rdi(ir))**(float(iint-1)/float(ninter-1))
147c             write(*,*) rr(iint,ir)
148           end do
149         end do
150
151      ! identify tracers corresponding to mass mixing ratio and
152      ! number mixing ratio
153        idust_mass=0      ! dummy initialization
154        idust_number=0    ! dummy initialization
155
156        do iq=1,nq
157          if (noms(iq).eq."dust_mass") then
158            idust_mass=iq
159          endif
160          if (noms(iq).eq."dust_number") then
161            idust_number=iq
162          endif
163        enddo
164
165        ! check that we did find the tracers
166        if ((idust_mass.eq.0).or.(idust_number.eq.0)) then
167          write(*,*) 'callsedim: error! could not identify'
168          write(*,*) ' tracers for dust mass and number mixing'
169          write(*,*) ' ratio and doubleq is activated!'
170          stop
171        endif
172        ENDIF !of if (doubleq)
173
174        IF (scavenging) THEN
175          iccn_mass=0
176          iccn_number=0
177          do iq=1,nq
178            if (noms(iq).eq."ccn_mass") then
179              iccn_mass=iq
180            endif
181            if (noms(iq).eq."ccn_number") then
182              iccn_number=iq
183            endif
184          enddo
185          ! check that we did find the tracers
186          if ((iccn_mass.eq.0).or.(iccn_number.eq.0)) then
187            write(*,*) 'callsedim: error! could not identify'
188            write(*,*) ' tracers for ccn mass and number mixing'
189            write(*,*) ' ratio and scavenging is activated!'
190            stop
191          endif
192        ENDIF !of if (scavenging)
193
194        IF (water) THEN
195          write(*,*) "water_param nueff Sedimentation:", nuice_sed
196          IF (activice) THEN
197            write(*,*) "water_param nueff Radiative:", nuice_ref
198          ENDIF
199        ENDIF
200     
201        firstcall=.false.
202      ENDIF ! of IF (firstcall)
203
204c-----------------------------------------------------------------------
205c    1. Initialization
206c    -----------------
207
208      zqi(1:ngrid,1:nlay,1:nqmx) = 0.
209c     Updating the mass mixing ratio with the tendencies coming
210c       from other parameterizations:
211c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212
213      do iq=1,nq
214        do l=1,nlay
215          do ig=1,ngrid
216            zqi(ig,l,iq)=pq(ig,l,iq)+pdqfi(ig,l,iq)*ptimestep
217          enddo
218        enddo
219      enddo
220
221c    Computing the different layer properties
222c    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223c    Mass (kg.m-2), thickness(m), crossing time (s)  etc.
224
225      do  l=1,nlay
226        do ig=1, ngrid
227          masse(ig,l)=(pplev(ig,l) - pplev(ig,l+1)) /g
228          epaisseur(ig,l)= zlev(ig,l+1) - zlev(ig,l)
229        end do
230      end do
231
232c =================================================================
233c     Compute the geometric mean radius used for sedimentation
234
235      if (doubleq) then
236        do l=1,nlay
237          do ig=1, ngrid
238            r0dust(ig,l) =
239     &        CBRT(r3n_q*zqi(ig,l,idust_mass)/
240     &        max(zqi(ig,l,idust_number),0.01))
241            r0dust(ig,l)=min(max(r0dust(ig,l),1.e-10),500.e-6)
242          end do
243        end do
244      endif
245      if (scavenging) then
246        do l=1,nlay
247          do ig=1, ngrid
248            r0ccn(ig,l) = rsedcloud(ig,l)/(1.+nuice_sed)**4.5
249          end do
250        end do
251      endif
252
253c =================================================================
254      do iq=1,nq
255        if(radius(iq).gt.1.e-9) then   ! no sedim for gaz
256
257c -----------------------------------------------------------------
258c         DOUBLEQ CASE
259c -----------------------------------------------------------------
260          if ((doubleq.and.
261     &        ((iq.eq.idust_mass).or.
262     &         (iq.eq.idust_number))).or.
263     &        (scavenging.and.
264     &        ((iq.eq.iccn_mass).or.
265     &        (iq.eq.iccn_number)))) then
266
267c           Computing size distribution:
268c           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269
270            if ((iq.eq.idust_mass).or.(iq.eq.idust_number)) then
271              do  l=1,nlay
272                do ig=1, ngrid
273                  r0(ig,l)=r0dust(ig,l)
274                end do
275              end do
276              sigma0 = varian
277            else
278              do  l=1,nlay
279                do ig=1, ngrid
280                  r0(ig,l)=r0ccn(ig,l)
281                end do
282              end do
283              sigma0 = sqrt(log(1.+nuice_sed))
284            endif
285
286c        Computing mass mixing ratio for each particle size
287c        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
288          IF ((iq.EQ.idust_mass).or.(iq.EQ.iccn_mass)) then
289            radpower = 2
290          ELSE
291            radpower = -1
292          ENDIF
293          Sq(1:ngrid,1:nlay) = 0.
294          do ir=1,nr
295            do l=1,nlay
296              do ig=1,ngrid
297c                ****************
298c                Size distribution integration
299c                (Trapezoid Integration Method)
300                 qr(ig,l,ir)=0.5*(rr(2,ir)-rr(1,ir))*
301     &             (rr(1,ir)**radpower)*
302     &             exp(-(log(rr(1,ir)/r0(ig,l)))**2/(2*sigma0**2))
303                 do iint=2,ninter-1
304                   qr(ig,l,ir)=qr(ig,l,ir) +
305     &             0.5*(rr(iint+1,ir)-rr(iint-1,ir))*
306     &             (rr(iint,ir)**radpower)*
307     &             exp(-(log(rr(iint,ir)/r0(ig,l)))**2/
308     &             (2*sigma0**2))
309                 end do
310                 qr(ig,l,ir)=qr(ig,l,ir) +
311     &             0.5*(rr(ninter,ir)-rr(ninter-1,ir))*
312     &             (rr(ninter,ir)**radpower)*
313     &             exp(-(log(rr(ninter,ir)/r0(ig,l)))**2/
314     &             (2*sigma0**2))
315
316c                **************** old method (not recommended!)
317c                qr(ig,l,ir)=(rd(ir)**(5-3*iq))*
318c    &           exp( -(log(rd(ir)/r0(ig,l)))**2 / (2*sigma0**2) )
319c                ******************************
320
321                 Sq(ig,l)=Sq(ig,l)+qr(ig,l,ir)
322              enddo
323            enddo
324          enddo
325
326          do ir=1,nr
327            do l=1,nlay
328              do ig=1,ngrid
329                 qr(ig,l,ir) = zqi(ig,l,iq)*qr(ig,l,ir)/Sq(ig,l)
330              enddo
331            enddo
332          enddo
333
334c         Computing sedimentation for each tracer
335c         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
336
337          zqi(1:ngrid,1:nlay,iq) = 0.
338          pdqs_sed(1:ngrid,iq) = 0.
339
340          do ir=1,nr
341             IF ((iq.EQ.idust_mass).or.(iq.EQ.idust_number)) then
342               call newsedim(ngrid,nlay,1,1,ptimestep,
343     &         pplev,masse,epaisseur,pt,rd(ir),rho_dust,qr(1,1,ir),
344     &         wq,0.5)
345             ELSE
346               call newsedim(ngrid,nlay,1,ngrid*nlay,ptimestep,
347     &         pplev,masse,epaisseur,pt,rd(ir),rhocloud,qr(1,1,ir),
348     &         wq,1.0)
349             ENDIF
350
351c            Tendencies
352c            ~~~~~~~~~~
353             do ig=1,ngrid
354               pdqs_sed(ig,iq) = pdqs_sed(ig,iq)
355     &                                + wq(ig,1)/ptimestep
356             end do
357             DO l = 1, nlay
358               DO ig=1,ngrid
359                 zqi(ig,l,iq)=zqi(ig,l,iq)+qr(ig,l,ir)
360               ENDDO
361             ENDDO
362          enddo ! of do ir=1,nr
363c -----------------------------------------------------------------
364c         WATER CYCLE CASE
365c -----------------------------------------------------------------
366          else if (water.and.(iq.eq.igcm_h2o_ice)) then
367            if (microphys) then
368              call newsedim(ngrid,nlay,ngrid*nlay,ngrid*nlay,ptimestep,
369     &        pplev,masse,epaisseur,pt,rsedcloud,rhocloud,zqi(1,1,iq),
370     &        wq,1.0)
371            else
372              call newsedim(ngrid,nlay,ngrid*nlay,1,ptimestep,
373     &        pplev,masse,epaisseur,pt,rsedcloud,rho_q(iq),zqi(1,1,iq),
374     &        wq,1.0)
375            endif ! of if (microphys)
376c           Tendencies
377c           ~~~~~~~~~~
378            do ig=1,ngrid
379              pdqs_sed(ig,iq)=wq(ig,1)/ptimestep
380            end do
381c -----------------------------------------------------------------
382c         GENERAL CASE
383c -----------------------------------------------------------------
384          else
385            call newsedim(ngrid,nlay,1,1,ptimestep,
386     &      pplev,masse,epaisseur,pt,radius(iq),rho_q(iq),
387     &      zqi(1,1,iq),wq,1.0)
388c           Tendencies
389c           ~~~~~~~~~~
390            do ig=1,ngrid
391              pdqs_sed(ig,iq)=wq(ig,1)/ptimestep
392            end do
393          endif ! of if doubleq and if water
394c -----------------------------------------------------------------
395
396c         Compute the final tendency:
397c         ---------------------------
398          DO l = 1, nlay
399            DO ig=1,ngrid
400              pdqsed(ig,l,iq)=(zqi(ig,l,iq)-
401     $        (pq(ig,l,iq) + pdqfi(ig,l,iq)*ptimestep))/ptimestep
402            ENDDO
403          ENDDO
404
405        endif ! of if(radius(iq).gt.1.e-9)
406c =================================================================
407      enddo ! of do iq=1,nq
408 
409c     Update the dust particle size "rdust"
410c     -------------------------------------
411      DO l = 1, nlay
412        DO ig=1,ngrid
413          rdust(ig,l)=
414     &      CBRT(r3n_q*zqi(ig,l,idust_mass)/
415     &      max(zqi(ig,l,idust_number),0.01))
416          rdust(ig,l)=min(max(rdust(ig,l),1.e-10),500.e-6)
417        ENDDO
418      ENDDO
419
420      RETURN
421      END
422
Note: See TracBrowser for help on using the repository browser.