2#include "exahype2/RefinementControl.h"
11#include "tarch/NonCriticalAssertions.h"
13#ifdef IncludeTwoPunctures
22#ifdef IncludeTwoPunctures
29 if constexpr (CCZ4swi==0){
41 if constexpr (CCZ4swi==4){
53 if constexpr (CCZ4swi==2 and CCZ4BBHType==0){
66 if constexpr (CCZ4swi==2 and CCZ4BBHType==1){
80 if constexpr (CCZ4swi==2 and CCZ4BBHType==2){
94 if constexpr (CCZ4swi==3){
95 double D=10.0, q=36.0/29.0, chip=0.31, chim=-0.46, M=1.0;
96 double Pr=-0.00084541526517121, Pphi=0.09530152296974252;
97 double mp=M*q/(1+q), mm=M*1/(1+q);
117 const char* name =
"GaugeWave";
118 int length = strlen(name);
121 #ifdef IncludeTwoPunctures
134 const tarch::la::Vector<DIMENSIONS,double>& volumeX,
135 const tarch::la::Vector<DIMENSIONS,double>& volumeH
149 #ifdef IncludeTwoPunctures
156 logError(
"initialCondition(...)",
"initial scenario " <<
Scenario <<
" is not supported" );
159 for (
int i=0; i<NumberOfUnknowns; i++) {
160 assertion2( std::isfinite(Q[i]), volumeX, i );
163 for (
int i=NumberOfUnknowns; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) {
170 const double * NOALIAS Q,
171 const tarch::la::Vector<DIMENSIONS,double>& volumeX,
172 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
177 logTraceInWith4Arguments(
"sourceTerm(...)", volumeX, volumeH, t, dt );
178 for(
int i=0; i<NumberOfUnknowns; i++){
179 assertion3( std::isfinite(Q[i]), i, volumeX, t );
184 for(
int i=0; i<NumberOfUnknowns; i++){
185 nonCriticalAssertion3( std::isfinite(S[i]), i, volumeX, t );
187 logTraceOut(
"sourceTerm(...)" );
192 const double * NOALIAS Qinside,
193 double * NOALIAS Qoutside,
194 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
195 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
199 logTraceInWith4Arguments(
"boundaryConditions(...)", faceCentre, volumeH, t, normal );
200 for(
int i=0; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) {
201 assertion4( Qinside[i]==Qinside[i], faceCentre, t, normal, i );
202 Qoutside[i]=Qinside[i];
204 logTraceOut(
"boundaryConditions(...)" );
209 const double * NOALIAS Q,
210 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
211 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
217 return maxEigenvalue(Q, faceCentre, volumeH, t, dt, normal, Offloadable::Yes);
222 const double * NOALIAS Q,
223 const double * NOALIAS deltaQ,
224 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
225 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
229 double * NOALIAS BgradQ
231 logTraceInWith4Arguments(
"nonconservativeProduct(...)", faceCentre, volumeH, t, normal );
232 assertion( normal>=0 );
233 assertion( normal<DIMENSIONS );
234 nonconservativeProduct(Q, deltaQ, faceCentre, volumeH, t, dt, normal, BgradQ, Offloadable::Yes);
236 for (
int i=0; i<NumberOfUnknowns; i++) {
237 nonCriticalAssertion4( std::isfinite(BgradQ[i]), i, faceCentre, t, normal );
239 logTraceOut(
"nonconservativeProduct(...)" );
243 const double * NOALIAS Q,
244 const double * NOALIAS deltaQ,
245 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
246 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
250 double * NOALIAS BgradQ,
254 double gradQSerialised[NumberOfUnknowns*3];
255 for (
int i=0; i<NumberOfUnknowns; i++) {
256 gradQSerialised[i+0*NumberOfUnknowns] = 0.0;
257 gradQSerialised[i+1*NumberOfUnknowns] = 0.0;
258 gradQSerialised[i+2*NumberOfUnknowns] = 0.0;
260 gradQSerialised[i+normal*NumberOfUnknowns] = deltaQ[i];
265 applications::exahype2::ccz4::ncp(BgradQ, Q, gradQSerialised, normal, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4mu, CCZ4SO);
269 const double * NOALIAS Q,
270 const tarch::la::Vector<DIMENSIONS,double>& volumeCentre,
271 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
274 ::exahype2::RefinementCommand result = ::exahype2::RefinementCommand::Keep;
276 const double radius = tarch::la::norm2( volumeCentre );
282 result=::exahype2::RefinementCommand::Refine;
286 if (tarch::la::equals(t,0.0)){
287 constexpr int NumberOfRefinementLayers = 2;
289 double Radius[NumberOfRefinementLayers] = {3.0, 1.5};
290 double MaxH[NumberOfRefinementLayers] = {0.15,0.04};
291 result = ::exahype2::RefinementCommand::Keep;
292 for (
int i=0; i<NumberOfRefinementLayers; i++) {
293 if (radius<Radius[i] and tarch::la::max(volumeH)>MaxH[i]) {
294 result=::exahype2::RefinementCommand::Refine;
void initialCondition(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &volumeCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH) 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