Finite Volume Solver  prototype
A framework to build finite volume solvers for the AG Klein at the Freie Universität Berlin.
KbnStabilisation.hpp
Go to the documentation of this file.
1 // Copyright (c) 2019 Maikel Nadolski
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #ifndef FUB_CUTCELL_METHOD_KBN_STABILISATION_HPP
22 #define FUB_CUTCELL_METHOD_KBN_STABILISATION_HPP
23 
24 #include "fub/CutCellData.hpp"
25 #include "fub/Duration.hpp"
26 #include "fub/Equation.hpp"
28 #include "fub/ForEach.hpp"
29 #include "fub/State.hpp"
30 #include "fub/StateRow.hpp"
31 #include "fub/core/span.hpp"
32 #include "fub/core/tuple.hpp"
33 
34 #include <algorithm>
35 
36 namespace fub {
37 
39  const PatchDataView<double, 2, layout_stride>& stabilised_fluxes,
40  const PatchDataView<double, 2, layout_stride>& shielded_left_fluxes,
41  const PatchDataView<double, 2, layout_stride>& shielded_right_fluxes,
43  const PatchDataView<const double, 2, layout_stride>& boundary_fluxes,
44  const CutCellData<2>& geom, Duration dt, double dx, Direction dir);
45 
47  const PatchDataView<double, 3, layout_stride>& stabilised_fluxes,
48  const PatchDataView<double, 3, layout_stride>& shielded_left_fluxes,
49  const PatchDataView<double, 3, layout_stride>& shielded_right_fluxes,
51  const PatchDataView<const double, 3, layout_stride>& boundary_fluxes,
52  const CutCellData<3>& geom, Duration dt, double dx, Direction dir);
53 
54 template <typename FM,
55  typename RiemannSolver = ExactRiemannSolver<typename FM::Equation>>
56 class KbnCutCellMethod : public FM {
57 public:
58  // Typedefs
59 
60  using Equation = typename FM::Equation;
65 
66  // Static Variables
67 
68  static constexpr int Rank = Equation::Rank();
69  static constexpr std::size_t sRank = static_cast<std::size_t>(Rank);
70  static constexpr int StencilWidth = FM::GetStencilWidth();
71  static_assert(StencilWidth > 0);
72  static constexpr std::size_t StencilSize =
73  static_cast<std::size_t>(2 * StencilWidth);
74 
75  template <typename T> using DataView = PatchDataView<T, Rank, layout_stride>;
76 
77  // Constructors
78 
79  /// Constructs a CutCell method from a given base flux method.
80  ///
81  /// This constructor uses a default constructed riemann problem solver.
82  explicit KbnCutCellMethod(const FM& fm);
83 
84  /// Constructs a CutCell Method from a specified base flux and riemann solver.
85  KbnCutCellMethod(const FM& fm, const RiemannSolver& rs);
86 
87  /// This function computes a reference state for each cut-cell.
88  ///
89  /// These states will be used to compute the embedded boundary fluxes and
90  /// need to be fixed for a whole split cycle.
91  ///
92  /// \param[out] references the destination view of references states which
93  /// will be filled by this method.
94  ///
95  /// \param[in] states the source view of states which will used as a
96  /// reference state.
97  void PreAdvanceHierarchy(const View<Complete>& references,
98  const View<const Complete>& states,
99  const CutCellData<Rank>& cutcell_data);
100 
101  /// This function can be used to compute a boundary flux for a given cut-cell.
102  ///
103  /// \param[out] flux the storage for the result.
104  /// \param[in,out] state the state in the cut cell.
105  /// \param[in] boundary_normal the boundary normal of the cutcell
106  /// \param[in] dir the split direction for the flux
107  /// \param[in] dt the current time step size
108  /// \param[in] dx the cell width length
109  void
111  const Complete& reference_state,
112  const Eigen::Matrix<double, Rank, 1>& boundary_normal,
113  Direction dir, Duration dt, double dx);
114 
115  /// This function can be used to compute a boundary flux for all cut cells.
116  void ComputeBoundaryFluxes(const View<Conservative>& boundary_fluxes,
117  const View<const Complete>& states,
118  const View<const Complete>& reference_states,
119  const CutCellData<Rank>& cutcell_data, Duration dt,
120  double dx, Direction dir);
121 
122  using FM::ComputeStableDt;
123 
124  /// \todo compute stable dt inside of cutcells, i.e. in the reflection with
125  /// their boundary state.
126  double ComputeStableDt(const View<const Complete>& states,
127  const CutCellData<Rank>& cutcell_data, double dx,
128  Direction dir);
129 
130  void ComputeRegularFluxes(const View<Conservative>& regular_fluxes,
131  const View<const Complete>& states,
132  const CutCellData<Rank>& cutcell_data, Duration dt,
133  double dx, Direction dir);
134 
135  void ComputeCutCellFluxes(const View<Conservative>& stabilised_fluxes,
136  const View<Conservative>& shielded_left_fluxes,
137  const View<Conservative>& shielded_right_fluxes,
138  const View<Conservative>& doubly_shielded_fluxes,
139  const View<Conservative>& boundary_fluxes,
140  const View<const Conservative>& regular_fluxes,
141  const View<const Complete>& states,
142  const CutCellData<Rank>& cutcell_data, Duration dt,
143  double dx, Direction dir);
144 
145 private:
146  std::array<Complete, StencilSize> stencil_{};
147  Complete state_{FM::GetEquation()};
148  Complete solution_{FM::GetEquation()};
149  Complete reflected_{FM::GetEquation()};
150  Complete reference_state_{FM::GetEquation()};
151  Conservative cutcell_flux_{FM::GetEquation()};
152  Conservative regular_flux_{FM::GetEquation()};
153  Conservative boundary_flux_left_{FM::GetEquation()};
154  Conservative boundary_flux_right_{FM::GetEquation()};
155  Conservative shielded_right_flux_{FM::GetEquation()};
156  Conservative shielded_left_flux_{FM::GetEquation()};
158 
159  std::array<CompleteArray, StencilSize> stencil_array_{};
161 
162  RiemannSolver riemann_solver_{FM::GetEquation()};
163 };
164 
165 // IMPLEMENTATION
166 
167 template <typename FM, typename RiemannSolver>
169  stencil_.fill(Complete(FM::GetEquation()));
170  stencil_array_.fill(CompleteArray(FM::GetEquation()));
171 }
172 
173 template <typename FM, typename RiemannSolver>
175  const RiemannSolver& rs)
176  : FM(fm), riemann_solver_(rs) {
177  stencil_.fill(Complete(FM::GetEquation()));
178  stencil_array_.fill(CompleteArray(FM::GetEquation()));
179 }
180 
181 template <typename FM, typename RiemannSolver>
183  const View<Complete>& references, const View<const Complete>& states,
184  const CutCellData<Rank>& geom) {
185  const Equation& equation = FM::GetEquation();
186  const Eigen::Matrix<double, Rank, 1> unit = UnitVector<Rank>(Direction::X);
187  ForEachIndex(Box<0>(states), [&](auto... is) {
188  std::array<std::ptrdiff_t, sRank> cell{is...};
189  if (IsCutCell(geom, cell)) {
190  Load(state_, states, cell);
191  if (state_.density > 0.0) {
192  const Eigen::Matrix<double, Rank, 1> normal =
193  GetBoundaryNormal(geom, cell);
194  Rotate(state_, state_, MakeRotation(normal, unit), equation);
195  Reflect(reflected_, state_, unit, equation);
196  riemann_solver_.SolveRiemannProblem(solution_, reflected_, state_,
197  Direction::X);
198  Rotate(solution_, solution_, MakeRotation(unit, normal), equation);
199  Store(references, solution_, cell);
200  }
201  }
202  });
203 }
204 
205 template <typename FM, typename RiemannSolver>
207  Conservative& flux, Complete& state, const Complete& reference_state,
208  const Eigen::Matrix<double, Rank, 1>& boundary_normal, Direction dir,
209  Duration /* dt */, double /* dx */) {
210  const Equation& equation = FM::GetEquation();
211  const Eigen::Matrix<double, Rank, 1> unit = UnitVector<Rank>(Direction::X);
212 
213  // Rotate states such that the boundary is left and the state is right
214  // Reflect state in the split direction
215  Rotate(state, state, MakeRotation(boundary_normal, unit), equation);
216  Reflect(reflected_, state, unit, equation);
217  riemann_solver_.SolveRiemannProblem(solution_, reflected_, state,
218  Direction::X);
219  Rotate(solution_, solution_, MakeRotation(unit, boundary_normal), equation);
220 
221  const int d = static_cast<int>(dir);
222  const double u_advective =
223  reference_state.momentum[d] / reference_state.density;
224  const double u_solution = solution_.momentum[d] / solution_.density;
225 
226  equation.Flux(flux, reference_state, dir);
227  flux.momentum[d] += solution_.pressure - reference_state.pressure;
228  flux.energy +=
229  u_solution * solution_.pressure - u_advective * reference_state.pressure;
230 }
231 
232 template <typename FM, typename RiemannSolver>
234  const View<Conservative>& boundary_fluxes,
235  const View<const Complete>& states,
236  const View<const Complete>& reference_states, const CutCellData<Rank>& geom,
237  Duration dt, double dx, Direction dir) {
238  FUB_ASSERT(Extents<0>(boundary_fluxes) == Extents<0>(states));
239  ForEachIndex(Box<0>(reference_states), [&](auto... is) {
240  if (IsCutCell(geom, {is...})) {
241  // Get the state and the boundary normal in this cell.
242  std::array<std::ptrdiff_t, sRank> cell{is...};
243  Load(state_, states, cell);
244  Load(reference_state_, reference_states, cell);
245  const Eigen::Matrix<double, Rank, 1> normal =
246  GetBoundaryNormal(geom, cell);
247 
248  this->ComputeBoundaryFlux(boundary_flux_left_, state_, reference_state_,
249  normal, dir, dt, dx);
250 
251  // Store the result in our array
252  Store(boundary_fluxes, boundary_flux_left_, cell);
253  }
254  });
255 }
256 
257 /// \todo compute stable dt inside of cutcells, i.e. in the reflection with
258 /// their boundary state.
259 template <typename FM, typename RiemannSolver>
261  const View<const Complete>& states, const CutCellData<Rank>& geom,
262  double dx, Direction dir) {
263  double min_dt = std::numeric_limits<double>::infinity();
264  static constexpr int kWidth = FM::GetStencilWidth();
265  IndexBox<Rank> cellbox = Box<0>(states);
266  IndexBox<Rank> fluxbox = Shrink(cellbox, dir, {kWidth, kWidth - 1});
267  View<const Complete> base = Subview(states, cellbox);
269  ArrayView volumes = geom.volume_fractions.Subview(cellbox);
270  const int d = static_cast<int>(dir);
271  ArrayView faces = geom.face_fractions[d].Subview(fluxbox);
272  std::array<View<const Complete>, StencilSize> stencil_views;
273  std::array<ArrayView, StencilSize> stencil_volumes;
274  for (std::size_t i = 0; i < StencilSize; ++i) {
275  stencil_views[i] =
276  Shrink(base, dir,
277  {static_cast<std::ptrdiff_t>(i),
278  static_cast<std::ptrdiff_t>(StencilSize - i) - 1});
279  stencil_volumes[i] = volumes.Subview(
280  Shrink(cellbox, dir,
281  {static_cast<std::ptrdiff_t>(i),
282  static_cast<std::ptrdiff_t>(StencilSize - i) - 1}));
283  }
284  std::tuple views = std::tuple_cat(std::tuple(faces), AsTuple(stencil_volumes),
285  AsTuple(stencil_views));
286  ForEachRow(views, [this, &min_dt, dx, dir](span<const double> faces,
287  auto... rest) {
288  std::tuple args{rest...};
289  std::array<span<const double>, StencilSize> volumes =
290  AsArray(Take<StencilSize>(args));
291  std::array states = std::apply(
292  [](const auto&... xs)
293  -> std::array<ViewPointer<const Complete>, StencilSize> {
294  return {Begin(xs)...};
295  },
296  Drop<StencilSize>(args));
297  std::array<Array1d, StencilSize> alphas;
298  alphas.fill(Array1d::Zero());
299  Array1d betas = Array1d::Zero();
300  int n = static_cast<int>(faces.size());
301  while (n >= kDefaultChunkSize) {
302  betas = Array1d::Map(faces.data());
303  for (std::size_t i = 0; i < StencilSize; ++i) {
304  Load(stencil_array_[i], states[i]);
305  alphas[i] = Array1d::Map(volumes[i].data());
306  }
307  Array1d dts = FM::ComputeStableDt(stencil_array_, betas, alphas, dx, dir);
308  min_dt = std::min(min_dt, dts.minCoeff());
309  for (std::size_t i = 0; i < StencilSize; ++i) {
310  Advance(states[i], kDefaultChunkSize);
311  volumes[i] = volumes[i].subspan(kDefaultChunkSize);
312  }
313  faces = faces.subspan(kDefaultChunkSize);
314  n = static_cast<int>(faces.size());
315  }
316  std::copy_n(faces.data(), n, betas.data());
317  std::fill_n(betas.data() + n, kDefaultChunkSize - n, 0.0);
318  for (std::size_t i = 0; i < StencilSize; ++i) {
319  LoadN(stencil_array_[i], states[i], n);
320  std::copy_n(volumes[i].data(), n, alphas[i].data());
321  std::fill_n(alphas[i].data() + n, kDefaultChunkSize - n, 0.0);
322  }
323  Array1d dts = FM::ComputeStableDt(stencil_array_, betas, alphas, dx, dir);
324  min_dt = std::min(min_dt, dts.minCoeff());
325  });
326  return min_dt;
327 }
328 
329 template <typename FM, typename RiemannSolver>
331  const View<Conservative>& fluxes, const View<const Complete>& states,
332  const CutCellData<Rank>& cutcell_data, Duration dt, double dx,
333  Direction dir) {
334  IndexBox<Rank> fluxbox = Box<0>(fluxes);
335  static constexpr int kWidth = FM::GetStencilWidth();
336  IndexBox<Rank> cellbox = Grow(fluxbox, dir, {kWidth, kWidth - 1});
337  View<const Complete> base = Subview(states, cellbox);
339  ArrayView volumes = cutcell_data.volume_fractions.Subview(cellbox);
340  const int d = static_cast<int>(dir);
341  ArrayView faces = cutcell_data.face_fractions[d].Subview(fluxbox);
342  std::array<View<const Complete>, StencilSize> stencil_views;
343  std::array<ArrayView, StencilSize> stencil_volumes;
344  for (std::size_t i = 0; i < StencilSize; ++i) {
345  stencil_views[i] =
346  Shrink(base, dir,
347  {static_cast<std::ptrdiff_t>(i),
348  static_cast<std::ptrdiff_t>(StencilSize - i) - 1});
349  stencil_volumes[i] = volumes.Subview(
350  Shrink(cellbox, dir,
351  {static_cast<std::ptrdiff_t>(i),
352  static_cast<std::ptrdiff_t>(StencilSize - i) - 1}));
353  }
354  std::tuple views =
355  std::tuple_cat(std::tuple(fluxes, faces), AsTuple(stencil_volumes),
356  AsTuple(stencil_views));
357  ForEachRow(views,
358  [this, dt, dx, dir](const Row<Conservative>& fluxes,
359  span<const double> faces, auto... rest) {
360  ViewPointer fit = Begin(fluxes);
361  ViewPointer fend = End(fluxes);
362  std::tuple args{rest...};
363  std::array<span<const double>, StencilSize> volumes =
364  AsArray(Take<StencilSize>(args));
365  std::array states = std::apply(
366  [](const auto&... xs)
367  -> std::array<ViewPointer<const Complete>, StencilSize> {
368  return {Begin(xs)...};
369  },
370  Drop<StencilSize>(args));
371  std::array<Array1d, StencilSize> alphas;
372  alphas.fill(Array1d::Zero());
373  Array1d betas = Array1d::Zero();
374  int n = static_cast<int>(get<0>(fend) - get<0>(fit));
375  while (n >= kDefaultChunkSize) {
376  betas = Array1d::Map(faces.data());
377  for (std::size_t i = 0; i < StencilSize; ++i) {
378  Load(stencil_array_[i], states[i]);
379  alphas[i] = Array1d::Map(volumes[i].data());
380  }
381  FM::ComputeNumericFlux(numeric_flux_array_, betas,
382  stencil_array_, alphas, dt, dx, dir);
383  for (int i = 0; i < betas.size(); ++i) {
385  [&](auto&& flux [[maybe_unused]]) {
386  FUB_ASSERT(betas[i] == 0.0 ||
387  (betas[i] > 0.0 && !std::isnan(flux[i])));
388  },
389  numeric_flux_array_);
390  }
391  Store(fit, numeric_flux_array_);
393  for (std::size_t i = 0; i < StencilSize; ++i) {
394  Advance(states[i], kDefaultChunkSize);
395  volumes[i] = volumes[i].subspan(kDefaultChunkSize);
396  }
397  faces = faces.subspan(kDefaultChunkSize);
398  n = static_cast<int>(get<0>(fend) - get<0>(fit));
399  }
400  std::copy_n(faces.data(), n, betas.data());
401  std::fill_n(betas.data() + n, kDefaultChunkSize - n, 0.0);
402  for (std::size_t i = 0; i < StencilSize; ++i) {
403  LoadN(stencil_array_[i], states[i], n);
404  std::copy_n(volumes[i].data(), n, alphas[i].data());
405  std::fill_n(alphas[i].data() + n, kDefaultChunkSize - n, 0.0);
406  }
407  FM::ComputeNumericFlux(numeric_flux_array_, betas,
408  stencil_array_, alphas, dt, dx, dir);
409  StoreN(fit, numeric_flux_array_, n);
410  });
411 }
412 
413 template <typename FM, typename RiemannSolver>
415  const View<Conservative>& stabilised_fluxes,
416  const View<Conservative>& shielded_left_fluxes,
417  const View<Conservative>& shielded_right_fluxes,
418  const View<Conservative>& /* doubly_shielded_fluxes */,
419  const View<Conservative>& boundary_fluxes,
420  const View<const Conservative>& regular_fluxes,
421  const View<const Complete>& /* states */, const CutCellData<Rank>& geom,
422  Duration dt, double dx, Direction dir) {
424  [&](DataView<double> stabilised, DataView<double> shielded_left,
425  DataView<double> shielded_right, DataView<const double> regular,
426  DataView<const double> boundary) {
427  ComputeStableFluxComponents(stabilised, shielded_left, shielded_right,
428  regular, boundary, geom, dt, dx, dir);
429  },
430  stabilised_fluxes, shielded_left_fluxes, shielded_right_fluxes,
431  regular_fluxes, AsConst(boundary_fluxes));
432 }
433 
434 } // namespace fub
435 
436 #endif
#define FUB_ASSERT(x)
Definition: assert.hpp:39
Definition: KbnStabilisation.hpp:56
KbnCutCellMethod(const FM &fm)
Constructs a CutCell method from a given base flux method.
Definition: KbnStabilisation.hpp:168
Complete solution_
Definition: KbnStabilisation.hpp:148
double ComputeStableDt(const View< const Complete > &states, const CutCellData< Rank > &cutcell_data, double dx, Direction dir)
Definition: KbnStabilisation.hpp:260
static constexpr int StencilWidth
Definition: KbnStabilisation.hpp:70
Conservative shielded_left_flux_
Definition: KbnStabilisation.hpp:156
Complete state_
Definition: KbnStabilisation.hpp:147
void ComputeBoundaryFlux(Conservative &flux, Complete &state, const Complete &reference_state, const Eigen::Matrix< double, Rank, 1 > &boundary_normal, Direction dir, Duration dt, double dx)
This function can be used to compute a boundary flux for a given cut-cell.
Definition: KbnStabilisation.hpp:206
Conservative boundary_flux_right_
Definition: KbnStabilisation.hpp:154
Conservative boundary_flux_left_
Definition: KbnStabilisation.hpp:153
void ComputeCutCellFluxes(const View< Conservative > &stabilised_fluxes, const View< Conservative > &shielded_left_fluxes, const View< Conservative > &shielded_right_fluxes, const View< Conservative > &doubly_shielded_fluxes, const View< Conservative > &boundary_fluxes, const View< const Conservative > &regular_fluxes, const View< const Complete > &states, const CutCellData< Rank > &cutcell_data, Duration dt, double dx, Direction dir)
Definition: KbnStabilisation.hpp:414
Complete reference_state_
Definition: KbnStabilisation.hpp:150
void ComputeBoundaryFluxes(const View< Conservative > &boundary_fluxes, const View< const Complete > &states, const View< const Complete > &reference_states, const CutCellData< Rank > &cutcell_data, Duration dt, double dx, Direction dir)
This function can be used to compute a boundary flux for all cut cells.
Definition: KbnStabilisation.hpp:233
std::array< CompleteArray, StencilSize > stencil_array_
Definition: KbnStabilisation.hpp:159
void ComputeRegularFluxes(const View< Conservative > &regular_fluxes, const View< const Complete > &states, const CutCellData< Rank > &cutcell_data, Duration dt, double dx, Direction dir)
Definition: KbnStabilisation.hpp:330
::fub::CompleteArray< Equation > CompleteArray
Definition: KbnStabilisation.hpp:64
static constexpr std::size_t sRank
Definition: KbnStabilisation.hpp:69
::fub::Complete< Equation > Complete
Definition: KbnStabilisation.hpp:63
static constexpr int Rank
Definition: KbnStabilisation.hpp:68
std::array< Complete, StencilSize > stencil_
Definition: KbnStabilisation.hpp:146
ConservativeArray numeric_flux_array_
Definition: KbnStabilisation.hpp:160
Conservative regular_flux_
Definition: KbnStabilisation.hpp:152
static constexpr std::size_t StencilSize
Definition: KbnStabilisation.hpp:72
RiemannSolver riemann_solver_
Definition: KbnStabilisation.hpp:162
Conservative shielded_right_flux_
Definition: KbnStabilisation.hpp:155
typename FM::Equation Equation
Definition: KbnStabilisation.hpp:60
Complete reflected_
Definition: KbnStabilisation.hpp:149
void PreAdvanceHierarchy(const View< Complete > &references, const View< const Complete > &states, const CutCellData< Rank > &cutcell_data)
This function computes a reference state for each cut-cell.
Definition: KbnStabilisation.hpp:182
Conservative doubly_shielded_flux_
Definition: KbnStabilisation.hpp:157
Conservative cutcell_flux_
Definition: KbnStabilisation.hpp:151
A span is a view over a contiguous sequence of objects, the storage of which is owned by some other o...
Definition: span.hpp:81
Function ForEachIndex(const layout_left::mapping< Extents > &mapping, Function function)
Iterate through the multi-dimensional index space descibed by mapping and invoke function for each su...
Definition: ForEach.hpp:74
std::decay_t< decltype(std::declval< T >().GetEquation())> Equation
A template typedef to detect the member function.
Definition: Meta.hpp:59
The fub namespace.
Definition: AnyBoundaryCondition.hpp:31
auto Shrink(const layout_left::mapping< Extent > &layout, Direction dir, std::ptrdiff_t n=1)
Definition: Equation.hpp:78
Eigen::Vector2d GetBoundaryNormal(const CutCellData< 2 > &ccdata, const std::array< std::ptrdiff_t, 2 > &index)
std::chrono::duration< double > Duration
Definition: Duration.hpp:31
View< State > Subview(const BasicView< State, Layout, Rank > &state, const IndexBox< Rank > &box)
Definition: Equation.hpp:86
Array< double, 1 > Array1d
Definition: Eigen.hpp:53
constexpr const int kDefaultChunkSize
Definition: Eigen.hpp:39
void StoreN(nodeduce_t< ViewPointer< Conservative< Eq >>> pointer, const ConservativeArray< Eq > &state, int n)
Definition: StateArray.hpp:416
IndexBox< Rank > Grow(const IndexBox< Rank > &box, Direction dir, const std::array< std::ptrdiff_t, 2 > &shifts)
Definition: PatchDataView.hpp:106
constexpr std::array< std::ptrdiff_t, Extents::rank()> AsArray(Extents e) noexcept
Definition: PatchDataView.hpp:154
void ForEachRow(const Tuple &views, Function f)
Definition: StateRow.hpp:172
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
ViewPointer< State > Begin(const BasicView< State, Layout, Rank > &view)
Definition: State.hpp:769
void LoadN(CompleteArray< Eq, N > &state, const BasicView< const Complete< Eq >, Layout, Rank > &view, int size, nodeduce_t< const std::array< std::ptrdiff_t, std::size_t(Rank)> & > pos)
Definition: StateArray.hpp:310
void Rotate(Conservative< IdealGasMix< 2 >> &rotated, const Conservative< IdealGasMix< 2 >> &state, const Eigen::Matrix< double, 2, 2 > &rotation, const IdealGasMix< 2 > &)
Defines how to rotate a given state of the euler equations.
bool IsCutCell(const CutCellData< 2 > &geom, const std::array< std::ptrdiff_t, 2 > &index)
Direction
This is a type safe type to denote a dimensional split direction.
Definition: Direction.hpp:30
void Advance(ViewPointer< State > &pointer, std::ptrdiff_t n) noexcept
Definition: State.hpp:825
constexpr auto AsTuple(const TupleLike &t)
Definition: tuple.hpp:69
Eigen::Matrix< double, 2, 2 > MakeRotation(const Eigen::Matrix< double, 2, 1 > &a, const Eigen::Matrix< double, 2, 1 > &b)
Definition: Eigen.hpp:103
void ComputeStableFluxComponents(const PatchDataView< double, 2, layout_stride > &stabilised_fluxes, const PatchDataView< double, 2, layout_stride > &shielded_left_fluxes, const PatchDataView< double, 2, layout_stride > &shielded_right_fluxes, const PatchDataView< const double, 2, layout_stride > &regular_fluxes, const PatchDataView< const double, 2, layout_stride > &boundary_fluxes, const CutCellData< 2 > &geom, Duration dt, double dx, Direction dir)
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
ViewPointer< State > End(const BasicView< State, Layout, Rank > &view)
Definition: State.hpp:782
void ForEachComponent(F function, Ts &&... states)
Definition: State.hpp:624
BasicView< const State, Layout, Rank > AsConst(const BasicView< State, Layout, Rank > &v)
Definition: State.hpp:431
Definition: State.hpp:403
Definition: CutCellData.hpp:34
PatchDataView< const double, Rank > volume_fractions
Definition: CutCellData.hpp:38
std::array< PatchDataView< const double, Rank >, sRank > face_fractions
Definition: CutCellData.hpp:40
Definition: PatchDataView.hpp:56
Definition: PatchDataView.hpp:201
PatchDataView< T, R, layout_stride > Subview(const IndexBox< R > &box) const
Definition: PatchDataView.hpp:245
Definition: StateRow.hpp:51
Definition: State.hpp:750