Skip to content

Commit

Permalink
switch the true-SDC / MOL hydro to use the flatten header
Browse files Browse the repository at this point in the history
this eliminates the duplicate flatten.cpp version
  • Loading branch information
zingale committed Jul 9, 2024
1 parent b373e92 commit e8332d5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 191 deletions.
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.

0 comments on commit e8332d5

Please sign in to comment.