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
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 #if !defined(WITH_GPU_OMP_TARGET)
189 logTraceInWith4Arguments(
"sourceTerm(...)", volumeX, volumeH,
t,
dt );
190 for(
int i=0; i<NumberOfUnknowns; i++){
191 assertion3( std::isfinite(Q[i]), i, volumeX,
t );
224 #if !defined(WITH_GPU_OMP_TARGET)
225 for(
int i=0; i<NumberOfUnknowns; i++){
226 nonCriticalAssertion3( std::isfinite(S[i]), i, volumeX,
t );
228 logTraceOut(
"sourceTerm(...)" );
234 const double * NOALIAS Qinside,
235 double * NOALIAS Qoutside,
236 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
237 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
241 logTraceInWith4Arguments(
"boundaryConditions(...)", faceCentre, volumeH,
t, normal );
242 for(
int i=0; i<NumberOfUnknowns+NumberOfAuxiliaryVariables; i++) {
243 assertion4( Qinside[i]==Qinside[i], faceCentre,
t, normal, i );
244 Qoutside[i]=Qinside[i];
246 logTraceOut(
"boundaryConditions(...)" );
251 const double * NOALIAS Q,
252 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
253 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
259 return maxEigenvalue(Q, faceCentre, volumeH,
t,
dt, normal, Offloadable::Yes);
264 const double * NOALIAS Q,
265 const double * NOALIAS deltaQ,
266 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
267 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
271 double * NOALIAS BgradQ
273 #if !defined(WITH_GPU_OMP_TARGET)
274 logTraceInWith4Arguments(
"nonconservativeProduct(...)", faceCentre, volumeH,
t, normal );
275 assertion( normal>=0 );
276 assertion( normal<DIMENSIONS );
278 nonconservativeProduct(Q, deltaQ, faceCentre, volumeH,
t,
dt, normal, BgradQ, Offloadable::Yes);
280 #if !defined(WITH_GPU_OMP_TARGET)
281 for (
int i=0; i<NumberOfUnknowns; i++) {
282 nonCriticalAssertion4( std::isfinite(BgradQ[i]), i, faceCentre,
t, normal );
284 logTraceOut(
"nonconservativeProduct(...)" );
288 #if defined(WITH_GPU_OMP_TARGET)
289 #pragma omp declare target
292 const double * NOALIAS Q,
293 const double * NOALIAS deltaQ,
294 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
295 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
299 double * NOALIAS BgradQ,
303 double gradQSerialised[NumberOfUnknowns*3];
304 for (
int i=0; i<NumberOfUnknowns; i++) {
305 gradQSerialised[i+0*NumberOfUnknowns] = 0.0;
306 gradQSerialised[i+1*NumberOfUnknowns] = 0.0;
307 gradQSerialised[i+2*NumberOfUnknowns] = 0.0;
309 gradQSerialised[i+normal*NumberOfUnknowns] = deltaQ[i];
314 applications::exahype2::ccz4::ncp(BgradQ, Q, gradQSerialised, normal, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4mu, CCZ4SO);
316 #if defined(WITH_GPU_OMP_TARGET)
317 #pragma omp end declare target
321 const double * NOALIAS Q,
322 const tarch::la::Vector<DIMENSIONS,double>& volumeCentre,
323 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
326 ::exahype2::RefinementCommand result = ::exahype2::RefinementCommand::Keep;
334 result=::exahype2::RefinementCommand::Refine;
338 if (tarch::la::equals(
t,0.0)){
339 constexpr
int NumberOfRefinementLayers = 2;
341 double Radius[NumberOfRefinementLayers] = {4, 2.5};
342 double MaxH[NumberOfRefinementLayers] = {0.15,0.04};
343 result = ::exahype2::RefinementCommand::Keep;
344 for (
int i=0; i<NumberOfRefinementLayers; i++) {
345 if (radius<Radius[i] and tarch::la::max(volumeH)>MaxH[i]) {
346 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
double norm2(double *v, int n)
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)
static double maxEigenvalue(const double *const Q, int normal, const double CCZ4e, const double CCZ4ds, const double CCZ4GLMc, const double CCZ4GLMd)
void gaugeWave(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &x, double t)
std::string grid_setup_method