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 "peano4/datamanagement/FaceMarker.h"
12#include "repositories/SolverRepository.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) {
65}
66
68 assertion(timeStepSize <= getAdmissibleTimeStepSize());
69 _admissibleTimeStepSize = timeStepSize;
70}
71
73 const peano4::datamanagement::CellMarker& marker
74) {
75 return isCellOverlappingWithBHImpactArea(marker.getX(), marker.getH());
76}
77
79 const peano4::datamanagement::CellMarker& marker
80) {
81 if (isCellOverlappingWithBHImpactArea(marker)) {
82 bool result = true;
83 for (int d = 0; d < DIMENSIONS; d++) {
84 tarch::la::Vector<DIMENSIONS, double> neighbourCellCentre = marker.getX();
85
86 neighbourCellCentre(d) = marker.getX()(d) - marker.getH()(d);
87 result &= isCellOverlappingWithBHImpactArea(neighbourCellCentre, marker.getH());
88
89 neighbourCellCentre(d) = marker.getX()(d) + marker.getH()(d);
90 result &= isCellOverlappingWithBHImpactArea(neighbourCellCentre, marker.getH());
91 }
92 return result;
93 } else {
94 return false;
95 }
96}
97
99 const peano4::datamanagement::CellMarker& marker,
100 int faceNumber
101) {
102 if (isCellOverlappingWithBHImpactArea(marker)) {
103 const int normal = faceNumber % DIMENSIONS;
104 tarch::la::Vector<DIMENSIONS, double> adjacentCellCentre = marker.getX();
105 adjacentCellCentre(normal) += faceNumber >= DIMENSIONS ? marker.getH()(normal) : -marker.getH()(normal);
106 return isCellOverlappingWithBHImpactArea(adjacentCellCentre, marker.getH());
107 } else {
108 return false;
109 }
110}
111
113 const peano4::datamanagement::FaceMarker& marker
114) {
115 const int normal = marker.getSelectedFaceNumber() % DIMENSIONS;
116
117 tarch::la::Vector<DIMENSIONS, double> leftCellCentre = marker.getX();
118 tarch::la::Vector<DIMENSIONS, double> rightCellCentre = marker.getX();
119
120 leftCellCentre(normal) -= 0.5 * marker.getH()(normal);
121 rightCellCentre(normal) += 0.5 * marker.getH()(normal);
122
123 return isCellOverlappingWithBHImpactArea(leftCellCentre, marker.getH())
124 and isCellOverlappingWithBHImpactArea(rightCellCentre, marker.getH());
125}
126
128 const peano4::datamanagement::FaceMarker& marker
129) {
130 const int normal = marker.getSelectedFaceNumber() % DIMENSIONS;
131
132 tarch::la::Vector<DIMENSIONS, double> leftCellCentre = marker.getX();
133 tarch::la::Vector<DIMENSIONS, double> rightCellCentre = marker.getX();
134
135 leftCellCentre(normal) -= 0.5 * marker.getH()(normal);
136 rightCellCentre(normal) += 0.5 * marker.getH()(normal);
137
138 return isCellOverlappingWithBHImpactArea(leftCellCentre, marker.getH())
139 or isCellOverlappingWithBHImpactArea(rightCellCentre, marker.getH());
140}
141
143 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
144 const tarch::la::Vector<DIMENSIONS, double>& cellH
145) {
146 return tarch::la::norm2(cellCentre) - tarch::la::norm2(0.5 * cellH) < BlackHoleFVRegion;
147}
148
150 double globalMinTimeStamp,
151 double globalMaxTimeStamp,
152 double globalMinTimeStepSize,
153 double globalMaxTimeStepSize
154) {
155 AbstractCCZ4SBH_FV::
156 startTimeStep(globalMinTimeStamp, globalMaxTimeStamp, globalMinTimeStepSize, globalMaxTimeStepSize);
157
158 _numberOfPatches = 0;
159}
160
162 AbstractCCZ4SBH_FV::finishTimeStep();
163
164 logInfo("finishTimeStep()", "number of patches on this rank=" << _numberOfPatches);
165}
166
168 tarch::multicore::Lock lock(_semaphore);
169 _numberOfPatches++;
170}
constexpr double timeStepSize
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.
virtual void initialCondition(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &volumeCentre, const tarch::la::Vector< DIMENSIONS, double > &volumeH) override
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]