2 #include "InitialValues.h"
3 #include "exahype2/RefinementControl.h"
11 #include "tarch/NonCriticalAssertions.h"
20 const char*
name =
"GaugeWave";
21 int length = strlen(
name);
25 std::cerr <<
"initial scenario " <<
Scenario <<
" is not supported" << std::endl << std::endl << std::endl;
31 const tarch::la::Vector<DIMENSIONS,double>&
x,
34 logTraceInWith2Arguments(
"adjustSolution(...)",
x,
t);
35 if (tarch::la::equals(
t,0.0) ) {
39 else if (
Scenario==
"linearwave-c++" ) {
43 logError(
"adjustSolution(...)",
"initial scenario " <<
Scenario <<
" is not supported" );
46 for (
int i=0; i<NumberOfUnknowns; i++) {
47 assertion3( std::isfinite(Q[i]),
x,
t, i );
50 for (
int i=NumberOfUnknowns; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) {
57 logTraceOut(
"adjustSolution(...)" );
61 const double * NOALIAS Q,
62 const tarch::la::Vector<DIMENSIONS,double>&
x,
63 const tarch::la::Vector<DIMENSIONS,double>&
h,
68 constexpr
int nVars = 59;
69 for(
int i=0; i<nVars; i++){
70 assertion3( std::isfinite(Q[i]), i,
x,
t );
72 memset(S, 0, nVars*
sizeof(
double));
75 for(
int i=0; i<nVars; i++){
76 nonCriticalAssertion3( std::isfinite(S[i]), i,
x,
t );
81 const double * NOALIAS Q,
82 const tarch::la::Vector<DIMENSIONS,double>&
x,
86 #if defined(MGCCZ4EINSTEIN)
87 const double qmin =
std::min({Q[0],Q[3],Q[5]});
88 const double alpha = std::max({1.0, std::exp(Q[16])}) * std::max({1.0, std::exp(Q[54])}) / std::sqrt(qmin);
90 const double alpha = 1.0;
93 constexpr
double sqrtwo = 1.4142135623730951;
95 const double tempA = alpha * std::max({sqrtwo, MGCCZ4e, MGCCZ4ds, MGCCZ4GLMc/alpha, MGCCZ4GLMd/alpha});
96 const double tempB = Q[17+normal];
98 return std::max({1.0, std::abs(-tempA-tempB), std::abs(tempA-tempB)});
134 const double * NOALIAS Q,
135 const double * NOALIAS deltaQ,
136 const tarch::la::Vector<DIMENSIONS,double>&
x,
139 double * NOALIAS BgradQ
141 logTraceInWith3Arguments(
"nonconservativeProduct(...)",
x,
t, normal );
143 assertion( normal>=0 );
144 assertion( normal<DIMENSIONS );
145 constexpr
int nVars = 59;
146 double gradQSerialised[nVars*3];
147 for (
int i=0; i<nVars; i++) {
148 gradQSerialised[i+0*nVars] = 0.0;
149 gradQSerialised[i+1*nVars] = 0.0;
150 gradQSerialised[i+2*nVars] = 0.0;
152 gradQSerialised[i+normal*nVars] = deltaQ[i];
155 ncp(BgradQ, Q, gradQSerialised, normal);
157 for (
int i=0; i<nVars; i++) {
158 nonCriticalAssertion4( std::isfinite(BgradQ[i]), i,
x,
t, normal );
161 logTraceOut(
"nonconservativeProduct(...)" );
165 const double * NOALIAS Qinside,
166 double * NOALIAS Qoutside,
167 const tarch::la::Vector<DIMENSIONS,double>&
x,
171 logTraceInWith3Arguments(
"boundaryConditions(...)",
x,
t, normal );
172 for(
int i=0; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) {
173 assertion4( Qinside[i]==Qinside[i],
x,
t, normal, i );
174 Qoutside[i]=Qinside[i];
176 logTraceOut(
"boundaryConditions(...)" );
void nonconservativeProduct(const double *NOALIAS Q, const double *NOALIAS deltaQ, const tarch::la::Vector< DIMENSIONS, double > &x, double t, int normal, double *NOALIAS BgradQ) override
void adjustSolution(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, double t) override
static tarch::logging::Log _log
double maxEigenvalue(const double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, double t, int normal) override
virtual void boundaryConditions(const double *NOALIAS Qinside, double *NOALIAS Qoutside, const tarch::la::Vector< DIMENSIONS, double > &x, double t, int normal) override
virtual void algebraicSource(const double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, const tarch::la::Vector< DIMENSIONS, double > &h, double t, double dt, double *NOALIAS S) override
static double min(double const x, double const y)
void ncp(double *BgradQ, const double *const Q, const double *const gradQSerialised, const int normal, const int MGCCZ4LapseType, const double MGCCZ4ds, const double MGCCZ4c, const double MGCCZ4e, const double MGCCZ4f, const double MGCCZ4bs, const double MGCCZ4sk, const double MGCCZ4xi, const double MGCCZ4mu)
void source(double *S, const double *const Q, const int MGCCZ4LapseType, const double MGCCZ4ds, const double MGCCZ4c, const double MGCCZ4e, const double MGCCZ4f, const double MGCCZ4bs, const double MGCCZ4sk, const double MGCCZ4xi, const double MGCCZ4itau, const double MGCCZ4eta, const double MGCCZ4k1, const double MGCCZ4k2, const double MGCCZ4k3)
void linearWave(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &X, double t)
void enforceMGCCZ4constraints(double *luh)
void gaugeWave(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, double t)