10 #include "exahype2/RefinementControl.h"
11 #include "repositories/SolverRepository.h"
12 #include "peano4/datamanagement/FaceMarker.h"
13 #include "tarch/multicore/Lock.h"
61 const tarch::la::Vector<DIMENSIONS, double>& volumeCentre,
62 const tarch::la::Vector<DIMENSIONS, double>& volumeH,
63 bool gridIsConstructed
65 logTraceInWith3Arguments(
"initialCondition(...)", volumeCentre, volumeH, gridIsConstructed);
69 logTraceOut(
"initialCondition(...)");
78 const peano4::datamanagement::CellMarker&
marker
80 return isCellOverlappingWithBHImpactArea(
marker.x(),
marker.h());
84 const peano4::datamanagement::CellMarker&
marker
86 if (isCellOverlappingWithBHImpactArea(
marker)) {
88 for (
int d = 0; d < DIMENSIONS; d++) {
89 tarch::la::Vector<DIMENSIONS, double> neighbourCellCentre =
marker.x();
92 result &= isCellOverlappingWithBHImpactArea(neighbourCellCentre,
marker.h());
95 result &= isCellOverlappingWithBHImpactArea(neighbourCellCentre,
marker.h());
104 const peano4::datamanagement::CellMarker&
marker,
int faceNumber
106 if (isCellOverlappingWithBHImpactArea(
marker)) {
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());
117 const peano4::datamanagement::FaceMarker&
marker
119 const int normal =
marker.getSelectedFaceNumber() % DIMENSIONS;
121 tarch::la::Vector<DIMENSIONS, double> leftCellCentre =
marker.x();
122 tarch::la::Vector<DIMENSIONS, double> rightCellCentre =
marker.x();
124 leftCellCentre(normal) -= 0.5 *
marker.h()(normal);
125 rightCellCentre(normal) += 0.5 *
marker.h()(normal);
127 return isCellOverlappingWithBHImpactArea(leftCellCentre,
marker.h())
128 and isCellOverlappingWithBHImpactArea(rightCellCentre,
marker.h());
132 const peano4::datamanagement::FaceMarker&
marker
134 const int normal =
marker.getSelectedFaceNumber() % DIMENSIONS;
136 tarch::la::Vector<DIMENSIONS, double> leftCellCentre =
marker.x();
137 tarch::la::Vector<DIMENSIONS, double> rightCellCentre =
marker.x();
139 leftCellCentre(normal) -= 0.5 *
marker.h()(normal);
140 rightCellCentre(normal) += 0.5 *
marker.h()(normal);
142 return isCellOverlappingWithBHImpactArea(leftCellCentre,
marker.h())
143 or isCellOverlappingWithBHImpactArea(rightCellCentre,
marker.h());
147 const tarch::la::Vector<DIMENSIONS, double>& cellCentre,
const tarch::la::Vector<DIMENSIONS, double>& cellH
153 double globalMinTimeStamp,
double globalMaxTimeStamp,
double globalMinTimeStepSize,
double globalMaxTimeStepSize
155 AbstractCCZ4SBH_FV::startTimeStep(
156 globalMinTimeStamp, globalMaxTimeStamp, globalMinTimeStepSize, globalMaxTimeStepSize
159 _numberOfPatches = 0;
163 AbstractCCZ4SBH_FV::finishTimeStep();
165 logInfo(
"finishTimeStep()",
"number of patches on this rank=" << _numberOfPatches);
169 tarch::multicore::Lock lock(_semaphore);
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.
void incNumberOfPatches()
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
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
double norm2(double *v, int n)
void ApplyTwoPunctures(double *NOALIAS Q, const tarch::la::Vector< DIMENSIONS, double > &X, double t, TP::TwoPunctures *tp, bool low_res)
void prepareTwoPunctures()
TP::TwoPunctures * twoPunctures
std::string grid_setup_method