Peano
Loading...
Searching...
No Matches
PDE.cpph
Go to the documentation of this file.
1// This file is part of the ExaHyPE2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3
4template <class T, class Shortcuts, int NumberOfUnknowns>
5static inline GPU_CALLABLE_METHOD void applications::exahype2::ShallowWater::flux(
6 const T* const NOALIAS Q,
7 const tarch::la::Vector<DIMENSIONS, double>& x,
8 const tarch::la::Vector<DIMENSIONS, double>& h,
9 const double t,
10 const double dt,
11 const int normal,
12 T* const NOALIAS F
13) {
14 for (int n = 0; n < NumberOfUnknowns; n++) {
15 F[n] = 0.0;
16 }
17
18 if (Q[Shortcuts::h] <= hThreshold) {
19 return;
20 }
21
22 const auto Vn{Q[Shortcuts::hu + normal] / Q[Shortcuts::h]};
23 F[Shortcuts::h] = Q[Shortcuts::hu + normal]; // Mass flux
24 F[Shortcuts::hu] = Vn * Q[Shortcuts::hu]; // Momentum-x flux
25 F[Shortcuts::hv] = Vn * Q[Shortcuts::hv]; // Momentum-y flux
26 //F[Shortcuts::hu + normal] += 0.5 * g * Q[Shortcuts::h] * Q[Shortcuts::h]; // Hydrostatic pressure
27}
28
29template <class T, class Shortcuts>
30static inline GPU_CALLABLE_METHOD double applications::exahype2::ShallowWater::maxEigenvalue(
31 const T* const NOALIAS Q,
32 const tarch::la::Vector<DIMENSIONS, double>& x,
33 const tarch::la::Vector<DIMENSIONS, double>& h,
34 const double t,
35 const double dt,
36 const int normal
37) {
38 if (Q[Shortcuts::h] <= hThreshold) {
39 return 0.0;
40 }
41
42 // Wave speed estimation based on the flux Jacobian
43 const auto Vn{Q[Shortcuts::hu + normal] / Q[Shortcuts::h]};
44 const auto c{std::sqrt(g * Q[Shortcuts::h])};
45 return {std::fmax(std::fabs(Vn + c), std::fabs(Vn - c))};
46}
47
48template <class T, class Shortcuts, int NumberOfUnknowns>
49static inline GPU_CALLABLE_METHOD void applications::exahype2::ShallowWater::nonconservativeProduct(
50 const T* const NOALIAS Q,
51 const T* const NOALIAS deltaQ,
52 const tarch::la::Vector<DIMENSIONS, double>& x,
53 const tarch::la::Vector<DIMENSIONS, double>& h,
54 const double t,
55 const double dt,
56 const int normal,
57 T* const NOALIAS BTimesDeltaQ
58) {
59 for (int n = 0; n < NumberOfUnknowns; n++) {
60 BTimesDeltaQ[n] = 0.0;
61 }
62
63 if (Q[Shortcuts::h] <= hThreshold) {
64 return;
65 }
66
67 // Bathymetry/topography-related effects
68 BTimesDeltaQ[Shortcuts::hu + normal] = g * Q[Shortcuts::h] * (deltaQ[Shortcuts::h] + deltaQ[Shortcuts::z]);
69}
static GPU_CALLABLE_METHOD void flux(const T *const NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, const tarch::la::Vector< DIMENSIONS, double > &h, const double t, const double dt, const int normal, T *const NOALIAS F)
static GPU_CALLABLE_METHOD void nonconservativeProduct(const T *const NOALIAS Q, const T *const NOALIAS deltaQ, const tarch::la::Vector< DIMENSIONS, double > &x, const tarch::la::Vector< DIMENSIONS, double > &h, const double t, const double dt, const int normal, T *const NOALIAS BTimesDeltaQ)
static GPU_CALLABLE_METHOD double maxEigenvalue(const T *const NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, const tarch::la::Vector< DIMENSIONS, double > &h, const double t, const double dt, const int normal)