2#include "exahype2/RefinementControl.h"
3#include "tarch/NonCriticalAssertions.h"
15#ifdef IncludeTwoPunctures
21#ifdef IncludeTwoPunctures
52 if (CCZ4swi==2 and CCZ4BBHType==0){
65 if (CCZ4swi==2 and CCZ4BBHType==1){
79 if (CCZ4swi==2 and CCZ4BBHType==2){
94 double D=10.0, q=36.0/29.0, chip=0.31, chim=-0.46, M=1.0;
95 double Pr=-0.00084541526517121, Pphi=0.09530152296974252;
96 double mp=M*q/(1+q), mm=M*1/(1+q);
116 const char* name =
"GaugeWave";
117 int length = strlen(name);
120 #ifdef IncludeTwoPunctures
133 const tarch::la::Vector<DIMENSIONS,double>& volumeX,
134 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
135 bool gridIsConstructed
137 logTraceInWith3Arguments(
"initialCondition(...)", volumeX, volumeH, gridIsConstructed );
151 #ifdef IncludeTwoPunctures
152 else if ( Scenario==2 ) {
159 logError(
"initialCondition(...)",
"initial scenario " << Scenario <<
" is not supported" );
162 for (
int i=0; i<NumberOfUnknowns; i++) {
163 assertion2( std::isfinite(Q[i]), volumeX, i );
166 for (
int i=NumberOfUnknowns; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) {
176 logTraceOut(
"initialCondition(...)" );
181 const double * NOALIAS Q,
182 const tarch::la::Vector<DIMENSIONS,double>& volumeX,
183 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
188 logTraceInWith4Arguments(
"sourceTerm(...)", volumeX, volumeH, t, dt );
189 for(
int i=0; i<NumberOfUnknowns; i++){
190 assertion3( std::isfinite(Q[i]), i, volumeX, t );
222 for(
int i=0; i<NumberOfUnknowns; i++){
223 nonCriticalAssertion3( std::isfinite(S[i]), i, volumeX, t );
225 logTraceOut(
"sourceTerm(...)" );
230 const double * NOALIAS Qinside,
231 double * NOALIAS Qoutside,
232 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
233 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
237 logTraceInWith4Arguments(
"boundaryConditions(...)", faceCentre, volumeH, t, normal );
238 for(
int i=0; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) {
239 assertion4( Qinside[i]==Qinside[i], faceCentre, t, normal, i );
240 Qoutside[i]=Qinside[i];
242 logTraceOut(
"boundaryConditions(...)" );
247 const double * NOALIAS Q,
248 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
249 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
255 return maxEigenvalue(Q, faceCentre, volumeH, t, dt, normal, Offloadable::Yes);
260 const double * NOALIAS Q,
261 const double * NOALIAS deltaQ,
262 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
263 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
267 double * NOALIAS BgradQ
269 logTraceInWith4Arguments(
"nonconservativeProduct(...)", faceCentre, volumeH, t, normal );
270 assertion( normal>=0 );
271 assertion( normal<DIMENSIONS );
274 for (
int i=0; i<NumberOfUnknowns; i++) {
275 nonCriticalAssertion4( std::isfinite(BgradQ[i]), i, faceCentre, t, normal );
277 logTraceOut(
"nonconservativeProduct(...)" );
281 const double * NOALIAS Q,
282 const double * NOALIAS deltaQ,
283 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
284 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
288 double * NOALIAS BgradQ,
292 double gradQSerialised[NumberOfUnknowns*3];
293 for (
int i=0; i<NumberOfUnknowns; i++) {
294 gradQSerialised[i+0*NumberOfUnknowns] = 0.0;
295 gradQSerialised[i+1*NumberOfUnknowns] = 0.0;
296 gradQSerialised[i+2*NumberOfUnknowns] = 0.0;
298 gradQSerialised[i+normal*NumberOfUnknowns] = deltaQ[i];
303 applications::exahype2::ccz4::ncp(BgradQ, Q, gradQSerialised, normal, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4mu, CCZ4SO);
307 const double * NOALIAS Q,
308 const tarch::la::Vector<DIMENSIONS,double>& volumeCentre,
309 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
312 ::exahype2::RefinementCommand result = ::exahype2::RefinementCommand::Keep;
314 const double radius = tarch::la::norm2( volumeCentre );
320 result=::exahype2::RefinementCommand::Refine;
324 if (tarch::la::equals(t,0.0)){
325 constexpr int NumberOfRefinementLayers = 2;
327 double Radius[NumberOfRefinementLayers] = {4, 2.5};
328 double MaxH[NumberOfRefinementLayers] = {0.15,0.04};
329 result = ::exahype2::RefinementCommand::Keep;
330 for (
int i=0; i<NumberOfRefinementLayers; i++) {
331 if (radius<Radius[i] and tarch::la::max(volumeH)>MaxH[i]) {
332 result=::exahype2::RefinementCommand::Refine;
void initialCondition(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &volumeCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, bool gridIsConstructed) override
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
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.
::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.
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
static tarch::logging::Log _log
void prepare(TP::TwoPunctures *tp)
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
void diagonal_gaugeWave(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, double t)
static void ncp(double *BgradQ, const double *const Q, const double *const gradQSerialised, const int normal, 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 CCZ4mu, const double CCZ4SO)
void linearWave(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &X, double t)
void ApplyTwoPunctures(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &X, double t, TP::TwoPunctures *tp, bool low_res)
void flat(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &X, double t)
void gaugeWave(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, double t)
std::string grid_setup_method