Peano
Loading...
Searching...
No Matches
CCZ4.cpp
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#include "CCZ4.h"
4
5#include "Constants.h"
6#include "exahype2/RefinementControl.h"
7#include "tarch/NonCriticalAssertions.h"
8
9#include <algorithm>
10#include <limits>
11#include <cstring>
12#include <stdio.h>
13#include <string.h>
14
15tarch::logging::Log benchmarks::exahype2::ccz4::CCZ4::_log("benchmarks::exahype2::ccz4::CCZ4");
16
18 double* NOALIAS Q,
19 const tarch::la::Vector<DIMENSIONS, double>& volumeX,
20 const tarch::la::Vector<DIMENSIONS, double>& volumeH,
21 bool gridIsConstructed
22) {
23 constexpr int nVars = 59;
24 constexpr double pi = M_PI;
25 constexpr double peak_number = 2.0;
26 constexpr double ICA = 0.1;
27 double HH = 1.0 - ICA * sin(peak_number * pi * (volumeX[0] - 0));
28 double dxH = -peak_number * pi * ICA * cos(peak_number * pi * (volumeX[0] - 0));
29 double dxphi = -pow(HH, (-7.0 / 6.0)) * dxH / 6.0;
30 double phi = pow((1.0 / HH), (1.0 / 6.0));
31 double Kxx = -0.5 * peak_number * pi * ICA * cos(peak_number * pi * (volumeX[0] - 0))
32 / sqrt(1.0 - ICA * sin(peak_number * pi * (volumeX[0] - 0)));
33 double traceK = Kxx / HH;
34 std::memset(Q, .0, nVars * sizeof(double));
35 Q[0] = phi * phi * HH; //\tilde(\gamma)_xx
36 Q[3] = phi * phi; //\tilde(\gamma)_yy
37 Q[5] = phi * phi; //\tilde(\gamma)_zz
38 Q[6] = phi * phi * (Kxx - 1.0 / 3.0 * traceK * HH); //\tilde(A)_xx
39 Q[9] = phi * phi * (0.0 - 1.0 / 3.0 * traceK * 1.0); //\tilde(A)_yy
40 Q[11] = phi * phi * (0.0 - 1.0 / 3.0 * traceK * 1.0); //\tilde(A)_zz
41 Q[16] = sqrt(HH); //\alpha
42 Q[13] = 2.0 / (3.0 * pow(HH, (5.0 / 3.0))) * dxH; //\hat(\Gamma)^x
43 Q[23] = 1.0 / (2.0) * dxH * pow(HH, (-1.0 / 2.0)); // A_x
44 Q[35] = pow(HH, (-1.0 / 3.0)) * dxH / 3.0; // D_xxx
45 Q[38] = phi * dxphi; // D_xyy
46 Q[40] = phi * dxphi; // D_xzz
47 Q[53] = traceK; // K
48 Q[54] = phi; //\phi
49 Q[55] = dxphi; // P_x
50
51 for (int i = 0; i < NumberOfUnknowns; i++) {
52 assertion2(std::isfinite(Q[i]), volumeX, i);
53 }
54}
55
57 const double* NOALIAS Qinside, // Qinside[59+0]
58 double* NOALIAS Qoutside, // Qoutside[59+0]
59 const tarch::la::Vector<DIMENSIONS, double>& faceCentre,
60 const tarch::la::Vector<DIMENSIONS, double>& volumeH,
61 double t,
62 int normal
63) {
64 for (int i = 0; i < NumberOfUnknowns + NumberOfAuxiliaryVariables; i++) {
65 assertion4(Qinside[i] == Qinside[i], faceCentre, t, normal, i);
66 Qoutside[i] = Qinside[i];
67 }
68}
69
71 const double* NOALIAS Q,
72 const tarch::la::Vector<DIMENSIONS, double>& volumeCentre,
73 const tarch::la::Vector<DIMENSIONS, double>& volumeH,
74 double t
75) {
76 return ::exahype2::RefinementCommand::Keep;
77}
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
::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