Skip to content

Commit

Permalink
Makes use_hetfrz_classnuc a runtime option and other minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
singhbalwinder committed Feb 2, 2025
1 parent ad80008 commit 487f9b6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion components/eamxx/cime_config/namelist_defaults_scream.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ be lost if SCREAM_HACK_XML is not enabled.
<!-- P3 microphysics -->
<p3 inherit="atm_proc_base">
<do_prescribed_ccn>true</do_prescribed_ccn>
<use_hetfrz_classnuc>true</use_hetfrz_classnuc>
<use_hetfrz_classnuc type="logical" doc="Switch to turn on heterogeneous freezing due to prognostic aerosols">false</use_hetfrz_classnuc>
<do_prescribed_ccn COMPSET=".*SCREAM.*noAero">false</do_prescribed_ccn>
<do_predict_nc>true</do_predict_nc>
<do_predict_nc COMPSET=".*SCREAM.*noAero">false</do_predict_nc>
Expand Down
2 changes: 1 addition & 1 deletion components/eamxx/src/physics/p3/disp/p3_main_impl_disp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ ::p3_main_internal_disp(

p3_main_part2_disp(
nj, nk, runtime_options.max_total_ni, infrastructure.predictNc, infrastructure.prescribedCCN, infrastructure.dt, inv_dt,
infrastructure.use_hetfrz_classnuc, hetfrz_immersion_nucleation_tend, hetfrz_contact_nucleation_tend, hetfrz_deposition_nucleation_tend,
runtime_options.use_hetfrz_classnuc, hetfrz_immersion_nucleation_tend, hetfrz_contact_nucleation_tend, hetfrz_deposition_nucleation_tend,
lookup_tables.dnu_table_vals, lookup_tables.ice_table_vals, lookup_tables.collect_table_vals,
lookup_tables.revap_table_vals, pres, dpres, dz, nc_nuceat_tend, inv_exner,
exner, inv_cld_frac_l, inv_cld_frac_i, inv_cld_frac_r, ni_activated, inv_qc_relvar, cld_frac_i,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ void P3Microphysics::set_grids(const std::shared_ptr<const GridsManager> grids_m
infrastructure.kte = m_num_levs-1;
infrastructure.predictNc = m_params.get<bool>("do_predict_nc",true);
infrastructure.prescribedCCN = m_params.get<bool>("do_prescribed_ccn",true);
infrastructure.use_hetfrz_classnuc = m_params.get<bool>("use_hetfrz_classnuc",true);

// Define the different field layouts that will be used for this process
using namespace ShortFieldTagsNames;
Expand Down
7 changes: 6 additions & 1 deletion components/eamxx/src/physics/p3/impl/p3_CNT_couple_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ ::CNT_couple(
{
constexpr Scalar pi = C::Pi;
constexpr Scalar rho_h2o = C::RHO_H2O;
constexpr Scalar qsmall = 1.0e-18; // BAD_CONSTANT!

// TODO: Verify if qsmall can be unified with other "small" numeric literals
constexpr Scalar qsmall = 1.0e-18;
constexpr Scalar piov3 = pi/3.0;

// TODO: Verify if 1.0e-18 can be unified with other "small" numeric literals
constexpr Scalar mi0 = 4.0*piov3*900.0*1.0e-18; // BAD_CONSTANT!

const Spack Zero(0.0);
Expand All @@ -48,6 +52,7 @@ ::CNT_couple(
qinuc_cnt.set(mask, ninuc_cnt*mi0, Zero);
break;
default:
EKAT_KERNEL_ERROR_MSG("Error! Unhandled case in switch statement for Iflag in p3_CNT_couple_impl.hpp .\n");
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/eamxx/src/physics/p3/impl/p3_main_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ ::p3_main_internal(

p3_main_part2(
team, nk_pack, runtime_options.max_total_ni, infrastructure.predictNc, infrastructure.prescribedCCN, infrastructure.dt, inv_dt,
infrastructure.use_hetfrz_classnuc, ohetfrz_immersion_nucleation_tend, ohetfrz_contact_nucleation_tend, ohetfrz_deposition_nucleation_tend,
runtime_options.use_hetfrz_classnuc, ohetfrz_immersion_nucleation_tend, ohetfrz_contact_nucleation_tend, ohetfrz_deposition_nucleation_tend,
lookup_tables.dnu_table_vals, lookup_tables.ice_table_vals, lookup_tables.collect_table_vals, lookup_tables.revap_table_vals, opres, odpres, odz, onc_nuceat_tend, oinv_exner,
exner, inv_cld_frac_l, inv_cld_frac_i, inv_cld_frac_r, oni_activated, oinv_qc_relvar, ocld_frac_i,
ocld_frac_l, ocld_frac_r, oqv_prev, ot_prev, T_atm, rho, inv_rho, qv_sat_l, qv_sat_i, qv_supersat_i, rhofacr, rhofaci, acn,
Expand Down
4 changes: 2 additions & 2 deletions components/eamxx/src/physics/p3/p3_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ struct Functions
bool set_cld_frac_l_to_one = false;
bool set_cld_frac_i_to_one = false;
bool set_cld_frac_r_to_one = false;
bool use_hetfrz_classnuc = false; // Set to true to use het frz from MAM4xx-ACI

void load_runtime_options_from_file(ekat::ParameterList& params) {
max_total_ni = params.get<double>("max_total_ni", max_total_ni);
Expand All @@ -159,6 +160,7 @@ struct Functions
set_cld_frac_l_to_one = params.get<bool>("set_cld_frac_l_to_one", set_cld_frac_l_to_one);
set_cld_frac_i_to_one = params.get<bool>("set_cld_frac_i_to_one", set_cld_frac_i_to_one);
set_cld_frac_r_to_one = params.get<bool>("set_cld_frac_r_to_one", set_cld_frac_r_to_one);
use_hetfrz_classnuc = params.get<bool>("use_hetfrz_classnuc", use_hetfrz_classnuc);
}

};
Expand Down Expand Up @@ -271,8 +273,6 @@ struct Functions
bool predictNc;
// Set to true to use prescribed CCN
bool prescribedCCN;
// Set to true to use het frz from MAM4xx-ACI
bool use_hetfrz_classnuc;
// Coordinates of columns, nj x 3
view_2d<const Scalar> col_location;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ Int p3_main_host(
precip_ice_surf_d, diag_eff_radius_qc_d, diag_eff_radius_qi_d, diag_eff_radius_qr_d,
rho_qi_d,precip_liq_flux_d, precip_ice_flux_d, precip_total_tend_d, nevapr_d};
P3F::P3Infrastructure infrastructure{dt, it, its, ite, kts, kte,
do_predict_nc, do_prescribed_CCN, use_hetfrz_classnuc, col_location_d};
do_predict_nc, do_prescribed_CCN, col_location_d};
P3F::P3HistoryOnly history_only{liq_ice_exchange_d, vap_liq_exchange_d,
vap_ice_exchange_d};

Expand Down

0 comments on commit 487f9b6

Please sign in to comment.