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

Last change on this file since 2740 was 2616, checked in by romain.vande, 3 years ago

LMDZ_MARS RV : Open_MP;
Put all the "save" variables as "!$OMP THREADPRIVATE" in phymars.
The code can now be tested, see README for more info

File size: 6.0 KB
Line 
1*******************************************************
2*                                                     *
3      subroutine nuclea(ph2o,temp,sat,n_ccn,nucrate)
4      USE comcstfi_h
5      implicit none
6*                                                     *
7*   This subroutine computes the nucleation rate      *
8*   as given in Pruppacher & Klett (1978) in the      *
9*   case of water ice forming on a solid substrate.   *
10*     Definition refined by Keese (jgr,1989)          *
11*   Authors: F. Montmessin                            *
12*     Adapted for the LMD/GCM by J.-B. Madeleine      *
13*     (October 2011)                                  *
14*     Optimisation by A. Spiga (February 2012)        * 
15*******************************************************
16
17#include "microphys.h"
18      include "callkeys.h"
19
20c     Inputs
21      DOUBLE PRECISION ph2o,sat
22      DOUBLE PRECISION n_ccn(nbin_cld)
23      REAL temp
24
25c     Output
26   !   DOUBLE PRECISION nucrate(nbin_cld)
27      REAL nucrate(nbin_cld)
28
29c     Local variables
30      DOUBLE PRECISION nh2o
31      DOUBLE PRECISION sig      ! Water-ice/air surface tension  (N.m)
32      external sig
33      DOUBLE PRECISION rstar    ! Radius of the critical germ (m)
34      DOUBLE PRECISION gstar    ! # of molecules forming a critical embryo
35      DOUBLE PRECISION fistar   ! Activation energy required to form a critical embryo (J)
36!      DOUBLE PRECISION zeldov   ! Zeldovitch factor (no dim)
37      DOUBLE PRECISION fshape   ! function defined at the end of the file
38      DOUBLE PRECISION deltaf
39
40c     Ratio rstar/radius of the nucleating dust particle
41c     double precision xratio
42     
43      double precision mtetalocal ! local mteta in double precision
44
45      double precision fshapesimple,zefshape
46
47
48      integer i
49     
50      LOGICAL firstcall
51     
52!$OMP THREADPRIVATE(firstcall)
53     
54      DATA firstcall/.true./
55      SAVE firstcall
56
57c     *************************************************
58
59      mtetalocal = mteta  !! use mtetalocal for better performance
60
61      IF (temp_dependant_m) THEN
62c     Simple linear parametrisation from Maattaanen 2014
63c     Smectite sample
64c     Maxed out at 0.97 for physical realism
65         mtetalocal = min(0.0044*temp + 0.1831,0.97)
66      ENDIF ! (temp_dependant_m) THEN
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
82      IF (firstcall.and.temp_dependant_m) THEN
83          print*, ' ' 
84          print*, 'dear user, please keep in mind that'
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'
94          print*, 'contact parameter IS constant'
95          print*, ' ' 
96         firstcall=.false.
97      END IF
98cccccccccccccccccccccccccccccccccccccccccccccccccc
99cccccccccccccccccccccccccccccccccccccccccccccccccc
100   
101
102      if (sat .gt. 1.) then    ! minimum condition to activate nucleation
103
104        nh2o   = ph2o / kbz / temp
105        rstar  = 2. * sig(temp) * vo1 / (rgp*temp*log(sat))
106        gstar  = 4. * nav * pi * (rstar * rstar * rstar) / (3.*vo1)
107       
108        fshapesimple = (2.+mtetalocal)*(1.-mtetalocal)*(1.-mtetalocal)
109     &                   / 4.
110
111c       Loop over size bins
112        do 200 i=1,nbin_cld
113
114          if ( n_ccn(i) .lt. 1e-10 ) then
115c           no dust, no need to compute nucleation!
116            nucrate(i)=0.
117            goto 200
118          endif
119
120          if (rad_cld(i).gt.3000.*rstar) then
121            zefshape = fshapesimple
122          else
123            zefshape = fshape(mtetalocal,rad_cld(i)/rstar)
124          endif
125
126          fistar = (4./3.*pi) * sig(temp) * (rstar * rstar) *
127     &             zefshape
128          deltaf = (2.*desorp-surfdif-fistar)/
129     &             (kbz*temp)
130          deltaf = min( max(deltaf, -100.d0), 100.d0)
131
132          if (deltaf.eq.-100.) then
133            nucrate(i) = 0.
134          else
135            nucrate(i)= real(sqrt ( fistar /
136     &               (3.*pi*kbz*temp*(gstar*gstar)) )
137     &                  * kbz * temp * rstar
138     &                  * rstar * 4. * pi
139     &                  * ( nh2o*rad_cld(i) )
140     &                  * ( nh2o*rad_cld(i) )
141     &                  / ( zefshape * nus * m0 )
142     &                  * exp (deltaf))
143          endif
144
145200     continue
146
147      else
148
149        do i=1,nbin_cld
150          nucrate(i) = 0.
151        enddo
152
153      endif
154
155      return
156      end
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
165      double precision cost,rap
166      double precision yeah
167
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
176          fshape = fshape +
177     & rap*rap*rap*(2.-3.*yeah+yeah*yeah*yeah)
178          !! ... + TERM C
179          fshape = fshape + 3. * cost * rap * rap * (yeah-1.)
180          !! FACTOR 1/2
181          fshape = 0.5*fshape
182
183      return
184      end
Note: See TracBrowser for help on using the repository browser.