Peano 4
Loading...
Searching...
No Matches
CCZ4SBH_FD4.cpp
Go to the documentation of this file.
1// This file is part of the ExaHyPE2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#include "CCZ4SBH_FD4.h"
4
6#include "repositories/SolverRepository.h"
7
8tarch::logging::Log benchmarks::exahype2::ccz4::CCZ4SBH_FD4::_log("benchmarks::exahype2::ccz4::CCZ4SBH_FD4");
9
11
13 if (twoPunctures == nullptr) {
15
16 // first we set the parameter. TODO:find a way to read parameter from python script
17 // int swi=0;//0--single black hole, 1--BBH hoc, 2--BBH rotation, 3--GW150914
18
19 twoPunctures->par_b = 1.0;
20 twoPunctures->center_offset[0] = -1.0;
23 twoPunctures->target_M_plus = 1.0; // adm mass
24 twoPunctures->par_P_plus[0] = 0.0;
25 twoPunctures->par_P_plus[1] = 0.0;
26 twoPunctures->par_P_plus[2] = 0.0; // linear momentum
27 twoPunctures->par_S_plus[0] = 0.0;
28 twoPunctures->par_S_plus[1] = 0.0;
29 twoPunctures->par_S_plus[2] = 0.0; // spin
30 twoPunctures->target_M_minus = 0.0; // adm mass
31 twoPunctures->par_P_minus[0] = 0.0;
32 twoPunctures->par_P_minus[1] = 0.0;
33 twoPunctures->par_P_minus[2] = 0.0; // linear momentum
34 twoPunctures->par_S_minus[0] = 0.0;
35 twoPunctures->par_S_minus[1] = 0.0;
36 twoPunctures->par_S_minus[2] = 0.0; // spin
37 twoPunctures->grid_setup_method = "evaluation"; // evaluation or Taylor expansion
39
41
42 // then solve the equation
44 }
45}
46
48 const double* __restrict__ Q, // Q[59+0]
51 double t
52) {
53 return tarch::la::norm2(volumeX) - std::sqrt(Dimensions)*meshCellH(0) < BlackHoleFVRegion
56}
57
59
61 double* __restrict__ Q,
62 const tarch::la::Vector<Dimensions, double>& meshCellCentre,
64 bool gridIsConstructed
65) {
66 logTraceInWith3Arguments("initialCondition(...)", meshCellCentre, meshCellH, gridIsConstructed);
67
68 applications::exahype2::ccz4::ApplyTwoPunctures(Q, meshCellCentre, 0, twoPunctures, not gridIsConstructed);
69
70 logTraceOut("initialCondition(...)");
71}
72
74 double globalMinTimeStamp, double globalMaxTimeStamp, double globalMinTimeStepSize, double globalMaxTimeStepSize
75) {
76 AbstractCCZ4SBH_FD4::startTimeStep(
77 globalMinTimeStamp, globalMaxTimeStamp, globalMinTimeStepSize, globalMaxTimeStepSize
78 );
79
80#if defined(CoupleWithFV)
81 if (isFirstGridSweepOfTimeStep()) {
82 double fvTimeStepSize = repositories::InstanceOfCCZ4SBH_FV.getAdmissibleTimeStepSize();
83 double newTimeStepSize = std::min(fvTimeStepSize, _admissibleTimeStepSize);
84 if (tarch::la::smaller(newTimeStepSize, fvTimeStepSize)) {
85 logInfo(
86 "startTimeStep(...)",
87 "reduce admissible time step size from dt_{dg}="
88 << _admissibleTimeStepSize << " vs dt_{fv}=" << fvTimeStepSize << " to dt=" << newTimeStepSize
89 << " (previously reported time step sizes for this step are invalid)"
90 );
91 }
92 _admissibleTimeStepSize = newTimeStepSize;
93 repositories::InstanceOfCCZ4SBH_FV.reduceAdmissibleTimeStepSize(newTimeStepSize);
94 }
95#endif
96}
#define logTraceOut(methodName)
Definition Log.h:379
#define logTraceInWith3Arguments(methodName, argument0, argument1, argument2)
Definition Log.h:372
#define logInfo(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
Definition Log.h:411
_admissibleTimeStepSize(std::numeric_limits< double >::max())
static tarch::logging::Log _log
Definition CCZ4SBH_FD4.h:24
CCZ4SBH_FD4()
Initialise the two punctures object if required.
virtual::exahype2::RefinementCommand refinementCriterion(const double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &meshCellCentre, const tarch::la::Vector< Dimensions, double > &meshCellH, double t) override
Refinement criterion.
virtual void initialCondition(double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &meshCellCentre, const tarch::la::Vector< Dimensions, double > &meshCellH, bool gridIsConstructed) override
virtual void startTimeStep(double globalMinTimeStamp, double globalMaxTimeStamp, double globalMinTimeStepSize, double globalMaxTimeStepSize) override
Start a new time step.
Log Device.
Definition Log.h:516
TP::TwoPunctures * twoPunctures
static bool smaller(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE) InlineMethod
Smaller operator for floating point values.
Scalar norm2(const Vector< Size, Scalar > &vector)
Computes the 2-norm of the vector, i.e.
double par_S_plus[3]
std::string grid_setup_method
double par_P_plus[3]
double par_S_minus[3]
double center_offset[3]
double target_M_minus
double par_P_minus[3]
Simple vector class.
Definition Vector.h:134