source: trunk/LMDZ.PLUTO/libf/phypluto/callsedim.F @ 3247

Last change on this file since 3247 was 3195, checked in by afalco, 2 years ago

Pluto PCM:
Imported condense n2 from pluto.old.
Aerosol data from Pluto.old not yet working.
AF

File size: 5.0 KB
Line 
1      SUBROUTINE callsedim(ngrid,nlay, ptimestep,
2     &                pplev,zlev, pt, pdt,
3     &                pq, pdqfi, pdqsed,pdqs_sed,nq)
4
5      use radinc_h, only : naerkind
6      ! use radii_mod, only: h2o_reffrad
7      ! use aerosol_mod, only : iaero_h2o
8      USE tracer_h, only : igcm_haze,radius,rho_q
9      use comcstfi_mod, only: g
10
11      IMPLICIT NONE
12
13!==================================================================
14!
15!     Purpose
16!     -------
17!     Calculates sedimentation of aerosols depending on their
18!     density and radius.
19!
20!     Authors
21!     -------
22!     F. Forget (1999)
23!     Tracer generalisation by E. Millour (2009)
24!
25!==================================================================
26
27c-----------------------------------------------------------------------
28c   declarations:
29c   -------------
30
31c   arguments:
32c   ----------
33
34      integer,intent(in):: ngrid ! number of horizontal grid points
35      integer,intent(in):: nlay  ! number of atmospheric layers
36      real,intent(in):: ptimestep  ! physics time step (s)
37      real,intent(in):: pplev(ngrid,nlay+1) ! pressure at inter-layers (Pa)
38      real,intent(in):: pt(ngrid,nlay)      ! temperature at mid-layer (K)
39      real,intent(in):: pdt(ngrid,nlay) ! tendency on temperature
40      real,intent(in):: zlev(ngrid,nlay+1)  ! altitude at layer boundaries
41      integer,intent(in) :: nq ! number of tracers
42      real,intent(in) :: pq(ngrid,nlay,nq)  ! tracers (kg/kg)
43      real,intent(in) :: pdqfi(ngrid,nlay,nq)  ! tendency on tracers before
44                                               ! sedimentation (kg/kg.s-1)
45
46      real,intent(out) :: pdqsed(ngrid,nlay,nq) ! tendency due to sedimentation (kg/kg.s-1)
47      real,intent(out) :: pdqs_sed(ngrid,nq)    ! flux at surface (kg.m-2.s-1)
48
49c   local:
50c   ------
51
52      INTEGER l,ig, iq
53
54      ! for particles with varying radii:
55      real,allocatable,save :: reffrad(:,:,:) ! particle radius (m)
56      real,allocatable,save :: nueffrad(:,:,:) ! aerosol effective radius variance
57!$OMP THREADPRIVATE(reffrad,nueffrad)
58
59      real zqi(ngrid,nlay,nq) ! to locally store tracers
60      real zt(ngrid,nlay) ! to locally store temperature (K)
61      real masse (ngrid,nlay) ! Layer mass (kg.m-2)
62      real epaisseur (ngrid,nlay) ! Layer thickness (m)
63      real wq(ngrid,nlay+1) ! displaced tracer mass (kg.m-2)
64c      real dens(ngrid,nlay) ! Mean density of the ice part. accounting for dust core
65
66
67      LOGICAL,SAVE :: firstcall=.true.
68!$OMP THREADPRIVATE(firstcall)
69
70c    ** un petit test de coherence
71c       --------------------------
72
73      IF (firstcall) THEN
74        firstcall=.false.
75        ! add some tests on presence of required tracers/aerosols:
76        ! allocate "naerkind" size local arrays (which are also
77        ! "saved" so that this is done only once in for all even if
78        ! we don't need to store the value from a time step to the next)
79        allocate(reffrad(ngrid,nlay,naerkind))
80        allocate(nueffrad(ngrid,nlay,naerkind))
81      ENDIF ! of IF (firstcall)
82
83!=======================================================================
84!     Preliminary calculation of the layer characteristics
85!     (mass (kg.m-2), thickness (m), etc.
86
87      do  l=1,nlay
88        do ig=1, ngrid
89          masse(ig,l)=(pplev(ig,l) - pplev(ig,l+1)) /g
90          epaisseur(ig,l)= zlev(ig,l+1) - zlev(ig,l)
91          zt(ig,l)=pt(ig,l)+pdt(ig,l)*ptimestep
92        end do
93      end do
94
95!======================================================================
96! Calculate the transport due to sedimentation for each tracer
97! [This has been rearranged by L. Kerber to allow the sedimentation
98!  of general tracers.]
99
100      do iq=1,nq
101       if((radius(iq).gt.1.e-9).and.(iq.ne.igcm_haze)) then ! JVO 08/2017 : be careful radius was tested uninitialized (fixed) ...
102
103!         (no sedim for gases, and n2_ice sedim is done in condense_n2)
104
105! store locally updated tracers
106
107          do l=1,nlay
108            do ig=1, ngrid
109              zqi(ig,l,iq)=pq(ig,l,iq)+pdqfi(ig,l,iq)*ptimestep
110            enddo
111          enddo ! of do l=1,nlay
112
113!======================================================================
114! Sedimentation
115!======================================================================
116! Water      !AF24: deleted
117
118! ! General Case
119!        else
120             call newsedim(ngrid,nlay,1,ptimestep,
121     &            pplev,masse,epaisseur,zt,radius(iq),rho_q(iq),
122     &            zqi(1,1,iq),wq,iq)
123      !  endif
124
125!=======================================================================
126!     Calculate the tendencies
127!======================================================================
128
129          do ig=1,ngrid
130!     Ehouarn: with new way of tracking tracers by name, this is simply
131            pdqs_sed(ig,iq) = wq(ig,1)/ptimestep
132          end do
133
134          DO l = 1, nlay
135            DO ig=1,ngrid
136              pdqsed(ig,l,iq)=(zqi(ig,l,iq)-
137     &        (pq(ig,l,iq) + pdqfi(ig,l,iq)*ptimestep))/ptimestep
138            ENDDO
139          ENDDO
140       endif ! of no gases no n2_ice
141      enddo ! of do iq=1,nq
142      return
143      end
Note: See TracBrowser for help on using the repository browser.