Peano 4
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#include "CCZ4SBH_FD4.h"
7#include "repositories/SolverRepository.h"
10
12tarch::logging::Log benchmarks::exahype2::ccz4::CCZ4SBH_FV::_log("benchmarks::exahype2::ccz4::CCZ4SBH_FV");
13
15
17 double* __restrict__ Q,
18 const tarch::la::Vector<Dimensions, double>& volumeCentre,
20 bool gridIsConstructed
21) {
22 logTraceInWith3Arguments("initialCondition(...)", volumeCentre, volumeH, gridIsConstructed);
23
24 applications::exahype2::ccz4::ApplyTwoPunctures(Q, volumeCentre, 0, twoPunctures, not gridIsConstructed);
25
26 logTraceOut("initialCondition(...)");
27}
28
30 assertion(timeStepSize <= getAdmissibleTimeStepSize());
31 _admissibleTimeStepSize = timeStepSize;
32}
33
36) {
37 return isCellOverlappingWithBHImpactArea(marker.x(), marker.h());
38}
39
42) {
43 if (isCellOverlappingWithBHImpactArea(marker)) {
44 bool result = true;
45 for (int d = 0; d < Dimensions; d++) {
46 tarch::la::Vector<Dimensions, double> neighbourCellCentre = marker.x();
47
48 neighbourCellCentre(d) = marker.x()(d) - marker.h()(d);
49 result &= isCellOverlappingWithBHImpactArea(neighbourCellCentre, marker.h());
50
51 neighbourCellCentre(d) = marker.x()(d) + marker.h()(d);
52 result &= isCellOverlappingWithBHImpactArea(neighbourCellCentre, marker.h());
53 }
54 return result;
55 } else {
56 return false;
57 }
58}
59
61 const peano4::datamanagement::CellMarker& marker, int faceNumber
62) {
63 if (isCellOverlappingWithBHImpactArea(marker)) {
64 const int normal = faceNumber % Dimensions;
65 tarch::la::Vector<Dimensions, double> adjacentCellCentre = marker.x();
66 adjacentCellCentre(normal) += faceNumber >= Dimensions ? marker.h()(normal) : -marker.h()(normal);
67 return isCellOverlappingWithBHImpactArea(adjacentCellCentre, marker.h());
68 } else {
69 return false;
70 }
71}
72
75) {
76 const int normal = marker.getSelectedFaceNumber() % Dimensions;
77
78 tarch::la::Vector<Dimensions, double> leftCellCentre = marker.x();
79 tarch::la::Vector<Dimensions, double> rightCellCentre = marker.x();
80
81 leftCellCentre(normal) -= 0.5 * marker.h()(normal);
82 rightCellCentre(normal) += 0.5 * marker.h()(normal);
83
84 return isCellOverlappingWithBHImpactArea(leftCellCentre, marker.h())
85 and isCellOverlappingWithBHImpactArea(rightCellCentre, marker.h());
86}
87
90) {
91 const int normal = marker.getSelectedFaceNumber() % Dimensions;
92
93 tarch::la::Vector<Dimensions, double> leftCellCentre = marker.x();
94 tarch::la::Vector<Dimensions, double> rightCellCentre = marker.x();
95
96 leftCellCentre(normal) -= 0.5 * marker.h()(normal);
97 rightCellCentre(normal) += 0.5 * marker.h()(normal);
98
99 return isCellOverlappingWithBHImpactArea(leftCellCentre, marker.h())
100 or isCellOverlappingWithBHImpactArea(rightCellCentre, marker.h());
101}
102
108
110 double globalMinTimeStamp, double globalMaxTimeStamp, double globalMinTimeStepSize, double globalMaxTimeStepSize
111) {
112 AbstractCCZ4SBH_FV::startTimeStep(
113 globalMinTimeStamp, globalMaxTimeStamp, globalMinTimeStepSize, globalMaxTimeStepSize
114 );
115
116 _numberOfPatches = 0;
117}
118
120 AbstractCCZ4SBH_FV::finishTimeStep();
121
122 logInfo("finishTimeStep()", "number of patches on this rank=" << _numberOfPatches);
123}
124
126 tarch::multicore::Lock lock(_semaphore);
127 _numberOfPatches++;
128}
#define assertion(expr)
#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())
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:19
static bool isOneAdjacentCellOverlappingWithBHImpactArea(const peano4::datamanagement::FaceMarker &marker)
virtual void initialCondition(double *__restrict__ Q, const tarch::la::Vector< Dimensions, double > &volumeCentre, const tarch::la::Vector< Dimensions, double > &volumeH, bool gridIsConstructed) override
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:18
Log Device.
Definition Log.h:516
Create a lock around a boolean semaphore region.
Definition Lock.h:19
TP::TwoPunctures * twoPunctures
Scalar norm2(const Vector< Size, Scalar > &vector)
Computes the 2-norm of the vector, i.e.
Provide information about selected face.
Definition FaceMarker.h:35
Simple vector class.
Definition Vector.h:134