Changeset 3957 for trunk/LMDZ.PLUTO/libf


Ignore:
Timestamp:
Nov 12, 2025, 2:00:58 PM (4 weeks ago)
Author:
debatzbr
Message:

Pluto PCM: Implementation of a microphysical model for clouds in moments.
BBT

Location:
trunk/LMDZ.PLUTO/libf
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.PLUTO/libf/muphypluto/mp2m_globals.F90

    r3952 r3957  
    292292    REAL(kind=mm_wp), PUBLIC, SAVE, DIMENSION(5) :: mm_bt3 = (/1._mm_wp,1._mm_wp,1._mm_wp,1._mm_wp,1._mm_wp/)
    293293
    294     ! Chemical specie properties (Cloud model)
    295     ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     294    ! Chemical species properties (Cloud model)
     295    ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    296296    TYPE, PUBLIC :: mm_esp
    297       !! Cloud related chemical specie properties.
     297      !! Cloud related chemical species properties.
    298298      !! This derived type is used in thermodynamic methods related to cloud microphysics.
    299299      !!
     
    10691069
    10701070      IF (.NOT.mm_call_clouds) THEN
    1071         IF (mm_debug) WRITE(*,'(a)') "[MM_DEBUG - mm_clouds_init]: Cloud microphysic is not enabled..."
     1071        IF (mm_debug) WRITE(*,'(a)') "[MM_DEBUG - mm_clouds_init] Cloud microphysic is not enabled..."
    10721072        RETURN
    10731073      ENDIF
     
    13201320      !!
    13211321      TYPE(cfgparser), INTENT(in)  :: parser ! Configuration parser.
    1322       CHARACTER(len=*), INTENT(in) :: sec    ! Name of the specie.
     1322      CHARACTER(len=*), INTENT(in) :: sec    ! Name of the species.
    13231323      TYPE(mm_esp), INTENT(out)    :: pp     ! [[mm_esp(type)]] object that stores the parameters.
    13241324
  • trunk/LMDZ.PLUTO/libf/muphypluto/mp2m_microphysics.F90

    r3951 r3957  
    88    !
    99    !     The module contains two methods:
    10     !        - mm_muphys(m3as_prod,dm0a_s,dm3a_s,dm0a_f,dm3a_f)
    11     !        - mm_diagnostics(dt,aer_prec,aer_s_w,aer_f_w,aer_s_flux,aer_f_flux,rc_sph,rc_fra)
     10    !        - mm_muphys
     11    !        - mm_diagnostics
    1212    !
    1313    !     Authors
     
    2020    USE MP2M_GLOBALS
    2121    USE MP2M_HAZE
     22    USE MP2M_CLOUDS
    2223    USE MP2M_METHODS
    2324    IMPLICIT NONE
    2425   
    2526    PUBLIC :: mm_muphys, mm_diagnostics
     27
     28    !! Interface to main microphysics subroutine:
     29    !! Computes either all the microphysics processes [[muphys_all]]
     30    !! or only aerosols microphysics [[muphys_nocld]] in a single call.
     31    INTERFACE mm_muphys
     32      MODULE PROCEDURE muphys_all,muphys_nocld
     33    END INTERFACE mm_muphys
    2634 
    2735    CONTAINS
    2836 
    29     FUNCTION mm_muphys(m3as_prod,dm0a_s,dm3a_s,dm0a_f,dm3a_f) RESULT(ret)
     37    FUNCTION muphys_all(m3as_prod,dm0as,dm3as,dm0af,dm3af,dm0ccn,dm3ccn,dm3ices,dmugases) RESULT(ret)
    3038        !! Compute the evolution of moments tracers through haze microphysics processes.
    3139        !!
     
    4452        REAL(kind=mm_wp), INTENT(in), DIMENSION(:) :: m3as_prod
    4553        ! Tendency of the 0th order moment of the spherical mode distribution (m-2).
    46         REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm0a_s
     54        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:) :: dm0as
    4755        ! Tendency of the 3rd order moment of the spherical mode distribution (m3.m-2).
    48         REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm3a_s
     56        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:) :: dm3as
    4957        ! Tendency of the 0th order moment of the fractal mode distribution (m-2).
    50         REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm0a_f
     58        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:) :: dm0af
    5159        ! Tendency of the 3rd order moment of the fractal mode distribution (m3.m-2).
    52         REAL(kind=mm_wp), INTENT(out), DIMENSION(:) :: dm3a_f
     60        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:) :: dm3af
     61        ! Tendency of the 0th order moment of the CCN distribution (m-2).
     62        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:)   :: dm0ccn
     63        ! Tendency of the 3rd order moment of the CCN distribution (m3.m-2).
     64        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:)   :: dm3ccn
     65        ! Tendency of the 3rd order moment of each ice components (m3.m-2).
     66        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:,:) :: dm3ices
     67        ! Tendencies of each condensible gaz species (mol.mol-1).
     68        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:,:) :: dmugases
     69
     70        ! .true. on succes (i.e. model has been initialized at least once previously), .false. otherwise.
     71        LOGICAL :: ret
     72       
     73        ! Local variables.
     74        INTEGER :: i
     75        ! Production of the spherical aerosols (m3.m-3).
     76        REAL(kind=mm_wp), DIMENSION(:), ALLOCATABLE :: m3a_s_prod
     77        ! Tendencies related to haze model (X/m3).
     78        REAL(kind=mm_wp), DIMENSION(SIZE(dm0as)) :: Hdm0as,Hdm3as,Hdm0af,Hdm3af
     79        ! Tendencies related to cloud model (X/m3).
     80        REAL(kind=mm_wp), DIMENSION(SIZE(dm0as)) :: Cdm0as,Cdm3as,Cdm0af,Cdm3af
     81       
     82        ALLOCATE(m3a_s_prod(mm_nla))
     83
     84        ! Sanity check for initialization
     85        ret = (mm_ini_col.AND.mm_ini_aer)
     86        if (.NOT.ret) then
     87            return
     88        endif
     89        if (mm_call_clouds.AND.mm_debug) then
     90            write(*,'(a)') "[MM_DEBUG - muphys_nocld] Clouds microphysics enabled but will not be computed... (wrong interface)"
     91        endif
     92     
     93        ! Reverse vectors so they go from top to ground
     94        ! @note: mm_dzlev is already from top to ground
     95        m3a_s_prod = m3as_prod(mm_nla:1:-1) / mm_dzlev(:)
     96
     97        ! Calls haze microphysics (/!\ tendencies in X/m-3)
     98        call mm_haze_microphysics(m3a_s_prod,Hdm0as,Hdm3as,Hdm0af,Hdm3af)
     99
     100        ! Calls cloud microphysics (/!\ tendencies in X/m-3)
     101        if (mm_call_clouds) then
     102            call mm_cloud_microphysics(Hdm0as,Hdm3as,Hdm0af,Hdm3af,&
     103                                       Cdm0as,Cdm3as,Cdm0af,Cdm3af,&
     104                                       dm0ccn,dm3ccn,dm3ices,dmugases)
     105
     106            ! Multiply by altitude thickness and reverse vectors so they go from ground to top (--> m-2)
     107            dm0ccn = dm0ccn(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
     108            dm3ccn = dm3ccn(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
     109            do i = 1, mm_nesp
     110                dm3ices(:,i)  = dm3ices(mm_nla:1:-1,i) * mm_dzlev(mm_nla:1:-1)
     111                dmugases(:,i) = dmugases(mm_nla:1:-1,i)
     112            enddo
     113         
     114        else
     115            Cdm0as(:) = 0._mm_wp ; Cdm3as(:) = 0._mm_wp ; Cdm0af(:) = 0._mm_wp ; Cdm3af(:) = 0._mm_wp
     116            dm0ccn(:) = 0._mm_wp ; dm3ccn(:) = 0._mm_wp ; dm3ices(:,:) = 0._mm_wp ; dmugases(:,:) = 0._mm_wp
     117        endif ! end of mm_call_clouds
     118       
     119        ! Multiply by altitude thickness and reverse vectors so they go from ground to top (--> m-2)
     120        dm0as = (Hdm0as(mm_nla:1:-1) + Cdm0as(mm_nla:1:-1)) * mm_dzlev(mm_nla:1:-1)
     121        dm3as = (Hdm3as(mm_nla:1:-1) + Cdm3as(mm_nla:1:-1)) * mm_dzlev(mm_nla:1:-1)
     122        dm0af = (Hdm0af(mm_nla:1:-1) + Cdm0af(mm_nla:1:-1)) * mm_dzlev(mm_nla:1:-1)
     123        dm3af = (Hdm3af(mm_nla:1:-1) + Cdm3af(mm_nla:1:-1)) * mm_dzlev(mm_nla:1:-1)
     124       
     125        RETURN
     126    END FUNCTION muphys_all
     127   
     128   
     129    FUNCTION muphys_nocld(m3as_prod,dm0as,dm3as,dm0af,dm3af) RESULT(ret)
     130        !! Compute the evolution of moments tracers through haze microphysics processes.
     131        !!
     132        !! This method computes the evolution of all the microphysics tracers, given under the form
     133        !! of moments during a time step.
     134        !!
     135        !! The method requires that global variables of the model (i.e. variables declared in mm_globals
     136        !! module) are initialized/updated correctly (see mm_global_init, mm_column_init, and mm_aerosols_init).
     137        !!
     138        !! The tendencies returned by the method are defined on the vertical __layers__ of the model from the __GROUND__ to
     139        !! the __TOP__ of the atmosphere. They should be added to the input variables used in the initialization methods
     140        !! before the latter are called to initialize a new step.
     141        !!
     142
     143        ! Production of the 3rd order moment of the spherical mode distribution (m3.m-2).
     144        REAL(kind=mm_wp), INTENT(in), DIMENSION(:) :: m3as_prod
     145        ! Tendency of the 0th order moment of the spherical mode distribution (m-2).
     146        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:) :: dm0as
     147        ! Tendency of the 3rd order moment of the spherical mode distribution (m3.m-2).
     148        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:) :: dm3as
     149        ! Tendency of the 0th order moment of the fractal mode distribution (m-2).
     150        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:) :: dm0af
     151        ! Tendency of the 3rd order moment of the fractal mode distribution (m3.m-2).
     152        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:) :: dm3af
    53153
    54154        ! .true. on succes (i.e. model has been initialized at least once previously), .false. otherwise.
     
    60160        ALLOCATE(m3a_s_prod(mm_nla))
    61161       
     162        ! Sanity check for initialization
    62163        ret = (mm_ini_col.AND.mm_ini_aer)
    63        
    64         IF (.NOT.ret) RETURN
     164        if (.NOT.ret) then
     165            return
     166        endif
     167        if (mm_call_clouds.AND.mm_debug) then
     168            write(*,'(a)') "[MM_DEBUG - muphys_nocld] Clouds microphysics enabled but will not be computed... (wrong interface)"
     169        endif
    65170     
    66171        ! Reverse vectors so they go from top to ground
     
    69174
    70175        ! Calls haze microphysics
    71         call mm_haze_microphysics(m3a_s_prod,dm0a_s,dm3a_s,dm0a_f,dm3a_f)
    72        
    73         ! Reverse vectors so they go from ground to top
    74         dm0a_s = dm0a_s(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
    75         dm3a_s = dm3a_s(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
    76         dm0a_f = dm0a_f(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
    77         dm3a_f = dm3a_f(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
     176        call mm_haze_microphysics(m3a_s_prod,dm0as,dm3as,dm0af,dm3af)
     177       
     178        ! Multiply by altitude thickness and reverse vectors so they go from ground to top (--> m-2)
     179        dm0as = dm0as(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
     180        dm3as = dm3as(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
     181        dm0af = dm0af(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
     182        dm3af = dm3af(mm_nla:1:-1) * mm_dzlev(mm_nla:1:-1)
    78183       
    79184        RETURN
    80     END FUNCTION mm_muphys
    81 
    82 
    83     SUBROUTINE mm_diagnostics(dt,aer_s_prec,aer_f_prec,aer_s_w,aer_f_w,aer_s_flux,aer_f_flux,rc_sph,rc_fra)
     185    END FUNCTION muphys_nocld
     186
     187
     188    SUBROUTINE mm_diagnostics(dt,aer_s_prec,aer_f_prec,aer_s_w,aer_f_w,aer_s_flux,aer_f_flux,rc_sph,rc_fra,&
     189                              ccn_prec,ice_prec,cld_w,ccn_flux,ice_fluxes,rcld,gas_sat,n_rate,g_rate)
    84190        !! Get various diagnostic fields of the microphysics.
    85191        !!
     
    91197        !! Precipitation are always positive and defined in kg.m-2.s-1.
    92198        !!
    93 
    94199        ! Physics timestep (s).
    95200        REAL(kind=8), INTENT(IN) :: dt
    96201
     202        ! Haze related:
     203        !~~~~~~~~~~~~~~
    97204        ! Aerosol precipitation (kg.m-2.s-1).
    98         REAL(kind=mm_wp), INTENT(out), OPTIONAL :: aer_s_prec
    99         REAL(kind=mm_wp), INTENT(out), OPTIONAL :: aer_f_prec
    100 
     205        REAL(kind=mm_wp), INTENT(inout), OPTIONAL :: aer_s_prec
     206        REAL(kind=mm_wp), INTENT(inout), OPTIONAL :: aer_f_prec
    101207        ! Aerosol settling velocity (m.s-1).
    102         REAL(kind=mm_wp), INTENT(out), DIMENSION(:), OPTIONAL :: aer_s_w
    103         REAL(kind=mm_wp), INTENT(out), DIMENSION(:), OPTIONAL :: aer_f_w
    104 
     208        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL :: aer_s_w
     209        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL :: aer_f_w
    105210        ! Aerosol mass flux (kg.m-2.s-1).
    106         REAL(kind=mm_wp), INTENT(out), DIMENSION(:), OPTIONAL :: aer_s_flux
    107         REAL(kind=mm_wp), INTENT(out), DIMENSION(:), OPTIONAL :: aer_f_flux
    108 
     211        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL :: aer_s_flux
     212        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL :: aer_f_flux
    109213        ! Aerosol characteristic radius (m).
    110         REAL(kind=mm_wp), INTENT(out), DIMENSION(:), OPTIONAL :: rc_sph
    111         REAL(kind=mm_wp), INTENT(out), DIMENSION(:), OPTIONAL :: rc_fra
    112 
     214        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL :: rc_sph
     215        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL :: rc_fra
     216
     217        ! Clouds related:
     218        !~~~~~~~~~~~~~~~~
     219        ! Cloud condensation nuclei precipitation (kg.m-2.s-1).
     220        REAL(kind=mm_wp), INTENT(inout), OPTIONAL                 :: ccn_prec
     221        ! Ice precipitation (kg.m-2.s-1).
     222        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL   :: ice_prec
     223        ! Cloud drop (CCN + ices) settling velocity (m.s-1).
     224        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL   :: cld_w
     225        ! Cloud condensation nuclei mass flux (kg.m-2.s-1).
     226        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL   :: ccn_flux
     227        ! Ice mass fluxes (kg.m-2.s-1).
     228        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:,:), OPTIONAL :: ice_fluxes
     229        ! Cloud drop (CCN + ices) radius (m).
     230        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:), OPTIONAL   :: rcld
     231        ! Cloud related diagnostics.
     232        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:,:), OPTIONAL :: gas_sat ! Condensible gaz saturation ratios.
     233        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:,:), OPTIONAL :: n_rate  ! Condensible gaz nucleation rates (m-2.s-1).
     234        REAL(kind=mm_wp), INTENT(inout), DIMENSION(:,:), OPTIONAL :: g_rate  ! Ice growth rates (m2.s-1).
     235
     236        ! Haze related:
     237        !~~~~~~~~~~~~~~
    113238        IF (PRESENT(aer_s_prec)) aer_s_prec = ABS(mm_aers_prec) / dt
    114239        IF (PRESENT(aer_f_prec)) aer_f_prec = ABS(mm_aerf_prec) / dt
     
    124249            IF (PRESENT(rc_sph)) rc_sph = 0._mm_wp
    125250            IF (PRESENT(rc_fra)) rc_fra = 0._mm_wp
    126         ENDIF   
     251        ENDIF
     252
     253        ! Clouds related:
     254        !~~~~~~~~~~~~~~~~
     255        IF (mm_call_clouds) THEN
     256            IF (PRESENT(ccn_prec))   ccn_prec   = ABS(mm_ccn_prec) / dt
     257            IF (PRESENT(ice_prec))   ice_prec   = ABS(mm_ice_prec) / dt
     258            IF (PRESENT(cld_w))      cld_w      = mm_cld_vsed(mm_nla:1:-1)
     259            IF (PRESENT(ccn_flux))   ccn_flux   = mm_ccn_flux(mm_nla:1:-1)
     260            IF (PRESENT(ice_fluxes)) ice_fluxes = mm_ice_fluxes(mm_nla:1:-1,:)
     261            IF (PRESENT(rcld))       rcld       = mm_drad(mm_nla:1:-1)
     262            IF (PRESENT(gas_sat))    gas_sat    = mm_gas_sat(mm_nla:1:-1,:)
     263            IF (PRESENT(n_rate))     n_rate     = mm_nrate(mm_nla:1:-1,:)
     264            IF (PRESENT(g_rate))     g_rate     = mm_grate(mm_nla:1:-1,:)
     265        ELSE
     266            IF (PRESENT(ccn_prec))   ccn_prec   = 0._mm_wp
     267            IF (PRESENT(ice_prec))   ice_prec   = 0._mm_wp
     268            IF (PRESENT(cld_w))      cld_w      = 0._mm_wp
     269            IF (PRESENT(ccn_flux))   ccn_flux   = 0._mm_wp
     270            IF (PRESENT(ice_fluxes)) ice_fluxes = 0._mm_wp
     271            IF (PRESENT(rcld))       rcld       = 0._mm_wp
     272            IF (PRESENT(gas_sat))    gas_sat    = 0._mm_wp
     273            IF (PRESENT(n_rate))     n_rate     = 0._mm_wp
     274            IF (PRESENT(g_rate))     g_rate     = 0._mm_wp
     275        ENDIF ! end of mm_call_clouds
     276
    127277    END SUBROUTINE mm_diagnostics
    128278
  • trunk/LMDZ.PLUTO/libf/phypluto/mp2m_calmufi.F90

    r3683 r3957  
    11MODULE mp2m_calmufi
    22    use tracer_h
    3     use callkeys_mod, only : call_haze_prod_pCH4, haze_rho
     3    use comcstfi_mod, only : mugaz
     4    use callkeys_mod, only : call_haze_prod_pCH4, haze_rho,&
     5                             callmuclouds
    46   
    57    ! Microphysical model MP2M
     
    1416    !     Purpose
    1517    !     -------
    16     !     Interface subroutine to YAMMS model for LMD PCM.
     18    !     Interface subroutine to YAMMS model for LMD's PCM.
    1719    !
    1820    !     The subroutine computes the microphysics processes for a single vertical column.
     
    2931    !
    3032    !     @warning
    31     !     We suppose a given order of tracers (1. mu_m0as, 2. mu_m3as, 3. mu_m0af, 4. mu_m3af)!
     33    !     We suppose a given order of microphysical tracers in micro_indx(:):
     34    !     1. mu_m0as, 2. mu_m3as, 3. mu_m0af, 4. mu_m3af.
     35    !     If clouds are activated:
     36    !     5. mu_m0ccn, 6. mu_m3ccn, 7(+). mu_m3ices.
    3237    !
    3338    !     Authors
     
    6267        REAL(kind=8), DIMENSION(:,:,:), ALLOCATABLE :: zq    ! Local tracers updated from former processes (X.kg-1).
    6368       
     69        ! Related to aerosols:
    6470        REAL(kind=8), DIMENSION(:), ALLOCATABLE :: m0as      ! 0th order moment of the spherical mode (m-2).
    6571        REAL(kind=8), DIMENSION(:), ALLOCATABLE :: m3as      ! 3rd order moment of the spherical mode (m3.m-2).
     
    7379        REAL(kind=8), DIMENSION(:), ALLOCATABLE   :: dm0af   ! Tendency of the 0th order moment of the fractal mode distribution (m-2).
    7480        REAL(kind=8), DIMENSION(:), ALLOCATABLE   :: dm3af   ! Tendency of the 3rd order moment of the fractal mode distribution (m3.m-2).
     81
     82        ! Related to clouds:
     83        REAL(kind=8), DIMENSION(:), ALLOCATABLE   :: m0ccn   ! 0th order moment of the ccn distribution (m-2).
     84        REAL(kind=8), DIMENSION(:), ALLOCATABLE   :: m3ccn   ! 3rd order moment of the ccn distribution (m3.m-2).
     85        REAL(kind=8), DIMENSION(:,:), ALLOCATABLE :: m3ices  ! 3rd order moments of the ice components (m3.m-2).
     86        REAL(kind=8), DIMENSION(:,:), ALLOCATABLE :: mugases ! Condensible species gas molar fraction (mol.mol-1).
     87
     88        REAL(kind=8), DIMENSION(:), ALLOCATABLE   :: dm0ccn   ! Tendency of the 0th order moment of the ccn distribution (m-2).
     89        REAL(kind=8), DIMENSION(:), ALLOCATABLE   :: dm3ccn   ! Tendency of the 3rd order moment of the ccn distribution (m3.m-2).
     90        REAL(kind=8), DIMENSION(:,:), ALLOCATABLE :: dm3ices  ! Tendencies of the 3rd order moments of each ice components (m3.m-2).
     91        REAL(kind=8), DIMENSION(:,:), ALLOCATABLE :: dmugases ! Tendencies of each condensible gas species (mol.mol-1).
    7592       
    7693        ! Local variables:
     
    8097        TYPE(error) :: err
    8198       
    82         INTEGER           :: ilon,iq
     99        INTEGER           :: i,ilon,iq
    83100        INTEGER           :: nq,nlon,nlay
    84101        CHARACTER(len=10) :: tname
     
    98115        ALLOCATE(m0af(nlay))
    99116        ALLOCATE(m3af(nlay))
    100 
    101117        ALLOCATE(m3as_prod(nlay))
    102        
    103118        ALLOCATE(dm0as(nlay))
    104119        ALLOCATE(dm3as(nlay))
     
    106121        ALLOCATE(dm3af(nlay))
    107122
     123        ALLOCATE(m0ccn(nlay))
     124        ALLOCATE(m3ccn(nlay))
     125        ALLOCATE(m3ices(nlay,nmicro_ices))
     126        ALLOCATE(mugases(nlay,nmicro_ices))
     127        ALLOCATE(dm0ccn(nlay))
     128        ALLOCATE(dm3ccn(nlay))
     129        ALLOCATE(dm3ices(nlay,nmicro_ices))
     130        ALLOCATE(dmugases(nlay,nmicro_ices))
     131
    108132        ALLOCATE(int2ext(nlon,nlay)) 
    109133       
     
    129153            m0af(:) = zq(ilon,:,micro_indx(3)) * int2ext(ilon,:)
    130154            m3af(:) = zq(ilon,:,micro_indx(4)) * int2ext(ilon,:)
     155           
     156            if (callmuclouds) then
     157                m0ccn(:) = zq(ilon,:,micro_indx(5)) * int2ext(ilon,:)
     158                m3ccn(:) = zq(ilon,:,micro_indx(6)) * int2ext(ilon,:)
     159                do i = 1, nmicro_ices
     160                    m3ices(:,i)  = zq(ilon,:,micro_ice_indx(i)) * int2ext(ilon,:)
     161                    mugases(:,i) = zq(ilon,:,micro_gas_indx(i)) / (mmol(micro_gas_indx(i))/mugaz)
     162                enddo
     163            endif ! end of callmuclouds
    131164
    132165            ! Production of haze in the atmosphere by photolysis of CH4
     
    150183            ! Initialize YAMMS atmospheric column
    151184            err = mm_column_init(tmp,zlev(ilon,:),play(ilon,:),zlay(ilon,:),temp(ilon,:)) ; IF (err /= 0) call abort_program(err)
    152             ! Initialize YAMMS aerosols moments column
     185            ! Initialize YAMMS aerosol moments column
    153186            err = mm_aerosols_init(m0as,m3as,m0af,m3af) ; IF (err /= 0) call abort_program(err)
     187            ! Initialize YAMMS cloud moments column
     188            if (callmuclouds) then
     189                err = mm_clouds_init(m0ccn,m3ccn,m3ices,mugases) ; IF (err /= 0) call abort_program(err)
     190            endif ! end of callmuclouds
    154191           
    155192            ! Initializes tendencies
    156193            dm0as(:) = 0._mm_wp ; dm3as(:) = 0._mm_wp ; dm0af(:) = 0._mm_wp ; dm3af(:) = 0._mm_wp
     194            dm0ccn(:) = 0._mm_wp ; dm3ccn(:) = 0._mm_wp ; dm3ices(:,:) = 0._mm_wp ; dmugases(:,:) = 0._mm_wp
    157195           
    158196        !----------------------------
     
    161199           
    162200            ! Call microphysics
    163             IF (.NOT.mm_muphys(m3as_prod,dm0as,dm3as,dm0af,dm3af)) THEN
    164                 call abort_program(error("mm_muphys aborted -> initialization not done !",-1))
    165             ENDIF
     201            if (callmuclouds) then
     202                if(.NOT.mm_muphys(m3as_prod,dm0as,dm3as,dm0af,dm3af,dm0ccn,dm3ccn,dm3ices,dmugases)) then
     203                    call abort_program(error("mm_muphys (clouds) aborted -> initialization not done !",-1))
     204                endif
     205            else
     206                if (.NOT.mm_muphys(m3as_prod,dm0as,dm3as,dm0af,dm3af)) then
     207                    call abort_program(error("mm_muphys (no cloud) aborted -> initialization not done !",-1))
     208                endif
     209            endif ! end of callmuclouds
    166210           
    167211            ! Save diagnostics
     
    169213                                mp2m_aer_s_w(ilon,:),mp2m_aer_f_w(ilon,:),       &
    170214                                mp2m_aer_s_flux(ilon,:),mp2m_aer_f_flux(ilon,:), &
    171                                 mp2m_rc_sph(ilon,:),mp2m_rc_fra(ilon,:))
     215                                mp2m_rc_sph(ilon,:),mp2m_rc_fra(ilon,:),         &
     216                                mp2m_ccn_prec(ilon),mp2m_ice_prec(ilon,:),       &
     217                                mp2m_cld_w(ilon,:),mp2m_ccn_flux(ilon,:),        &
     218                                mp2m_ice_fluxes(ilon,:,:),mp2m_rc_cld(ilon,:),   &
     219                                mp2m_gas_sat(ilon,:,:),mp2m_nrate(ilon,:,:),mp2m_grate(ilon,:,:))
    172220       
    173221            ! Convert tracers back to intensives
     
    176224            zdqmufi(ilon,:,micro_indx(3)) = dm0af(:) / int2ext(ilon,:)
    177225            zdqmufi(ilon,:,micro_indx(4)) = dm3af(:) / int2ext(ilon,:)
     226
     227            if (callmuclouds) then
     228                zdqmufi(ilon,:,micro_indx(5)) = dm0ccn(:) / int2ext(ilon,:)
     229                zdqmufi(ilon,:,micro_indx(6)) = dm3ccn(:) / int2ext(ilon,:)
     230                do i = 1, nmicro_ices
     231                    zdqmufi(ilon,:,micro_ice_indx(i)) = dm3ices(:,i) / int2ext(ilon,:)
     232                    zdqmufi(ilon,:,micro_gas_indx(i)) = dmugases(:,i) * (mmol(micro_gas_indx(i))/mugaz)
     233                enddo
     234            endif ! End of callmuclouds
    178235           
    179236        END DO ! End loop on ilon
  • trunk/LMDZ.PLUTO/libf/phypluto/physiq_mod.F90

    r3955 r3957  
    15931593         !--------------------------------------------------
    15941594         pdqmuchem(:,:,:) = 0.
    1595          IF (callmufi.and.callmuclouds) THEN
     1595         IF (callmufi) THEN
    15961596            call mugas_prof(ngrid,nlayer,nq,zzlay,zzlev,pplay,pt,pdqmuchem)
    15971597         ENDIF
     
    16211621            pdq(:,:,:) = pdq(:,:,:) + pdqmufi(:,:,:)
    16221622
    1623             ! Increment Haze surface tracer tendency (aerosol precipitation)
    1624             ! Sphericals
     1623            ! Increment surface tracer tendencies through precipitation
     1624            ! Spherical aerosols
    16251625            dqsurf(:,micro_indx(2)) = dqsurf(:,micro_indx(2)) + mp2m_aer_s_prec(:)
    1626             ! Fractals
     1626            ! Fractal aerosols
    16271627            dqsurf(:,micro_indx(4)) = dqsurf(:,micro_indx(4)) + mp2m_aer_f_prec(:)
     1628            IF (callmuclouds) THEN
     1629               ! Cloud condensation nuclei
     1630               dqsurf(:,micro_indx(6)) = dqsurf(:,micro_indx(6)) + mp2m_ccn_prec(:)
     1631               ! Ices
     1632               do iq = 1, size(micro_ice_indx)
     1633                  dqsurf(:,micro_ice_indx(iq)) = dqsurf(:,micro_ice_indx(iq)) + mp2m_ice_prec(:,iq)
     1634               enddo
     1635            ENDIF ! end of callmuclouds
    16281636
    16291637         ELSE
Note: See TracChangeset for help on using the changeset viewer.