Skip to content

Commit 1b865e0

Browse files
committed
Fixing setinv_test_nlev
1 parent 21c4821 commit 1b865e0

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/validation/mo_setinv/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ set(DEFAULT_TOL 1e-8)
3636

3737
set(ERROR_THRESHOLDS
3838
${DEFAULT_TOL}
39-
4e-5 # FIXME
39+
${DEFAULT_TOL}
4040
)
4141

4242
foreach(input tol IN ZIP_LISTS TEST_LIST ERROR_THRESHOLDS)

src/validation/mo_setinv/setinv_test_nlev.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,8 @@ void setinv_test_nlev(Ensemble *ensemble) {
4545
const int num_tracer_cnst = mam4::mo_setinv::num_tracer_cnst;
4646

4747
ColumnView tfld = haero::testing::create_column_view(nlev);
48-
auto tfld_h = Kokkos::create_mirror_view(tfld);
49-
ColumnView h2ovmr = haero::testing::create_column_view(nlev);
50-
auto h2ovmr_h = Kokkos::create_mirror_view(h2ovmr);
48+
ColumnView qv = haero::testing::create_column_view(nlev);
5149
ColumnView pmid = haero::testing::create_column_view(nlev);
52-
auto pmid_h = Kokkos::create_mirror_view(pmid);
5350

5451
View2D invariants("invariants", nlev, nfs);
5552
View1DHost invariants_h("invariants_h", nlev);
@@ -61,18 +58,18 @@ void setinv_test_nlev(Ensemble *ensemble) {
6158

6259
View2DHost c_off_h("c_off_h", nlev, num_tracer_cnst);
6360

61+
constexpr Real mwh2o = Constants::molec_weight_h2o;
62+
Real qv_k_in = conversions::mmr_from_vmr(h2ovmr_in, mwh2o);
63+
6464
for (int k = 0; k < nlev; ++k) {
65-
tfld_h(k) = tfld_in;
66-
h2ovmr_h(k) = h2ovmr_in;
67-
pmid_h(k) = pmid_in;
6865
for (int i = 0; i < num_tracer_cnst; ++i) {
6966
c_off_h(k, i) = c_off_in[i];
7067
}
7168
}
7269

73-
Kokkos::deep_copy(tfld, tfld_h);
74-
Kokkos::deep_copy(h2ovmr, h2ovmr_h);
75-
Kokkos::deep_copy(pmid, pmid_h);
70+
Kokkos::deep_copy(tfld, tfld_in);
71+
Kokkos::deep_copy(qv, qv_k_in);
72+
Kokkos::deep_copy(pmid, pmid_in);
7673
for (int i = 0; i < num_tracer_cnst; ++i) {
7774
const auto c_off_h_at_i = Kokkos::subview(c_off_h, Kokkos::ALL, i);
7875
Kokkos::deep_copy(c_off[i], c_off_h_at_i);
@@ -82,7 +79,7 @@ void setinv_test_nlev(Ensemble *ensemble) {
8279
auto team_policy = ThreadTeamPolicy(1u, Kokkos::AUTO);
8380
Kokkos::parallel_for(
8481
team_policy, KOKKOS_LAMBDA(const ThreadTeam &team) {
85-
mam4::mo_setinv::setinv(team, invariants, tfld, h2ovmr, c_off, pmid);
82+
mam4::mo_setinv::setinv(team, invariants, tfld, qv, c_off, pmid);
8683
});
8784

8885
std::vector<Real> invariants_out(nfs);

0 commit comments

Comments
 (0)