Skip to content

Commit 20321be

Browse files
committed
Add bounds checking to the interstitial aerosol number calculations.
1 parent 258f67e commit 20321be

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/mam4xx/physical_limits.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// mam4xx: Copyright (c) 2022,
2+
// Battelle Memorial Institute and
3+
// National Technology & Engineering Solutions of Sandia, LLC (NTESS)
4+
// SPDX-License-Identifier: BSD-3-Clause
5+
6+
#ifndef PHYSICAL_LIMITS_HPP
7+
#define PHYSICAL_LIMITS_HPP
8+
9+
namespace mam4 {
10+
KOKKOS_INLINE_FUNCTION
11+
constexpr Real interstitial_aerosol_number_min() { return 0; }
12+
KOKKOS_INLINE_FUNCTION
13+
constexpr Real interstitial_aerosol_number_max() { return 1e13; }
14+
KOKKOS_INLINE_FUNCTION
15+
void check_valid_interstitial_aerosol_number(const Real aero_num) {
16+
EKAT_KERNEL_REQUIRE_MSG(interstitial_aerosol_number_min() <= aero_num &&
17+
aero_num < interstitial_aerosol_number_max(),
18+
"Computed total interstitial aerosol number outside "
19+
"of the resonable baounds of 0 to 1e13.");
20+
}
21+
} // namespace mam4
22+
23+
#endif

0 commit comments

Comments
 (0)