diff --git a/Exec/RegTests/EB_ODEQty/PeleLMeX_ProblemSpecificFunctions.cpp b/Exec/RegTests/EB_ODEQty/PeleLMeX_ProblemSpecificFunctions.cpp index d7669544..9e3dce02 100644 --- a/Exec/RegTests/EB_ODEQty/PeleLMeX_ProblemSpecificFunctions.cpp +++ b/Exec/RegTests/EB_ODEQty/PeleLMeX_ProblemSpecificFunctions.cpp @@ -27,30 +27,28 @@ void problem_modify_ext_sources( Real /*time*/, Real /*dt*/, - int lev, const MultiFab& state_old, const MultiFab& /*state_new*/, - Vector>& a_extSource, + std::unique_ptr& ext_src, const GeometryData& /*geomdata*/, const ProbParm& prob_parm) { /* Notes: - 1) a_extSource contains sources from velocity forcing coming in. - This function should add to rather than overwrite a_extSource. + 1) ext_src contains sources from velocity forcing coming in. + This function should add to rather than overwrite ext_src. 2) Requires "peleLM.user_defined_ext_sources = true" in input file */ - auto ext_source_arr = a_extSource[lev]->arrays(); + auto ext_src_arr = ext_src->arrays(); auto const& state_old_arr = state_old.const_arrays(); ParallelFor( - *a_extSource[lev], - [=] AMREX_GPU_DEVICE(int box_no, int i, int j, int k) noexcept { + *ext_src, [=] AMREX_GPU_DEVICE(int box_no, int i, int j, int k) noexcept { for (int n = 0; n < NUM_ODE; n++) { Real B_n = state_old_arr[box_no](i, j, k, FIRSTODE + n); Real src = prob_parm.ode_srcstrength * pow(10.0, n + 1) * B_n; - ext_source_arr[box_no](i, j, k, FIRSTODE + n) += src; + ext_src_arr[box_no](i, j, k, FIRSTODE + n) += src; } }); Gpu::streamSynchronize(); diff --git a/Source/PeleLMeX_Forces.cpp b/Source/PeleLMeX_Forces.cpp index 164fac2f..d5170821 100644 --- a/Source/PeleLMeX_Forces.cpp +++ b/Source/PeleLMeX_Forces.cpp @@ -273,9 +273,10 @@ PeleLM::getExternalSources( for (int lev = 0; lev <= finest_level; lev++) { auto* ldata_p_old = getLevelDataPtr(lev, a_timestamp_old); auto* ldata_p_new = getLevelDataPtr(lev, a_timestamp_new); + auto& ext_src = m_extSource[lev]; problem_modify_ext_sources( - getTime(lev, a_timestamp_new), m_dt, lev, ldata_p_old->state, - ldata_p_new->state, m_extSource, geom[lev].data(), *prob_parm_d); + getTime(lev, a_timestamp_new), m_dt, ldata_p_old->state, + ldata_p_new->state, ext_src, geom[lev].data(), *prob_parm_d); } } } \ No newline at end of file diff --git a/Source/PeleLMeX_ProblemSpecificFunctions.H b/Source/PeleLMeX_ProblemSpecificFunctions.H index 534c1934..e504e23e 100644 --- a/Source/PeleLMeX_ProblemSpecificFunctions.H +++ b/Source/PeleLMeX_ProblemSpecificFunctions.H @@ -10,10 +10,9 @@ void set_ode_names(Vector& a_ode_names); void problem_modify_ext_sources( Real time, Real dt, - int lev, const MultiFab& state_old, const MultiFab& state_new, - Vector>& a_extSource, + std::unique_ptr& ext_src, const GeometryData& geomdata, const ProbParm& prob_parm); #endif \ No newline at end of file diff --git a/Source/PeleLMeX_ProblemSpecificFunctions.cpp b/Source/PeleLMeX_ProblemSpecificFunctions.cpp index 8c6cd905..82b3bf8f 100644 --- a/Source/PeleLMeX_ProblemSpecificFunctions.cpp +++ b/Source/PeleLMeX_ProblemSpecificFunctions.cpp @@ -27,10 +27,9 @@ void problem_modify_ext_sources( Real /*time*/, Real /*dt*/, - int /*lev*/, const MultiFab& /*state_old*/, const MultiFab& /*state_new*/, - Vector>& /*a_extSource*/, + std::unique_ptr& /*ext_src*/, const GeometryData& /*geomdata*/, const ProbParm& /*prob_parm*/) { @@ -41,16 +40,16 @@ problem_modify_ext_sources( 2) Requires peleLM.user_defined_ext_sources = true in input file // Example: Exponential decay ode quantity - auto ext_source_arr = a_extSource[lev]->arrays(); + auto ext_src_arr = ext_src->arrays(); auto const& state_old_arr = state_old.const_arrays(); ParallelFor( - *a_extSource[lev], + *ext_src, [=] AMREX_GPU_DEVICE(int box_no, int i, int j, int k) noexcept { for (int n = 0; n < NUM_ODE; n++) { Real B_n = state_old_arr[box_no](i, j, k, FIRSTODE + n); - Real src_strength = -1.0 * pow(10.0,n+1); - ext_source_arr[box_no](i, j, k, FIRSTODE + n) += src_strength * B_n; + Real src = -1.0 * pow(10.0, n + 1) * B_n; + ext_src_arr[box_no](i, j, k, FIRSTODE + n) += src; } }); Gpu::streamSynchronize();