21 #ifndef FUB_AMREX_CUTCELL_BOUNDARY_CONDITION_REFLECTIVE_BOUNDARY2_HPP
22 #define FUB_AMREX_CUTCELL_BOUNDARY_CONDITION_REFLECTIVE_BOUNDARY2_HPP
69 template <
typename Tag,
typename Equation>
73 : equation_{
Local<Tag,
Equation>{equation}}, dir_{dir}, side_{side},
74 boundary_section_{boundary_section} {}
76 template <
typename Tag,
typename Equation>
81 FillBoundary(mf, gridding, level);
85 template <
typename Tag,
typename Equation>
88 static constexpr
int Rank = Equation::Rank();
89 static constexpr std::size_t sRank =
static_cast<std::size_t
>(Rank);
90 const Eigen::Matrix<double, Rank, 1> unit = UnitVector<Rank>(dir_);
91 const ::amrex::MultiFab& alphas =
93 ForEachFab(Tag(), mf, [&](const ::amrex::MFIter& mfi) {
97 ::amrex::FArrayBox& fab = mf[mfi];
98 const ::amrex::FArrayBox& alpha = alphas[mfi];
99 ::amrex::Box box_to_fill = mfi.growntilebox() & boundary_section_;
100 if (!box_to_fill.isEmpty()) {
102 MakeView<Complete<Equation>>(fab, *equation_, mfi.growntilebox());
103 auto box = AsIndexBox<Rank>(box_to_fill);
105 std::array<std::ptrdiff_t, sRank> dest{is...};
106 std::array<std::ptrdiff_t, sRank> src =
109 AMREX_D_DECL(
int(src[0]),
int(src[1]),
int(src[2]))};
110 ::amrex::IntVect dest_iv{
111 AMREX_D_DECL(
int(dest[0]),
int(dest[1]),
int(dest[2]))};
112 if (alpha(dest_iv) > 0.0 && alpha(iv) > 0.0) {
113 Load(state, states, src);
115 Reflect(reflected, state, unit, *equation_);
116 Store(states, reflected, dest);
118 Store(states, zeros, dest);
125 template <
typename Tag,
typename Equation>
129 template <
typename Equation>
#define FUB_ASSERT(x)
Definition: assert.hpp:39
This class modifies and initializes a cutcell::PatchLevel in a cutcell::PatchHierarchy.
Definition: AMReX/cutcell/GriddingAlgorithm.hpp:56
const PatchHierarchy & GetPatchHierarchy() const noexcept
This boundary condition provides wall boundary which acts only on a specified subset of ghost cells.
Definition: ReflectiveBoundary2.hpp:37
Direction dir_
Definition: ReflectiveBoundary2.hpp:64
ReflectiveBoundary2(const Equation &equation, Direction dir, int side, const ::amrex::Box &boundary_section)
Delegates the construction to the tag constructor.
Definition: ReflectiveBoundary2.hpp:44
Local< Tag, Equation > equation_
The equation defines how to reflect states.
Definition: ReflectiveBoundary2.hpp:63
int side_
Definition: ReflectiveBoundary2.hpp:65
::amrex::Box boundary_section_
Definition: ReflectiveBoundary2.hpp:66
ReflectiveBoundary2(Tag, const Equation &equation, Direction dir, int side, const ::amrex::Box &boundary_section)
Constructs the boundary condition with respective execution tag.
Definition: ReflectiveBoundary2.hpp:70
void FillBoundary(::amrex::MultiFab &mf, const GriddingAlgorithm &gridding, int level)
Fill the boundary section with reflected states.
Definition: ReflectiveBoundary2.hpp:86
void ForEachFab(Tag, const ::amrex::FabArrayBase &fabarray, F function)
Iterate through all local FArrayBox objects in a MultiFab.
Definition: ForEachFab.hpp:34
Definition: FillCutCellData.hpp:30
ReflectiveBoundary2(const Equation &, Direction, int, const ::amrex::Box &) -> ReflectiveBoundary2< execution::SequentialTag, Equation >
void ForEachIndex(const ::amrex::Box &box, F function)
Definition: ForEachIndex.hpp:29
Index< 1 > ReflectIndex(Index< 1 > i, const IndexBox< 1 > &domain, Direction dir, int side)
void Load(State &state, const BasicView< const State, Layout, Rank > &view, const std::array< std::ptrdiff_t, State::Equation::Rank()> &index)
Definition: State.hpp:640
Direction
This is a type safe type to denote a dimensional split direction.
Definition: Direction.hpp:30
void Reflect(Complete< IdealGasMix< 1 >> &reflected, const Complete< IdealGasMix< 1 >> &state, const Eigen::Matrix< double, 1, 1 > &normal, const IdealGasMix< 1 > &gas)
void Store(const BasicView< Conservative< Eq >, Layout, Eq::Rank()> &view, const Conservative< Eq > &state, const std::array< std::ptrdiff_t, Eq::Rank()> &index)
Definition: State.hpp:663
IndexBox< Rank > Box(const BasicView< State, Layout, Rank > &view)
Definition: State.hpp:486
typename detail::LocalType< Tag, T >::type Local
Definition: Execution.hpp:56