Peano
Loading...
Searching...
No Matches
CCZ4SBH_FV.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_FV.h"
4
5#ifdef PureFV
6#else
7#include "CCZ4SBH_FD4.h"
8#endif
9
10#include "exahype2/RefinementControl.h"
11#include "repositories/SolverRepository.h"
12#include "peano4/datamanagement/FaceMarker.h"
13#include "tarch/multicore/Lock.h"
14
15tarch::multicore::BooleanSemaphore benchmarks::exahype2::ccz4::CCZ4SBH_FV::_semaphore;
16tarch::logging::Log benchmarks::exahype2::ccz4::CCZ4SBH_FV::_log("benchmarks::exahype2::ccz4::CCZ4SBH_FV");
17
18#ifdef PureFV
20
22 if (twoPunctures == nullptr) {
24
25 // first we set the parameter. TODO:find a way to read parameter from python script
26 // int swi=0;//0--single black hole, 1--BBH hoc, 2--BBH rotation, 3--GW150914
27
28 twoPunctures->par_b = 1.0;
29 twoPunctures->center_offset[0] = -1.0;
32 twoPunctures->target_M_plus = 1.0; // adm mass
33 twoPunctures->par_P_plus[0] = 0.0;
34 twoPunctures->par_P_plus[1] = 0.0;
35 twoPunctures->par_P_plus[2] = 0.0; // linear momentum
36 twoPunctures->par_S_plus[0] = 0.0;
37 twoPunctures->par_S_plus[1] = 0.0;
38 twoPunctures->par_S_plus[2] = 0.0; // spin
39 twoPunctures->target_M_minus = 0.0; // adm mass
40 twoPunctures->par_P_minus[0] = 0.0;
41 twoPunctures->par_P_minus[1] = 0.0;
42 twoPunctures->par_P_minus[2] = 0.0; // linear momentum
43 twoPunctures->par_S_minus[0] = 0.0;
44 twoPunctures->par_S_minus[1] = 0.0;
45 twoPunctures->par_S_minus[2] = 0.0; // spin
46 twoPunctures->grid_setup_method = "evaluation"; // evaluation or Taylor expansion
48
50
51 // then solve the equation
53 }
54}
55#endif
56
58
60 double* NOALIAS Q,
61 const tarch::la::Vector<DIMENSIONS, double>& volumeCentre,
62 const tarch::la::Vector<DIMENSIONS, double>& volumeH,
63 bool gridIsConstructed
64) {
65 logTraceInWith3Arguments("initialCondition(...)", volumeCentre, volumeH, gridIsConstructed);
66
67 applications::exahype2::ccz4::ApplyTwoPunctures(Q, volumeCentre, 0, twoPunctures, not gridIsConstructed);
68
69 logTraceOut("initialCondition(...)");
70}
71
73 assertion(timeStepSize <= getAdmissibleTimeStepSize());
74 _admissibleTimeStepSize = timeStepSize;
75}
76
78 const peano4::datamanagement::CellMarker& marker
79) {
80 return isCellOverlappingWithBHImpactArea(marker.x(), marker.h());
81}
82
84 const peano4::datamanagement::CellMarker& marker
85) {
87 bool result = true;
88 for (int d = 0; d < DIMENSIONS; d++) {
89 tarch::la::Vector<DIMENSIONS, double> neighbourCellCentre = marker.x();
90
91 neighbourCellCentre(d) = marker.x()(d) - marker.h()(d);
92 result &= isCellOverlappingWithBHImpactArea(neighbourCellCentre, marker.h());
93
94 neighbourCellCentre(d) = marker.x()(d) + marker.h()(d);
95 result &= isCellOverlappingWithBHImpactArea(neighbourCellCentre, marker.h());
96 }
97 return result;
98 } else {
99 return false;
100 }
101}
102
104 const peano4::datamanagement::CellMarker& marker, int faceNumber
105) {
107 const int normal = faceNumber % DIMENSIONS;
108 tarch::la::Vector<DIMENSIONS, double> adjacentCellCentre = marker.x();
109 adjacentCellCentre(normal) += faceNumber >= DIMENSIONS ? marker.h()(normal) : -marker.h()(normal);
110 return isCellOverlappingWithBHImpactArea(adjacentCellCentre, marker.h());
111 } else {
112 return false;
113 }
114}
115
117 const peano4::datamanagement::FaceMarker& marker
118) {
119 const int normal = marker.getSelectedFaceNumber() % DIMENSIONS;
120
121 tarch::la::Vector<DIMENSIONS, double> leftCellCentre = marker.x();
122 tarch::la::Vector<DIMENSIONS, double> rightCellCentre = marker.x();
123
124 leftCellCentre(normal) -= 0.5 * marker.h()(normal);
125 rightCellCentre(normal) += 0.5 * marker.h()(normal);
126
127 return isCellOverlappingWithBHImpactArea(leftCellCentre, marker.h())
128 and isCellOverlappingWithBHImpactArea(rightCellCentre, marker.h());
129}
130
132 const peano4::datamanagement::FaceMarker& marker
133) {
134 const int normal = marker.getSelectedFaceNumber() % DIMENSIONS;
135
136 tarch::la::Vector<DIMENSIONS, double> leftCellCentre = marker.x();
137 tarch::la::Vector<DIMENSIONS, double> rightCellCentre = marker.x();
138
139 leftCellCentre(normal) -= 0.5 * marker.h()(normal);
140 rightCellCentre(normal) += 0.5 * marker.h()(normal);
141
142 return isCellOverlappingWithBHImpactArea(leftCellCentre, marker.h())
143 or isCellOverlappingWithBHImpactArea(rightCellCentre, marker.h());
144}
145
147 const tarch::la::Vector<DIMENSIONS, double>& cellCentre, const tarch::la::Vector<DIMENSIONS, double>& cellH
148) {
149 return tarch::la::norm2(cellCentre) - tarch::la::norm2(0.5 * cellH) < BlackHoleFVRegion;
150}
151
153 double globalMinTimeStamp, double globalMaxTimeStamp, double globalMinTimeStepSize, double globalMaxTimeStepSize
154) {
155 AbstractCCZ4SBH_FV::startTimeStep(
156 globalMinTimeStamp, globalMaxTimeStamp, globalMinTimeStepSize, globalMaxTimeStepSize
157 );
158
160}
161
163 AbstractCCZ4SBH_FV::finishTimeStep();
164
165 logInfo("finishTimeStep()", "number of patches on this rank=" << _numberOfPatches);
166}
167
constexpr double timeStepSize
virtual void initialCondition(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &volumeCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH, bool gridIsConstructed) override
virtual void startTimeStep(double globalMinTimeStamp, double globalMaxTimeStamp, double globalMinTimeStepSize, double globalMaxTimeStepSize) override
Call superclass and after that report/maintain _numberOfPatches.
static bool areBothAdjacentCellsOverlappingWithBHImpactArea(const peano4::datamanagement::FaceMarker &marker)
Check two adjacent octants.
void reduceAdmissibleTimeStepSize(double timeStepSize)
Overwrite limiters time step size.
static bool isCellOverlappingWithBHImpactArea(const peano4::datamanagement::CellMarker &marker)
Is octant area overlapping with BH impact area.
static bool areAllFaceConnectedCellsOverlappingWithBHImpactArea(const peano4::datamanagement::CellMarker &marker)
static tarch::multicore::BooleanSemaphore _semaphore
Definition CCZ4SBH_FV.h:29
static bool isOneAdjacentCellOverlappingWithBHImpactArea(const peano4::datamanagement::FaceMarker &marker)
CCZ4SBH_FV()
Initialise the two punctures object if required.
virtual void finishTimeStep() override
Call superclass and after that report/maintain _numberOfPatches.
static tarch::logging::Log _log
Definition CCZ4SBH_FV.h:28
void ApplyTwoPunctures(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &X, double t, TP::TwoPunctures *tp, bool low_res)
TP::TwoPunctures * twoPunctures
Definition CCZ4SBH_FV.h:16
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]