Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch the MHD / MOL hydro to use the flatten header #2906

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions Source/hydro/Castro_hydro.H
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,6 @@
amrex::Array4<amrex::Real> const& q_arr,
amrex::Array4<amrex::Real> const& qaux_arr);

///
/// compute the flattening coefficient. This is 0 if we are in a shock and
/// 1 if we are not applying any flattening
///
/// @param bx the box to operate over
/// @param q_arr the primitive variable state
/// @param flatn the flattening coefficient
/// @param pres_comp index into q_arr of the pressure component
///
static void uflatten(const amrex::Box& bx,
amrex::Array4<amrex::Real const> const& q_arr,
amrex::Array4<amrex::Real> const& flatn,
const int pres_comp);

///
/// A multidimensional shock detection algorithm
Expand Down
27 changes: 16 additions & 11 deletions Source/hydro/Castro_mol_hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <advection_util.H>

#include <fourth_center_average.H>
#include <flatten.H>

using namespace amrex;

Expand Down Expand Up @@ -117,19 +118,23 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update)
Array4<Real> const flatn_arr = flatn.array();

if (first_order_hydro == 1) {
amrex::ParallelFor(obx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
flatn_arr(i,j,k) = 0.0;
});
amrex::ParallelFor(obx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
flatn_arr(i,j,k) = 0.0;
});
} else if (use_flattening == 1) {
uflatten(obx, q_arr, flatn_arr, QPRES);
amrex::ParallelFor(obx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
flatn_arr(i,j,k) = hydro::flatten(i, j, k, q_arr, QPRES);
});
} else {
amrex::ParallelFor(obx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
flatn_arr(i,j,k) = 1.0;
});
amrex::ParallelFor(obx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
flatn_arr(i,j,k) = 1.0;
});
}


Expand Down
1 change: 0 additions & 1 deletion Source/hydro/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ CEXE_sources += Castro_mol.cpp
CEXE_headers += advection_util.H
CEXE_sources += advection_util.cpp
CEXE_headers += flatten.H
CEXE_sources += flatten.cpp

ifeq ($(USE_TRUE_SDC),TRUE)
CEXE_sources += Castro_mol_hydro.cpp
Expand Down
166 changes: 0 additions & 166 deletions Source/hydro/flatten.cpp

This file was deleted.

11 changes: 3 additions & 8 deletions Source/mhd/Castro_mhd.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <Castro.H>

#include <advection_util.H>
#include <flatten.H>

using namespace amrex;

Expand Down Expand Up @@ -196,10 +197,6 @@ Castro::construct_ctu_mhd_source(Real time, Real dt)
auto flatn_arr = flatn.array();
auto elix_flatn = flatn.elixir();

flatg.resize(bxi, 1);
auto flatg_arr = flatg.array();
auto elix_flatg = flatg.elixir();

if (use_flattening == 0) {
amrex::ParallelFor(bxi,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
Expand All @@ -209,13 +206,11 @@ Castro::construct_ctu_mhd_source(Real time, Real dt)

} else {

uflatten(bxi, q_arr, flatn_arr, QPRES);
uflatten(bxi, q_arr, flatg_arr, QPTOT);

amrex::ParallelFor(bxi,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
flatn_arr(i,j,k) = flatn_arr(i,j,k) * flatg_arr(i,j,k);
flatn_arr(i,j,k) = hydro::flatten(i, j, k, q_arr, QPRES) *
hydro::flatten(i, j, k, q_arr, QPTOT);
});

}
Expand Down