Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non bfb issues with latent heat in p3 on PM-GPU #2998

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions components/eamxx/src/physics/p3/disp/p3_ice_sed_impl_disp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ ::ice_sedimentation_disp(

// Ice sedimentation: (adaptive substepping)
ice_sedimentation(
ekat::subview(rho, i), ekat::subview(inv_rho, i), ekat::subview(rhofaci, i), ekat::subview(cld_frac_i, i),
ekat::subview(inv_dz, i), team, workspace, nk, ktop, kbot, kdir, dt, inv_dt,
ekat::subview(rho, i), ekat::subview(inv_rho, i), ekat::subview(rhofaci, i), ekat::subview(cld_frac_i, i),
ekat::subview(inv_dz, i), team, workspace, nk, ktop, kbot, kdir, dt, inv_dt,
ekat::subview(qi, i), ekat::subview(qi_incld, i), ekat::subview(ni, i), ekat::subview(ni_incld, i),
ekat::subview(qm, i), ekat::subview(qm_incld, i), ekat::subview(bm, i), ekat::subview(bm_incld, i), ekat::subview(qi_tend, i), ekat::subview(ni_tend, i),
ice_table_vals, precip_ice_surf(i), p3constants);
Expand All @@ -60,6 +60,7 @@ void Functions<Real,DefaultDevice>
::homogeneous_freezing_disp(
const uview_2d<const Spack>& T_atm,
const uview_2d<const Spack>& inv_exner,
const uview_2d<const Spack>& latent_heat_fusion,
const Int& nj, const Int& nk, const Int& ktop, const Int& kbot, const Int& kdir,
const uview_2d<Spack>& qc,
const uview_2d<Spack>& nc,
Expand Down Expand Up @@ -88,7 +89,7 @@ ::homogeneous_freezing_disp(

// homogeneous freezing of cloud and rain
homogeneous_freezing(
ekat::subview(T_atm, i), ekat::subview(inv_exner, i), team, nk, ktop, kbot, kdir,
ekat::subview(T_atm, i), ekat::subview(inv_exner, i), ekat::subview(latent_heat_fusion, i), team, nk, ktop, kbot, kdir,
ekat::subview(qc, i), ekat::subview(nc, i), ekat::subview(qr, i), ekat::subview(nr, i), ekat::subview(qi, i),
ekat::subview(ni, i), ekat::subview(qm, i), ekat::subview(bm, i), ekat::subview(th_atm, i));

Expand Down
20 changes: 16 additions & 4 deletions components/eamxx/src/physics/p3/disp/p3_main_impl_disp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ::p3_main_init_disp(
const uview_2d<Spack>& diag_eff_radius_qr,
const uview_2d<Spack>& inv_cld_frac_i, const uview_2d<Spack>& inv_cld_frac_l, const uview_2d<Spack>& inv_cld_frac_r,
const uview_2d<Spack>& exner, const uview_2d<Spack>& T_atm, const uview_2d<Spack>& qv, const uview_2d<Spack>& inv_dz,
const uview_2d<Spack>& latent_heat_vapor, const uview_2d<Spack>& latent_heat_sublim, const uview_2d<Spack>& latent_heat_fusion,
const uview_1d<Scalar>& precip_liq_surf, const uview_1d<Scalar>& precip_ice_surf,
const uview_2d<Spack>& mu_r, const uview_2d<Spack>& lamr, const uview_2d<Spack>& logn0r, const uview_2d<Spack>& nu,
const uview_2d<Spack>& cdist, const uview_2d<Spack>& cdist1, const uview_2d<Spack>& cdistr,
Expand All @@ -43,6 +44,9 @@ ::p3_main_init_disp(
precip_liq_surf(i) = 0;
precip_ice_surf(i) = 0;

constexpr Scalar latvap = C::LatVap;
constexpr Scalar latice = C::LatIce;

Kokkos::parallel_for(
Kokkos::TeamVectorRange(team, nk_pack), [&] (Int k) {
diag_equiv_reflectivity(i,k) = -99;
Expand All @@ -58,6 +62,9 @@ ::p3_main_init_disp(
T_atm(i,k) = th_atm(i,k) * exner(i,k);
qv(i,k) = max(qv(i,k), 0);
inv_dz(i,k) = 1 / dz(i,k);
latent_heat_vapor(i,k) = latvap;
latent_heat_sublim(i,k) = latvap+latice;
latent_heat_fusion(i,k) = latice;
mu_r(i,k) = 0.;
lamr(i,k) = 0.;
logn0r(i,k) = 0.;
Expand Down Expand Up @@ -221,6 +228,9 @@ ::p3_main_internal_disp(
auto flux_qit = temporaries.flux_qit;
auto v_qr = temporaries.v_qr;
auto v_nr = temporaries.v_nr;
auto latent_heat_vapor = temporaries.latent_heat_vapor;
auto latent_heat_sublim = temporaries.latent_heat_sublim;
auto latent_heat_fusion = temporaries.latent_heat_fusion;

// we do not want to measure init stuff
auto start = std::chrono::steady_clock::now();
Expand All @@ -230,6 +240,7 @@ ::p3_main_internal_disp(
nj, nk_pack, cld_frac_i, cld_frac_l, cld_frac_r, inv_exner, th, dz, diag_equiv_reflectivity,
ze_ice, ze_rain, diag_eff_radius_qc, diag_eff_radius_qi, diag_eff_radius_qr,
inv_cld_frac_i, inv_cld_frac_l, inv_cld_frac_r, exner, T_atm, qv, inv_dz,
latent_heat_vapor, latent_heat_sublim, latent_heat_fusion,
diagnostic_outputs.precip_liq_surf, diagnostic_outputs.precip_ice_surf,
mu_r, lamr, logn0r, nu, cdist, cdist1, cdistr,
qc_incld, qr_incld, qi_incld, qm_incld, nc_incld, nr_incld, ni_incld, bm_incld,
Expand All @@ -240,7 +251,7 @@ ::p3_main_internal_disp(
p3_main_part1_disp(
nj, nk, infrastructure.predictNc, infrastructure.prescribedCCN, infrastructure.dt,
pres, dpres, dz, nc_nuceat_tend, nccn_prescribed, inv_exner, exner, inv_cld_frac_l, inv_cld_frac_i,
inv_cld_frac_r,
inv_cld_frac_r, latent_heat_vapor, latent_heat_sublim, latent_heat_fusion,
T_atm, rho, inv_rho, qv_sat_l, qv_sat_i, qv_supersat_i, rhofacr,
rhofaci, acn, qv, th, qc, nc, qr, nr, qi, ni, qm,
bm, qc_incld, qr_incld, qi_incld, qm_incld, nc_incld, nr_incld,
Expand All @@ -255,7 +266,8 @@ ::p3_main_internal_disp(
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,
cld_frac_l, cld_frac_r, qv_prev, t_prev, T_atm, rho, inv_rho, qv_sat_l, qv_sat_i, qv_supersat_i, rhofacr, rhofaci, acn,
qv, th, qc, nc, qr, nr, qi, ni, qm, bm, qc_incld, qr_incld, qi_incld, qm_incld, nc_incld,
qv, th, qc, nc, qr, nr, qi, ni, qm, bm, latent_heat_vapor,
latent_heat_sublim, latent_heat_fusion, qc_incld, qr_incld, qi_incld, qm_incld, nc_incld,
nr_incld, ni_incld, bm_incld, mu_c, nu, lamc, cdist, cdist1, cdistr,
mu_r, lamr, logn0r, qv2qi_depos_tend, precip_total_tend, nevapr, qr_evap_tend,
vap_liq_exchange, vap_ice_exchange, liq_ice_exchange,
Expand Down Expand Up @@ -296,7 +308,7 @@ ::p3_main_internal_disp(

// homogeneous freezing f cloud and rain
homogeneous_freezing_disp(
T_atm, inv_exner, nj, nk, ktop, kbot, kdir, qc, nc, qr, nr, qi,
T_atm, inv_exner, latent_heat_fusion, nj, nk, ktop, kbot, kdir, qc, nc, qr, nr, qi,
ni, qm, bm, th, nucleationPossible, hydrometeorsPresent);

//
Expand All @@ -306,7 +318,7 @@ ::p3_main_internal_disp(
p3_main_part3_disp(
nj, nk_pack, runtime_options.max_total_ni, lookup_tables.dnu_table_vals, lookup_tables.ice_table_vals, inv_exner, cld_frac_l, cld_frac_r, cld_frac_i,
rho, inv_rho, rhofaci, qv, th, qc, nc, qr, nr, qi, ni,
qm, bm, mu_c, nu, lamc, mu_r, lamr,
qm, bm, latent_heat_vapor, latent_heat_sublim, mu_c, nu, lamc, mu_r, lamr,
vap_liq_exchange, ze_rain, ze_ice, diag_vm_qi, diag_eff_radius_qi, diag_diam_qi,
rho_qi, diag_equiv_reflectivity, diag_eff_radius_qc, diag_eff_radius_qr, nucleationPossible, hydrometeorsPresent,
p3constants);
Expand Down
11 changes: 7 additions & 4 deletions components/eamxx/src/physics/p3/disp/p3_main_impl_part1_disp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ ::p3_main_part1_disp(
const uview_2d<const Spack>& inv_cld_frac_l,
const uview_2d<const Spack>& inv_cld_frac_i,
const uview_2d<const Spack>& inv_cld_frac_r,
const uview_2d<const Spack>& latent_heat_vapor,
const uview_2d<const Spack>& latent_heat_sublim,
const uview_2d<const Spack>& latent_heat_fusion,
const uview_2d<Spack>& T_atm,
const uview_2d<Spack>& rho,
const uview_2d<Spack>& inv_rho,
Expand Down Expand Up @@ -70,17 +73,17 @@ ::p3_main_part1_disp(
policy, KOKKOS_LAMBDA(const MemberType& team) {

const Int i = team.league_rank();

p3_main_part1(
team, nk, predictNc, prescribedCCN, dt,
ekat::subview(pres, i), ekat::subview(dpres, i), ekat::subview(dz, i), ekat::subview(nc_nuceat_tend, i),
ekat::subview(nccn_prescribed, i), ekat::subview(inv_exner, i), ekat::subview(exner, i), ekat::subview(inv_cld_frac_l, i),
ekat::subview(inv_cld_frac_i, i), ekat::subview(inv_cld_frac_r, i),
ekat::subview(T_atm, i), ekat::subview(rho, i), ekat::subview(inv_rho, i), ekat::subview(qv_sat_l, i),
ekat::subview(inv_cld_frac_i, i), ekat::subview(inv_cld_frac_r, i), ekat::subview(latent_heat_vapor, i), ekat::subview(latent_heat_sublim, i),
ekat::subview(latent_heat_fusion, i), ekat::subview(T_atm, i), ekat::subview(rho, i), ekat::subview(inv_rho, i), ekat::subview(qv_sat_l, i),
ekat::subview(qv_sat_i, i), ekat::subview(qv_supersat_i, i), ekat::subview(rhofacr, i), ekat::subview(rhofaci, i), ekat::subview(acn, i),
ekat::subview(qv, i), ekat::subview(th_atm, i), ekat::subview(qc, i), ekat::subview(nc, i), ekat::subview(qr, i), ekat::subview(nr, i), ekat::subview(qi, i),
ekat::subview(ni, i), ekat::subview(qm, i), ekat::subview(bm, i), ekat::subview(qc_incld, i), ekat::subview(qr_incld, i), ekat::subview(qi_incld, i),
ekat::subview(qm_incld, i), ekat::subview(nc_incld, i), ekat::subview(nr_incld, i), ekat::subview(ni_incld, i), ekat::subview(bm_incld, i),
ekat::subview(qm_incld, i), ekat::subview(nc_incld, i), ekat::subview(nr_incld, i), ekat::subview(ni_incld, i), ekat::subview(bm_incld, i),
nucleationPossible(i), hydrometeorsPresent(i), p3constants);

});
Expand Down
25 changes: 14 additions & 11 deletions components/eamxx/src/physics/p3/disp/p3_main_impl_part2_disp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ ::p3_main_part2_disp(
const uview_2d<Spack>& ni,
const uview_2d<Spack>& qm,
const uview_2d<Spack>& bm,
const uview_2d<Spack>& latent_heat_vapor,
const uview_2d<Spack>& latent_heat_sublim,
const uview_2d<Spack>& latent_heat_fusion,
const uview_2d<Spack>& qc_incld,
const uview_2d<Spack>& qr_incld,
const uview_2d<Spack>& qi_incld,
Expand Down Expand Up @@ -101,25 +104,25 @@ ::p3_main_part2_disp(

const Int i = team.league_rank();
if (!(nucleationPossible(i) || hydrometeorsPresent(i))) {
return;
return;
}

// ------------------------------------------------------------------------------------------
// main k-loop (for processes):
p3_main_part2(
team, nk_pack, max_total_ni, predictNc, do_prescribed_CCN, dt, inv_dt,
dnu_table_vals, ice_table_vals, collect_table_vals, revap_table_vals,
dnu_table_vals, ice_table_vals, collect_table_vals, revap_table_vals,
ekat::subview(pres, i), ekat::subview(dpres, i), ekat::subview(dz, i), ekat::subview(nc_nuceat_tend, i), ekat::subview(inv_exner, i),
ekat::subview(exner, i), ekat::subview(inv_cld_frac_l, i), ekat::subview(inv_cld_frac_i, i), ekat::subview(inv_cld_frac_r, i),
ekat::subview(ni_activated, i), ekat::subview(inv_qc_relvar, i), ekat::subview(cld_frac_i, i), ekat::subview(cld_frac_l, i),
ekat::subview(cld_frac_r, i), ekat::subview(qv_prev, i), ekat::subview(t_prev, i), ekat::subview(T_atm, i), ekat::subview(rho, i),
ekat::subview(inv_rho, i), ekat::subview(qv_sat_l, i), ekat::subview(qv_sat_i, i), ekat::subview(qv_supersat_i, i), ekat::subview(rhofacr, i),
ekat::subview(rhofaci, i), ekat::subview(acn, i), ekat::subview(qv, i), ekat::subview(th_atm, i), ekat::subview(qc, i), ekat::subview(nc, i),
ekat::subview(qr, i), ekat::subview(nr, i), ekat::subview(qi, i), ekat::subview(ni, i), ekat::subview(qm, i), ekat::subview(bm, i),
ekat::subview(qc_incld, i),
ekat::subview(qr_incld, i), ekat::subview(qi_incld, i), ekat::subview(qm_incld, i), ekat::subview(nc_incld, i), ekat::subview(nr_incld, i),
ekat::subview(exner, i), ekat::subview(inv_cld_frac_l, i), ekat::subview(inv_cld_frac_i, i), ekat::subview(inv_cld_frac_r, i),
ekat::subview(ni_activated, i), ekat::subview(inv_qc_relvar, i), ekat::subview(cld_frac_i, i), ekat::subview(cld_frac_l, i),
ekat::subview(cld_frac_r, i), ekat::subview(qv_prev, i), ekat::subview(t_prev, i), ekat::subview(T_atm, i), ekat::subview(rho, i),
ekat::subview(inv_rho, i), ekat::subview(qv_sat_l, i), ekat::subview(qv_sat_i, i), ekat::subview(qv_supersat_i, i), ekat::subview(rhofacr, i),
ekat::subview(rhofaci, i), ekat::subview(acn, i), ekat::subview(qv, i), ekat::subview(th_atm, i), ekat::subview(qc, i), ekat::subview(nc, i),
ekat::subview(qr, i), ekat::subview(nr, i), ekat::subview(qi, i), ekat::subview(ni, i), ekat::subview(qm, i), ekat::subview(bm, i),
ekat::subview(latent_heat_vapor, i), ekat::subview(latent_heat_sublim, i), ekat::subview(latent_heat_fusion, i), ekat::subview(qc_incld, i),
ekat::subview(qr_incld, i), ekat::subview(qi_incld, i), ekat::subview(qm_incld, i), ekat::subview(nc_incld, i), ekat::subview(nr_incld, i),
ekat::subview(ni_incld, i), ekat::subview(bm_incld, i), ekat::subview(mu_c, i), ekat::subview(nu, i), ekat::subview(lamc, i), ekat::subview(cdist, i),
ekat::subview(cdist1, i), ekat::subview(cdistr, i), ekat::subview(mu_r, i), ekat::subview(lamr, i), ekat::subview(logn0r, i),
ekat::subview(cdist1, i), ekat::subview(cdistr, i), ekat::subview(mu_r, i), ekat::subview(lamr, i), ekat::subview(logn0r, i),
ekat::subview(qv2qi_depos_tend, i), ekat::subview(precip_total_tend, i),
ekat::subview(nevapr, i), ekat::subview(qr_evap_tend, i), ekat::subview(vap_liq_exchange, i), ekat::subview(vap_ice_exchange, i), ekat::subview(liq_ice_exchange, i),
ekat::subview(pratot, i), ekat::subview(prctot, i), hydrometeorsPresent(i), nk, p3constants);
Expand Down
10 changes: 6 additions & 4 deletions components/eamxx/src/physics/p3/disp/p3_main_impl_part3_disp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ::p3_main_part3_disp(
const uview_2d<Spack>& ni,
const uview_2d<Spack>& qm,
const uview_2d<Spack>& bm,
const uview_2d<Spack>& latent_heat_vapor,
const uview_2d<Spack>& latent_heat_sublim,
const uview_2d<Spack>& mu_c,
const uview_2d<Spack>& nu,
const uview_2d<Spack>& lamc,
Expand Down Expand Up @@ -75,11 +77,11 @@ ::p3_main_part3_disp(
//
p3_main_part3(
team, nk_pack, max_total_ni, dnu_table_vals, ice_table_vals, ekat::subview(inv_exner, i), ekat::subview(cld_frac_l, i), ekat::subview(cld_frac_r, i),
ekat::subview(cld_frac_i, i), ekat::subview(rho, i), ekat::subview(inv_rho, i), ekat::subview(rhofaci, i), ekat::subview(qv, i),
ekat::subview(th_atm, i), ekat::subview(qc, i), ekat::subview(nc, i), ekat::subview(qr, i), ekat::subview(nr, i), ekat::subview(qi, i),
ekat::subview(ni, i), ekat::subview(qm, i), ekat::subview(bm, i),
ekat::subview(cld_frac_i, i), ekat::subview(rho, i), ekat::subview(inv_rho, i), ekat::subview(rhofaci, i), ekat::subview(qv, i),
ekat::subview(th_atm, i), ekat::subview(qc, i), ekat::subview(nc, i), ekat::subview(qr, i), ekat::subview(nr, i), ekat::subview(qi, i),
ekat::subview(ni, i), ekat::subview(qm, i), ekat::subview(bm, i), ekat::subview(latent_heat_vapor, i), ekat::subview(latent_heat_sublim, i),
ekat::subview(mu_c, i), ekat::subview(nu, i), ekat::subview(lamc, i), ekat::subview(mu_r, i), ekat::subview(lamr, i),
ekat::subview(vap_liq_exchange, i), ekat::subview(ze_rain, i), ekat::subview(ze_ice, i), ekat::subview(diag_vm_qi, i), ekat::subview(diag_eff_radius_qi, i),
ekat::subview(vap_liq_exchange, i), ekat::subview(ze_rain, i), ekat::subview(ze_ice, i), ekat::subview(diag_vm_qi, i), ekat::subview(diag_eff_radius_qi, i),
ekat::subview(diag_diam_qi, i), ekat::subview(rho_qi, i), ekat::subview(diag_equiv_reflectivity, i), ekat::subview(diag_eff_radius_qc, i),
ekat::subview(diag_eff_radius_qr, i), p3constants);

Expand Down
11 changes: 7 additions & 4 deletions components/eamxx/src/physics/p3/eamxx_p3_process_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ size_t P3Microphysics::requested_buffer_size_in_bytes() const

// Number of Reals needed by the WorkspaceManager passed to p3_main
const auto policy = ekat::ExeSpaceUtils<KT::ExeSpace>::get_default_team_policy(m_num_cols, nk_pack);
const size_t wsm_request = WSM::get_total_bytes_needed(nk_pack_p1, 52, policy);
const size_t wsm_request = WSM::get_total_bytes_needed(nk_pack_p1, 55, policy);

return interface_request + wsm_request;
}
Expand Down Expand Up @@ -188,7 +188,7 @@ void P3Microphysics::init_buffers(const ATMBufferManager &buffer_manager)
&m_buffer.ntend_ignore, &m_buffer.mu_c, &m_buffer.lamc, &m_buffer.qr_evap_tend, &m_buffer.v_qc,
&m_buffer.v_nc, &m_buffer.flux_qx, &m_buffer.flux_nx, &m_buffer.v_qit, &m_buffer.v_nit,
&m_buffer.flux_nit, &m_buffer.flux_bir, &m_buffer.flux_qir, &m_buffer.flux_qit, &m_buffer.v_qr,
&m_buffer.v_nr
&m_buffer.v_nr, &m_buffer.latent_heat_vapor, &m_buffer.latent_heat_sublim, &m_buffer.latent_heat_fusion
#endif
};
for (int i=0; i<Buffer::num_2d_vector; ++i) {
Expand All @@ -210,7 +210,7 @@ void P3Microphysics::init_buffers(const ATMBufferManager &buffer_manager)
// Compute workspace manager size to check used memory
// vs. requested memory
const auto policy = ekat::ExeSpaceUtils<KT::ExeSpace>::get_default_team_policy(m_num_cols, nk_pack);
const int wsm_size = WSM::get_total_bytes_needed(nk_pack_p1, 52, policy)/sizeof(Spack);
const int wsm_size = WSM::get_total_bytes_needed(nk_pack_p1, 55, policy)/sizeof(Spack);
s_mem += wsm_size;

size_t used_mem = (reinterpret_cast<Real*>(s_mem) - buffer_manager.get_memory())*sizeof(Real);
Expand Down Expand Up @@ -398,6 +398,9 @@ void P3Microphysics::initialize_impl (const RunType /* run_type */)
temporaries.flux_qit = m_buffer.flux_qit;
temporaries.v_qr = m_buffer.v_qr;
temporaries.v_nr = m_buffer.v_nr;
temporaries.latent_heat_vapor = m_buffer.latent_heat_vapor;
temporaries.latent_heat_sublim = m_buffer.latent_heat_sublim;
temporaries.latent_heat_fusion = m_buffer.latent_heat_fusion;
#endif

// -- Set values for the post-amble structure
Expand Down Expand Up @@ -427,7 +430,7 @@ void P3Microphysics::initialize_impl (const RunType /* run_type */)

// Setup WSM for internal local variables
const auto policy = ekat::ExeSpaceUtils<KT::ExeSpace>::get_default_team_policy(m_num_cols, nk_pack);
workspace_mgr.setup(m_buffer.wsm_data, nk_pack_p1, 52, policy);
workspace_mgr.setup(m_buffer.wsm_data, nk_pack_p1, 55, policy);
}

// =========================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class P3Microphysics : public AtmosphereProcess
static constexpr int num_1d_scalar = 2; //no 2d vars now, but keeping 1d struct for future expansion
// 2d view packed, size (ncol, nlev_packs)
#ifdef SCREAM_P3_SMALL_KERNELS
static constexpr int num_2d_vector = 64;
static constexpr int num_2d_vector = 67;
#else
static constexpr int num_2d_vector = 8;
#endif
Expand Down Expand Up @@ -393,7 +393,7 @@ class P3Microphysics : public AtmosphereProcess
diag_diam_qi, pratot, prctot, qtend_ignore, ntend_ignore,
mu_c, lamc, qr_evap_tend, v_qc, v_nc, flux_qx, flux_nx,
v_qit, v_nit, flux_nit, flux_bir, flux_qir, flux_qit,
v_qr, v_nr;
v_qr, v_nr, latent_heat_vapor, latent_heat_sublim, latent_heat_fusion;
#endif

suview_2d col_location;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ::evaporate_rain(
const Spack& cld_frac_l, const Spack& cld_frac_r, const Spack& qv, const Spack& qv_prev,
const Spack& qv_sat_l, const Spack& qv_sat_i, const Spack& ab, const Spack& abi,
const Spack& epsr, const Spack& epsi_tot, const Spack& t_atm, const Spack& t_atm_prev,
const Spack& dqsdt, const Scalar& dt,
const Spack& latent_heat_sublim, const Spack& dqsdt, const Scalar& dt,
Spack& qr2qv_evap_tend, Spack& nr_evap_tend,
const Smask& context)
{
Expand All @@ -92,8 +92,6 @@ ::evaporate_rain(
constexpr Scalar QSMALL = C::QSMALL;
constexpr Scalar Tmelt = C::Tmelt;
constexpr Scalar inv_cp = 1/C::Cpair;
constexpr Scalar latvap = C::LatVap;
constexpr Scalar latice = C::LatIce;

//Compute absolute supersaturation.
//Ignore the difference between clear-sky and cell-ave qv and T
Expand Down Expand Up @@ -135,9 +133,9 @@ ::evaporate_rain(
const Smask not_freezing = !is_freezing && context;
Spack eps_eff, A_c;
if (is_freezing.any()){
eps_eff.set(is_freezing,epsr + epsi_tot*(1 + (latvap+latice)*inv_cp*dqsdt)/abi);
eps_eff.set(is_freezing,epsr + epsi_tot*(1 + latent_heat_sublim*inv_cp*dqsdt)/abi);
A_c.set(is_freezing,(qv - qv_prev)*inv_dt - dqsdt*(t_atm-t_atm_prev)*inv_dt
- (qv_sat_l - qv_sat_i)*(1 + (latvap+latice)*inv_cp*dqsdt)/abi*epsi_tot );
- (qv_sat_l - qv_sat_i)*(1 + latent_heat_sublim*inv_cp*dqsdt)/abi*epsi_tot );
}
if (not_freezing.any()){
eps_eff.set(not_freezing,epsr);
Expand Down
Loading