Ignore:
Timestamp:
Oct 12, 2023, 10:30:22 AM (15 months ago)
Author:
slebonnois
Message:

BBT : Update for the titan microphysics and cloud model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/libf/muphytitan/mm_haze.f90

    r2109 r3083  
    1 ! Copyright 2013-2015,2017 Université de Reims Champagne-Ardenne
     1! Copyright 2013-2015,2017,2022 Université de Reims Champagne-Ardenne
    22! Contributor: J. Burgalat (GSMA, URCA)
    33! email of the author : jeremie.burgalat@univ-reims.fr
    4 ! 
     4!
    55! This software is a computer program whose purpose is to compute
    66! microphysics processes using a two-moments scheme.
    7 ! 
     7!
    88! This library is governed by the CeCILL-B license under French law and
    9 ! abiding by the rules of distribution of free software.  You can  use, 
     9! abiding by the rules of distribution of free software.  You can  use,
    1010! modify and/ or redistribute the software under the terms of the CeCILL-B
    1111! license as circulated by CEA, CNRS and INRIA at the following URL
    12 ! "http://www.cecill.info". 
    13 ! 
     12! "http://www.cecill.info".
     13!
    1414! As a counterpart to the access to the source code and  rights to copy,
    1515! modify and redistribute granted by the license, users are provided only
    1616! with a limited warranty  and the software's author,  the holder of the
    1717! economic rights,  and the successive licensors  have only  limited
    18 ! liability. 
    19 ! 
     18! liability.
     19!
    2020! In this respect, the user's attention is drawn to the risks associated
    2121! with loading,  using,  modifying and/or developing or reproducing the
     
    2525! professionals having in-depth computer knowledge. Users are therefore
    2626! encouraged to load and test the software's suitability as regards their
    27 ! requirements in conditions enabling the security of their systems and/or 
    28 ! data to be ensured and,  more generally, to use and operate it in the 
    29 ! same conditions as regards security. 
    30 ! 
     27! requirements in conditions enabling the security of their systems and/or
     28! data to be ensured and,  more generally, to use and operate it in the
     29! same conditions as regards security.
     30!
    3131! The fact that you are presently reading this means that you have had
    3232! knowledge of the CeCILL-B license and that you accept its terms.
     
    3535!! summary: Haze microphysics module.
    3636!! author: J. Burgalat
    37 !! date: 2013-2015,2017
     37!! date: 2013-2015,2017,2022
    3838MODULE MM_HAZE
    3939  !! Haze microphysics module.
     
    4646  !!
    4747  !! @note
    48   !! The production function is specific to Titan, where aerosols are created above the detached 
    49   !! haze layer. No other source is taken into account.  This process is controled by two parameters, 
    50   !! the pressure level of production and the production rate. Then both M0 and M3 of the aerosols 
     48  !! The production function is specific to Titan, where aerosols are created above the detached
     49  !! haze layer. No other source is taken into account.  This process is controled by two parameters,
     50  !! the pressure level of production and the production rate. Then both M0 and M3 of the aerosols
    5151  !! distribution are updated in the production zone by addition of the production rate along a
    5252  !! gaussian shape.
    5353  !!
    5454  !! @note
    55   !! The interface methods always uses the global variables defined in [[mm_globals(module)]] when 
     55  !! The interface methods always uses the global variables defined in [[mm_globals(module)]] when
    5656  !! values (any kind, temperature, pressure, moments...) over the vertical grid are required.
    5757  !!
    5858  !! @warning
    59   !! The tendencies returned by the method are always defined over the vertical grid from __TOP__ 
     59  !! The tendencies returned by the method are always defined over the vertical grid from __TOP__
    6060  !! to __GROUND__.
    6161  !!
    62   !! @todo 
     62  !! @todo
    6363  !! Modify tests on tendencies vectors to get sure that allocation is done:
    6464  !! Currently, we assume the compiler handles automatic allocation of arrays.
     
    7272
    7373  PUBLIC :: mm_haze_microphysics, mm_haze_coagulation, mm_haze_sedimentation, &
    74             mm_haze_production
    75 
    76   CONTAINS
     74    mm_haze_production
     75
     76CONTAINS
    7777
    7878  !============================================================================
     
    8383    !! Get the evolution of moments tracers through haze microphysics processes.
    8484    !!
    85     !! The subroutine is a wrapper to the haze microphysics methods. It computes the tendencies 
    86     !! of moments tracers for coagulation, sedimentation and production processes for the 
     85    !! The subroutine is a wrapper to the haze microphysics methods. It computes the tendencies
     86    !! of moments tracers for coagulation, sedimentation and production processes for the
    8787    !! atmospheric column.
    8888    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm0a_s
    89       !! Tendency of the 0th order moment of the spherical mode distribution (\(m^{-3}\)).
     89    !! Tendency of the 0th order moment of the spherical mode distribution (\(m^{-3}\)).
    9090    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm3a_s
    91       !! Tendency of the 3rd order moment of the spherical mode distribution (\(m^{3}.m^{-3}\)).
     91    !! Tendency of the 3rd order moment of the spherical mode distribution (\(m^{3}.m^{-3}\)).
    9292    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm0a_f
    93       !! Tendency of the 0th order moment of the fractal mode distribution (\(m^{-3}\)).
     93    !! Tendency of the 0th order moment of the fractal mode distribution (\(m^{-3}\)).
    9494    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm3a_f
    95       !! Tendency of the 3rd order moment of the fractal mode distribution (\(m^{3}.m^{-3}\)).
     95    !! Tendency of the 3rd order moment of the fractal mode distribution (\(m^{3}.m^{-3}\)).
    9696    REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE :: zdm0as
    9797    REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE :: zdm3as
     
    107107    zdm3af(1:mm_nla) = 0._mm_wp
    108108
    109     IF (mm_w_haze_coag) THEN 
     109    IF (mm_w_haze_coag) THEN
    110110      ! Calls coagulation
    111111      call mm_haze_coagulation(dm0a_s,dm3a_s,dm0a_f,dm3a_f)
     
    120120
    121121      ! Updates tendencies
    122       dm0a_s=dm0a_s+zdm0as ; dm3a_s=dm3a_s+zdm3as 
     122      dm0a_s=dm0a_s+zdm0as ; dm3a_s=dm3a_s+zdm3as
    123123      dm0a_f=dm0a_f+zdm0af ; dm3a_f=dm3a_f+zdm3af
    124124    ENDIF
     
    127127      call mm_haze_production(zdm0as,zdm3as)
    128128      ! We only produce spherical aerosols
    129       dm0a_s=dm0a_s+zdm0as ; dm3a_s=dm3a_s+zdm3as 
     129      dm0a_s=dm0a_s+zdm0as ; dm3a_s=dm3a_s+zdm3as
    130130    ENDIF
    131131
     
    137137  ! COAGULATION PROCESS RELATED METHODS
    138138  !============================================================================
    139  
     139
    140140  SUBROUTINE mm_haze_coagulation(dM0s,dM3s,dM0f,dM3f)
    141141    !! Get the evolution of the aerosols moments vertical column due to coagulation process.
    142     !! 
     142    !!
    143143    !! This is main method of the coagulation process:
    144144    !!
     
    149149    !! 5. Finally computes the tendencies of the moments.
    150150    !!
    151     !! All arguments are assumed vectors of __N__ elements where __N__ is the total number of 
     151    !! All arguments are assumed vectors of __N__ elements where __N__ is the total number of
    152152    !! vertical __layers__.
    153153    !!
    154154    !! @note
    155     !! The method uses directly the global variables related to the vertical atmospheric structure 
    156     !! stored in [[mm_globals(module)]]. Consequently they must be updated before calling the subroutine. 
     155    !! The method uses directly the global variables related to the vertical atmospheric structure
     156    !! stored in [[mm_globals(module)]]. Consequently they must be updated before calling the subroutine.
    157157    !!
    158158    !! @bug
    159     !! If the transfert probabilities are set to 1 for the two flow regimes (pco and pfm), 
     159    !! If the transfert probabilities are set to 1 for the two flow regimes (pco and pfm),
    160160    !! a floating point exception occured (i.e. a NaN) as we perform a division by zero
    161161    !!
     
    163163    !! Get rid of the fu\*\*\*\* STOP statement...
    164164    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dM0s
    165       !! Tendency of the 0th order moment of the spherical size-distribution over a time step (\(m^{-3}\)).
     165    !! Tendency of the 0th order moment of the spherical size-distribution over a time step (\(m^{-3}\)).
    166166    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dM3s
    167       !! Tendency of the 3rd order moment of the spherical size-distribution (\(m^{3}.m^{-3}\)).
     167    !! Tendency of the 3rd order moment of the spherical size-distribution (\(m^{3}.m^{-3}\)).
    168168    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dM0f
    169       !! Tendency of the 0th order moment of the fractal size-distribution over a time step (\(m^{-3}\)).
     169    !! Tendency of the 0th order moment of the fractal size-distribution over a time step (\(m^{-3}\)).
    170170    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dM3f
    171       !! Tendency of the 3rd order moment of the fractal size-distribution over a time step (\(m^{3}.m^{-3}\)).
     171    !! Tendency of the 3rd order moment of the fractal size-distribution over a time step (\(m^{3}.m^{-3}\)).
    172172    REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE :: c_kco,c_kfm,c_slf,tmp, &
    173                                                    kco,kfm,pco,pfm,mq
     173      kco,kfm,pco,pfm,mq
    174174    REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE :: a_ss,a_sf,b_ss,b_ff,c_ss,c_sf
    175175    INTEGER                                     :: i
     
    180180    ! Alloctes local arrays
    181181    ALLOCATE(kco(mm_nla),kfm(mm_nla),c_slf(mm_nla), &
    182              c_kco(mm_nla),c_kfm(mm_nla),mq(mm_nla), &
    183              pco(mm_nla),pfm(mm_nla))
     182      c_kco(mm_nla),c_kfm(mm_nla),mq(mm_nla), &
     183      pco(mm_nla),pfm(mm_nla))
    184184    ALLOCATE(a_ss(mm_nla),a_sf(mm_nla), &
    185              b_ss(mm_nla),b_ff(mm_nla), &
    186              c_ss(mm_nla),c_sf(mm_nla))
    187              
     185      b_ss(mm_nla),b_ff(mm_nla), &
     186      c_ss(mm_nla),c_sf(mm_nla))
     187
    188188    a_ss(:) = 0._mm_wp ; a_sf(:) = 0._mm_wp
    189     b_ss(:) = 0._mm_wp ; b_ff(:) = 0._mm_wp 
     189    b_ss(:) = 0._mm_wp ; b_ff(:) = 0._mm_wp
    190190    c_ss(:) = 0._mm_wp ; c_sf(:) = 0._mm_wp
    191191
     
    193193    c_kco(:) = mm_get_kco(mm_temp) ; c_kfm(:) = mm_get_kfm(mm_temp)
    194194    ! get slf (slip-flow factor)
    195     c_slf(:) = mm_akn * mm_lambda_g(mm_temp,mm_play) 
     195    c_slf(:) = mm_akn * mm_lambda_g(mm_temp,mm_play)
    196196
    197197    DO i=1,mm_nla
     
    202202        pfm(i) = mm_ps2s(mm_rcs(i),0,1,mm_temp(i),mm_play(i))
    203203        ! (A_SS_CO x A_SS_FM) / (A_SS_CO + A_SS_FM)
    204         kco(i) = g0ssco(mm_rcs(i),c_slf(i),c_kco(i)) 
    205         kfm(i) = g0ssfm(mm_rcs(i),c_kfm(i)) 
     204        kco(i) = g0ssco(mm_rcs(i),c_slf(i),c_kco(i))
     205        kfm(i) = g0ssfm(mm_rcs(i),c_kfm(i))
    206206        IF (kco(i)*(pco(i)-2._mm_wp)+kfm(i)*(pfm(i)-2._mm_wp) /=0) THEN
    207207          a_ss(i) = (kco(i)*(pco(i)-2._mm_wp)*kfm(i)*(pfm(i)-2._mm_wp))/(kco(i)*(pco(i)-2._mm_wp)+kfm(i)*(pfm(i)-2._mm_wp))
     
    267267      ENDIF
    268268    ENDDO
    269    
     269
    270270    DEALLOCATE(kco,kfm,c_kco,c_kfm,pco,pfm,c_slf)
    271271
     
    302302    !! Get γ pre-factor for the 0th order moment with SS interactions in the continuous flow regime.
    303303    !!
    304     !! @note 
     304    !! @note
    305305    !! If __rcs__ is 0, the function returns 0.
    306306    REAL(kind=mm_wp), INTENT(in) :: rcs   !! Characteristic radius of the spherical size-distribution.
     
    320320    !! Get γ pre-factor for the 0th order moment with SF interactions in the continuous flow regime.
    321321    !!
    322     !! @note 
     322    !! @note
    323323    !! If __rcs__ or __rcf__ is 0, the function returns 0.
    324324    REAL(kind=mm_wp), INTENT(in) :: rcs   !! Characteristic radius of the spherical size-distribution.
     
    329329    REAL(kind=mm_wp) :: a1, a2, a3, a4, a5, a6, e, rcff
    330330    res = 0._mm_wp ; IF (rcs <= 0._mm_wp .OR. rcf <= 0._mm_wp) RETURN
    331     e=3._mm_wp/mm_df ; rcff = rcf**e*mm_rb2ra 
    332     ! computes mm_alpha coefficients
    333     a1=mm_alpha_s(1._mm_wp)   ; a2=mm_alpha_f(-e)   ; a3=mm_alpha_f(e) 
     331    e=3._mm_wp/mm_df ; rcff = rcf**e*mm_rb2ra
     332    ! computes mm_alpha coefficients
     333    a1=mm_alpha_s(1._mm_wp)   ; a2=mm_alpha_f(-e)   ; a3=mm_alpha_f(e)
    334334    a4=mm_alpha_s(-1._mm_wp) ; a5=mm_alpha_s(-2._mm_wp) ; a6=mm_alpha_f(-2._mm_wp*e)
    335335    ! Computes gamma pre-factor
    336336    res = c_kco*( 2._mm_wp + a1*a2*rcs/rcff + a4*a3*rcff/rcs + c_slf*( a4/rcs + &
    337                          a2/rcff + a5*a3*rcff/rcs**2 + a1*a6*rcs/rcff**2))
     337      a2/rcff + a5*a3*rcff/rcs**2 + a1*a6*rcs/rcff**2))
    338338    RETURN
    339339  END FUNCTION g0sfco
     
    342342    !! Get &gamma; pre-factor for the 0th order moment with FF interactions in the continuous flow regime.
    343343    !!
    344     !! @note 
     344    !! @note
    345345    !! If __rcf__ is 0, the function returns 0.
    346346    REAL(kind=mm_wp), INTENT(in) :: rcf   !! Characteristic radius of the fractal size-distribution.
     
    361361    !! Get &gamma; pre-factor for the 3rd order moment with SS interactions in the continuous flow regime.
    362362    !!
    363     !! @note 
     363    !! @note
    364364    !! If __rcs__ is 0, the function returns 0.
    365365    REAL(kind=mm_wp), INTENT(in) :: rcs   !! Characteristic radius of the spherical size-distribution.
     
    370370    res = 0._mm_wp ; IF (rcs <= 0._mm_wp) RETURN
    371371    ! computes mm_alpha coefficients
    372     a1=mm_alpha_s(3._mm_wp) ; a2=mm_alpha_s(2._mm_wp)  ; a3=mm_alpha_s(1._mm_wp) 
     372    a1=mm_alpha_s(3._mm_wp) ; a2=mm_alpha_s(2._mm_wp)  ; a3=mm_alpha_s(1._mm_wp)
    373373    a4=mm_alpha_s(4._mm_wp) ; a5=mm_alpha_s(-1._mm_wp) ; a6=mm_alpha_s(-2._mm_wp)
    374374
    375375    ! Computes gamma pre-factor
    376     res = (2._mm_wp*a1 + a2*a3 + a4*a5 + c_slf/rcs*(a3**2 + a4*a6 + a1*a5 + a2))* & 
    377           c_kco/(a1**2*rcs**3)
     376    res = (2._mm_wp*a1 + a2*a3 + a4*a5 + c_slf/rcs*(a3**2 + a4*a6 + a1*a5 + a2))* &
     377      c_kco/(a1**2*rcs**3)
    378378    RETURN
    379379  END FUNCTION g3ssco
     
    382382    !! Get &gamma; pre-factor for the 3rd order moment with SF interactions in the continuous flow regime.
    383383    !!
    384     !! @note 
     384    !! @note
    385385    !! If __rcs__ or __rcf__ is 0, the function returns 0.
    386386    REAL(kind=mm_wp), INTENT(in) :: rcs   !! Characteristic radius of the spherical size-distribution.
     
    392392    res = 0._mm_wp ; IF (rcs <= 0._mm_wp .OR. rcf <= 0._mm_wp) RETURN
    393393    ! computes mm_alpha coefficients
    394     e=3._mm_wp/mm_df ; rcff = rcf**e*mm_rb2ra 
    395     a1=mm_alpha_s(3._mm_wp)    ; a2=mm_alpha_s(4._mm_wp) ; a3=mm_alpha_f(-e) 
     394    e=3._mm_wp/mm_df ; rcff = rcf**e*mm_rb2ra
     395    a1=mm_alpha_s(3._mm_wp)    ; a2=mm_alpha_s(4._mm_wp) ; a3=mm_alpha_f(-e)
    396396    a4=mm_alpha_s(2._mm_wp)    ; a5=mm_alpha_f(e)    ; a6=mm_alpha_s(1._mm_wp)
    397397    a7=mm_alpha_f(-2._mm_wp*e) ; a8=mm_alpha_f(3._mm_wp)
    398398    ! Computes gamma pre-factor
    399399    res = (2._mm_wp*a1*rcs**3 + a2*rcs**4*a3/rcff + a4*rcs**2*a5*rcff + &
    400                 c_slf *( a4*rcs**2 + a1*rcs**3*a3/rcff + a6*rcs*a5*rcff + &
    401                 a2*rcs**4*a7/rcff**2))* c_kco/(a1*a8*(rcs*rcf)**3)
     400      c_slf *( a4*rcs**2 + a1*rcs**3*a3/rcff + a6*rcs*a5*rcff + &
     401      a2*rcs**4*a7/rcff**2))* c_kco/(a1*a8*(rcs*rcf)**3)
    402402    RETURN
    403403  END FUNCTION g3sfco
     
    406406    !! Get &gamma; pre-factor for the 0th order moment with SS interactions in the Free Molecular flow regime.
    407407    !!
    408     !! @note 
     408    !! @note
    409409    !! If __rcs__ is 0, the function returns 0.
    410410    REAL(kind=mm_wp), INTENT(in) :: rcs   !! Characteristic radius of the spherical size-distribution.
     
    422422
    423423  ELEMENTAL FUNCTION g0sffm(rcs, rcf, c_kfm) RESULT(res)
    424     !> Get &gamma; pre-factor for the 0th order moment with SF interactions in the Free Molecular flow regime. 
    425     !!
    426     !! @note 
     424    !> Get &gamma; pre-factor for the 0th order moment with SF interactions in the Free Molecular flow regime.
     425    !!
     426    !! @note
    427427    !! If __rcs__ or __rcf__ is 0, the function returns 0.
    428428    REAL(kind=mm_wp), INTENT(in) :: rcs   !! Characteristic radius of the spherical size-distribution.
     
    435435    res = 0._mm_wp ; IF (rcs <= 0._mm_wp .OR. rcf <= 0._mm_wp) RETURN
    436436    ! computes mm_alpha coefficients
    437     e1 = 3._mm_wp/mm_df 
    438     e2 = 6._mm_wp/mm_df 
     437    e1 = 3._mm_wp/mm_df
     438    e2 = 6._mm_wp/mm_df
    439439    e3 = (6._mm_wp-3._mm_wp*mm_df)/(2._mm_wp*mm_df)
    440440    e4 = (12._mm_wp-3._mm_wp*mm_df)/(2._mm_wp*mm_df)
    441441
    442     rcff1 = mm_rb2ra * rcf**e1 
     442    rcff1 = mm_rb2ra * rcf**e1
    443443    rcff2 = rcff1**2
    444     rcff3 = mm_rb2ra * rcf**e3 
     444    rcff3 = mm_rb2ra * rcf**e3
    445445    rcff4 = mm_rb2ra**2 * rcf**e4
    446446
    447     a1=mm_alpha_s(0.5_mm_wp)  ; a2=mm_alpha_s(-0.5_mm_wp) ; a3=mm_alpha_f(e1) 
     447    a1=mm_alpha_s(0.5_mm_wp)  ; a2=mm_alpha_s(-0.5_mm_wp) ; a3=mm_alpha_f(e1)
    448448    a4=mm_alpha_s(-1.5_mm_wp) ; a5=mm_alpha_f(e2)      ; a6=mm_alpha_s(2._mm_wp)
    449     a7=mm_alpha_f(-1.5_mm_wp) ; a8=mm_alpha_s(1._mm_wp)   ; a9=mm_alpha_f(e3) 
     449    a7=mm_alpha_f(-1.5_mm_wp) ; a8=mm_alpha_s(1._mm_wp)   ; a9=mm_alpha_f(e3)
    450450    a10=mm_alpha_f(e4)
    451451
    452452    ! Computes gamma pre-factor
    453453    res = (a1*rcs**0.5_mm_wp + 2._mm_wp*rcff1*a2*a3/rcs**0.5_mm_wp + a4*a5*rcff2/rcs**1.5_mm_wp + &
    454            a6*a7*rcs**2/rcf**1.5_mm_wp + 2._mm_wp*a8*a9*rcs*rcff3 + a10*rcff4 &
    455           )*mm_get_btk(4,0)*c_kfm
     454      a6*a7*rcs**2/rcf**1.5_mm_wp + 2._mm_wp*a8*a9*rcs*rcff3 + a10*rcff4 &
     455      )*mm_get_btk(4,0)*c_kfm
    456456    RETURN
    457457  END FUNCTION g0sffm
    458458
    459459  ELEMENTAL FUNCTION g0fffm(rcf, c_kfm) RESULT(res)
    460     !! Get &gamma; pre-factor for the 0th order moment with FF interactions in the Free Molecular flow regime. 
    461     !!
    462     !! @note 
     460    !! Get &gamma; pre-factor for the 0th order moment with FF interactions in the Free Molecular flow regime.
     461    !!
     462    !! @note
    463463    !! If __rcf__ is 0, the function returns 0.
    464464    REAL(kind=mm_wp), INTENT(in) :: rcf   !! Characteristic radius of the fractal size-distribution.
    465465    REAL(kind=mm_wp), INTENT(in) :: c_kfm !! Thermodynamic free molecular flow regime pre-factor.
    466     REAL(kind=mm_wp) :: res               !! &gamma; coagulation kernel pre-factor. 
     466    REAL(kind=mm_wp) :: res               !! &gamma; coagulation kernel pre-factor.
    467467    REAL(kind=mm_wp) :: a1, a2, a3, a4, a5, e1, e2, e3, rcff
    468468    res = 0._mm_wp ; IF (rcf <= 0._mm_wp) RETURN
    469469    ! computes mm_alpha coefficients
    470     e1=3._mm_wp/mm_df ; e2=(6_mm_wp-3._mm_wp*mm_df)/(2._mm_wp*mm_df) 
     470    e1=3._mm_wp/mm_df ; e2=(6_mm_wp-3._mm_wp*mm_df)/(2._mm_wp*mm_df)
    471471    e3=(12._mm_wp-3._mm_wp*mm_df)/(2._mm_wp*mm_df)
    472472    rcff=mm_rb2ra**2*rcf**e3
     
    489489    res = 0._mm_wp ; IF (rcs <= 0._mm_wp) RETURN
    490490    ! computes mm_alpha coefficients
    491     a1=mm_alpha_s(3.5_mm_wp)  ; a2=mm_alpha_s(1._mm_wp)  ; a3=mm_alpha_s(2.5_mm_wp) 
     491    a1=mm_alpha_s(3.5_mm_wp)  ; a2=mm_alpha_s(1._mm_wp)  ; a3=mm_alpha_s(2.5_mm_wp)
    492492    a4=mm_alpha_s(2._mm_wp)   ; a5=mm_alpha_s(1.5_mm_wp) ; a6=mm_alpha_s(5._mm_wp)
    493     a7=mm_alpha_s(-1.5_mm_wp) ; a8=mm_alpha_s(4._mm_wp)  ; a9=mm_alpha_s(-0.5_mm_wp) 
     493    a7=mm_alpha_s(-1.5_mm_wp) ; a8=mm_alpha_s(4._mm_wp)  ; a9=mm_alpha_s(-0.5_mm_wp)
    494494    a10=mm_alpha_s(3._mm_wp) ; a11=mm_alpha_s(0.5_mm_wp)
    495495    ! Computes gamma pre-factor
    496496    res = (a1 + 2._mm_wp*a2*a3 + a4*a5 + a6*a7 + 2._mm_wp*a8*a9 + a10*a11) &
    497           *mm_get_btk(1,3)*c_kfm/(a10**2*rcs**2.5_mm_wp)
     497      *mm_get_btk(1,3)*c_kfm/(a10**2*rcs**2.5_mm_wp)
    498498    RETURN
    499499  END FUNCTION g3ssfm
     
    502502    !! Get &gamma; pre-factor for the 3rd order moment with SF interactions in the Free Molecular flow regime.
    503503    !!
    504     !! @note 
     504    !! @note
    505505    !! If __rcs__ or __rcf__ is 0, the function returns 0.
    506506    REAL(kind=mm_wp), INTENT(in) :: rcs   !! Characteristic radius of the spherical size-distribution.
     
    512512    res = 0._mm_wp ; IF (rcs <= 0._mm_wp .OR. rcf <= 0._mm_wp) RETURN
    513513    ! computes mm_alpha coefficients
    514     e1=3._mm_wp/mm_df 
    515     e2=(6._mm_wp-3._mm_wp*mm_df)/(2._mm_wp*mm_df) 
     514    e1=3._mm_wp/mm_df
     515    e2=(6._mm_wp-3._mm_wp*mm_df)/(2._mm_wp*mm_df)
    516516    e3=(12._mm_wp-3._mm_wp*mm_df)/(2._mm_wp*mm_df)
    517517    rcff1=mm_rb2ra*rcf**e1 ; rcff2=mm_rb2ra*rcf**e2 ; rcff3=mm_rb2ra**2*rcf**e3
    518     a1=mm_alpha_s(3.5_mm_wp)  ; a2=mm_alpha_s(2.5_mm_wp)   ; a3=mm_alpha_f(e1) 
    519     a4=mm_alpha_s(1.5_mm_wp)  ; a5=mm_alpha_f(2._mm_wp*e1) ; a6=mm_alpha_s(5._mm_wp) 
    520     a7=mm_alpha_f(-1.5_mm_wp) ; a8=mm_alpha_s(4._mm_wp)    ; a9=mm_alpha_f(e2) 
     518    a1=mm_alpha_s(3.5_mm_wp)  ; a2=mm_alpha_s(2.5_mm_wp)   ; a3=mm_alpha_f(e1)
     519    a4=mm_alpha_s(1.5_mm_wp)  ; a5=mm_alpha_f(2._mm_wp*e1) ; a6=mm_alpha_s(5._mm_wp)
     520    a7=mm_alpha_f(-1.5_mm_wp) ; a8=mm_alpha_s(4._mm_wp)    ; a9=mm_alpha_f(e2)
    521521    a10=mm_alpha_s(3._mm_wp)  ; a11=mm_alpha_f(e3)         ; a12=mm_alpha_f(3._mm_wp)
    522522    ! Computes gamma pre-factor
    523523    res = (a1*rcs**3.5_mm_wp + 2._mm_wp*a2*a3*rcs**2.5_mm_wp*rcff1 + a4*a5*rcs**1.5_mm_wp*rcff1**2 + &
    524           a6*a7*rcs**5/rcf**1.5_mm_wp + 2._mm_wp*a8*a9*rcs**4*rcff2 + &
    525           a10*a11*rcs**3*rcff3)*mm_get_btk(4,3)*c_kfm/(a10*a12*(rcs*rcf)**3)
     524      a6*a7*rcs**5/rcf**1.5_mm_wp + 2._mm_wp*a8*a9*rcs**4*rcff2 + &
     525      a10*a11*rcs**3*rcff3)*mm_get_btk(4,3)*c_kfm/(a10*a12*(rcs*rcf)**3)
    526526    RETURN
    527527  END FUNCTION g3sffm
     
    530530  ! SEDIMENTATION PROCESS RELATED METHODS
    531531  !============================================================================
    532  
     532
    533533  SUBROUTINE mm_haze_sedimentation(dm0s,dm3s,dm0f,dm3f)
    534534    !! Interface to sedimentation algorithm.
    535535    !!
    536536    !! The subroutine computes the evolution of each moment of the aerosols tracers
    537     !! through sedimentation process and returns their tendencies for a timestep. 
     537    !! through sedimentation process and returns their tendencies for a timestep.
    538538    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm0s
    539       !! Tendency of the 0th order moment of the spherical mode (\(m^{-3}\)).
     539    !! Tendency of the 0th order moment of the spherical mode (\(m^{-3}\)).
    540540    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm3s
    541       !! Tendency of the 3rd order moment of the spherical mode (\(m^{3}.m^{-3}\)).
     541    !! Tendency of the 3rd order moment of the spherical mode (\(m^{3}.m^{-3}\)).
    542542    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm0f
    543       !! Tendency of the 0th order moment of the fractal mode (\(m^{-3}\)).
     543    !! Tendency of the 0th order moment of the fractal mode (\(m^{-3}\)).
    544544    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm3f
    545       !! Tendency of the 3rd order moment of the fractal mode (\(m^{3}.m^{-3}\)).
     545    !! Tendency of the 3rd order moment of the fractal mode (\(m^{3}.m^{-3}\)).
    546546    REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE :: ft,fdcor,wth
    547     REAL(kind=mm_wp)                            :: m,n,p
    548     REAL(kind=mm_wp), PARAMETER                 :: fac = 4._mm_wp/3._mm_wp * mm_pi
     547    REAL(kind=mm_wp), PARAMETER                 :: fac = 4._mm_wp/3._mm_wp * mm_pi
    549548
    550549    ALLOCATE(ft(mm_nle),wth(mm_nle),fdcor(mm_nle))
     
    624623    !! Compute the tendency of the moment through sedimentation process.
    625624    !!
    626     !! 
     625    !!
    627626    !! The method computes the time evolution of the \(k^{th}\) order moment through sedimentation:
    628627    !!
     
    630629    !!
    631630    !! The equation is resolved using a [Crank-Nicolson algorithm](http://en.wikipedia.org/wiki/Crank-Nicolson_method).
    632     !! 
    633     !! Sedimentation algorithm is quite messy. It appeals to the dark side of the Force and uses evil black magic spells 
     631    !!
     632    !! Sedimentation algorithm is quite messy. It appeals to the dark side of the Force and uses evil black magic spells
    634633    !! from ancient times. It is based on \cite{toon1988b,fiadeiro1977,turco1979} and is an update of the algorithm
    635634    !! originally implemented in the LMDZ-Titan 2D GCM.
     
    638637    REAL(kind=mm_wp), INTENT(in), DIMENSION(:)  :: ft  !! Downward sedimentation flux  (effective velocity of the moment).
    639638    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dmk !! Tendency of \(k^{th}\) order moment (in \(m^{k}.m^{-3}\)).
    640     INTEGER                                 :: i 
     639    INTEGER                                 :: i
    641640    REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE :: as,bs,cs,mko
    642641    ALLOCATE(as(mm_nla), bs(mm_nla), cs(mm_nla), mko(mm_nla))
     
    648647      bs(1:mm_nla) = -(ft(2:mm_nle)+mm_dzlay(1:mm_nla)/dt)
    649648      cs(1:mm_nla) = -mm_dzlay(1:mm_nla)/dt*mk(1:mm_nla)
    650       ! (Tri)diagonal matrix inversion 
     649      ! (Tri)diagonal matrix inversion
    651650      mko(1) = cs(1)/bs(1)
    652651      DO i=2,mm_nla ; mko(i) = (cs(i)-mko(i-1)*as(i))/bs(i) ; ENDDO
     
    660659      ! interior
    661660      mko(2:mm_nla-1)=(bs(2:mm_nla-1)*mk(1:mm_nla-2) + &
    662                        cs(2:mm_nla-1)*mk(2:mm_nla-1)   &
    663                       )/as(2:mm_nla-1)
     661        cs(2:mm_nla-1)*mk(2:mm_nla-1)   &
     662        )/as(2:mm_nla-1)
    664663    ENDIF
    665664    dmk = mko - mk
     
    670669  SUBROUTINE get_weff(mk,k,df,rc,dt,afun,wth,corf)
    671670    !! Get the effective settling velocity for aerosols moments.
    672     !! 
    673     !! This method computes the effective settling velocity of the \(k^{th}\) order moment of aerosol 
    674     !! tracers. The basic settling velocity (\(v^{eff}_{M_{k}}\)) is computed using the following 
     671    !!
     672    !! This method computes the effective settling velocity of the \(k^{th}\) order moment of aerosol
     673    !! tracers. The basic settling velocity (\(v^{eff}_{M_{k}}\)) is computed using the following
    675674    !! equation:
    676     !! 
    677     !! $$ 
     675    !!
     676    !! $$
    678677    !! \begin{eqnarray*}
    679     !! \Phi^{sed}_{M_{k}} &=& \int_{0}^{\infty} n(r) r^{k} \times w(r) dr 
     678    !! \Phi^{sed}_{M_{k}} &=& \int_{0}^{\infty} n(r) r^{k} \times w(r) dr
    680679    !!                     == M_{k}  \times v^{eff}_{M_{k}} \\
    681680    !!     v^{eff}_{M_{k} &=& \dfrac{2 \rho g r_{c}^{\dfrac{3D_{f}-3}{D_{f}}}}
     
    686685    !! $$
    687686    !!
    688     !! \(v^{eff}_{M_{k}\) is then corrected to reduce numerical diffusion of the sedimentation algorithm 
     687    !! \(v^{eff}_{M_{k}\) is then corrected to reduce numerical diffusion of the sedimentation algorithm
    689688    !! as defined in \cite{toon1988b}.
    690689    !!
    691690    !! @warning
    692     !! Both __df__, __rc__ and __afun__ must be consistent with each other otherwise wrong values will 
     691    !! Both __df__, __rc__ and __afun__ must be consistent with each other otherwise wrong values will
    693692    !! be computed.
    694693    REAL(kind=mm_wp), INTENT(in), DIMENSION(mm_nla)            :: mk
    695       !! Moment of order __k__ (\(m^{k}.m^{-3}\)) at each layer.
     694    !! Moment of order __k__ (\(m^{k}.m^{-3}\)) at each layer.
    696695    REAL(kind=mm_wp), INTENT(in), DIMENSION(mm_nla)            :: rc
    697       !! Characteristic radius associated to the moment at each layer.
     696    !! Characteristic radius associated to the moment at each layer.
    698697    REAL(kind=mm_wp), INTENT(in)                               :: k
    699       !! The order of the moment.
     698    !! The order of the moment.
    700699    REAL(kind=mm_wp), INTENT(in)                               :: df
    701       !! Fractal dimension of the aersols.
     700    !! Fractal dimension of the aersols.
    702701    REAL(kind=mm_wp), INTENT(in)                               :: dt
    703       !! Time step (s).
     702    !! Time step (s).
    704703    REAL(kind=mm_wp), INTENT(out), DIMENSION(mm_nle)           :: wth
    705       !! Theoretical Settling velocity at each vertical __levels__ (\( wth \times corf = weff\)).
    706     REAL(kind=mm_wp), INTENT(out), DIMENSION(mm_nle), OPTIONAL :: corf 
    707       !! _Fiadero_ correction factor applied to the theoretical settling velocity at each vertical __levels__.
     704    !! Theoretical Settling velocity at each vertical __levels__ (\( wth \times corf = weff\)).
     705    REAL(kind=mm_wp), INTENT(out), DIMENSION(mm_nle), OPTIONAL :: corf
     706    !! _Fiadero_ correction factor applied to the theoretical settling velocity at each vertical __levels__.
    708707    INTERFACE
    709708      FUNCTION afun(order)
     
    713712        REAL(kind=mm_wp) :: afun              !! Alpha value.
    714713      END FUNCTION afun
    715     END INTERFACE 
     714    END INTERFACE
    716715    INTEGER                             :: i
    717716    REAL(kind=mm_wp)                    :: af1,af2,ar1,ar2
     
    720719    REAL(kind=mm_wp), DIMENSION(mm_nle) :: zcorf
    721720    ! ------------------
    722    
     721
    723722    wth(:) = 0._mm_wp ; zcorf(:) = 1._mm_wp
    724723
    725724    ar1 = (3._mm_wp*df -3._mm_wp)/df    ; ar2 = (3._mm_wp*df -6._mm_wp)/df
    726     af1 = (df*(k+3._mm_wp)-3._mm_wp)/df ; af2 = (df*(k+3._mm_wp)-6._mm_wp)/df 
     725    af1 = (df*(k+3._mm_wp)-3._mm_wp)/df ; af2 = (df*(k+3._mm_wp)-6._mm_wp)/df
    727726    rb2ra = mm_rm**((df-3._mm_wp)/df)
    728727    DO i=2,mm_nla
    729       IF (rc(i-1) <= 0._mm_wp) CYCLE 
     728      IF (rc(i-1) <= 0._mm_wp) CYCLE
    730729      dzb = (mm_dzlay(i)+mm_dzlay(i-1))/2._mm_wp
    731730      csto = 2._mm_wp*mm_rhoaer*mm_effg(mm_zlev(i))/(9._mm_wp*mm_eta_g(mm_btemp(i)))
    732731      cslf = mm_akn * mm_lambda_g(mm_btemp(i),mm_plev(i))
    733       wth(i) = - csto/(rb2ra*afun(k)) * (rc(i-1)**ar1 * afun(af1) + cslf/rb2ra * rc(i-1)**ar2 * afun(af2))
     732      wth(i) = - csto/(rb2ra*afun(k)) * (rc(i-1)**ar1 * afun(af1) + cslf/rb2ra * rc(i-1)**ar2 * afun(af2))
     733
     734      ! >>> [TEMPO : BBT]
     735      !wth(i) = wth(i) * (2574e3 / (2574e3+mm_zlev(i)))**4
     736      ! <<< [TEMPO : BBT]
     737     
    734738      ! now correct velocity to reduce numerical diffusion
    735739      IF (.NOT.mm_no_fiadero_w) THEN
    736740        IF (mk(i) <= 0._mm_wp) THEN
    737           ratio = mm_fiadero_max 
     741          ratio = mm_fiadero_max
    738742        ELSE
    739           ratio = MAX(MIN(mk(i-1)/mk(i),mm_fiadero_max),mm_fiadero_min) 
     743          ratio = MAX(MIN(mk(i-1)/mk(i),mm_fiadero_max),mm_fiadero_min)
    740744        ENDIF
    741745        ! apply correction
     
    760764  SUBROUTINE mm_haze_production(dm0s,dm3s)
    761765    !! Compute the production of aerosols moments.
    762     !! 
    763     !! The method computes the tendencies of M0 and M3 for the spherical mode through production process. 
    764     !! Production values are distributed along a normal law in altitude, centered  at 
     766    !!
     767    !! The method computes the tendencies of M0 and M3 for the spherical mode through production process.
     768    !! Production values are distributed along a normal law in altitude, centered  at
    765769    !! [[mm_globals(module):mm_p_prod(variable)]] pressure level with a fixed sigma of 20km.
    766770    !!
    767     !! First M3 tendency is computed and M0 is retrieved using the inter-moments relation a spherical 
     771    !! First M3 tendency is computed and M0 is retrieved using the inter-moments relation a spherical
    768772    !! characteristic radius set to [[mm_globals(module):mm_rc_prod(variable)]].
    769773    !!
     
    773777    REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm3s !! Tendency of M3 (\(m^{3}.m^{-3}\)).
    774778    INTEGER                     :: i
    775     REAL(kind=mm_wp)            :: zprod,cprod,timefact 
     779    REAL(kind=mm_wp)            :: zprod,cprod,timefact
    776780    REAL(kind=mm_wp), PARAMETER :: sigz  = 20e3_mm_wp, &
    777781                                   fnorm = 1._mm_wp/(dsqrt(2._mm_wp*mm_pi)*sigz), &
     
    793797    dm3s(:)= mm_tx_prod *0.75_mm_wp/mm_pi *mm_dt / mm_rhoaer / 2._mm_wp / mm_dzlev(1:mm_nla) * &
    794798             (erf((mm_zlev(1:mm_nla)-zprod)/znorm) - &
    795              erf((mm_zlev(2:mm_nla+1)-zprod)/znorm)) 
     799             erf((mm_zlev(2:mm_nla+1)-zprod)/znorm))
    796800    dm0s(:) = dm3s(:)/(mm_rc_prod**3*mm_alpha_s(3._mm_wp))
    797801
     
    803807    ENDIF
    804808
    805 
    806809  END SUBROUTINE mm_haze_production
    807810
Note: See TracChangeset for help on using the changeset viewer.