Peano
CCZ4.h
Go to the documentation of this file.
1 //
2 // ExaHyPE2 solver file
3 // Generated by Peano's Python API
4 // www.peano-framework.org
5 //
6 // This is generated. If you change fundamental properties, you will have to
7 // generate this file. Backup your manual changes before you do so.
8 //
9 #pragma once
10 
11 #include "AbstractCCZ4.h"
12 #include "tarch/logging/Log.h"
13 
14 
15 #include <cstring>
16 #include "InitialValues.h"
17 
18 #include "CCZ4Kernels.h"
19 
20 
21 namespace benchmarks {
22  namespace exahype2 {
23  namespace ccz4 {
24  class CCZ4;
25  }
26  }
27 }
28 
29 
30 class benchmarks::exahype2::ccz4::CCZ4: public AbstractCCZ4 {
31  private:
32  static tarch::logging::Log _log;
33 
34  public:
35  CCZ4();
36 
72  ::exahype2::RefinementCommand refinementCriterion(
73  const double * NOALIAS Q, // Q[59+0],
74  const tarch::la::Vector<DIMENSIONS,double>& volumeCentre,
75  const tarch::la::Vector<DIMENSIONS,double>& volumeH,
76  double t
77  ) override;
78 
79 #ifdef IncludeTwoPunctures
80  void prepare(TP::TwoPunctures* tp);
81 #endif
82 
83  void initialCondition(
84  double * NOALIAS Q,
85  const tarch::la::Vector<DIMENSIONS,double>& volumeCentre,
86  const tarch::la::Vector<DIMENSIONS,double>& volumeH,
87  bool gridIsConstructed
88  ) override;
89 
90 
91 
92 
93  virtual void boundaryConditions(
94  const double * NOALIAS Qinside, // Qinside[59+0]
95  double * NOALIAS Qoutside, // Qoutside[59+0]
96  const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
97  const tarch::la::Vector<DIMENSIONS,double>& volumeH,
98  double t,
99  int normal
100  ) override;
101 
102 
103 
104  public:
105 
106  void sourceTerm(
107  const double * NOALIAS Q,
108  const tarch::la::Vector<DIMENSIONS,double>& volumeCentre,
109  const tarch::la::Vector<DIMENSIONS,double>& volumeH,
110  double t,
111  double dt,
112  double * NOALIAS S
113  ) override;
114 
115 
116 
124  virtual double maxEigenvalue(
125  const double * NOALIAS Q, // Q[59+0],
126  const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
127  const tarch::la::Vector<DIMENSIONS,double>& volumeH,
128  double t,
129  double dt,
130  int normal
131  ) override;
132 
133 
134 
135 
136 
137 
138 
139  virtual void nonconservativeProduct(
140  const double * NOALIAS Q, // Q[59+0],
141  const double * NOALIAS deltaQ, // [59+0]
142  const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
143  const tarch::la::Vector<DIMENSIONS,double>& volumeH,
144  double t,
145  double dt,
146  int normal,
147  double * NOALIAS BgradQ // BgradQ[59]
148  ) override;
149 
150 
151 
152 
167  #if defined(WITH_GPU_OMP_TARGET)
168  #pragma omp declare target
169  #endif
170  static GPU_CALLABLE_METHOD void sourceTerm(
171  const double * NOALIAS Q,
172  const tarch::la::Vector<DIMENSIONS,double>& volumeCentre,
173  const tarch::la::Vector<DIMENSIONS,double>& volumeH,
174  double t,
175  double dt,
176  double * NOALIAS S,
177  ::exahype2::Solver::Offloadable
178  ) {
179  memset(S, 0, NumberOfUnknowns*sizeof(double));
180  applications::exahype2::ccz4::source(S,Q, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4itau, CCZ4eta, CCZ4k1, CCZ4k2, CCZ4k3, CCZ4SO);
181  }
182  #if defined(WITH_GPU_OMP_TARGET)
183  #pragma omp end declare target
184  #endif
185 
186 
187 
188 
203  #if defined(WITH_GPU_OMP_TARGET)
204  #pragma omp declare target
205  #endif
206  static GPU_CALLABLE_METHOD double maxEigenvalue(
207  const double * NOALIAS Q, // Q[59+0],
208  const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
209  const tarch::la::Vector<DIMENSIONS,double>& volumeH,
210  double t,
211  double dt,
212  int normal,
213  ::exahype2::Solver::Offloadable
214  ) {
215  const double np = 1.0;
216  #if defined(CCZ4EINSTEIN)
217  const double qmin = std::min({Q[0],Q[3],Q[5]});
218  const double alpha = std::max({1.0, Q[16]}) * std::max({1.0, pow(Q[54],1.0/np)}) / std::sqrt(qmin);
219  #else
220  const double alpha = 1.0;
221  #endif
222 
223  constexpr double sqrtwo = 1.4142135623730951;
224  // NOTE parameters are stored in abstract superclass
225  const double tempA = alpha * std::max({sqrtwo, CCZ4e, CCZ4ds, CCZ4GLMc/alpha, CCZ4GLMd/alpha});
226  const double tempB = Q[17+normal];//DOT_PRODUCT(Q(18:20),nv(:))
227  double tem = std::max({1.0, std::abs(-tempA-tempB), std::abs(tempA-tempB)});
228  bool flag = false;
229  return tem;
230  }
231 
232  #if defined(WITH_GPU_OMP_TARGET)
233  #pragma omp end declare target
234  #endif
235 
236 
237 
238 
239 
240 
241 
256  #if defined(WITH_GPU_OMP_TARGET)
257  #pragma omp declare target
258  #endif
259  static GPU_CALLABLE_METHOD void nonconservativeProduct(
260  const double * NOALIAS Q, // Q[5+0],
261  const double * NOALIAS deltaQ, // [5+0]
262  const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
263  const tarch::la::Vector<DIMENSIONS,double>& volumeH,
264  double t,
265  double dt,
266  int normal,
267  double * NOALIAS BgradQ, // BgradQ[5]
268  ::exahype2::Solver::Offloadable
269  );
270  #if defined(WITH_GPU_OMP_TARGET)
271  #pragma omp end declare target
272  #endif
273 
274 };
275 
276 
static GPU_CALLABLE_METHOD void sourceTerm(const double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &volumeCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t, double dt, double *NOALIAS S, ::exahype2::Solver::Offloadable)
To obtain the best performance, I recommend to man inline command to this signature and to copy the i...
Definition: CCZ4.h:170
void initialCondition(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &volumeCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, bool gridIsConstructed) override
Definition: CCZ4.cpp:17
static GPU_CALLABLE_METHOD void nonconservativeProduct(const double *NOALIAS Q, const double *NOALIAS deltaQ, const tarch::la::Vector< DIMENSIONS, double > &faceCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t, double dt, int normal, double *NOALIAS BgradQ, ::exahype2::Solver::Offloadable)
To obtain the best performance, I recommend to man inline command to this signature and to copy the i...
virtual void nonconservativeProduct(const double *NOALIAS Q, const double *NOALIAS deltaQ, const tarch::la::Vector< DIMENSIONS, double > &faceCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t, double dt, int normal, double *NOALIAS BgradQ) override
Definition: CCZ4.cpp:263
virtual double maxEigenvalue(const double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &faceCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t, double dt, int normal) override
Determine max eigenvalue over Jacobian in a given point with solution values (states) Q.
Definition: CCZ4.cpp:250
static GPU_CALLABLE_METHOD double maxEigenvalue(const double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &faceCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t, double dt, int normal, ::exahype2::Solver::Offloadable)
To obtain the best performance, I recommend to man inline command to this signature and to copy the i...
Definition: CCZ4.h:206
::exahype2::RefinementCommand refinementCriterion(const double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &volumeCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t) override
Refinement criterion.
Definition: CCZ4.cpp:70
virtual void boundaryConditions(const double *NOALIAS Qinside, double *NOALIAS Qoutside, const tarch::la::Vector< DIMENSIONS, double > &faceCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t, int normal) override
Definition: CCZ4.cpp:56
static tarch::logging::Log _log
Definition: CCZ4.h:32
void prepare(TP::TwoPunctures *tp)
Definition: CCZ4.cpp:23
void sourceTerm(const double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &volumeCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t, double dt, double *NOALIAS S) override
Definition: CCZ4.cpp:180
static double min(double const x, double const y)
static void source(double *S, const double *const Q, const int CCZ4LapseType, const double CCZ4ds, const double CCZ4c, const double CCZ4e, const double CCZ4f, const double CCZ4bs, const double CCZ4sk, const double CCZ4xi, const double CCZ4itau, const double CCZ4eta, const double CCZ4k1, const double CCZ4k2, const double CCZ4k3, const double CCZ4SO)
The source term is one out of two terms that we use in our CCZ4 formulation.
Definition: ccz4.py:1