source: trunk/LMDZ.PLUTO/libf/phypluto/mp2m_diagnostics.F90 @ 3573

Last change on this file since 3573 was 3559, checked in by debatzbr, 6 weeks ago

Addition of the interface between the physics and the microphysics model.

File size: 5.3 KB
RevLine 
[3559]1MODULE mp2m_diagnostics
2
3!=======================================================================
4!   Purpose
5!   -------
6!   Microphysics diagnostics variables module.
7!
8!   The module contains all the variables related to output diagnostics of the microphysics two moments.
9!   Such variables are not (and should not be) used as input in the GCM except for output data writing.
10!
11!   The module also contains three methods:
12!      - inimuphy_diag(ngrid,nlayer,nq,pq,int2ext)
13!      - alpha_s(k)
14!      - alpha_f(k)
15!
16!   Authors
17!   -------
18!      Bruno de Batz de Trenquelléon (11/2024)
19!=======================================================================
20
21  USE tracer_h
22 
23  IMPLICIT NONE
24
25  REAL(kind=8), ALLOCATABLE, DIMENSION(:)     :: mp2m_aer_s_prec ! Spherical aerosols precipitations (kg.m-2.s-1).
26  REAL(kind=8), ALLOCATABLE, DIMENSION(:)     :: mp2m_aer_f_prec ! Fractal aerosols precipitations (kg.m-2.s-1).
27  REAL(kind=8), ALLOCATABLE, DIMENSION(:,:)   :: mp2m_aer_s_w    ! Spherical aerosol settling velocity (m.s-1).
28  REAL(kind=8), ALLOCATABLE, DIMENSION(:,:)   :: mp2m_aer_f_w    ! Fractal aerosol settling velocity (m.s-1).
29  REAL(kind=8), ALLOCATABLE, DIMENSION(:,:)   :: mp2m_aer_s_flux ! Spherical aerosol mass flux (kg.m-2.s-1).
30  REAL(kind=8), ALLOCATABLE, DIMENSION(:,:)   :: mp2m_aer_f_flux ! Fractal aerosol mass flux (kg.m-2.s-1).
31  REAL(kind=8), ALLOCATABLE, DIMENSION(:,:)   :: mp2m_rc_sph     ! Spherical mode characteristic radius, i.e. bulk radius (m).
32  REAL(kind=8), ALLOCATABLE, DIMENSION(:,:)   :: mp2m_rc_fra     ! Fractal mode characteristic radius, i.e. bulk radius (m).
33 
34  !$OMP THREADPRIVATE(mp2m_aer_s_prec,mp2m_aer_f_prec,mp2m_aer_s_w,mp2m_aer_f_w,mp2m_aer_s_flux,mp2m_aer_f_flux)
35  !$OMP THREADPRIVATE(mp2m_rc_sph,mp2m_rc_fra)
36
37  CONTAINS
38
39  SUBROUTINE inimufi_diag(ngrid,nlayer,nq,pq,int2ext)
40    !! Initialize the variables associated to microphysics diagnostics.
41    !!
42    use callkeys_mod, only : haze_rc_prod, haze_rm
43
44    INTEGER, INTENT(in) :: ngrid  ! Number of points of the horizontal grid.
45    INTEGER, INTENT(in) :: nlayer ! Number of points of the vertical grid (layers).
46    INTEGER, INTENT(in) :: nq     ! Number of advected fields.
47
48    REAL,INTENT(in) :: pq(ngrid,nlayer,nq)   ! Tracers (X/kg_of_air).
49    REAL,INTENT(in) :: int2ext(ngrid,nlayer) ! Intensive to extensive factor (kg_air/m3).
50
51    ! Local variables:
52    !~~~~~~~~~~~~~~~~~
53    REAL, DIMENSION(:,:), ALLOCATABLE :: m0as ! 0th order moment of the spherical mode (m-3).
54    REAL, DIMENSION(:,:), ALLOCATABLE :: m3as ! 3rd order moment of the spherical mode (m3.m-3).
55    REAL, DIMENSION(:,:), ALLOCATABLE :: m0af ! 0th order moment of the fractal mode (m-3).
56    REAL, DIMENSION(:,:), ALLOCATABLE :: m3af ! 3rd order moment of the fractal mode (m3.m-3).
57   
58    IF (.NOT.ALLOCATED(mp2m_aer_s_prec)) ALLOCATE(mp2m_aer_s_prec(ngrid))
59    IF (.NOT.ALLOCATED(mp2m_aer_f_prec)) ALLOCATE(mp2m_aer_f_prec(ngrid))
60    IF (.NOT.ALLOCATED(mp2m_aer_s_w))    ALLOCATE(mp2m_aer_s_w(ngrid,nlayer))
61    IF (.NOT.ALLOCATED(mp2m_aer_f_w))    ALLOCATE(mp2m_aer_f_w(ngrid,nlayer))
62    IF (.NOT.ALLOCATED(mp2m_aer_s_flux)) ALLOCATE(mp2m_aer_s_flux(ngrid,nlayer))
63    IF (.NOT.ALLOCATED(mp2m_aer_f_flux)) ALLOCATE(mp2m_aer_f_flux(ngrid,nlayer))
64    IF (.NOT.ALLOCATED(mp2m_rc_sph))     ALLOCATE(mp2m_rc_sph(ngrid,nlayer))
65    IF (.NOT.ALLOCATED(mp2m_rc_fra))     ALLOCATE(mp2m_rc_fra(ngrid,nlayer))
66   
67    mp2m_aer_s_prec(:)   = 0d0
68    mp2m_aer_f_prec(:)   = 0d0
69    mp2m_aer_s_w(:,:)    = 0d0
70    mp2m_aer_f_w(:,:)    = 0d0
71    mp2m_aer_s_flux(:,:) = 0d0
72    mp2m_aer_f_flux(:,:) = 0d0
73   
74    ! Initializes the radius to their first value (useful for radiative transfer).
75    m0as = pq(:,:,micro_indx(1)) * int2ext
76    m3as = pq(:,:,micro_indx(2)) * int2ext
77    m0af = pq(:,:,micro_indx(3)) * int2ext
78    m3af = pq(:,:,micro_indx(4)) * int2ext
79
80    WHERE(m0as > 1e-10 .AND. m3as > (1e-10*alpha_s(3.)*haze_rc_prod**3))
81      mp2m_rc_sph = (m3as / (m0as*alpha_s(3.)))**(1./3.)
82    ELSEWHERE
83      mp2m_rc_sph = 0d0
84    ENDWHERE
85
86    WHERE(m0af > 1e-10 .AND. m3af > (1e-10*alpha_f(3.)*haze_rm**3))
87      mp2m_rc_fra = (m3af / (m0af*alpha_f(3.)))**(1./3.)
88    ELSEWHERE
89      mp2m_rc_fra = 0d0
90    ENDWHERE
91 
92    CONTAINS
93
94    FUNCTION alpha_s(k) RESULT (res)
95      !! Inter-moment relation for spherical aerosols size distribution law.
96      !! Mk / M0 = rc^k . alpha(k)
97      !!
98      use mp2m_intgcm
99      REAL, INTENT(in) :: k ! k order of the moment.
100      REAL :: sigma         ! Standard deviation.
101      REAL :: res           ! Alpha value.
102   
103      ! Titan's case
104      !~~~~~~~~~~~~~
105      ! res = SUM(dexp(mm_asp%a*k**2 + mm_asp%b*k + mm_asp%c))
106
107      ! Pluto's case
108      !~~~~~~~~~~~~~
109      sigma = 0.2
110      res = exp(k**2 * sigma**2 / 2.)
111    END FUNCTION alpha_s
112
113    FUNCTION alpha_f(k) RESULT (res)
114      !! Inter-moment relation for fractal aerosols size distribution law.
115      !! Mk / M0 = rc^k . alpha(k)
116      !!
117      use mp2m_intgcm
118      REAL, INTENT(in) :: k ! k order of the moment.
119      REAL :: sigma         ! Standard deviation.
120      REAL :: res           ! Alpha value.
121   
122      ! Titan's case
123      !~~~~~~~~~~~~~
124      ! res = SUM(dexp(mm_asp%a*k**2 + mm_asp%b*k + mm_asp%c))
125
126      ! Pluto's case
127      !~~~~~~~~~~~~~
128      sigma = 0.35
129      res = exp(k**2 * sigma**2 / 2.)
130    END FUNCTION alpha_f
131  END SUBROUTINE inimufi_diag
132
133END MODULE mp2m_diagnostics
Note: See TracBrowser for help on using the repository browser.