LCOV - code coverage report
Current view: top level - physics/clubb/src/CLUBB_core - model_flags.F90 (source / functions) Hit Total Coverage
Test: coverage.info Lines: 188 191 98.4 %
Date: 2025-03-13 18:42:46 Functions: 4 5 80.0 %

          Line data    Source code
       1             : !-----------------------------------------------------------------------
       2             : ! $Id$
       3             : !===============================================================================
       4             : module model_flags
       5             : 
       6             : ! Description:
       7             : !   Various model options that can be toggled off and on as desired.
       8             : 
       9             : ! References:
      10             : !   None
      11             : !-------------------------------------------------------------------------------
      12             : 
      13             :   implicit none
      14             : 
      15             :   public :: setup_model_flags, clubb_config_flags_type, set_default_clubb_config_flags, &
      16             :             initialize_clubb_config_flags_type, print_clubb_config_flags
      17             : 
      18             :   private ! Default Scope
      19             : 
      20             :   ! Options for the two component normal (double Gaussian) PDF type to use for
      21             :   ! the w, rt, and theta-l (or w, chi, and eta) portion of CLUBB's multivariate,
      22             :   ! two-component PDF.
      23             :   integer, parameter, public :: &
      24             :     iiPDF_ADG1 = 1,       & ! ADG1 PDF
      25             :     iiPDF_ADG2 = 2,       & ! ADG2 PDF
      26             :     iiPDF_3D_Luhar = 3,   & ! 3D Luhar PDF
      27             :     iiPDF_new = 4,        & ! new PDF
      28             :     iiPDF_TSDADG = 5,     & ! new TSDADG PDF
      29             :     iiPDF_LY93 = 6,       & ! Lewellen and Yoh (1993)
      30             :     iiPDF_new_hybrid = 7    ! new hybrid PDF
      31             : 
      32             :   ! Options for the placement of the call to CLUBB's PDF.
      33             :   integer, parameter, public :: &
      34             :     ipdf_pre_advance_fields   = 1,   & ! Call before advancing predictive fields
      35             :     ipdf_post_advance_fields  = 2,   & ! Call after advancing predictive fields
      36             :     ipdf_pre_post_advance_fields = 3   ! Call both before and after advancing
      37             :                                        ! predictive fields
      38             : 
      39             :   integer, parameter, public :: &
      40             :     lapack          = 1,  & ! Use lapack library for matrix solves
      41             :     penta_lu        = 2,  & ! Use penta_lu solver for 5 banded matrices
      42             :     tridiag_lu      = 2,  & ! Use tridiag_lu solver for 3 banded matrices
      43             :     penta_bicgstab  = 3     ! Use bicgstab to solve 5 banded matrices
      44             : 
      45             :   logical, parameter, public ::  & 
      46             :     l_pos_def            = .false., & ! Flux limiting positive definite scheme on rtm
      47             :     l_hole_fill          = .true.,  & ! Hole filling pos def scheme on wp2,up2,rtp2,etc
      48             :     l_clip_turb_adv      = .false.    ! Corrects thlm/rtm when w'th_l'/w'r_t' is clipped
      49             : 
      50             :   logical, parameter, public :: &
      51             : #ifdef BYTESWAP_IO
      52             :     l_byteswap_io = .true.,   & ! Don't use the native byte ordering in GrADS output
      53             : #else
      54             :     l_byteswap_io = .false.,  & ! Use the native byte ordering in GrADS output
      55             : #endif
      56             :     l_gamma_Skw   = .true.      ! Use a Skw dependent gamma parameter
      57             : 
      58             :   logical, parameter, public :: &
      59             :     l_use_boussinesq = .false.  ! Flag to use the Boussinesq form of the
      60             :                                 ! predictive equations.  The predictive
      61             :                                 ! equations are anelastic by default.
      62             : 
      63             :   logical, parameter, public :: &
      64             :     ! Flag to use explicit turbulent advection in the wp3 predictive equation.
      65             :     l_explicit_turbulent_adv_wp3 = .false.,  &
      66             :     ! Flag to use explicit turbulent advection in the wpxp predictive equation.
      67             :     l_explicit_turbulent_adv_wpxp = .false., &
      68             :     ! Flag to use explicit turbulent advection in the xp2 and xpyp predictive
      69             :     ! equations.
      70             :     l_explicit_turbulent_adv_xpyp = .false.
      71             : 
      72             :   ! Flag to advance xp3 using a simplified version of the d(xp3)/dt predictive
      73             :   ! equation or calculate it using a steady-state approximation.  When the flag
      74             :   ! is turned off, the Larson and Golaz (2005) ansatz to calculate xp3 after
      75             :   ! calculating Skx using the ansatz.
      76             :   logical, parameter, public :: &
      77             :     l_advance_xp3 = .false.
      78             : 
      79             :   logical, parameter, public :: &
      80             :     l_morr_xp2_mc = .false. ! Flag to include the effects of rain evaporation
      81             :                             ! on rtp2 and thlp2.  The moister (rt_1 or rt_2)
      82             :                             ! and colder (thl_1 or thl_2) will be fed into
      83             :                             ! the morrison microphys, and rain evaporation will
      84             :                             ! be allowed to increase variances
      85             : 
      86             :   logical, parameter, public :: &
      87             :     l_evaporate_cold_rcm = .false. ! Flag to evaporate cloud water at temperatures
      88             :                                    ! colder than -37C.  This is to be used for 
      89             :                                    ! Morrison microphysics, to prevent excess ice
      90             : 
      91             :   logical, parameter, public :: &
      92             :     l_cubic_interp = .false.      ! Flag to convert grid points with cubic monotonic
      93             :                                   ! spline interpolation as opposed to linear interpolation.
      94             : 
      95             :   logical, parameter, public :: &
      96             :     l_upwind_Kh_dp_term = .false.
      97             : 
      98             :   ! These are the integer constants that represent the various saturation
      99             :   ! formulas. To add a new formula, add an additional constant here,
     100             :   ! add the logic to check the strings for the new formula in clubb_core and
     101             :   ! this module, and add logic in saturation to call the proper function--
     102             :   ! the control logic will be based on these named constants.
     103             : 
     104             :   integer, parameter, public :: &
     105             :     saturation_bolton = 1, & ! Constant for Bolton approximations of saturation
     106             :     saturation_gfdl   = 2, & ! Constant for the GFDL approximation of saturation
     107             :     saturation_flatau = 3, & ! Constant for Flatau approximations of saturation
     108             :     saturation_lookup = 4    ! Use a lookup table for mixing length
     109             :                              ! saturation vapor pressure calculations
     110             :   !$acc declare create(saturation_flatau,saturation_gfdl,saturation_bolton,saturation_lookup)
     111             : 
     112             :   !-----------------------------------------------------------------------------
     113             :   ! Options that can be changed at runtime 
     114             :   ! The default values are chosen below and overwritten if desired by the user
     115             :   !----------------------------------------------------------------------------- 
     116             : 
     117             :   ! Flag to use high accuracy for the parabolic cylinder function
     118             :   logical, public :: &
     119             :     l_high_accuracy_parab_cyl_fnc = .false. 
     120             : 
     121             : !$omp threadprivate(l_high_accuracy_parab_cyl_fnc)
     122             : 
     123             :   logical, public :: & 
     124             :     l_quintic_poly_interp = .false. ! Use a quintic polynomial in mono_cubic_interp
     125             : 
     126             : !$omp threadprivate(l_quintic_poly_interp)
     127             : 
     128             :   ! Use to determine whether a host model has already applied the surface flux,
     129             :   ! to avoid double counting.
     130             :   logical, public :: &
     131             :     l_host_applies_sfc_fluxes = .false.
     132             : 
     133             : !$omp threadprivate(l_host_applies_sfc_fluxes)
     134             : 
     135             :   integer, public :: &
     136             :     saturation_formula = saturation_flatau ! Integer that stores the saturation formula to be used
     137             : 
     138             : !$omp threadprivate(saturation_formula)
     139             : !$acc declare create(saturation_formula)
     140             : 
     141             :   logical, parameter, public :: &
     142             :     l_silhs_rad = .false.    ! Resolve radiation over subcolumns using SILHS
     143             : 
     144             : #ifdef GFDL
     145             :   logical, public :: &
     146             :      I_sat_sphum       ! h1g, 2010-06-15
     147             : !$omp threadprivate( I_sat_sphum )
     148             : #endif
     149             : 
     150             :   ! Derived type to hold all configurable CLUBB flags
     151             :   type clubb_config_flags_type
     152             :     ! Note that all flags in this data type might also be modified in 
     153             :     ! corresponding .in files which would supercede the default values!
     154             :     
     155             :     integer :: &
     156             :       iiPDF_type,          & ! Selected option for the two-component normal
     157             :                              ! (double Gaussian) PDF type to use for the w, rt,
     158             :                              ! and theta-l (or w, chi, and eta) portion of
     159             :                              ! CLUBB's multivariate, two-component PDF.
     160             :       ipdf_call_placement, & ! Selected option for the placement of the call to
     161             :                              ! CLUBB's PDF.
     162             :       penta_solve_method,  & ! Option to set the penta-diagonal matrix solving method
     163             :       tridiag_solve_method   ! Option to set the tri-diagonal matrix solving method
     164             : 
     165             :     logical :: &
     166             :       l_use_precip_frac,            & ! Flag to use precipitation fraction in KK microphysics. The
     167             :                                       ! precipitation fraction is automatically set to 1 when this
     168             :                                       ! flag is turned off.
     169             :       l_predict_upwp_vpwp,          & ! Flag to predict <u'w'> and <v'w'> along with <u> and <v>
     170             :                                       ! alongside the advancement of <rt>, <w'rt'>, <thl>,
     171             :                                       ! <wpthlp>, <sclr>, and <w'sclr'> in subroutine
     172             :                                       ! advance_xm_wpxp.  Otherwise, <u'w'> and <v'w'> are still
     173             :                                       ! approximated by eddy diffusivity when <u> and <v> are
     174             :                                       ! advanced in subroutine advance_windm_edsclrm.
     175             :       l_min_wp2_from_corr_wx,       & ! Flag to base the threshold minimum value of wp2 on keeping
     176             :                                       ! the overall correlation of w and x (w and rt, as well as w
     177             :                                       ! and theta-l) within the limits of -max_mag_correlation_flux
     178             :                                       ! to max_mag_correlation_flux.
     179             :       l_min_xp2_from_corr_wx,       & ! Flag to base the threshold minimum value of xp2 (rtp2 and
     180             :                                       ! thlp2) on keeping the overall correlation of w and x within
     181             :                                       ! the limits of -max_mag_correlation_flux to
     182             :                                       ! max_mag_correlation_flux.
     183             :       l_C2_cloud_frac,              & ! Flag to use cloud fraction to adjust the value of the
     184             :                                       ! turbulent dissipation coefficient, C2.
     185             :       l_diffuse_rtm_and_thlm,       & ! Diffuses rtm and thlm
     186             :       l_stability_correct_Kh_N2_zm, & ! Divides Kh_N2_zm by a stability factor
     187             :       l_calc_thlp2_rad,             & ! Include the contribution of radiation to thlp2
     188             :       l_upwind_xpyp_ta,             & ! This flag determines whether we want to use an upwind
     189             :                                       ! differencing approximation rather than a centered
     190             :                                       ! differencing for turbulent or mean advection terms. It
     191             :                                       ! affects rtp2, thlp2, up2, vp2, sclrp2, rtpthlp, sclrprtp, &
     192             :                                       ! sclrpthlp.
     193             :       l_upwind_xm_ma,               & ! This flag determines whether we want to use an upwind
     194             :                                       ! differencing approximation rather than a centered
     195             :                                       ! differencing for turbulent or mean advection terms. It
     196             :                                       ! affects rtm, thlm, sclrm, um and vm.
     197             :       l_uv_nudge,                   & ! For wind speed nudging.
     198             :       l_rtm_nudge,                  & ! For rtm nudging
     199             :       l_tke_aniso,                  & ! For anisotropic turbulent kinetic energy, i.e.
     200             :                                       ! TKE = 1/2 (u'^2 + v'^2 + w'^2)
     201             :       l_vert_avg_closure,           & ! Use 2 calls to pdf_closure and the trapezoidal rule to
     202             :                                       ! compute the varibles that are output from high order
     203             :                                       ! closure
     204             :       l_trapezoidal_rule_zt,        & ! If true, the trapezoidal rule is called for the
     205             :                                       ! thermodynamic-level variables output from pdf_closure.
     206             :       l_trapezoidal_rule_zm,        & ! If true, the trapezoidal rule is called for three
     207             :                                       ! momentum-level variables - wpthvp, thlpthvp, and rtpthvp -
     208             :                                       ! output from pdf_closure.
     209             :       l_call_pdf_closure_twice,     & ! This logical flag determines whether or not to call
     210             :                                       ! subroutine pdf_closure twice.  If true, pdf_closure is
     211             :                                       ! called first on thermodynamic levels and then on momentum
     212             :                                       ! levels so that each variable is computed on its native
     213             :                                       ! level.  If false, pdf_closure is only called on
     214             :                                       ! thermodynamic levels, and variables which belong on
     215             :                                       ! momentum levels are interpolated.
     216             :       l_standard_term_ta,           & ! Use the standard discretization for the turbulent advection
     217             :                                       ! terms.  Setting to .false. means that a_1 and a_3 are
     218             :                                       ! pulled outside of the derivative in
     219             :                                       ! advance_wp2_wp3_module.F90 and in
     220             :                                       ! advance_xp2_xpyp_module.F90.
     221             :       l_partial_upwind_wp3,         & ! Flag to use an "upwind" discretization rather
     222             :                                       ! than a centered discretization for the portion
     223             :                                       ! of the wp3 turbulent advection term for ADG1
     224             :                                       ! that is linearized in terms of wp3<t+1>.
     225             :                                       ! (Requires ADG1 PDF and l_standard_term_ta).
     226             :       l_godunov_upwind_wpxp_ta,     & ! This flag determines whether we want to use an upwind
     227             :                                       ! differencing approximation rather than a centered 
     228             :                                       ! differencing for turbulent advection terms. 
     229             :                                       ! It affects  wpxp only.
     230             :       l_godunov_upwind_xpyp_ta,     & ! This flag determines whether we want to use an upwind
     231             :                                       ! differencing approximation rather than a centered 
     232             :                                       ! differencing for turbulent advection terms. It affects
     233             :                                       ! xpyp only.
     234             :       l_use_cloud_cover,            & ! Use cloud_cover and rcm_in_layer to help boost cloud_frac
     235             :                                       ! and rcm to help increase cloudiness at coarser grid
     236             :                                       ! resolutions.
     237             :       l_diagnose_correlations,      & ! Diagnose correlations instead of using fixed ones
     238             :       l_calc_w_corr,                & ! Calculate the correlations between w and the hydrometeors
     239             :       l_const_Nc_in_cloud,          & ! Use a constant cloud droplet conc. within cloud (K&K)
     240             :       l_fix_w_chi_eta_correlations, & ! Use a fixed correlation for s and t Mellor(chi/eta)
     241             :       l_stability_correct_tau_zm,   & ! Use tau_N2_zm instead of tau_zm in wpxp_pr1 stability
     242             :                                       ! correction
     243             :       l_damp_wp2_using_em,          & ! In wp2 equation, use a dissipation formula of
     244             :                                       ! -(2/3)*em/tau_zm, as in Bougeault (1981)
     245             :       l_do_expldiff_rtm_thlm,       & ! Diffuse rtm and thlm explicitly
     246             :       l_Lscale_plume_centered,      & ! Alternate that uses the PDF to compute the perturbed values
     247             :       l_diag_Lscale_from_tau,       & ! First diagnose dissipation time tau, and then diagnose the
     248             :                                       ! mixing length scale as Lscale = tau * tke
     249             :       l_use_C7_Richardson,          & ! Parameterize C7 based on Richardson number
     250             :       l_use_C11_Richardson,         & ! Parameterize C11 and C16 based on Richardson number
     251             :       l_use_shear_Richardson,       & ! Use shear in the calculation of Richardson number
     252             :       l_brunt_vaisala_freq_moist,   & ! Use a different formula for the Brunt-Vaisala frequency in
     253             :                                       ! saturated atmospheres (from Durran and Klemp, 1982)
     254             :       l_use_thvm_in_bv_freq,        & ! Use thvm in the calculation of Brunt-Vaisala frequency
     255             :       l_rcm_supersat_adj,           & ! Add excess supersaturated vapor to cloud water
     256             :       l_damp_wp3_Skw_squared,       & ! Set damping on wp3 to use Skw^2 rather than Skw^4
     257             :       l_prescribed_avg_deltaz,      & ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz
     258             :       l_lmm_stepping,               & ! Apply Linear Multistep Method (LMM) Stepping
     259             :       l_e3sm_config,                & ! Run model with E3SM settings
     260             :       l_vary_convect_depth,         & ! Flag used to calculate convective velocity using
     261             :                                       ! a variable estimate of layer depth based on the depth
     262             :                                       ! over which wpthlp is positive near the ground when true
     263             :                                       ! More information can be found by
     264             :                                       ! Looking at issue #905 on the clubb repo
     265             :       l_use_tke_in_wp3_pr_turb_term, &! Use TKE formulation for wp3 pr_turb term
     266             :       l_use_tke_in_wp2_wp3_K_dfsn,  & ! Use TKE in eddy diffusion for wp2 and wp3
     267             :       l_use_wp3_lim_with_smth_Heaviside, & ! Flag to activate mods on wp3 limiters for conv test
     268             :       l_smooth_Heaviside_tau_wpxp,  & ! Use smoothed Heaviside 'Peskin' function
     269             :                                       ! in the calculation of H_invrs_tau_wpxp_N2
     270             :                                       ! in src/CLUBB_core/mixing_length.F90
     271             :       l_modify_limiters_for_cnvg_test, & ! Flag to activate mods on limiters for conv test
     272             :       l_enable_relaxed_clipping,    & ! Flag to relax clipping on wpxp in
     273             :                                       ! xm_wpxp_clipping_and_stats
     274             :       l_linearize_pbl_winds,        & ! Code to linearize PBL winds
     275             :       l_mono_flux_lim_thlm,         & ! Flag to turn on monotonic flux limiter for thlm
     276             :       l_mono_flux_lim_rtm,          & ! Flag to turn on monotonic flux limiter for rtm
     277             :       l_mono_flux_lim_um,           & ! Flag to turn on monotonic flux limiter for um
     278             :       l_mono_flux_lim_vm,           & ! Flag to turn on monotonic flux limiter for vm
     279             :       l_mono_flux_lim_spikefix        ! Flag to implement monotonic flux limiter code that 
     280             :                                       ! eliminates spurious drying tendencies at model top
     281             : 
     282             :   end type clubb_config_flags_type
     283             : 
     284             :   contains
     285             : 
     286             : !===============================================================================
     287        1536 :   subroutine setup_model_flags & 
     288             :              ( l_host_applies_sfc_fluxes_in, & 
     289             :                saturation_formula_in &
     290             : #ifdef GFDL
     291             :                ,  I_sat_sphum_in   &  ! h1g, 2010-06-15
     292             : #endif
     293             :                 )
     294             : 
     295             : ! Description:
     296             : !   Setup flags that influence the numerics, etc. of CLUBB core
     297             : 
     298             : ! References:
     299             : !   None
     300             : !-------------------------------------------------------------------------------
     301             : 
     302             :     implicit none
     303             : 
     304             :     ! External
     305             :     intrinsic :: trim
     306             : 
     307             :     ! Input Variables
     308             :     logical, intent(in) ::  & 
     309             :       l_host_applies_sfc_fluxes_in
     310             : 
     311             :     character(len=*), intent(in) :: &
     312             :       saturation_formula_in
     313             : 
     314             : #ifdef GFDL
     315             :     logical, intent(in) ::  & 
     316             :       I_sat_sphum_in           ! h1g, 2010-06-15
     317             : #endif
     318             : 
     319             :     !---- Begin Code ----
     320             : 
     321             :     ! Logicals
     322             : 
     323        1536 :     l_host_applies_sfc_fluxes = l_host_applies_sfc_fluxes_in
     324             : 
     325        1536 :     l_high_accuracy_parab_cyl_fnc = .false.
     326             : 
     327             :     ! Integers
     328             : 
     329             :     ! Set up the saturation formula value
     330        3072 :     select case ( trim( saturation_formula_in ) )
     331             :     case ( "bolton", "Bolton" )
     332           0 :       saturation_formula = saturation_bolton
     333             : 
     334             :     case ( "flatau", "Flatau" )
     335           0 :       saturation_formula = saturation_flatau
     336             : 
     337             :     case ( "gfdl", "GFDL" )
     338        1536 :       saturation_formula = saturation_gfdl
     339             : 
     340             :     case ( "lookup" )
     341        3072 :       saturation_formula = saturation_lookup
     342             : 
     343             :       ! Add new saturation formulas after this.
     344             :     end select
     345             : 
     346             : #ifdef GFDL
     347             :     I_sat_sphum = I_sat_sphum_in  ! h1g, 2010-06-15
     348             : #endif
     349        1536 :     return
     350             :   end subroutine setup_model_flags
     351             : 
     352             : !===============================================================================
     353        1536 :   subroutine set_default_clubb_config_flags( iiPDF_type, &
     354             :                                              ipdf_call_placement, &
     355             :                                              penta_solve_method, &
     356             :                                              tridiag_solve_method, &
     357             :                                              l_use_precip_frac, &
     358             :                                              l_predict_upwp_vpwp, &
     359             :                                              l_min_wp2_from_corr_wx, &
     360             :                                              l_min_xp2_from_corr_wx, &
     361             :                                              l_C2_cloud_frac, &
     362             :                                              l_diffuse_rtm_and_thlm, &
     363             :                                              l_stability_correct_Kh_N2_zm, &
     364             :                                              l_calc_thlp2_rad, &
     365             :                                              l_upwind_xpyp_ta, &
     366             :                                              l_upwind_xm_ma, &
     367             :                                              l_uv_nudge, &
     368             :                                              l_rtm_nudge, &
     369             :                                              l_tke_aniso, &
     370             :                                              l_vert_avg_closure, &
     371             :                                              l_trapezoidal_rule_zt, &
     372             :                                              l_trapezoidal_rule_zm, &
     373             :                                              l_call_pdf_closure_twice, &
     374             :                                              l_standard_term_ta, &
     375             :                                              l_partial_upwind_wp3, &
     376             :                                              l_godunov_upwind_wpxp_ta, &
     377             :                                              l_godunov_upwind_xpyp_ta, &
     378             :                                              l_use_cloud_cover, &
     379             :                                              l_diagnose_correlations, &
     380             :                                              l_calc_w_corr, &
     381             :                                              l_const_Nc_in_cloud, &
     382             :                                              l_fix_w_chi_eta_correlations, &
     383             :                                              l_stability_correct_tau_zm, &
     384             :                                              l_damp_wp2_using_em, &
     385             :                                              l_do_expldiff_rtm_thlm, &
     386             :                                              l_Lscale_plume_centered, &
     387             :                                              l_diag_Lscale_from_tau, &
     388             :                                              l_use_C7_Richardson, &
     389             :                                              l_use_C11_Richardson, &
     390             :                                              l_use_shear_Richardson, &
     391             :                                              l_brunt_vaisala_freq_moist, &
     392             :                                              l_use_thvm_in_bv_freq, &
     393             :                                              l_rcm_supersat_adj, &
     394             :                                              l_damp_wp3_Skw_squared, &
     395             :                                              l_prescribed_avg_deltaz, &
     396             :                                              l_lmm_stepping, &
     397             :                                              l_e3sm_config, &
     398             :                                              l_vary_convect_depth, &
     399             :                                              l_use_tke_in_wp3_pr_turb_term, &
     400             :                                              l_use_tke_in_wp2_wp3_K_dfsn, &
     401             :                                              l_use_wp3_lim_with_smth_Heaviside, &
     402             :                                              l_smooth_Heaviside_tau_wpxp, &
     403             :                                              l_modify_limiters_for_cnvg_test, &
     404             :                                              l_enable_relaxed_clipping, &
     405             :                                              l_linearize_pbl_winds, &
     406             :                                              l_mono_flux_lim_thlm, &
     407             :                                              l_mono_flux_lim_rtm, &
     408             :                                              l_mono_flux_lim_um, &
     409             :                                              l_mono_flux_lim_vm, &
     410             :                                              l_mono_flux_lim_spikefix )
     411             : 
     412             : ! Description:
     413             : !   Sets all CLUBB flags to a default setting.
     414             : 
     415             : ! References:
     416             : !   None
     417             : !-------------------------------------------------------------------------------
     418             : 
     419             :     implicit none
     420             : 
     421             :     ! Output variables
     422             :     integer, intent(out) :: &
     423             :       iiPDF_type,          & ! Selected option for the two-component normal
     424             :                              ! (double Gaussian) PDF type to use for the w, rt,
     425             :                              ! and theta-l (or w, chi, and eta) portion of
     426             :                              ! CLUBB's multivariate, two-component PDF.
     427             :       ipdf_call_placement, & ! Selected option for the placement of the call to
     428             :                              ! CLUBB's PDF.
     429             :       penta_solve_method,  & ! Option to set the penta-diagonal matrix solving method
     430             :       tridiag_solve_method   ! Option to set the tri-diagonal matrix solving method
     431             : 
     432             :     logical, intent(out) :: &
     433             :       l_use_precip_frac,            & ! Flag to use precipitation fraction in KK microphysics. The
     434             :                                       ! precipitation fraction is automatically set to 1 when this
     435             :                                       ! flag is turned off.
     436             :       l_predict_upwp_vpwp,          & ! Flag to predict <u'w'> and <v'w'> along with <u> and <v>
     437             :                                       ! alongside the advancement of <rt>, <w'rt'>, <thl>,
     438             :                                       ! <wpthlp>, <sclr>, and <w'sclr'> in subroutine
     439             :                                       ! advance_xm_wpxp.  Otherwise, <u'w'> and <v'w'> are still
     440             :                                       ! approximated by eddy diffusivity when <u> and <v> are
     441             :                                       ! advanced in subroutine advance_windm_edsclrm.
     442             :       l_min_wp2_from_corr_wx,       & ! Flag to base the threshold minimum value of wp2 on keeping
     443             :                                       ! the overall correlation of w and x (w and rt, as well as w
     444             :                                       ! and theta-l) within the limits of -max_mag_correlation_flux
     445             :                                       ! to max_mag_correlation_flux.
     446             :       l_min_xp2_from_corr_wx,       & ! Flag to base the threshold minimum value of xp2 (rtp2 and
     447             :                                       ! thlp2) on keeping the overall correlation of w and x within
     448             :                                       ! the limits of -max_mag_correlation_flux to
     449             :                                       ! max_mag_correlation_flux.
     450             :       l_C2_cloud_frac,              & ! Flag to use cloud fraction to adjust the value of the
     451             :                                       ! turbulent dissipation coefficient, C2.
     452             :       l_diffuse_rtm_and_thlm,       & ! Diffuses rtm and thlm
     453             :       l_stability_correct_Kh_N2_zm, & ! Divides Kh_N2_zm by a stability factor
     454             :       l_calc_thlp2_rad,             & ! Include the contribution of radiation to thlp2
     455             :       l_upwind_xpyp_ta,             & ! This flag determines whether we want to use an upwind
     456             :                                       ! differencing approximation rather than a centered
     457             :                                       ! differencing for turbulent or mean advection terms. It
     458             :                                       ! affects rtp2, thlp2, up2, vp2, sclrp2, rtpthlp, sclrprtp, &
     459             :                                       ! sclrpthlp.
     460             :       l_upwind_xm_ma,               & ! This flag determines whether we want to use an upwind
     461             :                                       ! differencing approximation rather than a centered
     462             :                                       ! differencing for turbulent or mean advection terms. It
     463             :                                       ! affects rtm, thlm, sclrm, um and vm.
     464             :       l_uv_nudge,                   & ! For wind speed nudging.
     465             :       l_rtm_nudge,                  & ! For rtm nudging
     466             :       l_tke_aniso,                  & ! For anisotropic turbulent kinetic energy, i.e.
     467             :                                       ! TKE = 1/2 (u'^2 + v'^2 + w'^2)
     468             :       l_vert_avg_closure,           & ! Use 2 calls to pdf_closure and the trapezoidal rule to
     469             :                                       ! compute the varibles that are output from high order
     470             :                                       ! closure
     471             :       l_trapezoidal_rule_zt,        & ! If true, the trapezoidal rule is called for the
     472             :                                       ! thermodynamic-level variables output from pdf_closure.
     473             :       l_trapezoidal_rule_zm,        & ! If true, the trapezoidal rule is called for three
     474             :                                       ! momentum-level variables - wpthvp, thlpthvp, and rtpthvp -
     475             :                                       ! output from pdf_closure.
     476             :       l_call_pdf_closure_twice,     & ! This logical flag determines whether or not to call
     477             :                                       ! subroutine pdf_closure twice.  If true, pdf_closure is
     478             :                                       ! called first on thermodynamic levels and then on momentum
     479             :                                       ! levels so that each variable is computed on its native
     480             :                                       ! level.  If false, pdf_closure is only called on
     481             :                                       ! thermodynamic levels, and variables which belong on
     482             :                                       ! momentum levels are interpolated.
     483             :       l_standard_term_ta,           & ! Use the standard discretization for the turbulent advection
     484             :                                       ! terms.  Setting to .false. means that a_1 and a_3 are
     485             :                                       ! pulled outside of the derivative in
     486             :                                       ! advance_wp2_wp3_module.F90 and in
     487             :                                       ! advance_xp2_xpyp_module.F90.
     488             :       l_partial_upwind_wp3,         & ! Flag to use an "upwind" discretization rather
     489             :                                       ! than a centered discretization for the portion
     490             :                                       ! of the wp3 turbulent advection term for ADG1
     491             :                                       ! that is linearized in terms of wp3<t+1>.
     492             :                                       ! (Requires ADG1 PDF and l_standard_term_ta).
     493             :       l_godunov_upwind_wpxp_ta,     & ! This flag determines whether we want to use an upwind
     494             :                                       ! differencing approximation rather than a centered 
     495             :                                       ! differencing for turbulent advection terms. 
     496             :                                       ! It affects  wpxp only.
     497             :       l_godunov_upwind_xpyp_ta,     & ! This flag determines whether we want to use an upwind
     498             :                                       ! differencing approximation rather than a centered 
     499             :                                       ! differencing for turbulent advection terms. It affects
     500             :                                       ! xpyp only.
     501             :       l_use_cloud_cover,            & ! Use cloud_cover and rcm_in_layer to help boost cloud_frac
     502             :                                       ! and rcm to help increase cloudiness at coarser grid
     503             :                                       ! resolutions.
     504             :       l_diagnose_correlations,      & ! Diagnose correlations instead of using fixed ones
     505             :       l_calc_w_corr,                & ! Calculate the correlations between w and the hydrometeors
     506             :       l_const_Nc_in_cloud,          & ! Use a constant cloud droplet conc. within cloud (K&K)
     507             :       l_fix_w_chi_eta_correlations, & ! Use a fixed correlation for s and t Mellor(chi/eta)
     508             :       l_stability_correct_tau_zm,   & ! Use tau_N2_zm instead of tau_zm in wpxp_pr1 stability
     509             :                                       ! correction
     510             :       l_damp_wp2_using_em,          & ! In wp2 equation, use a dissipation formula of
     511             :                                       ! -(2/3)*em/tau_zm, as in Bougeault (1981)
     512             :       l_do_expldiff_rtm_thlm,       & ! Diffuse rtm and thlm explicitly
     513             :       l_Lscale_plume_centered,      & ! Alternate that uses the PDF to compute the perturbed values
     514             :       l_diag_Lscale_from_tau,       & ! First diagnose dissipation time tau, and then diagnose the
     515             :                                       ! mixing length scale as Lscale = tau * tke
     516             :       l_use_C7_Richardson,          & ! Parameterize C7 based on Richardson number
     517             :       l_use_C11_Richardson,         & ! Parameterize C11 and C16 based on Richardson number
     518             :       l_use_shear_Richardson,       & ! Use shear in the calculation of Richardson number
     519             :       l_brunt_vaisala_freq_moist,   & ! Use a different formula for the Brunt-Vaisala frequency in
     520             :                                       ! saturated atmospheres (from Durran and Klemp, 1982)
     521             :       l_use_thvm_in_bv_freq,        & ! Use thvm in the calculation of Brunt-Vaisala frequency
     522             :       l_rcm_supersat_adj,           & ! Add excess supersaturated vapor to cloud water
     523             :       l_damp_wp3_Skw_squared,       & ! Set damping on wp3 to use Skw^2 rather than Skw^4
     524             :       l_prescribed_avg_deltaz,      & ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz
     525             :       l_lmm_stepping,               & ! Apply Linear Multistep Method (LMM) Stepping
     526             :       l_e3sm_config,                & ! Run model with E3SM settings
     527             :       l_vary_convect_depth,         & ! Flag used to calculate convective velocity using
     528             :                                       ! a variable estimate of layer depth based on the depth
     529             :                                       ! over which wpthlp is positive near the ground when true
     530             :                                       ! More information can be found by
     531             :                                       ! Looking at issue #905 on the clubb repo
     532             :       l_use_tke_in_wp3_pr_turb_term,& ! Use TKE formulation for wp3 pr_turb term
     533             :       l_use_tke_in_wp2_wp3_K_dfsn,  & ! Use TKE in eddy diffusion for wp2 and wp3
     534             :       l_use_wp3_lim_with_smth_Heaviside, & ! Flag to activate mods on wp3 limiters for conv test
     535             :       l_smooth_Heaviside_tau_wpxp,  & ! Use smoothed Heaviside 'Peskin' function
     536             :                                       ! in the calculation of H_invrs_tau_wpxp_N2
     537             :                                       ! in src/CLUBB_core/mixing_length.F90
     538             :       l_modify_limiters_for_cnvg_test, & ! Flag to activate mods on limiters for conv test
     539             :       l_enable_relaxed_clipping,    & ! Flag to relax clipping on wpxp in
     540             :                                       ! xm_wpxp_clipping_and_stats
     541             :       l_linearize_pbl_winds,        & ! Code to linearize PBL winds
     542             :       l_mono_flux_lim_thlm,         & ! Flag to turn on monotonic flux limiter for thlm
     543             :       l_mono_flux_lim_rtm,          & ! Flag to turn on monotonic flux limiter for rtm
     544             :       l_mono_flux_lim_um,           & ! Flag to turn on monotonic flux limiter for um
     545             :       l_mono_flux_lim_vm,           & ! Flag to turn on monotonic flux limiter for vm
     546             :       l_mono_flux_lim_spikefix        ! Flag to implement monotonic flux limiter code that
     547             :                                       ! eliminates spurious drying tendencies at model top
     548             : 
     549             : !-----------------------------------------------------------------------
     550             :     ! Begin code
     551             :     ! WARNING: THE DEFAULT VALUES OF THE FLAGS BELOW MAY BE OVERWRITTEN
     552             :     !    BY NAMELIST VALUES FROM, E.G., configurable_clubb_flags_nl!!!
     553             : 
     554        1536 :     iiPDF_type = iiPDF_ADG1
     555        1536 :     ipdf_call_placement = ipdf_post_advance_fields
     556        1536 :     penta_solve_method = lapack
     557        1536 :     tridiag_solve_method = lapack
     558        1536 :     l_use_precip_frac = .true.
     559        1536 :     l_predict_upwp_vpwp = .true.
     560        1536 :     l_min_wp2_from_corr_wx = .true.
     561        1536 :     l_min_xp2_from_corr_wx = .true.
     562        1536 :     l_C2_cloud_frac = .false.
     563        1536 :     l_diffuse_rtm_and_thlm = .false.
     564        1536 :     l_stability_correct_Kh_N2_zm = .false.
     565        1536 :     l_calc_thlp2_rad = .true.
     566        1536 :     l_upwind_xpyp_ta = .true.
     567        1536 :     l_upwind_xm_ma = .true.
     568        1536 :     l_uv_nudge = .false.
     569        1536 :     l_rtm_nudge = .false.
     570        1536 :     l_tke_aniso = .true.
     571        1536 :     l_vert_avg_closure  = .false.
     572        1536 :     l_trapezoidal_rule_zt = .false.
     573        1536 :     l_trapezoidal_rule_zm = .false.
     574        1536 :     l_call_pdf_closure_twice = .false.
     575        1536 :     l_standard_term_ta = .false.
     576        1536 :     l_partial_upwind_wp3 = .false.
     577        1536 :     l_godunov_upwind_wpxp_ta = .false.
     578        1536 :     l_godunov_upwind_xpyp_ta = .false.
     579        1536 :     l_use_cloud_cover = .false.
     580        1536 :     l_diagnose_correlations = .false.
     581        1536 :     l_calc_w_corr = .false.
     582        1536 :     l_const_Nc_in_cloud = .false.
     583        1536 :     l_fix_w_chi_eta_correlations = .true.
     584        1536 :     l_stability_correct_tau_zm = .false.
     585        1536 :     l_damp_wp2_using_em = .true.
     586        1536 :     l_do_expldiff_rtm_thlm = .false.
     587        1536 :     l_Lscale_plume_centered = .false.
     588        1536 :     l_diag_Lscale_from_tau = .true.
     589        1536 :     l_use_C7_Richardson = .true.
     590        1536 :     l_use_C11_Richardson = .false.
     591        1536 :     l_use_shear_Richardson = .false.
     592        1536 :     l_brunt_vaisala_freq_moist = .false.
     593        1536 :     l_use_thvm_in_bv_freq = .false.
     594        1536 :     l_rcm_supersat_adj = .true.
     595        1536 :     l_damp_wp3_Skw_squared = .true.
     596             : #ifdef GFDL
     597             :     l_prescribed_avg_deltaz = .true.
     598             : #else
     599        1536 :     l_prescribed_avg_deltaz = .false.
     600             : #endif
     601        1536 :     l_lmm_stepping = .false.
     602        1536 :     l_e3sm_config = .false.
     603        1536 :     l_vary_convect_depth = .false.
     604        1536 :     l_use_tke_in_wp3_pr_turb_term = .true.
     605        1536 :     l_use_tke_in_wp2_wp3_K_dfsn = .false.
     606        1536 :     l_use_wp3_lim_with_smth_Heaviside = .false.
     607        1536 :     l_smooth_Heaviside_tau_wpxp = .false.
     608        1536 :     l_modify_limiters_for_cnvg_test = .false.
     609        1536 :     l_enable_relaxed_clipping = .false.
     610        1536 :     l_linearize_pbl_winds = .false.
     611        1536 :     l_mono_flux_lim_thlm = .true.
     612        1536 :     l_mono_flux_lim_rtm = .true.
     613        1536 :     l_mono_flux_lim_um = .true.
     614        1536 :     l_mono_flux_lim_vm = .true.
     615        1536 :     l_mono_flux_lim_spikefix = .true.
     616             : 
     617        1536 :     return
     618             :   end subroutine set_default_clubb_config_flags
     619             : 
     620             : !===============================================================================
     621        1536 :   subroutine initialize_clubb_config_flags_type( iiPDF_type,          &
     622             :                                                  ipdf_call_placement, &
     623             :                                                  penta_solve_method, &
     624             :                                                  tridiag_solve_method, &
     625             :                                                  l_use_precip_frac, &
     626             :                                                  l_predict_upwp_vpwp, &
     627             :                                                  l_min_wp2_from_corr_wx, &
     628             :                                                  l_min_xp2_from_corr_wx, &
     629             :                                                  l_C2_cloud_frac, &
     630             :                                                  l_diffuse_rtm_and_thlm, &
     631             :                                                  l_stability_correct_Kh_N2_zm, &
     632             :                                                  l_calc_thlp2_rad, &
     633             :                                                  l_upwind_xpyp_ta, &
     634             :                                                  l_upwind_xm_ma, &
     635             :                                                  l_uv_nudge, &
     636             :                                                  l_rtm_nudge, &
     637             :                                                  l_tke_aniso, &
     638             :                                                  l_vert_avg_closure, &
     639             :                                                  l_trapezoidal_rule_zt, &
     640             :                                                  l_trapezoidal_rule_zm, &
     641             :                                                  l_call_pdf_closure_twice, &
     642             :                                                  l_standard_term_ta, &
     643             :                                                  l_partial_upwind_wp3, &
     644             :                                                  l_godunov_upwind_wpxp_ta, &
     645             :                                                  l_godunov_upwind_xpyp_ta, &
     646             :                                                  l_use_cloud_cover, &
     647             :                                                  l_diagnose_correlations, &
     648             :                                                  l_calc_w_corr, &
     649             :                                                  l_const_Nc_in_cloud, &
     650             :                                                  l_fix_w_chi_eta_correlations, &
     651             :                                                  l_stability_correct_tau_zm, &
     652             :                                                  l_damp_wp2_using_em, &
     653             :                                                  l_do_expldiff_rtm_thlm, &
     654             :                                                  l_Lscale_plume_centered, &
     655             :                                                  l_diag_Lscale_from_tau, &
     656             :                                                  l_use_C7_Richardson, &
     657             :                                                  l_use_C11_Richardson, &
     658             :                                                  l_use_shear_Richardson, &
     659             :                                                  l_brunt_vaisala_freq_moist, &
     660             :                                                  l_use_thvm_in_bv_freq, &
     661             :                                                  l_rcm_supersat_adj, &
     662             :                                                  l_damp_wp3_Skw_squared, &
     663             :                                                  l_prescribed_avg_deltaz, &
     664             :                                                  l_lmm_stepping, &
     665             :                                                  l_e3sm_config, &
     666             :                                                  l_vary_convect_depth, &
     667             :                                                  l_use_tke_in_wp3_pr_turb_term, &
     668             :                                                  l_use_tke_in_wp2_wp3_K_dfsn, &
     669             :                                                  l_use_wp3_lim_with_smth_Heaviside, &
     670             :                                                  l_smooth_Heaviside_tau_wpxp, &
     671             :                                                  l_modify_limiters_for_cnvg_test, &
     672             :                                                  l_enable_relaxed_clipping, &
     673             :                                                  l_linearize_pbl_winds, &
     674             :                                                  l_mono_flux_lim_thlm, &
     675             :                                                  l_mono_flux_lim_rtm, &
     676             :                                                  l_mono_flux_lim_um, &
     677             :                                                  l_mono_flux_lim_vm, &
     678             :                                                  l_mono_flux_lim_spikefix, &
     679             :                                                  clubb_config_flags )
     680             : 
     681             : ! Description:
     682             : !   Initialize the clubb_config_flags_type.
     683             : 
     684             : ! References:
     685             : !   None
     686             : !-------------------------------------------------------------------------------
     687             : 
     688             :     implicit none
     689             : 
     690             :     ! Input variables
     691             :     integer, intent(in) :: &
     692             :       iiPDF_type,          & ! Selected option for the two-component normal
     693             :                              ! (double Gaussian) PDF type to use for the w, rt,
     694             :                              ! and theta-l (or w, chi, and eta) portion of
     695             :                              ! CLUBB's multivariate, two-component PDF.
     696             :       ipdf_call_placement, & ! Selected option for the placement of the call to
     697             :                              ! CLUBB's PDF.
     698             :       penta_solve_method,  & ! Option to set the penta-diagonal matrix solving method
     699             :       tridiag_solve_method   ! Option to set the tri-diagonal matrix solving method
     700             : 
     701             :     logical, intent(in) :: &
     702             :       l_use_precip_frac,            & ! Flag to use precipitation fraction in KK microphysics. The
     703             :                                       ! precipitation fraction is automatically set to 1 when this
     704             :                                       ! flag is turned off.
     705             :       l_predict_upwp_vpwp,          & ! Flag to predict <u'w'> and <v'w'> along with <u> and <v>
     706             :                                       ! alongside the advancement of <rt>, <w'rt'>, <thl>,
     707             :                                       ! <wpthlp>, <sclr>, and <w'sclr'> in subroutine
     708             :                                       ! advance_xm_wpxp.  Otherwise, <u'w'> and <v'w'> are still
     709             :                                       ! approximated by eddy diffusivity when <u> and <v> are
     710             :                                       ! advanced in subroutine advance_windm_edsclrm.
     711             :       l_min_wp2_from_corr_wx,       & ! Flag to base the threshold minimum value of wp2 on keeping
     712             :                                       ! the overall correlation of w and x (w and rt, as well as w
     713             :                                       ! and theta-l) within the limits of -max_mag_correlation_flux
     714             :                                       ! to max_mag_correlation_flux.
     715             :       l_min_xp2_from_corr_wx,       & ! Flag to base the threshold minimum value of xp2 (rtp2 and
     716             :                                       ! thlp2) on keeping the overall correlation of w and x within
     717             :                                       ! the limits of -max_mag_correlation_flux to
     718             :                                       ! max_mag_correlation_flux.
     719             :       l_C2_cloud_frac,              & ! Flag to use cloud fraction to adjust the value of the
     720             :                                       ! turbulent dissipation coefficient, C2.
     721             :       l_diffuse_rtm_and_thlm,       & ! Diffuses rtm and thlm
     722             :       l_stability_correct_Kh_N2_zm, & ! Divides Kh_N2_zm by a stability factor
     723             :       l_calc_thlp2_rad,             & ! Include the contribution of radiation to thlp2
     724             :       l_upwind_xpyp_ta,             & ! This flag determines whether we want to use an upwind
     725             :                                       ! differencing approximation rather than a centered
     726             :                                       ! differencing for turbulent or mean advection terms. It
     727             :                                       ! affects rtp2, thlp2, up2, vp2, sclrp2, rtpthlp, sclrprtp, &
     728             :                                       ! sclrpthlp.
     729             :       l_upwind_xm_ma,               & ! This flag determines whether we want to use an upwind
     730             :                                       ! differencing approximation rather than a centered
     731             :                                       ! differencing for turbulent or mean advection terms. It
     732             :                                       ! affects rtm, thlm, sclrm, um and vm.
     733             :       l_uv_nudge,                   & ! For wind speed nudging.
     734             :       l_rtm_nudge,                  & ! For rtm nudging
     735             :       l_tke_aniso,                  & ! For anisotropic turbulent kinetic energy, i.e.
     736             :                                       ! TKE = 1/2 (u'^2 + v'^2 + w'^2)
     737             :       l_vert_avg_closure,           & ! Use 2 calls to pdf_closure and the trapezoidal rule to
     738             :                                       ! compute the varibles that are output from high order
     739             :                                       ! closure
     740             :       l_trapezoidal_rule_zt,        & ! If true, the trapezoidal rule is called for the
     741             :                                       ! thermodynamic-level variables output from pdf_closure.
     742             :       l_trapezoidal_rule_zm,        & ! If true, the trapezoidal rule is called for three
     743             :                                       ! momentum-level variables - wpthvp, thlpthvp, and rtpthvp -
     744             :                                       ! output from pdf_closure.
     745             :       l_call_pdf_closure_twice,     & ! This logical flag determines whether or not to call
     746             :                                       ! subroutine pdf_closure twice.  If true, pdf_closure is
     747             :                                       ! called first on thermodynamic levels and then on momentum
     748             :                                       ! levels so that each variable is computed on its native
     749             :                                       ! level.  If false, pdf_closure is only called on
     750             :                                       ! thermodynamic levels, and variables which belong on
     751             :                                       ! momentum levels are interpolated.
     752             :       l_standard_term_ta,           & ! Use the standard discretization for the turbulent advection
     753             :                                       ! terms.  Setting to .false. means that a_1 and a_3 are
     754             :                                       ! pulled outside of the derivative in
     755             :                                       ! advance_wp2_wp3_module.F90 and in
     756             :                                       ! advance_xp2_xpyp_module.F90.
     757             :       l_partial_upwind_wp3,         & ! Flag to use an "upwind" discretization rather
     758             :                                       ! than a centered discretization for the portion
     759             :                                       ! of the wp3 turbulent advection term for ADG1
     760             :                                       ! that is linearized in terms of wp3<t+1>.
     761             :                                       ! (Requires ADG1 PDF and l_standard_term_ta).
     762             :       l_godunov_upwind_wpxp_ta,     & ! This flag determines whether we want to use an upwind
     763             :                                       ! differencing approximation rather than a centered 
     764             :                                       ! differencing for turbulent advection terms. 
     765             :                                       ! It affects  wpxp only.
     766             :       l_godunov_upwind_xpyp_ta,     & ! This flag determines whether we want to use an upwind
     767             :                                       ! differencing approximation rather than a centered 
     768             :                                       ! differencing for turbulent advection terms. It affects
     769             :                                       ! xpyp only.
     770             :       l_use_cloud_cover,            & ! Use cloud_cover and rcm_in_layer to help boost cloud_frac
     771             :                                       ! and rcm to help increase cloudiness at coarser grid
     772             :                                       ! resolutions.
     773             :       l_diagnose_correlations,      & ! Diagnose correlations instead of using fixed ones
     774             :       l_calc_w_corr,                & ! Calculate the correlations between w and the hydrometeors
     775             :       l_const_Nc_in_cloud,          & ! Use a constant cloud droplet conc. within cloud (K&K)
     776             :       l_fix_w_chi_eta_correlations, & ! Use a fixed correlation for s and t Mellor(chi/eta)
     777             :       l_stability_correct_tau_zm,   & ! Use tau_N2_zm instead of tau_zm in wpxp_pr1 stability
     778             :                                       ! correction
     779             :       l_damp_wp2_using_em,          & ! In wp2 equation, use a dissipation formula of
     780             :                                       ! -(2/3)*em/tau_zm, as in Bougeault (1981)
     781             :       l_do_expldiff_rtm_thlm,       & ! Diffuse rtm and thlm explicitly
     782             :       l_Lscale_plume_centered,      & ! Alternate that uses the PDF to compute the perturbed values
     783             :       l_diag_Lscale_from_tau,       & ! First diagnose dissipation time tau, and then diagnose the
     784             :                                       ! mixing length scale as Lscale = tau * tke
     785             :       l_use_C7_Richardson,          & ! Parameterize C7 based on Richardson number
     786             :       l_use_C11_Richardson,         & ! Parameterize C11 and C16 based on Richardson number
     787             :       l_use_shear_Richardson,       & ! Use shear in the calculation of Richardson number
     788             :       l_brunt_vaisala_freq_moist,   & ! Use a different formula for the Brunt-Vaisala frequency in
     789             :                                       ! saturated atmospheres (from Durran and Klemp, 1982)
     790             :       l_use_thvm_in_bv_freq,        & ! Use thvm in the calculation of Brunt-Vaisala frequency
     791             :       l_rcm_supersat_adj,           & ! Add excess supersaturated vapor to cloud water
     792             :       l_damp_wp3_Skw_squared,       & ! Set damping on wp3 to use Skw^2 rather than Skw^4
     793             :       l_prescribed_avg_deltaz,      & ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz
     794             :       l_lmm_stepping,               & ! Apply Linear Multistep Method (LMM) Stepping
     795             :       l_e3sm_config,                & ! Run model with E3SM settings
     796             :       l_vary_convect_depth,         & ! Flag used to calculate convective velocity using
     797             :                                       ! a variable estimate of layer depth based on the depth
     798             :                                       ! over which wpthlp is positive near the ground when true
     799             :                                       ! More information can be found by
     800             :                                       ! Looking at issue #905 on the clubb repo
     801             :       l_use_tke_in_wp3_pr_turb_term,& ! Use TKE formulation for wp3 pr_turb term
     802             :       l_use_tke_in_wp2_wp3_K_dfsn,  & ! Use TKE in eddy diffusion for wp2 and wp3
     803             :       l_use_wp3_lim_with_smth_Heaviside, & ! Flag to activate mods on wp3 limiters for conv test
     804             :       l_smooth_Heaviside_tau_wpxp,  & ! Use smoothed Heaviside 'Peskin' function
     805             :                                       ! in the calculation of H_invrs_tau_wpxp_N2
     806             :                                       ! in src/CLUBB_core/mixing_length.F90
     807             :       l_modify_limiters_for_cnvg_test, & ! Flag to activate mods on limiters for conv test
     808             :       l_enable_relaxed_clipping,    & ! Flag to relax clipping on wpxp in
     809             :                                       ! xm_wpxp_clipping_and_stats
     810             :       l_linearize_pbl_winds,        & ! Code to linearize PBL winds
     811             :       l_mono_flux_lim_thlm,         & ! Flag to turn on monotonic flux limiter for thlm
     812             :       l_mono_flux_lim_rtm,          & ! Flag to turn on monotonic flux limiter for rtm
     813             :       l_mono_flux_lim_um,           & ! Flag to turn on monotonic flux limiter for um
     814             :       l_mono_flux_lim_vm,           & ! Flag to turn on monotonic flux limiter for vm
     815             :       l_mono_flux_lim_spikefix        ! Flag to implement monotonic flux limiter code that
     816             :                                       ! eliminates spurious drying tendencies at model top
     817             : 
     818             :     ! Output variables
     819             :     type(clubb_config_flags_type), intent(out) :: &
     820             :       clubb_config_flags            ! Derived type holding all configurable CLUBB flags
     821             : 
     822             : !-----------------------------------------------------------------------
     823             :     ! Begin code
     824             : 
     825        1536 :     clubb_config_flags%iiPDF_type = iiPDF_type
     826        1536 :     clubb_config_flags%ipdf_call_placement = ipdf_call_placement
     827        1536 :     clubb_config_flags%penta_solve_method = penta_solve_method
     828        1536 :     clubb_config_flags%tridiag_solve_method = tridiag_solve_method
     829        1536 :     clubb_config_flags%l_use_precip_frac = l_use_precip_frac
     830        1536 :     clubb_config_flags%l_predict_upwp_vpwp = l_predict_upwp_vpwp
     831        1536 :     clubb_config_flags%l_min_wp2_from_corr_wx = l_min_wp2_from_corr_wx
     832        1536 :     clubb_config_flags%l_min_xp2_from_corr_wx = l_min_xp2_from_corr_wx
     833        1536 :     clubb_config_flags%l_C2_cloud_frac = l_C2_cloud_frac
     834        1536 :     clubb_config_flags%l_diffuse_rtm_and_thlm = l_diffuse_rtm_and_thlm
     835        1536 :     clubb_config_flags%l_stability_correct_Kh_N2_zm = l_stability_correct_Kh_N2_zm
     836        1536 :     clubb_config_flags%l_calc_thlp2_rad = l_calc_thlp2_rad
     837        1536 :     clubb_config_flags%l_upwind_xpyp_ta = l_upwind_xpyp_ta
     838        1536 :     clubb_config_flags%l_upwind_xm_ma = l_upwind_xm_ma
     839        1536 :     clubb_config_flags%l_uv_nudge = l_uv_nudge
     840        1536 :     clubb_config_flags%l_rtm_nudge = l_rtm_nudge
     841        1536 :     clubb_config_flags%l_tke_aniso = l_tke_aniso
     842        1536 :     clubb_config_flags%l_vert_avg_closure  = l_vert_avg_closure
     843        1536 :     clubb_config_flags%l_trapezoidal_rule_zt = l_trapezoidal_rule_zt
     844        1536 :     clubb_config_flags%l_trapezoidal_rule_zm = l_trapezoidal_rule_zm
     845        1536 :     clubb_config_flags%l_call_pdf_closure_twice = l_call_pdf_closure_twice
     846        1536 :     clubb_config_flags%l_standard_term_ta = l_standard_term_ta
     847        1536 :     clubb_config_flags%l_partial_upwind_wp3 = l_partial_upwind_wp3
     848        1536 :     clubb_config_flags%l_godunov_upwind_wpxp_ta = l_godunov_upwind_wpxp_ta
     849        1536 :     clubb_config_flags%l_godunov_upwind_xpyp_ta = l_godunov_upwind_xpyp_ta
     850        1536 :     clubb_config_flags%l_use_cloud_cover = l_use_cloud_cover
     851        1536 :     clubb_config_flags%l_diagnose_correlations = l_diagnose_correlations
     852        1536 :     clubb_config_flags%l_calc_w_corr = l_calc_w_corr
     853        1536 :     clubb_config_flags%l_const_Nc_in_cloud = l_const_Nc_in_cloud
     854        1536 :     clubb_config_flags%l_fix_w_chi_eta_correlations = l_fix_w_chi_eta_correlations
     855        1536 :     clubb_config_flags%l_stability_correct_tau_zm = l_stability_correct_tau_zm
     856        1536 :     clubb_config_flags%l_damp_wp2_using_em = l_damp_wp2_using_em
     857        1536 :     clubb_config_flags%l_do_expldiff_rtm_thlm = l_do_expldiff_rtm_thlm
     858        1536 :     clubb_config_flags%l_Lscale_plume_centered = l_Lscale_plume_centered
     859        1536 :     clubb_config_flags%l_diag_Lscale_from_tau = l_diag_Lscale_from_tau
     860        1536 :     clubb_config_flags%l_use_C7_Richardson = l_use_C7_Richardson
     861        1536 :     clubb_config_flags%l_use_C11_Richardson = l_use_C11_Richardson
     862        1536 :     clubb_config_flags%l_use_shear_Richardson = l_use_shear_Richardson
     863        1536 :     clubb_config_flags%l_brunt_vaisala_freq_moist = l_brunt_vaisala_freq_moist
     864        1536 :     clubb_config_flags%l_use_thvm_in_bv_freq = l_use_thvm_in_bv_freq
     865        1536 :     clubb_config_flags%l_rcm_supersat_adj = l_rcm_supersat_adj
     866        1536 :     clubb_config_flags%l_damp_wp3_Skw_squared = l_damp_wp3_Skw_squared
     867        1536 :     clubb_config_flags%l_prescribed_avg_deltaz = l_prescribed_avg_deltaz
     868        1536 :     clubb_config_flags%l_lmm_stepping = l_lmm_stepping
     869        1536 :     clubb_config_flags%l_e3sm_config = l_e3sm_config
     870        1536 :     clubb_config_flags%l_vary_convect_depth = l_vary_convect_depth
     871        1536 :     clubb_config_flags%l_use_tke_in_wp3_pr_turb_term = l_use_tke_in_wp3_pr_turb_term
     872        1536 :     clubb_config_flags%l_use_tke_in_wp2_wp3_K_dfsn = l_use_tke_in_wp2_wp3_K_dfsn
     873        1536 :     clubb_config_flags%l_use_wp3_lim_with_smth_Heaviside = l_use_wp3_lim_with_smth_Heaviside
     874        1536 :     clubb_config_flags%l_smooth_Heaviside_tau_wpxp = l_smooth_Heaviside_tau_wpxp
     875        1536 :     clubb_config_flags%l_modify_limiters_for_cnvg_test = l_modify_limiters_for_cnvg_test
     876        1536 :     clubb_config_flags%l_enable_relaxed_clipping = l_enable_relaxed_clipping
     877        1536 :     clubb_config_flags%l_linearize_pbl_winds = l_linearize_pbl_winds
     878        1536 :     clubb_config_flags%l_mono_flux_lim_thlm = l_mono_flux_lim_thlm
     879        1536 :     clubb_config_flags%l_mono_flux_lim_rtm = l_mono_flux_lim_rtm
     880        1536 :     clubb_config_flags%l_mono_flux_lim_um = l_mono_flux_lim_um
     881        1536 :     clubb_config_flags%l_mono_flux_lim_vm = l_mono_flux_lim_vm
     882        1536 :     clubb_config_flags%l_mono_flux_lim_spikefix = l_mono_flux_lim_spikefix
     883             : 
     884        1536 :     return
     885             :   end subroutine initialize_clubb_config_flags_type
     886             : 
     887             : !===============================================================================
     888           2 :   subroutine print_clubb_config_flags( iunit, clubb_config_flags )
     889             : 
     890             : ! Description:
     891             : !   Prints the clubb_config_flags.
     892             : 
     893             : ! References:
     894             : !   None
     895             : !-------------------------------------------------------------------------------
     896             : 
     897             :     implicit none
     898             : 
     899             :     ! Input variables
     900             :     integer, intent(in) :: &
     901             :       iunit ! The file to write to
     902             : 
     903             :     type(clubb_config_flags_type), intent(in) :: &
     904             :       clubb_config_flags ! Derived type holding all configurable CLUBB flags
     905             : 
     906             : !-----------------------------------------------------------------------
     907             :     ! Begin code
     908             : 
     909           2 :     write(iunit,*) "iiPDF_type = ", clubb_config_flags%iiPDF_type
     910           2 :     write(iunit,*) "ipdf_call_placement = ", clubb_config_flags%ipdf_call_placement
     911           2 :     write(iunit,*) "penta_solve_method = ", clubb_config_flags%penta_solve_method
     912           2 :     write(iunit,*) "tridiag_solve_method = ", clubb_config_flags%tridiag_solve_method
     913           2 :     write(iunit,*) "l_use_precip_frac = ", clubb_config_flags%l_use_precip_frac
     914           2 :     write(iunit,*) "l_predict_upwp_vpwp = ", clubb_config_flags%l_predict_upwp_vpwp
     915           2 :     write(iunit,*) "l_min_wp2_from_corr_wx = ", clubb_config_flags%l_min_wp2_from_corr_wx
     916           2 :     write(iunit,*) "l_min_xp2_from_corr_wx = ", clubb_config_flags%l_min_xp2_from_corr_wx
     917           2 :     write(iunit,*) "l_C2_cloud_frac = ", clubb_config_flags%l_C2_cloud_frac
     918           2 :     write(iunit,*) "l_diffuse_rtm_and_thlm = ", clubb_config_flags%l_diffuse_rtm_and_thlm
     919           2 :     write(iunit,*) "l_stability_correct_Kh_N2_zm = ", &
     920           4 :                    clubb_config_flags%l_stability_correct_Kh_N2_zm
     921           2 :     write(iunit,*) "l_calc_thlp2_rad = ", clubb_config_flags%l_calc_thlp2_rad
     922           2 :     write(iunit,*) "l_upwind_xpyp_ta = ", clubb_config_flags%l_upwind_xpyp_ta
     923           2 :     write(iunit,*) "l_upwind_xm_ma = ", clubb_config_flags%l_upwind_xm_ma
     924           2 :     write(iunit,*) "l_uv_nudge = ", clubb_config_flags%l_uv_nudge
     925           2 :     write(iunit,*) "l_rtm_nudge = ", clubb_config_flags%l_rtm_nudge
     926           2 :     write(iunit,*) "l_tke_aniso = ", clubb_config_flags%l_tke_aniso
     927           2 :     write(iunit,*) "l_vert_avg_closure = ", clubb_config_flags%l_vert_avg_closure
     928           2 :     write(iunit,*) "l_trapezoidal_rule_zt = ", clubb_config_flags%l_trapezoidal_rule_zt
     929           2 :     write(iunit,*) "l_trapezoidal_rule_zm = ", clubb_config_flags%l_trapezoidal_rule_zm
     930           2 :     write(iunit,*) "l_call_pdf_closure_twice = ", clubb_config_flags%l_call_pdf_closure_twice
     931           2 :     write(iunit,*) "l_standard_term_ta = ", clubb_config_flags%l_standard_term_ta
     932           2 :     write(iunit,*) "l_partial_upwind_wp3 = ", clubb_config_flags%l_partial_upwind_wp3
     933           2 :     write(iunit,*) "l_godunov_upwind_wpxp_ta = ", clubb_config_flags%l_godunov_upwind_wpxp_ta
     934           2 :     write(iunit,*) "l_godunov_upwind_xpyp_ta = ", clubb_config_flags%l_godunov_upwind_xpyp_ta
     935           2 :     write(iunit,*) "l_use_cloud_cover = ", clubb_config_flags%l_use_cloud_cover
     936           2 :     write(iunit,*) "l_diagnose_correlations = ", clubb_config_flags%l_diagnose_correlations
     937           2 :     write(iunit,*) "l_calc_w_corr = ", clubb_config_flags%l_calc_w_corr
     938           2 :     write(iunit,*) "l_const_Nc_in_cloud = ", clubb_config_flags%l_const_Nc_in_cloud
     939           2 :     write(iunit,*) "l_fix_w_chi_eta_correlations = ", clubb_config_flags%l_fix_w_chi_eta_correlations
     940           2 :     write(iunit,*) "l_stability_correct_tau_zm = ", clubb_config_flags%l_stability_correct_tau_zm
     941           2 :     write(iunit,*) "l_damp_wp2_using_em = ", clubb_config_flags%l_damp_wp2_using_em
     942           2 :     write(iunit,*) "l_do_expldiff_rtm_thlm = ", clubb_config_flags%l_do_expldiff_rtm_thlm
     943           2 :     write(iunit,*) "l_Lscale_plume_centered = ", clubb_config_flags%l_Lscale_plume_centered
     944           2 :     write(iunit,*) "l_diag_Lscale_from_tau = ", clubb_config_flags%l_diag_Lscale_from_tau
     945           2 :     write(iunit,*) "l_use_C7_Richardson = ", clubb_config_flags%l_use_C7_Richardson
     946           2 :     write(iunit,*) "l_use_C11_Richardson = ", clubb_config_flags%l_use_C11_Richardson
     947           2 :     write(iunit,*) "l_use_shear_Richardson = ", clubb_config_flags%l_use_shear_Richardson
     948           2 :     write(iunit,*) "l_brunt_vaisala_freq_moist = ", clubb_config_flags%l_brunt_vaisala_freq_moist
     949           2 :     write(iunit,*) "l_use_thvm_in_bv_freq = ", clubb_config_flags%l_use_thvm_in_bv_freq
     950           2 :     write(iunit,*) "l_rcm_supersat_adj = ", clubb_config_flags%l_rcm_supersat_adj
     951           2 :     write(iunit,*) "l_damp_wp3_Skw_squared = ", clubb_config_flags%l_damp_wp3_Skw_squared
     952           2 :     write(iunit,*) "l_prescribed_avg_deltaz = ", clubb_config_flags%l_prescribed_avg_deltaz
     953           2 :     write(iunit,*) "l_lmm_stepping = ", clubb_config_flags%l_lmm_stepping
     954           2 :     write(iunit,*) "l_e3sm_config = ", clubb_config_flags%l_e3sm_config
     955           2 :     write(iunit,*) "l_vary_convect_depth", clubb_config_flags%l_vary_convect_depth
     956           2 :     write(iunit,*) "l_use_tke_in_wp3_pr_turb_term = ", clubb_config_flags%l_use_tke_in_wp3_pr_turb_term
     957           2 :     write(iunit,*) "l_use_tke_in_wp2_wp3_K_dfsn = ", clubb_config_flags%l_use_tke_in_wp2_wp3_K_dfsn
     958           2 :     write(iunit,*) "l_use_wp3_lim_with_smth_Heaviside = ", clubb_config_flags%l_use_wp3_lim_with_smth_Heaviside
     959           2 :     write(iunit,*) "l_smooth_Heaviside_tau_wpxp = ", clubb_config_flags%l_smooth_Heaviside_tau_wpxp
     960           2 :     write(iunit,*) "l_modify_limiters_for_cnvg_test = ", clubb_config_flags%l_modify_limiters_for_cnvg_test
     961           2 :     write(iunit,*) "l_enable_relaxed_clipping = ", clubb_config_flags%l_enable_relaxed_clipping
     962           2 :     write(iunit,*) "l_linearize_pbl_winds = ", clubb_config_flags%l_linearize_pbl_winds
     963           2 :     write(iunit,*) "l_mono_flux_lim_thlm = ",clubb_config_flags%l_mono_flux_lim_thlm
     964           2 :     write(iunit,*) "l_mono_flux_lim_rtm = ",clubb_config_flags%l_mono_flux_lim_rtm
     965           2 :     write(iunit,*) "l_mono_flux_lim_um = ",clubb_config_flags%l_mono_flux_lim_vm
     966           2 :     write(iunit,*) "l_mono_flux_lim_vm = ",clubb_config_flags%l_mono_flux_lim_um
     967           2 :     write(iunit,*) "l_mono_flux_lim_spikefix = ",clubb_config_flags%l_mono_flux_lim_spikefix
     968             : 
     969           2 :     return
     970             :   end subroutine print_clubb_config_flags
     971             : 
     972           0 : end module model_flags

Generated by: LCOV version 1.14