Skip to content

Commit

Permalink
Fixes some p3 test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
singhbalwinder committed Feb 1, 2025
1 parent 132e4dd commit ad80008
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
12 changes: 7 additions & 5 deletions components/eamxx/src/physics/p3/tests/infra/p3_test_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,17 @@ P3MainPart3Data::P3MainPart3Data(
///////////////////////////////////////////////////////////////////////////////

P3MainData::P3MainData(
Int its_, Int ite_, Int kts_, Int kte_, Int it_, Real dt_, bool do_predict_nc_, bool do_prescribed_CCN_, Real) :
Int its_, Int ite_, Int kts_, Int kte_, Int it_, Real dt_, bool do_predict_nc_, bool do_prescribed_CCN_, bool use_hetfrz_classnuc_, Real) :
PhysicsTestData( { {(ite_ - its_) + 1, (kte_ - kts_) + 1}, {(ite_ - its_) + 1, (kte_ - kts_) + 2} }, { {
&pres, &dz, &nc_nuceat_tend, &nccn_prescribed, &ni_activated, &dpres, &inv_exner, &cld_frac_i, &cld_frac_l, &cld_frac_r,
&inv_qc_relvar, &qc, &nc, &qr, &nr, &qi, &qm, &ni, &bm, &qv, &th_atm, &qv_prev, &t_prev,
&inv_qc_relvar, &qc, &nc, &qr, &nr, &qi, &qm, &ni, &bm, &qv, &th_atm, &qv_prev, &t_prev, &hetfrz_immersion_nucleation_tend,
&hetfrz_contact_nucleation_tend, &hetfrz_deposition_nucleation_tend,
&diag_eff_radius_qc, &diag_eff_radius_qi, &diag_eff_radius_qr, &rho_qi, &mu_c, &lamc, &qv2qi_depos_tend, &precip_total_tend, &nevapr,
&qr_evap_tend, &liq_ice_exchange, &vap_liq_exchange, &vap_ice_exchange, &precip_liq_flux,
&precip_ice_flux},
{&precip_liq_surf, &precip_ice_surf} }), // these two are (ni, nk+1)
its(its_), ite(ite_), kts(kts_), kte(kte_), it(it_), dt(dt_), do_predict_nc(do_predict_nc_), do_prescribed_CCN(do_prescribed_CCN_)
its(its_), ite(ite_), kts(kts_), kte(kte_), it(it_), dt(dt_), do_predict_nc(do_predict_nc_), do_prescribed_CCN(do_prescribed_CCN_),
use_hetfrz_classnuc(use_hetfrz_classnuc_)
{}

void IceSupersatConservationData::randomize(std::mt19937_64& engine)
Expand Down Expand Up @@ -1433,8 +1435,8 @@ Int p3_main_host(
liq_ice_exchange_d, vap_liq_exchange_d, vap_ice_exchange_d,
precip_liq_flux_d, precip_ice_flux_d, precip_liq_surf_temp_d, precip_ice_surf_temp_d
};
std::vector<size_t> dim1_sizes_out(P3MainData::NUM_ARRAYS - 13, nj);
std::vector<size_t> dim2_sizes_out(P3MainData::NUM_ARRAYS - 13, nk);
std::vector<size_t> dim1_sizes_out(P3MainData::NUM_ARRAYS - 16, nj);
std::vector<size_t> dim2_sizes_out(P3MainData::NUM_ARRAYS - 16, nk);
int dim_sizes_out_len = dim1_sizes_out.size();
dim2_sizes_out[dim_sizes_out_len-4] = nk+1; // precip_liq_flux
dim2_sizes_out[dim_sizes_out_len-3] = nk+1; // precip_ice_flux
Expand Down
4 changes: 2 additions & 2 deletions components/eamxx/src/physics/p3/tests/infra/p3_test_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,9 @@ struct P3MainData : public PhysicsTestData
*precip_liq_flux, *precip_ice_flux, *precip_liq_surf, *precip_ice_surf;
Real elapsed_s;

P3MainData(Int its_, Int ite_, Int kts_, Int kte_, Int it_, Real dt_, bool do_predict_nc_, bool do_prescribed_CCN_, Real=0.);
P3MainData(Int its_, Int ite_, Int kts_, Int kte_, Int it_, Real dt_, bool do_predict_nc_, bool do_prescribed_CCN_, bool=false, Real=0.);

PTD_STD_DEF(P3MainData, 9, its, ite, kts, kte, it, dt, do_predict_nc, do_prescribed_CCN, elapsed_s);
PTD_STD_DEF(P3MainData, 10, its, ite, kts, kte, it, dt, do_predict_nc, do_prescribed_CCN, use_hetfrz_classnuc, elapsed_s);
};

struct IceSupersatConservationData {
Expand Down
6 changes: 3 additions & 3 deletions components/eamxx/src/physics/p3/tests/p3_main_unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ void run_bfb_p3_main()
auto engine = Base::get_engine();

P3MainData isds_baseline[] = {
// its, ite, kts, kte, it, dt, do_predict_nc, do_prescribed_CCN
P3MainData(1, 10, 1, 72, 1, 1.800E+03, false, true),
P3MainData(1, 10, 1, 72, 1, 1.800E+03, true, false),
// its, ite, kts, kte, it, dt, do_predict_nc, do_prescribed_CCN, use_hetfrz_classnuc
P3MainData(1, 10, 1, 72, 1, 1.800E+03, false, true, true, 0),
P3MainData(1, 10, 1, 72, 1, 1.800E+03, true, false, false, 0),
};

static constexpr Int num_runs = sizeof(isds_baseline) / sizeof(P3MainData);
Expand Down
5 changes: 2 additions & 3 deletions components/eamxx/src/physics/p3/tests/p3_unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct UnitWrap::UnitTest<D>::TestP3Conservation : public UnitWrap::UnitTest<D>:

using KTH = KokkosTypes<HostDevice>;

CloudWaterConservationData cwdc[1] = {{sp(1e-5), sp(1.1), sp(1e-4), 0.0, 0.0, 0.0, 0.0, 0.0, sp(1.0), sp(1.0), sp(1.0), sp(1.0), true, true}};
CloudWaterConservationData cwdc[1] = {{sp(1e-5), sp(1.1), sp(1e-4), 0.0, 0.0, 0.0, 0.0, 0.0, sp(1.0), sp(1.0), sp(1.0), sp(1.0), false, true}};

// Sync to device
KTH::view_1d<CloudWaterConservationData> cwdc_host("cwdc_host", 1);
Expand Down Expand Up @@ -139,8 +139,7 @@ struct UnitWrap::UnitTest<D>::TestP3Conservation : public UnitWrap::UnitTest<D>:

void ice_water_conservation_tests_device() {
using KTH = KokkosTypes<HostDevice>;

IceWaterConservationData iwdc[1] = {{sp(1e-5), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, sp(1.1), sp(1e-4), 0.0, 0.0, true, true}};
IceWaterConservationData iwdc[1] = {{sp(1e-5), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, sp(1.1), sp(1e-4), 0.0, 0.0, false, true}};

// Sync to device
KTH::view_1d<IceWaterConservationData> iwdc_host("iwdc_host", 1);
Expand Down

0 comments on commit ad80008

Please sign in to comment.