LCOV - code coverage report
Current view: | top level - physics/clubb/src/CLUBB_core - pdf_parameter_module.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 74 | 416 | 17.8 %
Date: | 2024-12-17 22:39:59 |  | Functions: | 2 | 11 | 18.2 %

              Line data    Source code
           1             : !-----------------------------------------------------------------------
           2             : ! $Id$
           3             : !===============================================================================
           4             : module pdf_parameter_module
           5             :
           6             :   ! Description:
           7             :   ! This module defines the derived type pdf_parameter.
           8             :
           9             :   ! References:
          10             :   !   None
          11             :   !-----------------------------------------------------------------------
          12             :
          13             :   use clubb_precision, only: &
          14             :       core_rknd
          15             :
          16             :   implicit none
          17             :
          18             :   private ! Default scope
          19             :
          20             :   public :: pdf_parameter,                 & ! Variable Type(s)
          21             :             implicit_coefs_terms,          &
          22             :             init_pdf_params,               & ! Procedure(s)
          23             :             print_pdf_params,              &
          24             :             copy_single_pdf_params_to_multi, &
          25             :             copy_multi_pdf_params_to_single, &
          26             :             init_pdf_implicit_coefs_terms
          27             :
          28             :   ! CLUBB's PDF parameters.
          29             :   type pdf_parameter
          30             :
          31             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
          32             :       w_1,             & ! Mean of w (1st PDF component)                   [m/s]
          33             :       w_2,             & ! Mean of w (2nd PDF component)                   [m/s]
          34             :       varnce_w_1,      & ! Variance of w (1st PDF component)           [m^2/s^2]
          35             :       varnce_w_2,      & ! Variance of w (2nd PDF component)           [m^2/s^2]
          36             :       rt_1,            & ! Mean of r_t (1st PDF component)               [kg/kg]
          37             :       rt_2,            & ! Mean of r_t (2nd PDF component)               [kg/kg]
          38             :       varnce_rt_1,     & ! Variance of r_t (1st PDF component)       [kg^2/kg^2]
          39             :       varnce_rt_2,     & ! Variance of r_t (2nd PDF component)       [kg^2/kg^2]
          40             :       thl_1,           & ! Mean of th_l (1st PDF component)                  [K]
          41             :       thl_2,           & ! Mean of th_l (2nd PDF component)                  [K]
          42             :       varnce_thl_1,    & ! Variance of th_l (1st PDF component)            [K^2]
          43             :       varnce_thl_2,    & ! Variance of th_l (2nd PDF component)            [K^2]
          44             :       corr_w_rt_1,     & ! Correlation of w and r_t (1st PDF component)      [-]
          45             :       corr_w_rt_2,     & ! Correlation of w and r_t (2nd PDF component)      [-]
          46             :       corr_w_thl_1,    & ! Correlation of w and th_l (1st PDF component)     [-]
          47             :       corr_w_thl_2,    & ! Correlation of w and th_l (2nd PDF component)     [-]
          48             :       corr_rt_thl_1,   & ! Correlation of r_t and th_l (1st PDF component)   [-]
          49             :       corr_rt_thl_2,   & ! Correlation of r_t and th_l (2nd PDF component)   [-]
          50             :       alpha_thl,       & ! Factor relating to normalized variance for th_l   [-]
          51             :       alpha_rt,        & ! Factor relating to normalized variance for r_t    [-]
          52             :       crt_1,           & ! r_t coef. in chi/eta eqns. (1st PDF comp.)        [-]
          53             :       crt_2,           & ! r_t coef. in chi/eta eqns. (2nd PDF comp.)        [-]
          54             :       cthl_1,          & ! th_l coef.: chi/eta eqns. (1st PDF comp.) [(kg/kg)/K]
          55             :       cthl_2,          & ! th_l coef.: chi/eta eqns. (2nd PDF comp.) [(kg/kg)/K]
          56             :       chi_1,           & ! Mean of chi (old s) (1st PDF component)       [kg/kg]
          57             :       chi_2,           & ! Mean of chi (old s) (2nd PDF component)       [kg/kg]
          58             :       stdev_chi_1,     & ! Standard deviation of chi (1st PDF component) [kg/kg]
          59             :       stdev_chi_2,     & ! Standard deviation of chi (2nd PDF component) [kg/kg]
          60             :       stdev_eta_1,     & ! Standard dev. of eta (old t) (1st PDF comp.)  [kg/kg]
          61             :       stdev_eta_2,     & ! Standard dev. of eta (old t) (2nd PDF comp.)  [kg/kg]
          62             :       covar_chi_eta_1, & ! Covariance of chi and eta (1st PDF comp.) [kg^2/kg^2]
          63             :       covar_chi_eta_2, & ! Covariance of chi and eta (2nd PDF comp.) [kg^2/kg^2]
          64             :       corr_w_chi_1,    & ! Correlation of w and chi (1st PDF component)      [-]
          65             :       corr_w_chi_2,    & ! Correlation of w and chi (2nd PDF component)      [-]
          66             :       corr_w_eta_1,    & ! Correlation of w and eta (1st PDF component)      [-]
          67             :       corr_w_eta_2,    & ! Correlation of w and eta (2nd PDF component)      [-]
          68             :       corr_chi_eta_1,  & ! Correlation of chi and eta (1st PDF component)    [-]
          69             :       corr_chi_eta_2,  & ! Correlation of chi and eta (2nd PDF component)    [-]
          70             :       rsatl_1,         & ! Saturation mixing ratio r_sat(mu_Tl_1,p)      [kg/kg]
          71             :       rsatl_2,         & ! Saturation mixing ratio r_sat(mu_Tl_2,p)      [kg/kg]
          72             :       rc_1,            & ! Mean of r_c (1st PDF component)               [kg/kg]
          73             :       rc_2,            & ! Mean of r_c (2nd PDF component)               [kg/kg]
          74             :       cloud_frac_1,    & ! Cloud fraction (1st PDF component)                [-]
          75             :       cloud_frac_2,    & ! Cloud fraction (2nd PDF component)                [-]
          76             :       mixt_frac,       & ! Weight of 1st PDF component (Sk_w dependent)      [-]
          77             :       ice_supersat_frac_1, & ! Ice supersaturation fraction (1st PDF comp.)  [-]
          78             :       ice_supersat_frac_2    ! Ice supersaturation fraction (2nd PDF comp.)  [-]
          79             :
          80             :   end type pdf_parameter
          81             :
          82             :   ! The implicit coefficients, semi-implicit coefficients and terms, and
          83             :   ! explicit terms for turbulent advection of turbulent fields are calculated
          84             :   ! from the PDF and the resulting PDF parameters.
          85             :   type implicit_coefs_terms
          86             :
          87             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
          88             :       coef_wp4_implicit    ! <w'^4> = coef_wp4_implicit * <w'^2>^2       [-]
          89             :
          90             :     ! <w'^2 rt'> = coef_wp2rtp_implicit * <w'rt'> + term_wp2rtp_explicit
          91             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
          92             :       coef_wp2rtp_implicit, & ! Coefficient that is multiplied by <w'rt'>  [m/s]
          93             :       term_wp2rtp_explicit    ! Term that is on the RHS          [m^2/s^2 kg/kg]
          94             :
          95             :     ! <w'^2 thl'> = coef_wp2thlp_implicit * <w'thl'> + term_wp2thlp_explicit
          96             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
          97             :       coef_wp2thlp_implicit, & ! Coef. that is multiplied by <w'thl'>      [m/s]
          98             :       term_wp2thlp_explicit    ! Term that is on the RHS             [m^2/s^2 K]
          99             :
         100             :     ! <w'^2 u'> = coef_wp2up_implicit * <u'w'> + term_wp2up_explicit
         101             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
         102             :       coef_wp2up_implicit, & ! Coefficient that is multiplied by <u'w'>    [m/s]
         103             :       term_wp2up_explicit    ! Term that is on the RHS                 [m^3/s^3]
         104             :
         105             :     ! <w'^2 v'> = coef_wp2vp_implicit * <v'w'> + term_wp2vp_explicit
         106             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
         107             :       coef_wp2vp_implicit, & ! Coefficient that is multiplied by <v'w'>    [m/s]
         108             :       term_wp2vp_explicit    ! Term that is on the RHS                 [m^3/s^3]
         109             :
         110             :     ! <w'rt'^2> = coef_wprtp2_implicit * <rt'^2> + term_wprtp2_explicit
         111             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
         112             :       coef_wprtp2_implicit, & ! Coefficient that is multiplied by <rt'^2>  [m/s]
         113             :       term_wprtp2_explicit    ! Term that is on the RHS          [m/s kg^2/kg^2]
         114             :
         115             :     ! <w'thl'^2> = coef_wpthlp2_implicit * <thl'^2> + term_wpthlp2_explicit
         116             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
         117             :       coef_wpthlp2_implicit, & ! Coef. that is multiplied by <thl'^2>      [m/s]
         118             :       term_wpthlp2_explicit    ! Term that is on the RHS               [m/s K^2]
         119             :
         120             :     ! <w'rt'thl'> = coef_wprtpthlp_implicit*<rt'thl'> + term_wprtpthlp_explicit
         121             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
         122             :       coef_wprtpthlp_implicit, & ! Coef. that is multiplied by <rt'thl'>   [m/s]
         123             :       term_wprtpthlp_explicit    ! Term that is on the RHS         [m/s(kg/kg)K]
         124             :
         125             :     ! <w'u'^2> = coef_wpup2_implicit * <u'^2> + term_wpup2_explicit
         126             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
         127             :       coef_wpup2_implicit, & ! Coefficient that is multiplied by <u'^2>    [m/s]
         128             :       term_wpup2_explicit    ! Term that is on the RHS                 [m^3/s^3]
         129             :
         130             :     ! <w'v'^2> = coef_wpvp2_implicit * <v'^2> + term_wpvp2_explicit
         131             :     real( kind = core_rknd ), dimension(:,:), allocatable :: &
         132             :       coef_wpvp2_implicit, & ! Coefficient that is multiplied by <v'^2>    [m/s]
         133             :       term_wpvp2_explicit    ! Term that is on the RHS                 [m^3/s^3]
         134             :
         135             :     ! <w'^2 sclr'> = coef_wp2sclrp_implicit * <w'sclr'> + term_wp2sclrp_explicit
         136             :     real( kind = core_rknd ), dimension(:,:,:), allocatable :: &
         137             :       coef_wp2sclrp_implicit, & ! Coef. that is multiplied by <w'sclr'>    [m/s]
         138             :       term_wp2sclrp_explicit    ! Term that is on the RHS   [m^2/s^2 (un. vary)]
         139             :
         140             :     ! <w'sclr'^2> = coef_wpsclrp2_implicit * <sclr'^2> + term_wpsclrp2_explicit
         141             :     real( kind = core_rknd ), dimension(:,:,:), allocatable :: &
         142             :       coef_wpsclrp2_implicit, & ! Coef. that is multiplied by <sclr'^2>    [m/s]
         143             :       term_wpsclrp2_explicit    ! Term that is on the RHS    [m/s(units vary)^2]
         144             :
         145             :     ! <w'rt'sclr'> = coef_wprtpsclrp_implicit * <sclr'rt'>
         146             :     !                + term_wprtpsclrp_explicit
         147             :     real( kind = core_rknd ), dimension(:,:,:), allocatable :: &
         148             :       coef_wprtpsclrp_implicit, & ! Coef. that is multiplied by <sclr'rt'> [m/s]
         149             :       term_wprtpsclrp_explicit    ! Term that is on the RHS [m/s(kg/kg)(un. v.)]
         150             :
         151             :     ! <w'thl'sclr'> = coef_wpthlpsclrp_implicit * <sclr'thl'>
         152             :     !                 + term_wpthlpsclrp_explicit
         153             :     real( kind = core_rknd ), dimension(:,:,:), allocatable :: &
         154             :       coef_wpthlpsclrp_implicit, & ! Coef. that is mult. by <sclr'thl'>    [m/s]
         155             :       term_wpthlpsclrp_explicit    ! Term that is on the RHS  [(m/s)K(un. vary)]
         156             :
         157             :   end type implicit_coefs_terms
         158             :
         159             : ! The CLUBB_CAM preprocessor directives are being commented out because this
         160             : ! code is now also used for WRF-CLUBB.
         161             : !#ifdef CLUBB_CAM /* Code for storing pdf_parameter structs in pbuf as array */
         162             :
         163             :   public :: pack_pdf_params, unpack_pdf_params
         164             :
         165             :   integer, public, parameter :: num_pdf_params = 47
         166             :
         167             : !#endif /* CLUBB_CAM */
         168             :
         169             :   contains
         170             :
         171             :   !=============================================================================
         172       12384 :   subroutine init_pdf_params( nz, ngrdcol, &
         173             :                               pdf_params )
         174             :
         175             :     ! Description:
         176             :     ! Initializes all PDF parameters in the variable type pdf_parameter.
         177             :
         178             :     ! References:
         179             :     !--------------------------------------------------------------------
         180             :
         181             :     use constants_clubb, only: &
         182             :         zero    ! Constant(s)
         183             :
         184             :     implicit none
         185             :
         186             :     ! Input Variable(s)
         187             :     integer, intent(in) :: &
         188             :       nz,   & ! Number of vertical grid levels    [-]
         189             :       ngrdcol ! Number of grid columns            [-]
         190             :
         191             :     ! Output Variable(s)
         192             :     type(pdf_parameter), intent(out) :: &
         193             :       pdf_params    ! PDF parameters            [units vary]
         194             :
         195           0 :     allocate( pdf_params%w_1(ngrdcol,nz), &
         196           0 :               pdf_params%w_2(ngrdcol,nz), &
         197           0 :               pdf_params%varnce_w_1(ngrdcol,nz), &
         198           0 :               pdf_params%varnce_w_2(ngrdcol,nz), &
         199           0 :               pdf_params%rt_1(ngrdcol,nz), &
         200           0 :               pdf_params%rt_2(ngrdcol,nz), &
         201           0 :               pdf_params%varnce_rt_1(ngrdcol,nz), &
         202           0 :               pdf_params%varnce_rt_2(ngrdcol,nz), &
         203           0 :               pdf_params%thl_1(ngrdcol,nz), &
         204           0 :               pdf_params%thl_2(ngrdcol,nz), &
         205           0 :               pdf_params%varnce_thl_1(ngrdcol,nz), &
         206           0 :               pdf_params%varnce_thl_2(ngrdcol,nz), &
         207           0 :               pdf_params%corr_w_rt_1(ngrdcol,nz), &
         208           0 :               pdf_params%corr_w_rt_2(ngrdcol,nz), &
         209           0 :               pdf_params%corr_w_thl_1(ngrdcol,nz), &
         210           0 :               pdf_params%corr_w_thl_2(ngrdcol,nz), &
         211           0 :               pdf_params%corr_rt_thl_1(ngrdcol,nz), &
         212           0 :               pdf_params%corr_rt_thl_2(ngrdcol,nz), &
         213           0 :               pdf_params%alpha_thl(ngrdcol,nz), &
         214           0 :               pdf_params%alpha_rt(ngrdcol,nz), &
         215           0 :               pdf_params%crt_1(ngrdcol,nz), &
         216           0 :               pdf_params%crt_2(ngrdcol,nz), &
         217           0 :               pdf_params%cthl_1(ngrdcol,nz), &
         218           0 :               pdf_params%cthl_2(ngrdcol,nz), &
         219           0 :               pdf_params%chi_1(ngrdcol,nz), &
         220           0 :               pdf_params%chi_2(ngrdcol,nz), &
         221           0 :               pdf_params%stdev_chi_1(ngrdcol,nz), &
         222           0 :               pdf_params%stdev_chi_2(ngrdcol,nz), &
         223           0 :               pdf_params%stdev_eta_1(ngrdcol,nz), &
         224           0 :               pdf_params%stdev_eta_2(ngrdcol,nz), &
         225           0 :               pdf_params%covar_chi_eta_1(ngrdcol,nz), &
         226           0 :               pdf_params%covar_chi_eta_2(ngrdcol,nz), &
         227           0 :               pdf_params%corr_w_chi_1(ngrdcol,nz), &
         228           0 :               pdf_params%corr_w_chi_2(ngrdcol,nz), &
         229           0 :               pdf_params%corr_w_eta_1(ngrdcol,nz), &
         230           0 :               pdf_params%corr_w_eta_2(ngrdcol,nz), &
         231           0 :               pdf_params%corr_chi_eta_1(ngrdcol,nz), &
         232           0 :               pdf_params%corr_chi_eta_2(ngrdcol,nz), &
         233           0 :               pdf_params%rsatl_1(ngrdcol,nz), &
         234           0 :               pdf_params%rsatl_2(ngrdcol,nz), &
         235           0 :               pdf_params%rc_1(ngrdcol,nz), &
         236           0 :               pdf_params%rc_2(ngrdcol,nz), &
         237           0 :               pdf_params%cloud_frac_1(ngrdcol,nz), &
         238           0 :               pdf_params%cloud_frac_2(ngrdcol,nz), &
         239           0 :               pdf_params%mixt_frac(ngrdcol,nz), &
         240           0 :               pdf_params%ice_supersat_frac_1(ngrdcol,nz), &
         241     1188864 :               pdf_params%ice_supersat_frac_2(ngrdcol,nz) )
         242             :
         243    17589024 :     pdf_params%w_1(:,:) = zero
         244    17589024 :     pdf_params%w_2(:,:) = zero
         245    17589024 :     pdf_params%varnce_w_1(:,:) = zero
         246    17589024 :     pdf_params%varnce_w_2(:,:) = zero
         247    17589024 :     pdf_params%rt_1(:,:) = zero
         248    17589024 :     pdf_params%rt_2(:,:) = zero
         249    17589024 :     pdf_params%varnce_rt_1(:,:) = zero
         250    17589024 :     pdf_params%varnce_rt_2(:,:) = zero
         251    17589024 :     pdf_params%thl_1(:,:) = zero
         252    17589024 :     pdf_params%thl_2(:,:) = zero
         253    17589024 :     pdf_params%varnce_thl_1(:,:) = zero
         254    17589024 :     pdf_params%varnce_thl_2(:,:) = zero
         255    17589024 :     pdf_params%corr_w_rt_1(:,:) = zero
         256    17589024 :     pdf_params%corr_w_rt_2(:,:) = zero
         257    17589024 :     pdf_params%corr_w_thl_1(:,:) = zero
         258    17589024 :     pdf_params%corr_w_thl_2(:,:) = zero
         259    17589024 :     pdf_params%corr_rt_thl_1(:,:) = zero
         260    17589024 :     pdf_params%corr_rt_thl_2(:,:) = zero
         261    17589024 :     pdf_params%alpha_thl(:,:) = zero
         262    17589024 :     pdf_params%alpha_rt(:,:) = zero
         263    17589024 :     pdf_params%crt_1(:,:) = zero
         264    17589024 :     pdf_params%crt_2(:,:) = zero
         265    17589024 :     pdf_params%cthl_1(:,:) = zero
         266    17589024 :     pdf_params%cthl_2(:,:) = zero
         267    17589024 :     pdf_params%chi_1(:,:) = zero
         268    17589024 :     pdf_params%chi_2(:,:) = zero
         269    17589024 :     pdf_params%stdev_chi_1(:,:) = zero
         270    17589024 :     pdf_params%stdev_chi_2(:,:) = zero
         271    17589024 :     pdf_params%stdev_eta_1(:,:) = zero
         272    17589024 :     pdf_params%stdev_eta_2(:,:) = zero
         273    17589024 :     pdf_params%covar_chi_eta_1(:,:) = zero
         274    17589024 :     pdf_params%covar_chi_eta_2(:,:) = zero
         275    17589024 :     pdf_params%corr_w_chi_1(:,:) = zero
         276    17589024 :     pdf_params%corr_w_chi_2(:,:) = zero
         277    17589024 :     pdf_params%corr_w_eta_1(:,:) = zero
         278    17589024 :     pdf_params%corr_w_eta_2(:,:) = zero
         279    17589024 :     pdf_params%corr_chi_eta_1(:,:) = zero
         280    17589024 :     pdf_params%corr_chi_eta_2(:,:) = zero
         281    17589024 :     pdf_params%rsatl_1(:,:) = zero
         282    17589024 :     pdf_params%rsatl_2(:,:) = zero
         283    17589024 :     pdf_params%rc_1(:,:) = zero
         284    17589024 :     pdf_params%rc_2(:,:) = zero
         285    17589024 :     pdf_params%cloud_frac_1(:,:) = zero
         286    17589024 :     pdf_params%cloud_frac_2(:,:) = zero
         287    17589024 :     pdf_params%mixt_frac(:,:) = zero
         288    17589024 :     pdf_params%ice_supersat_frac_1(:,:) = zero
         289    17589024 :     pdf_params%ice_supersat_frac_2(:,:) = zero
         290             :
         291             :
         292       12384 :     return
         293             :
         294             :   end subroutine init_pdf_params
         295             :
         296             :   !=============================================================================
         297        6192 :   subroutine init_pdf_implicit_coefs_terms( nz, ngrdcol, sclr_dim, &
         298             :                                             pdf_implicit_coefs_terms )
         299             :
         300             :     ! Description:
         301             :     ! Initializes all PDF implicit coefficients and explicit terms in the
         302             :     ! variable type implicit_coefs_terms.
         303             :
         304             :     ! References:
         305             :     !--------------------------------------------------------------------
         306             :
         307             :     use constants_clubb, only: &
         308             :         zero    ! Constant(s)
         309             :
         310             :     implicit none
         311             :
         312             :     ! Input Variables
         313             :     integer, intent(in) :: &
         314             :       nz,       & ! Number of vertical grid levels    [-]
         315             :       ngrdcol,  & ! Number of grid columns            [-]
         316             :       sclr_dim    ! Number of scalar variables        [-]
         317             :
         318             :     ! Output Variable
         319             :     type(implicit_coefs_terms), intent(out) :: &
         320             :       pdf_implicit_coefs_terms    ! Implicit coefs / explicit terms [units vary]
         321             :
         322             :
         323             :     ! Allocate pdf_implicit_coefs_terms
         324           0 :     allocate( pdf_implicit_coefs_terms%coef_wp4_implicit(1:ngrdcol,1:nz), &
         325           0 :               pdf_implicit_coefs_terms%coef_wp2rtp_implicit(1:ngrdcol,1:nz), &
         326           0 :               pdf_implicit_coefs_terms%term_wp2rtp_explicit(1:ngrdcol,1:nz), &
         327           0 :               pdf_implicit_coefs_terms%coef_wp2thlp_implicit(1:ngrdcol,1:nz), &
         328           0 :               pdf_implicit_coefs_terms%term_wp2thlp_explicit(1:ngrdcol,1:nz), &
         329           0 :               pdf_implicit_coefs_terms%coef_wp2up_implicit(1:ngrdcol,1:nz), &
         330           0 :               pdf_implicit_coefs_terms%term_wp2up_explicit(1:ngrdcol,1:nz), &
         331           0 :               pdf_implicit_coefs_terms%coef_wp2vp_implicit(1:ngrdcol,1:nz), &
         332           0 :               pdf_implicit_coefs_terms%term_wp2vp_explicit(1:ngrdcol,1:nz), &
         333           0 :               pdf_implicit_coefs_terms%coef_wprtp2_implicit(1:ngrdcol,1:nz), &
         334           0 :               pdf_implicit_coefs_terms%term_wprtp2_explicit(1:ngrdcol,1:nz), &
         335           0 :               pdf_implicit_coefs_terms%coef_wpthlp2_implicit(1:ngrdcol,1:nz), &
         336           0 :               pdf_implicit_coefs_terms%term_wpthlp2_explicit(1:ngrdcol,1:nz), &
         337           0 :               pdf_implicit_coefs_terms%coef_wprtpthlp_implicit(1:ngrdcol,1:nz), &
         338           0 :               pdf_implicit_coefs_terms%term_wprtpthlp_explicit(1:ngrdcol,1:nz), &
         339           0 :               pdf_implicit_coefs_terms%coef_wpup2_implicit(1:ngrdcol,1:nz), &
         340           0 :               pdf_implicit_coefs_terms%term_wpup2_explicit(1:ngrdcol,1:nz), &
         341           0 :               pdf_implicit_coefs_terms%coef_wpvp2_implicit(1:ngrdcol,1:nz), &
         342      247680 :               pdf_implicit_coefs_terms%term_wpvp2_explicit(1:ngrdcol,1:nz) )
         343             :
         344        6192 :     if ( sclr_dim > 0 ) then
         345             :        allocate( &
         346           0 :           pdf_implicit_coefs_terms%coef_wp2sclrp_implicit(1:ngrdcol,1:nz,1:sclr_dim), &
         347           0 :           pdf_implicit_coefs_terms%term_wp2sclrp_explicit(1:ngrdcol,1:nz,1:sclr_dim), &
         348           0 :           pdf_implicit_coefs_terms%coef_wpsclrp2_implicit(1:ngrdcol,1:nz,1:sclr_dim), &
         349           0 :           pdf_implicit_coefs_terms%term_wpsclrp2_explicit(1:ngrdcol,1:nz,1:sclr_dim), &
         350           0 :           pdf_implicit_coefs_terms%coef_wprtpsclrp_implicit(1:ngrdcol,1:nz,1:sclr_dim), &
         351           0 :           pdf_implicit_coefs_terms%term_wprtpsclrp_explicit(1:ngrdcol,1:nz,1:sclr_dim), &
         352           0 :           pdf_implicit_coefs_terms%coef_wpthlpsclrp_implicit(1:ngrdcol,1:nz,1:sclr_dim), &
         353           0 :           pdf_implicit_coefs_terms%term_wpthlpsclrp_explicit(1:ngrdcol,1:nz,1:sclr_dim) )
         354             :     endif ! sclr_dim > 0
         355             :
         356             :     ! Initialize pdf_implicit_coefs_terms
         357     8794512 :     pdf_implicit_coefs_terms%coef_wp4_implicit = zero
         358     8794512 :     pdf_implicit_coefs_terms%coef_wp2rtp_implicit = zero
         359     8794512 :     pdf_implicit_coefs_terms%term_wp2rtp_explicit = zero
         360     8794512 :     pdf_implicit_coefs_terms%coef_wp2thlp_implicit = zero
         361     8794512 :     pdf_implicit_coefs_terms%term_wp2thlp_explicit = zero
         362     8794512 :     pdf_implicit_coefs_terms%coef_wp2up_implicit = zero
         363     8794512 :     pdf_implicit_coefs_terms%term_wp2up_explicit = zero
         364     8794512 :     pdf_implicit_coefs_terms%coef_wp2vp_implicit = zero
         365     8794512 :     pdf_implicit_coefs_terms%term_wp2vp_explicit = zero
         366     8794512 :     pdf_implicit_coefs_terms%coef_wprtp2_implicit = zero
         367     8794512 :     pdf_implicit_coefs_terms%term_wprtp2_explicit = zero
         368     8794512 :     pdf_implicit_coefs_terms%coef_wpthlp2_implicit = zero
         369     8794512 :     pdf_implicit_coefs_terms%term_wpthlp2_explicit = zero
         370     8794512 :     pdf_implicit_coefs_terms%coef_wprtpthlp_implicit = zero
         371     8794512 :     pdf_implicit_coefs_terms%term_wprtpthlp_explicit = zero
         372     8794512 :     pdf_implicit_coefs_terms%coef_wpup2_implicit = zero
         373     8794512 :     pdf_implicit_coefs_terms%term_wpup2_explicit = zero
         374     8794512 :     pdf_implicit_coefs_terms%coef_wpvp2_implicit = zero
         375     8794512 :     pdf_implicit_coefs_terms%term_wpvp2_explicit = zero
         376        6192 :     if ( sclr_dim > 0 ) then
         377           0 :        pdf_implicit_coefs_terms%coef_wp2sclrp_implicit = zero
         378           0 :        pdf_implicit_coefs_terms%term_wp2sclrp_explicit = zero
         379           0 :        pdf_implicit_coefs_terms%coef_wpsclrp2_implicit = zero
         380           0 :        pdf_implicit_coefs_terms%term_wpsclrp2_explicit = zero
         381           0 :        pdf_implicit_coefs_terms%coef_wprtpsclrp_implicit = zero
         382           0 :        pdf_implicit_coefs_terms%term_wprtpsclrp_explicit = zero
         383           0 :        pdf_implicit_coefs_terms%coef_wpthlpsclrp_implicit = zero
         384           0 :        pdf_implicit_coefs_terms%term_wpthlpsclrp_explicit = zero
         385             :     endif ! sclr_dim > 0
         386             :
         387             :
         388        6192 :     return
         389             :
         390             :   end subroutine init_pdf_implicit_coefs_terms
         391             :
         392             :   !=============================================================================
         393           0 :   subroutine print_pdf_params( pdf_params, ngrdcol )
         394             :
         395             :     ! Description:
         396             :     ! Prints every value found in type pdf_parameter
         397             :
         398             :     !-------------------------------------------------------------------
         399             :
         400             :     use constants_clubb, only: &
         401             :         fstderr
         402             :
         403             :     implicit none
         404             :
         405             :     ! Input Variable(s)
         406             :     type(pdf_parameter), intent(in) :: &
         407             :       pdf_params    ! PDF parameters            [units vary]
         408             :
         409             :     integer, intent(in) :: &
         410             :       ngrdcol    ! Number of horizontal grid columns
         411             :
         412             :     ! Local Variable(s)
         413             :     integer :: i    ! Loop index
         414             :
         415             :
         416           0 :     do i = 1, ngrdcol
         417             :
         418           0 :        write(fstderr,*) "PDF parameters for column ", i
         419           0 :        write(fstderr,*) "---------------------------------------------------"
         420           0 :        write(fstderr,*) "w_1(i,:) = ", pdf_params%w_1(i,:)
         421           0 :        write(fstderr,*) "w_2(i,:) = ", pdf_params%w_2(i,:)
         422           0 :        write(fstderr,*) "varnce_w_1(i,:) = ", pdf_params%varnce_w_1(i,:)
         423           0 :        write(fstderr,*) "varnce_w_2(i,:) = ", pdf_params%varnce_w_2(i,:)
         424           0 :        write(fstderr,*) "rt_1(i,:) = ", pdf_params%rt_1(i,:)
         425           0 :        write(fstderr,*) "rt_2(i,:) = ", pdf_params%rt_2(i,:)
         426           0 :        write(fstderr,*) "varnce_rt_1(i,:) = ", pdf_params%varnce_rt_1(i,:)
         427           0 :        write(fstderr,*) "varnce_rt_2(i,:) = ", pdf_params%varnce_rt_2(i,:)
         428           0 :        write(fstderr,*) "thl_1(i,:) = ", pdf_params%thl_1(i,:)
         429           0 :        write(fstderr,*) "thl_2(i,:) = ", pdf_params%thl_2(i,:)
         430           0 :        write(fstderr,*) "varnce_thl_1(i,:) = ", pdf_params%varnce_thl_1(i,:)
         431           0 :        write(fstderr,*) "varnce_thl_2(i,:) = ", pdf_params%varnce_thl_2(i,:)
         432           0 :        write(fstderr,*) "corr_w_rt_1(i,:) = ", pdf_params%corr_w_rt_1(i,:)
         433           0 :        write(fstderr,*) "corr_w_rt_2(i,:) = ", pdf_params%corr_w_rt_2(i,:)
         434           0 :        write(fstderr,*) "corr_w_thl_1(i,:) = ", pdf_params%corr_w_thl_1(i,:)
         435           0 :        write(fstderr,*) "corr_w_thl_2(i,:) = ", pdf_params%corr_w_thl_2(i,:)
         436           0 :        write(fstderr,*) "corr_rt_thl_1(i,:) = ", pdf_params%corr_rt_thl_1(i,:)
         437           0 :        write(fstderr,*) "corr_rt_thl_2(i,:) = ", pdf_params%corr_rt_thl_2(i,:)
         438           0 :        write(fstderr,*) "alpha_thl(i,:) = ", pdf_params%alpha_thl(i,:)
         439           0 :        write(fstderr,*) "alpha_rt(i,:) = ", pdf_params%alpha_rt(i,:)
         440           0 :        write(fstderr,*) "crt_1(i,:) = ", pdf_params%crt_1(i,:)
         441           0 :        write(fstderr,*) "crt_2(i,:) = ", pdf_params%crt_2(i,:)
         442           0 :        write(fstderr,*) "cthl_1(i,:) = ", pdf_params%cthl_1(i,:)
         443           0 :        write(fstderr,*) "cthl_2(i,:) = ", pdf_params%cthl_2(i,:)
         444           0 :        write(fstderr,*) "chi_1(i,:) = ", pdf_params%chi_1(i,:)
         445           0 :        write(fstderr,*) "chi_2(i,:) = ", pdf_params%chi_2(i,:)
         446           0 :        write(fstderr,*) "stdev_chi_1(i,:) = ", pdf_params%stdev_chi_1(i,:)
         447           0 :        write(fstderr,*) "stdev_chi_2(i,:) = ", pdf_params%stdev_chi_2(i,:)
         448           0 :        write(fstderr,*) "stdev_eta_1(i,:) = ", pdf_params%stdev_eta_1(i,:)
         449           0 :        write(fstderr,*) "stdev_eta_2(i,:) = ", pdf_params%stdev_eta_2(i,:)
         450           0 :        write(fstderr,*) "covar_chi_eta_1(i,:) = ", &
         451           0 :                         pdf_params%covar_chi_eta_1(i,:)
         452           0 :        write(fstderr,*) "covar_chi_eta_2(i,:) = ", &
         453           0 :                         pdf_params%covar_chi_eta_2(i,:)
         454           0 :        write(fstderr,*) "corr_w_chi_1(i,:) = ", pdf_params%corr_w_chi_1(i,:)
         455           0 :        write(fstderr,*) "corr_w_chi_2(i,:) = ", pdf_params%corr_w_chi_2(i,:)
         456           0 :        write(fstderr,*) "corr_w_eta_1(i,:) = ", pdf_params%corr_w_eta_1(i,:)
         457           0 :        write(fstderr,*) "corr_w_eta_2(i,:) = ", pdf_params%corr_w_eta_2(i,:)
         458           0 :        write(fstderr,*) "corr_chi_eta_1(i,:) = ", &
         459           0 :                         pdf_params%corr_chi_eta_1(i,:)
         460           0 :        write(fstderr,*) "corr_chi_eta_2(i,:) = ", &
         461           0 :                         pdf_params%corr_chi_eta_2(i,:)
         462           0 :        write(fstderr,*) "rsatl_1(i,:) = ", pdf_params%rsatl_1(i,:)
         463           0 :        write(fstderr,*) "rsatl_2(i,:) = ", pdf_params%rsatl_2(i,:)
         464           0 :        write(fstderr,*) "rc_1(i,:) = ", pdf_params%rc_1(i,:)
         465           0 :        write(fstderr,*) "rc_2(i,:) = ", pdf_params%rc_2(i,:)
         466           0 :        write(fstderr,*) "cloud_frac_1(i,:) = ", pdf_params%cloud_frac_1(i,:)
         467           0 :        write(fstderr,*) "cloud_frac_2(i,:) = ", pdf_params%cloud_frac_2(i,:)
         468           0 :        write(fstderr,*) "mixt_frac(i,:) = ", pdf_params%mixt_frac(i,:)
         469           0 :        write(fstderr,*) "ice_supersat_frac_1(i,:) = ", &
         470           0 :                         pdf_params%ice_supersat_frac_1(i,:)
         471           0 :        write(fstderr,*) "ice_supersat_frac_2(i,:) = ", &
         472           0 :                         pdf_params%ice_supersat_frac_2(i,:)
         473             :
         474             :     enddo ! i = 1, ngrdcol
         475             :
         476             :
         477           0 :     return
         478             :
         479             :   end subroutine print_pdf_params
         480             :
         481             :   !=============================================================================
         482             :
         483             : ! The CLUBB_CAM preprocessor directives are being commented out because this
         484             : ! code is now also used for WRF-CLUBB.
         485             : !#ifdef CLUBB_CAM /* Code for storing pdf_parameter structs in pbuf as array */
         486             :
         487           0 :   subroutine pack_pdf_params(pdf_params, nz, &
         488           0 :                              r_param_array, &
         489             :                              k_start_in, k_end_in )
         490             :     implicit none
         491             :
         492             :     integer, intent(in) :: nz ! Num Vert Model Levs
         493             :
         494             :     ! Input a pdf_parameter array with nz instances of pdf_parameter
         495             :     type (pdf_parameter), intent(in) :: pdf_params
         496             :
         497             :     ! Output a two dimensional real array with all values
         498             :     real (kind = core_rknd), dimension(nz,num_pdf_params), intent(out) :: &
         499             :        r_param_array
         500             :
         501             :     integer, optional, intent(in) :: k_start_in, k_end_in
         502             :
         503             :     integer :: k_start, k_end
         504             :
         505           0 :     if( present( k_start_in ) .and. present( k_end_in ) ) then
         506           0 :         k_start = k_start_in
         507           0 :         k_end = k_end_in
         508             :     else
         509             :         k_start = 1
         510             :         k_end = nz
         511             :     end if
         512             :
         513           0 :     r_param_array(:,1) = pdf_params%w_1(1,k_start:k_end)
         514           0 :     r_param_array(:,2) = pdf_params%w_2(1,k_start:k_end)
         515           0 :     r_param_array(:,3) = pdf_params%varnce_w_1(1,k_start:k_end)
         516           0 :     r_param_array(:,4) = pdf_params%varnce_w_2(1,k_start:k_end)
         517           0 :     r_param_array(:,5) = pdf_params%rt_1(1,k_start:k_end)
         518           0 :     r_param_array(:,6) = pdf_params%rt_2(1,k_start:k_end)
         519           0 :     r_param_array(:,7) = pdf_params%varnce_rt_1(1,k_start:k_end)
         520           0 :     r_param_array(:,8) = pdf_params%varnce_rt_2(1,k_start:k_end)
         521           0 :     r_param_array(:,9) = pdf_params%thl_1(1,k_start:k_end)
         522           0 :     r_param_array(:,10) = pdf_params%thl_2(1,k_start:k_end)
         523           0 :     r_param_array(:,11) = pdf_params%varnce_thl_1(1,k_start:k_end)
         524           0 :     r_param_array(:,12) = pdf_params%varnce_thl_2(1,k_start:k_end)
         525           0 :     r_param_array(:,13) = pdf_params%corr_w_rt_1(1,k_start:k_end)
         526           0 :     r_param_array(:,14) = pdf_params%corr_w_rt_2(1,k_start:k_end)
         527           0 :     r_param_array(:,15) = pdf_params%corr_w_thl_1(1,k_start:k_end)
         528           0 :     r_param_array(:,16) = pdf_params%corr_w_thl_2(1,k_start:k_end)
         529           0 :     r_param_array(:,17) = pdf_params%corr_rt_thl_1(1,k_start:k_end)
         530           0 :     r_param_array(:,18) = pdf_params%corr_rt_thl_2(1,k_start:k_end)
         531           0 :     r_param_array(:,19) = pdf_params%alpha_thl(1,k_start:k_end)
         532           0 :     r_param_array(:,20) = pdf_params%alpha_rt(1,k_start:k_end)
         533           0 :     r_param_array(:,21) = pdf_params%crt_1(1,k_start:k_end)
         534           0 :     r_param_array(:,22) = pdf_params%crt_2(1,k_start:k_end)
         535           0 :     r_param_array(:,23) = pdf_params%cthl_1(1,k_start:k_end)
         536           0 :     r_param_array(:,24) = pdf_params%cthl_2(1,k_start:k_end)
         537           0 :     r_param_array(:,25) = pdf_params%chi_1(1,k_start:k_end)
         538           0 :     r_param_array(:,26) = pdf_params%chi_2(1,k_start:k_end)
         539           0 :     r_param_array(:,27) = pdf_params%stdev_chi_1(1,k_start:k_end)
         540           0 :     r_param_array(:,28) = pdf_params%stdev_chi_2(1,k_start:k_end)
         541           0 :     r_param_array(:,29) = pdf_params%stdev_eta_1(1,k_start:k_end)
         542           0 :     r_param_array(:,30) = pdf_params%stdev_eta_2(1,k_start:k_end)
         543           0 :     r_param_array(:,31) = pdf_params%covar_chi_eta_1(1,k_start:k_end)
         544           0 :     r_param_array(:,32) = pdf_params%covar_chi_eta_2(1,k_start:k_end)
         545           0 :     r_param_array(:,33) = pdf_params%corr_w_chi_1(1,k_start:k_end)
         546           0 :     r_param_array(:,34) = pdf_params%corr_w_chi_2(1,k_start:k_end)
         547           0 :     r_param_array(:,35) = pdf_params%corr_w_eta_1(1,k_start:k_end)
         548           0 :     r_param_array(:,36) = pdf_params%corr_w_eta_2(1,k_start:k_end)
         549           0 :     r_param_array(:,37) = pdf_params%corr_chi_eta_1(1,k_start:k_end)
         550           0 :     r_param_array(:,38) = pdf_params%corr_chi_eta_2(1,k_start:k_end)
         551           0 :     r_param_array(:,39) = pdf_params%rsatl_1(1,k_start:k_end)
         552           0 :     r_param_array(:,40) = pdf_params%rsatl_2(1,k_start:k_end)
         553           0 :     r_param_array(:,41) = pdf_params%rc_1(1,k_start:k_end)
         554           0 :     r_param_array(:,42) = pdf_params%rc_2(1,k_start:k_end)
         555           0 :     r_param_array(:,43) = pdf_params%cloud_frac_1(1,k_start:k_end)
         556           0 :     r_param_array(:,44) = pdf_params%cloud_frac_2(1,k_start:k_end)
         557           0 :     r_param_array(:,45) = pdf_params%mixt_frac(1,k_start:k_end)
         558           0 :     r_param_array(:,46) = pdf_params%ice_supersat_frac_1(1,k_start:k_end)
         559           0 :     r_param_array(:,47) = pdf_params%ice_supersat_frac_2(1,k_start:k_end)
         560             :
         561           0 :   end subroutine pack_pdf_params
         562             : !===============================================================!
         563           0 :   subroutine unpack_pdf_params(r_param_array, nz, &
         564             :                                pdf_params, &
         565             :                                k_start_in, k_end_in )
         566             :     implicit none
         567             :
         568             :     integer, intent(in) :: nz ! Num Vert Model Levs
         569             :
         570             :     ! Input a two dimensional real array with pdf values
         571             :     real (kind = core_rknd), dimension(nz,num_pdf_params), intent(in) :: &
         572             :        r_param_array
         573             :
         574             :     ! Output a pdf_parameter array with nz instances of pdf_parameter
         575             :     type (pdf_parameter), intent(inout) :: pdf_params
         576             :
         577             :     integer, optional, intent(in) :: k_start_in, k_end_in
         578             :
         579             :     integer :: k_start, k_end
         580             :
         581           0 :     if( present( k_start_in ) .and. present( k_end_in ) ) then
         582           0 :         k_start = k_start_in
         583           0 :         k_end = k_end_in
         584             :     else
         585             :         k_start = 1
         586             :         k_end = nz
         587             :     end if
         588             :
         589           0 :     pdf_params%w_1(1,k_start:k_end) = r_param_array(:,1)
         590           0 :     pdf_params%w_2(1,k_start:k_end) = r_param_array(:,2)
         591           0 :     pdf_params%varnce_w_1(1,k_start:k_end) = r_param_array(:,3)
         592           0 :     pdf_params%varnce_w_2(1,k_start:k_end) = r_param_array(:,4)
         593           0 :     pdf_params%rt_1(1,k_start:k_end) = r_param_array(:,5)
         594           0 :     pdf_params%rt_2(1,k_start:k_end) = r_param_array(:,6)
         595           0 :     pdf_params%varnce_rt_1(1,k_start:k_end) = r_param_array(:,7)
         596           0 :     pdf_params%varnce_rt_2(1,k_start:k_end)= r_param_array(:,8)
         597           0 :     pdf_params%thl_1(1,k_start:k_end) = r_param_array(:,9)
         598           0 :     pdf_params%thl_2(1,k_start:k_end) = r_param_array(:,10)
         599           0 :     pdf_params%varnce_thl_1(1,k_start:k_end) = r_param_array(:,11)
         600           0 :     pdf_params%varnce_thl_2(1,k_start:k_end) = r_param_array(:,12)
         601           0 :     pdf_params%corr_w_rt_1(1,k_start:k_end) = r_param_array(:,13)
         602           0 :     pdf_params%corr_w_rt_2(1,k_start:k_end) = r_param_array(:,14)
         603           0 :     pdf_params%corr_w_thl_1(1,k_start:k_end) = r_param_array(:,15)
         604           0 :     pdf_params%corr_w_thl_2(1,k_start:k_end) = r_param_array(:,16)
         605           0 :     pdf_params%corr_rt_thl_1(1,k_start:k_end) = r_param_array(:,17)
         606           0 :     pdf_params%corr_rt_thl_2(1,k_start:k_end) = r_param_array(:,18)
         607           0 :     pdf_params%alpha_thl(1,k_start:k_end) = r_param_array(:,19)
         608           0 :     pdf_params%alpha_rt(1,k_start:k_end) = r_param_array(:,20)
         609           0 :     pdf_params%crt_1(1,k_start:k_end) = r_param_array(:,21)
         610           0 :     pdf_params%crt_2(1,k_start:k_end) = r_param_array(:,22)
         611           0 :     pdf_params%cthl_1(1,k_start:k_end) = r_param_array(:,23)
         612           0 :     pdf_params%cthl_2(1,k_start:k_end) = r_param_array(:,24)
         613           0 :     pdf_params%chi_1(1,k_start:k_end) = r_param_array(:,25)
         614           0 :     pdf_params%chi_2(1,k_start:k_end) = r_param_array(:,26)
         615           0 :     pdf_params%stdev_chi_1(1,k_start:k_end) = r_param_array(:,27)
         616           0 :     pdf_params%stdev_chi_2(1,k_start:k_end) = r_param_array(:,28)
         617           0 :     pdf_params%stdev_eta_1(1,k_start:k_end) = r_param_array(:,29)
         618           0 :     pdf_params%stdev_eta_2(1,k_start:k_end) = r_param_array(:,30)
         619           0 :     pdf_params%covar_chi_eta_1(1,k_start:k_end) = r_param_array(:,31)
         620           0 :     pdf_params%covar_chi_eta_2(1,k_start:k_end) = r_param_array(:,32)
         621           0 :     pdf_params%corr_w_chi_1(1,k_start:k_end) = r_param_array(:,33)
         622           0 :     pdf_params%corr_w_chi_2(1,k_start:k_end) = r_param_array(:,34)
         623           0 :     pdf_params%corr_w_eta_1(1,k_start:k_end) = r_param_array(:,35)
         624           0 :     pdf_params%corr_w_eta_2(1,k_start:k_end) = r_param_array(:,36)
         625           0 :     pdf_params%corr_chi_eta_1(1,k_start:k_end) = r_param_array(:,37)
         626           0 :     pdf_params%corr_chi_eta_2(1,k_start:k_end) = r_param_array(:,38)
         627           0 :     pdf_params%rsatl_1(1,k_start:k_end) = r_param_array(:,39)
         628           0 :     pdf_params%rsatl_2(1,k_start:k_end) = r_param_array(:,40)
         629           0 :     pdf_params%rc_1(1,k_start:k_end) = r_param_array(:,41)
         630           0 :     pdf_params%rc_2(1,k_start:k_end) = r_param_array(:,42)
         631           0 :     pdf_params%cloud_frac_1(1,k_start:k_end) = r_param_array(:,43)
         632           0 :     pdf_params%cloud_frac_2(1,k_start:k_end) = r_param_array(:,44)
         633           0 :     pdf_params%mixt_frac(1,k_start:k_end) = r_param_array(:,45)
         634           0 :     pdf_params%ice_supersat_frac_1(1,k_start:k_end) = r_param_array(:,46)
         635           0 :     pdf_params%ice_supersat_frac_2(1,k_start:k_end) = r_param_array(:,47)
         636             :
         637           0 :   end subroutine unpack_pdf_params
         638             :
         639             :
         640             :   !================================================================================================
         641             :   ! copy_single_pdf_params_to_multi - copies values of a single column version of pdf_params
         642             :   !   to a multiple column version for a specified column.
         643             :   !
         644             :   ! NOTE: THIS SUBROUTINE IS INTENDED TO BE TEMPORARY AND SHOULD BECOME UNNECESSARY ONCE
         645             :   !       CLUBB IS ABLE TO OPERATE OVER MULTIPLE COLUMNS.
         646             :   !       See https://github.com/larson-group/cam/issues/129#issuecomment-827944454
         647             :   !================================================================================================
         648           0 :   subroutine copy_single_pdf_params_to_multi( pdf_params_single, icol, &
         649             :                                               pdf_params_multi )
         650             :
         651             :     implicit none
         652             :
         653             :     ! Input Variable(s)
         654             :     integer, intent(in) :: &
         655             :       icol   ! Column number to copy to
         656             :
         657             :     type(pdf_parameter), intent(in) :: &
         658             :       pdf_params_single  ! PDF parameters            [units vary]
         659             :
         660             :     ! Output Variable(s)
         661             :     type(pdf_parameter), intent(inout) :: &
         662             :       pdf_params_multi  ! PDF parameters            [units vary]
         663             :
         664           0 :     pdf_params_multi%w_1(icol,:)                  = pdf_params_single%w_1(1,:)
         665           0 :     pdf_params_multi%w_2(icol,:)                  = pdf_params_single%w_2(1,:)
         666           0 :     pdf_params_multi%varnce_w_1(icol,:)           = pdf_params_single%varnce_w_1(1,:)
         667           0 :     pdf_params_multi%varnce_w_2(icol,:)           = pdf_params_single%varnce_w_2(1,:)
         668           0 :     pdf_params_multi%rt_1(icol,:)                 = pdf_params_single%rt_1(1,:)
         669           0 :     pdf_params_multi%rt_2(icol,:)                 = pdf_params_single%rt_2(1,:)
         670           0 :     pdf_params_multi%varnce_rt_1(icol,:)          = pdf_params_single%varnce_rt_1(1,:)
         671           0 :     pdf_params_multi%varnce_rt_2(icol,:)          = pdf_params_single%varnce_rt_2(1,:)
         672           0 :     pdf_params_multi%thl_1(icol,:)                = pdf_params_single%thl_1(1,:)
         673           0 :     pdf_params_multi%thl_2(icol,:)                = pdf_params_single%thl_2(1,:)
         674           0 :     pdf_params_multi%varnce_thl_1(icol,:)         = pdf_params_single%varnce_thl_1(1,:)
         675           0 :     pdf_params_multi%varnce_thl_2(icol,:)         = pdf_params_single%varnce_thl_2(1,:)
         676           0 :     pdf_params_multi%corr_w_rt_1(icol,:)          = pdf_params_single%corr_w_rt_1(1,:)
         677           0 :     pdf_params_multi%corr_w_rt_2(icol,:)          = pdf_params_single%corr_w_rt_2(1,:)
         678           0 :     pdf_params_multi%corr_w_thl_1(icol,:)         = pdf_params_single%corr_w_thl_1(1,:)
         679           0 :     pdf_params_multi%corr_w_thl_2(icol,:)         = pdf_params_single%corr_w_thl_2(1,:)
         680           0 :     pdf_params_multi%corr_rt_thl_1(icol,:)        = pdf_params_single%corr_rt_thl_1(1,:)
         681           0 :     pdf_params_multi%corr_rt_thl_2(icol,:)        = pdf_params_single%corr_rt_thl_2(1,:)
         682           0 :     pdf_params_multi%alpha_thl(icol,:)            = pdf_params_single%alpha_thl(1,:)
         683           0 :     pdf_params_multi%alpha_rt(icol,:)             = pdf_params_single%alpha_rt(1,:)
         684           0 :     pdf_params_multi%crt_1(icol,:)                = pdf_params_single%crt_1(1,:)
         685           0 :     pdf_params_multi%crt_2(icol,:)                = pdf_params_single%crt_2(1,:)
         686           0 :     pdf_params_multi%cthl_1(icol,:)               = pdf_params_single%cthl_1(1,:)
         687           0 :     pdf_params_multi%cthl_2(icol,:)               = pdf_params_single%cthl_2(1,:)
         688           0 :     pdf_params_multi%chi_1(icol,:)                = pdf_params_single%chi_1(1,:)
         689           0 :     pdf_params_multi%chi_2(icol,:)                = pdf_params_single%chi_2(1,:)
         690           0 :     pdf_params_multi%stdev_chi_1(icol,:)          = pdf_params_single%stdev_chi_1(1,:)
         691           0 :     pdf_params_multi%stdev_chi_2(icol,:)          = pdf_params_single%stdev_chi_2(1,:)
         692           0 :     pdf_params_multi%stdev_eta_1(icol,:)          = pdf_params_single%stdev_eta_1(1,:)
         693           0 :     pdf_params_multi%stdev_eta_2(icol,:)          = pdf_params_single%stdev_eta_2(1,:)
         694           0 :     pdf_params_multi%covar_chi_eta_1(icol,:)      = pdf_params_single%covar_chi_eta_1(1,:)
         695           0 :     pdf_params_multi%covar_chi_eta_2(icol,:)      = pdf_params_single%covar_chi_eta_2(1,:)
         696           0 :     pdf_params_multi%corr_w_chi_1(icol,:)         = pdf_params_single%corr_w_chi_1(1,:)
         697           0 :     pdf_params_multi%corr_w_chi_2(icol,:)         = pdf_params_single%corr_w_chi_2(1,:)
         698           0 :     pdf_params_multi%corr_w_eta_1(icol,:)         = pdf_params_single%corr_w_eta_1(1,:)
         699           0 :     pdf_params_multi%corr_w_eta_2(icol,:)         = pdf_params_single%corr_w_eta_2(1,:)
         700           0 :     pdf_params_multi%corr_chi_eta_1(icol,:)       = pdf_params_single%corr_chi_eta_1(1,:)
         701           0 :     pdf_params_multi%corr_chi_eta_2(icol,:)       = pdf_params_single%corr_chi_eta_2(1,:)
         702           0 :     pdf_params_multi%rsatl_1(icol,:)              = pdf_params_single%rsatl_1(1,:)
         703           0 :     pdf_params_multi%rsatl_2(icol,:)              = pdf_params_single%rsatl_2(1,:)
         704           0 :     pdf_params_multi%rc_1(icol,:)                 = pdf_params_single%rc_1(1,:)
         705           0 :     pdf_params_multi%rc_2(icol,:)                 = pdf_params_single%rc_2(1,:)
         706           0 :     pdf_params_multi%cloud_frac_1(icol,:)         = pdf_params_single%cloud_frac_1(1,:)
         707           0 :     pdf_params_multi%cloud_frac_2(icol,:)         = pdf_params_single%cloud_frac_2(1,:)
         708           0 :     pdf_params_multi%mixt_frac(icol,:)            = pdf_params_single%mixt_frac(1,:)
         709           0 :     pdf_params_multi%ice_supersat_frac_1(icol,:)  = pdf_params_single%ice_supersat_frac_1(1,:)
         710           0 :     pdf_params_multi%ice_supersat_frac_2(icol,:)  = pdf_params_single%ice_supersat_frac_2(1,:)
         711             :
         712           0 :   end subroutine copy_single_pdf_params_to_multi
         713             :
         714             :   !================================================================================================
         715             :   ! copy_multi_pdf_params_to_single - copies values of a multiple column version of pdf_params
         716             :   !   at a specified column to a single column version.
         717             :   !
         718             :   ! NOTE: THIS SUBROUTINE IS INTENDED TO BE TEMPORARY AND SHOULD BECOME UNNECESSARY ONCE
         719             :   !       CLUBB IS ABLE TO OPERATE OVER MULTIPLE COLUMNS.
         720             :   !       See https://github.com/larson-group/cam/issues/129#issuecomment-827944454
         721             :   !================================================================================================
         722           0 :   subroutine copy_multi_pdf_params_to_single( pdf_params_multi, icol, &
         723             :                                               pdf_params_single )
         724             :
         725             :     implicit none
         726             :
         727             :     ! Input Variable(s)
         728             :     integer, intent(in) :: &
         729             :       icol   ! Column number to copy to
         730             :
         731             :     type(pdf_parameter), intent(in) :: &
         732             :       pdf_params_multi  ! PDF parameters            [units vary]
         733             :
         734             :     ! Output Variable(s)
         735             :     type(pdf_parameter), intent(inout) :: &
         736             :       pdf_params_single   ! PDF parameters            [units vary]
         737             :
         738           0 :     pdf_params_single%w_1(1,:)                  = pdf_params_multi%w_1(icol,:)
         739           0 :     pdf_params_single%w_2(1,:)                  = pdf_params_multi%w_2(icol,:)
         740           0 :     pdf_params_single%varnce_w_1(1,:)           = pdf_params_multi%varnce_w_1(icol,:)
         741           0 :     pdf_params_single%varnce_w_2(1,:)           = pdf_params_multi%varnce_w_2(icol,:)
         742           0 :     pdf_params_single%rt_1(1,:)                 = pdf_params_multi%rt_1(icol,:)
         743           0 :     pdf_params_single%rt_2(1,:)                 = pdf_params_multi%rt_2(icol,:)
         744           0 :     pdf_params_single%varnce_rt_1(1,:)          = pdf_params_multi%varnce_rt_1(icol,:)
         745           0 :     pdf_params_single%varnce_rt_2(1,:)          = pdf_params_multi%varnce_rt_2(icol,:)
         746           0 :     pdf_params_single%thl_1(1,:)                = pdf_params_multi%thl_1(icol,:)
         747           0 :     pdf_params_single%thl_2(1,:)                = pdf_params_multi%thl_2(icol,:)
         748           0 :     pdf_params_single%varnce_thl_1(1,:)         = pdf_params_multi%varnce_thl_1(icol,:)
         749           0 :     pdf_params_single%varnce_thl_2(1,:)         = pdf_params_multi%varnce_thl_2(icol,:)
         750           0 :     pdf_params_single%corr_w_rt_1(1,:)          = pdf_params_multi%corr_w_rt_1(icol,:)
         751           0 :     pdf_params_single%corr_w_rt_2(1,:)          = pdf_params_multi%corr_w_rt_2(icol,:)
         752           0 :     pdf_params_single%corr_w_thl_1(1,:)         = pdf_params_multi%corr_w_thl_1(icol,:)
         753           0 :     pdf_params_single%corr_w_thl_2(1,:)         = pdf_params_multi%corr_w_thl_2(icol,:)
         754           0 :     pdf_params_single%corr_rt_thl_1(1,:)        = pdf_params_multi%corr_rt_thl_1(icol,:)
         755           0 :     pdf_params_single%corr_rt_thl_2(1,:)        = pdf_params_multi%corr_rt_thl_2(icol,:)
         756           0 :     pdf_params_single%alpha_thl(1,:)            = pdf_params_multi%alpha_thl(icol,:)
         757           0 :     pdf_params_single%alpha_rt(1,:)             = pdf_params_multi%alpha_rt(icol,:)
         758           0 :     pdf_params_single%crt_1(1,:)                = pdf_params_multi%crt_1(icol,:)
         759           0 :     pdf_params_single%crt_2(1,:)                = pdf_params_multi%crt_2(icol,:)
         760           0 :     pdf_params_single%cthl_1(1,:)               = pdf_params_multi%cthl_1(icol,:)
         761           0 :     pdf_params_single%cthl_2(1,:)               = pdf_params_multi%cthl_2(icol,:)
         762           0 :     pdf_params_single%chi_1(1,:)                = pdf_params_multi%chi_1(icol,:)
         763           0 :     pdf_params_single%chi_2(1,:)                = pdf_params_multi%chi_2(icol,:)
         764           0 :     pdf_params_single%stdev_chi_1(1,:)          = pdf_params_multi%stdev_chi_1(icol,:)
         765           0 :     pdf_params_single%stdev_chi_2(1,:)          = pdf_params_multi%stdev_chi_2(icol,:)
         766           0 :     pdf_params_single%stdev_eta_1(1,:)          = pdf_params_multi%stdev_eta_1(icol,:)
         767           0 :     pdf_params_single%stdev_eta_2(1,:)          = pdf_params_multi%stdev_eta_2(icol,:)
         768           0 :     pdf_params_single%covar_chi_eta_1(1,:)      = pdf_params_multi%covar_chi_eta_1(icol,:)
         769           0 :     pdf_params_single%covar_chi_eta_2(1,:)      = pdf_params_multi%covar_chi_eta_2(icol,:)
         770           0 :     pdf_params_single%corr_w_chi_1(1,:)         = pdf_params_multi%corr_w_chi_1(icol,:)
         771           0 :     pdf_params_single%corr_w_chi_2(1,:)         = pdf_params_multi%corr_w_chi_2(icol,:)
         772           0 :     pdf_params_single%corr_w_eta_1(1,:)         = pdf_params_multi%corr_w_eta_1(icol,:)
         773           0 :     pdf_params_single%corr_w_eta_2(1,:)         = pdf_params_multi%corr_w_eta_2(icol,:)
         774           0 :     pdf_params_single%corr_chi_eta_1(1,:)       = pdf_params_multi%corr_chi_eta_1(icol,:)
         775           0 :     pdf_params_single%corr_chi_eta_2(1,:)       = pdf_params_multi%corr_chi_eta_2(icol,:)
         776           0 :     pdf_params_single%rsatl_1(1,:)              = pdf_params_multi%rsatl_1(icol,:)
         777           0 :     pdf_params_single%rsatl_2(1,:)              = pdf_params_multi%rsatl_2(icol,:)
         778           0 :     pdf_params_single%rc_1(1,:)                 = pdf_params_multi%rc_1(icol,:)
         779           0 :     pdf_params_single%rc_2(1,:)                 = pdf_params_multi%rc_2(icol,:)
         780           0 :     pdf_params_single%cloud_frac_1(1,:)         = pdf_params_multi%cloud_frac_1(icol,:)
         781           0 :     pdf_params_single%cloud_frac_2(1,:)         = pdf_params_multi%cloud_frac_2(icol,:)
         782           0 :     pdf_params_single%mixt_frac(1,:)            = pdf_params_multi%mixt_frac(icol,:)
         783           0 :     pdf_params_single%ice_supersat_frac_1(1,:)  = pdf_params_multi%ice_supersat_frac_1(icol,:)
         784           0 :     pdf_params_single%ice_supersat_frac_2(1,:)  = pdf_params_multi%ice_supersat_frac_2(icol,:)
         785             :
         786           0 :   end subroutine copy_multi_pdf_params_to_single
         787             :
         788             : !#endif /* CLUBB_CAM */
         789             :
         790           0 : end module pdf_parameter_module

Generated by: LCOV version 1.14