2 #include "exahype2/RefinementControl.h"
3 #include "InitialValues.h"
15 #include "tarch/NonCriticalAssertions.h"
25 const char*
name =
"GaugeWave";
26 int length = strlen(
name);
30 std::cerr <<
"initial scenario " <<
Scenario <<
" is not supported" << std::endl << std::endl << std::endl;
37 const tarch::la::Vector<DIMENSIONS,double>& volumeX,
38 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
42 logTraceInWith4Arguments(
"adjustSolution(...)", volumeX, volumeH,
t,
dt );
43 if (tarch::la::equals(
t,0.0) ) {
54 logError(
"adjustSolution(...)",
"initial scenario " <<
Scenario <<
" is not supported" );
57 for (
int i=0; i<NumberOfUnknowns; i++) {
58 assertion3( std::isfinite(Q[i]), volumeX,
t, i );
61 for (
int i=NumberOfUnknowns; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) {
68 logTraceOut(
"adjustSolution(...)" );
73 const double * NOALIAS Q,
74 const tarch::la::Vector<DIMENSIONS,double>& volumeX,
75 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
80 logTraceInWith4Arguments(
"sourceTerm(...)", volumeX, volumeH,
t,
dt );
81 for(
int i=0; i<NumberOfUnknowns; i++){
82 assertion3( std::isfinite(Q[i]), i,
x,
t );
85 memset(S, 0, NumberOfUnknowns*
sizeof(
double));
88 for(
int i=0; i<NumberOfUnknowns; i++){
89 nonCriticalAssertion3( std::isfinite(S[i]), i, volumeX,
t );
91 logTraceOut(
"sourceTerm(...)" );
97 const double * NOALIAS Qinside,
98 double * NOALIAS Qoutside,
99 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
100 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
104 logTraceInWith4Arguments(
"boundaryConditions(...)", faceCentre, volumeH,
t, normal );
105 for(
int i=0; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) {
106 assertion4( Qinside[i]==Qinside[i], faceCentre,
t, normal, i );
107 Qoutside[i]=Qinside[i];
109 logTraceOut(
"boundaryConditions(...)" );
114 const double * NOALIAS Q,
115 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
116 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
121 #if defined(MGCCZ4EINSTEIN)
122 const double qmin =
std::min({Q[0],Q[3],Q[5]});
123 const double alpha = std::max({1.0, std::exp(Q[16])}) * std::max({1.0, std::exp(Q[54])}) / std::sqrt(qmin);
125 const double alpha = 1.0;
128 constexpr
double sqrtwo = 1.4142135623730951;
130 const double tempA = alpha * std::max({sqrtwo, MGCCZ4e, MGCCZ4ds, MGCCZ4GLMc/alpha, MGCCZ4GLMd/alpha});
131 const double tempB = Q[17+normal];
132 return std::max({1.0, std::abs(-tempA-tempB), std::abs(tempA-tempB)});
166 const double * NOALIAS Q,
167 const double * NOALIAS deltaQ,
168 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
169 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
172 double * NOALIAS BgradQ
174 #if !defined(WITH_GPU_OMP_TARGET)
175 logTraceInWith4Arguments(
"nonconservativeProduct(...)", faceCentre, volumeH,
t, normal );
176 assertion( normal>=0 );
177 assertion( normal<DIMENSIONS );
179 double gradQSerialised[NumberOfUnknowns*3];
180 for (
int i=0; i<NumberOfUnknowns; i++) {
181 gradQSerialised[i+0*NumberOfUnknowns] = 0.0;
182 gradQSerialised[i+1*NumberOfUnknowns] = 0.0;
183 gradQSerialised[i+2*NumberOfUnknowns] = 0.0;
185 gradQSerialised[i+normal*NumberOfUnknowns] = deltaQ[i];
188 pdencp_(BgradQ, Q, gradQSerialised);
189 #if !defined(WITH_GPU_OMP_TARGET)
190 for (
int i=0; i<NumberOfUnknowns; i++) {
191 nonCriticalAssertion4( std::isfinite(BgradQ[i]), i, faceCentre,
t, normal );
193 logTraceOut(
"nonconservativeProduct(...)" );
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, int normal, double *NOALIAS BgradQ)
double maxEigenvalue(const double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &faceCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t, int normal)
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)
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
void adjustSolution(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &volumeCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, double t, double dt) override
static tarch::logging::Log _log
void pdesource_(double *S, const double *const Q)
void pdencp_(double *BgradQ, const double *const Q, const double *const gradQ)
static double min(double const x, double const y)
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)
void forcedflat(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &X, double t)