source: trunk/LMDZ.MARS/libf/phymars/nuclea.F @ 3026

Last change on this file since 3026 was 3008, checked in by emillour, 18 months ago

Mars PCM:
Some code cleanup around microphysics. Turn microphys.h into module
microphys_h.F90, and while at it also turn nuclea.F, growthrate.F90 and
massflowrateco2.F90 into modules.
EM

File size: 6.1 KB
RevLine 
[3008]1      MODULE nuclea_mod
2     
3      IMPLICIT NONE
4     
5      CONTAINS
6
[358]7      subroutine nuclea(ph2o,temp,sat,n_ccn,nucrate)
[3008]8      use comcstfi_h, only: pi
9      use microphys_h, only: nbin_cld, rad_cld, nav, mteta, m0
10      use microphys_h, only: desorp, kbz, nus, rgp, surfdif, vo1
[358]11      implicit none
12*                                                     *
13*   This subroutine computes the nucleation rate      *
14*   as given in Pruppacher & Klett (1978) in the      *
15*   case of water ice forming on a solid substrate.   *
16*     Definition refined by Keese (jgr,1989)          *
17*   Authors: F. Montmessin                            *
18*     Adapted for the LMD/GCM by J.-B. Madeleine      *
19*     (October 2011)                                  *
[530]20*     Optimisation by A. Spiga (February 2012)        * 
[358]21*******************************************************
22
[2522]23      include "callkeys.h"
[358]24
25c     Inputs
[3008]26      DOUBLE PRECISION, INTENT(IN) :: ph2o,sat
27      DOUBLE PRECISION, INTENT(IN) :: n_ccn(nbin_cld)
28      REAL, INTENT(IN) :: temp
[358]29
30c     Output
[633]31   !   DOUBLE PRECISION nucrate(nbin_cld)
[3008]32      REAL, INTENT(OUT) :: nucrate(nbin_cld)
[358]33
34c     Local variables
35      DOUBLE PRECISION nh2o
36      DOUBLE PRECISION sig      ! Water-ice/air surface tension  (N.m)
37      external sig
38      DOUBLE PRECISION rstar    ! Radius of the critical germ (m)
39      DOUBLE PRECISION gstar    ! # of molecules forming a critical embryo
40      DOUBLE PRECISION fistar   ! Activation energy required to form a critical embryo (J)
[530]41!      DOUBLE PRECISION zeldov   ! Zeldovitch factor (no dim)
[358]42      DOUBLE PRECISION deltaf
43
44c     Ratio rstar/radius of the nucleating dust particle
[530]45c     double precision xratio
[358]46     
47      double precision mtetalocal ! local mteta in double precision
48
[530]49      double precision fshapesimple,zefshape
50
51
[358]52      integer i
[520]53     
[3008]54      LOGICAL, SAVE :: firstcall = .true.
[2616]55!$OMP THREADPRIVATE(firstcall)
[358]56
57c     *************************************************
58
[530]59      mtetalocal = mteta  !! use mtetalocal for better performance
[358]60
[2522]61      IF (temp_dependant_m) THEN
[2561]62c     Simple linear parametrisation from Maattaanen 2014
63c     Smectite sample
64c     Maxed out at 0.97 for physical realism
[2522]65         mtetalocal = min(0.0044*temp + 0.1831,0.97)
66      ENDIF ! (temp_dependant_m) THEN
[520]67cccccccccccccccccccccccccccccccccccccccccccccccccc
68ccccccccccc ESSAIS TN MTETA = F (T) cccccccccccccc
69c      if (temp .gt. 200) then
70c         mtetalocal = mtetalocal
71c      else if (temp .lt. 190) then
72c         mtetalocal = mtetalocal-0.05
73c      else
74c         mtetalocal = mtetalocal - (190-temp)*0.005
75c      endif
76c----------------exp law, see Trainer 2008, J. Phys. Chem. C 2009, 113, 2036\u20132040
77       !mtetalocal = max(mtetalocal - 6005*exp(-0.065*temp),0.1)
78       !mtetalocal = max(mtetalocal - 6005*exp(-0.068*temp),0.1)
79               !print*, mtetalocal, temp
80cccccccccccccccccccccccccccccccccccccccccccccccccc
81cccccccccccccccccccccccccccccccccccccccccccccccccc
[2522]82      IF (firstcall.and.temp_dependant_m) THEN
[520]83          print*, ' ' 
84          print*, 'dear user, please keep in mind that'
[2522]85          print*, 'contact parameter IS NOT constant ;'
86          print*, 'Using the following linear fit from'
87          print*, 'Maattanen et al. 2014 (SM linear fit) :'
88          print*, 'min(0.0044*temp + 0.1831,0.97)'
89          print*, ' ' 
90         firstcall=.false.
91      ELSE IF (firstcall.and.(.not.(temp_dependant_m))) THEN
92          print*, ' ' 
93          print*, 'dear user, please keep in mind that'
[520]94          print*, 'contact parameter IS constant'
95          print*, ' ' 
96         firstcall=.false.
97      END IF
98cccccccccccccccccccccccccccccccccccccccccccccccccc
99cccccccccccccccccccccccccccccccccccccccccccccccccc
100   
101
[358]102      if (sat .gt. 1.) then    ! minimum condition to activate nucleation
103
104        nh2o   = ph2o / kbz / temp
[2456]105        rstar  = 2. * sig(temp) * vo1 / (rgp*temp*log(sat))
[530]106        gstar  = 4. * nav * pi * (rstar * rstar * rstar) / (3.*vo1)
107       
108        fshapesimple = (2.+mtetalocal)*(1.-mtetalocal)*(1.-mtetalocal)
109     &                   / 4.
[358]110
111c       Loop over size bins
[3008]112        do i=1,nbin_cld
[358]113
114          if ( n_ccn(i) .lt. 1e-10 ) then
115c           no dust, no need to compute nucleation!
116            nucrate(i)=0.
[3008]117            ! move on to next bin
118            cycle
[358]119          endif
120
[530]121          if (rad_cld(i).gt.3000.*rstar) then
122            zefshape = fshapesimple
123          else
124            zefshape = fshape(mtetalocal,rad_cld(i)/rstar)
125          endif
126
127          fistar = (4./3.*pi) * sig(temp) * (rstar * rstar) *
128     &             zefshape
[358]129          deltaf = (2.*desorp-surfdif-fistar)/
130     &             (kbz*temp)
[706]131          deltaf = min( max(deltaf, -100.d0), 100.d0)
[358]132
133          if (deltaf.eq.-100.) then
134            nucrate(i) = 0.
135          else
[633]136            nucrate(i)= real(sqrt ( fistar /
[530]137     &               (3.*pi*kbz*temp*(gstar*gstar)) )
138     &                  * kbz * temp * rstar
[358]139     &                  * rstar * 4. * pi
[530]140     &                  * ( nh2o*rad_cld(i) )
141     &                  * ( nh2o*rad_cld(i) )
142     &                  / ( zefshape * nus * m0 )
[2456]143     &                  * exp (deltaf))
[358]144          endif
145
[3008]146        enddo ! of do i=1,nbin_cld
[358]147
148      else
149
150        do i=1,nbin_cld
151          nucrate(i) = 0.
152        enddo
153
[3008]154      endif ! of if (sat .gt. 1.)
[358]155
[3008]156      end subroutine nuclea
[358]157
158*********************************************************
159      double precision function fshape(cost,rap)
160      implicit none
161*        function computing the f(m,x) factor           *
162* related to energy required to form a critical embryo  *
163*********************************************************
164
[3008]165      double precision, intent(in) :: cost,rap
[530]166      double precision yeah
[358]167
[530]168          !! PHI
169          yeah = sqrt( 1. - 2.*cost*rap + rap*rap )
170          !! FSHAPE = TERM A
171          fshape = (1.-cost*rap) / yeah
172          fshape = fshape * fshape * fshape
173          fshape = 1. + fshape
174          !! ... + TERM B
175          yeah = (rap-cost)/yeah
[695]176          fshape = fshape +
177     & rap*rap*rap*(2.-3.*yeah+yeah*yeah*yeah)
[530]178          !! ... + TERM C
179          fshape = fshape + 3. * cost * rap * rap * (yeah-1.)
180          !! FACTOR 1/2
181          fshape = 0.5*fshape
[358]182
[3008]183      end function fshape
184
185
186      END MODULE nuclea_mod
Note: See TracBrowser for help on using the repository browser.