Skip to content

Commit 31ef113

Browse files
authored
Fix OOB in ActuatorSourceTagging (#1173)
1 parent c53a9e8 commit 31ef113

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

amr-wind/physics/ActuatorSourceTagging.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ void ActuatorSourceTagging::post_init_actions()
2626

2727
if (m_has_act_src) {
2828
m_act_src = &(m_repo.get_field("actuator_src_term"));
29+
AMREX_ALWAYS_ASSERT(m_act_src->num_grow() <= m_tracer->num_grow());
2930
}
3031

3132
if (m_has_iblank) {
3233
m_iblank = &(m_repo.get_int_field("iblank_cell"));
34+
AMREX_ALWAYS_ASSERT(m_iblank->num_grow() <= m_tracer->num_grow());
3335
}
3436
}
3537

@@ -50,7 +52,7 @@ void ActuatorSourceTagging::post_advance_work()
5052
if (m_has_act_src) {
5153
const auto& src_arrs = (*m_act_src)(lev).const_arrays();
5254
amrex::ParallelFor(
53-
(*m_tracer)(lev), m_tracer->num_grow(),
55+
(*m_tracer)(lev), m_act_src->num_grow(),
5456
[=] AMREX_GPU_DEVICE(int nbx, int i, int j, int k) noexcept {
5557
const auto src = src_arrs[nbx];
5658
const amrex::Real srcmag = std::sqrt(
@@ -69,7 +71,7 @@ void ActuatorSourceTagging::post_advance_work()
6971
const bool tag_fringe = m_tag_fringe;
7072
const bool tag_hole = m_tag_hole;
7173
amrex::ParallelFor(
72-
(*m_tracer)(lev), m_tracer->num_grow(),
74+
(*m_tracer)(lev), m_iblank->num_grow(),
7375
[=] AMREX_GPU_DEVICE(int nbx, int i, int j, int k) noexcept {
7476
const auto ib = iblank_arrs[nbx](i, j, k);
7577
if ((tag_fringe && (ib == -1)) || (tag_hole && (ib == 0))) {

0 commit comments

Comments
 (0)