Peano 4
Loading...
Searching...
No Matches
FixedBoundary.cpph
Go to the documentation of this file.
2
3
4template <typename Particle>
6 Particle& particle,
10 double relativeDomainHalo,
11 int treeId
12) {
13 const double maxDt = particle.getSpecies().getMaxTimeStepSize();
14 const double maxV = particle.getSpecies().getMaxVelocity();
15
16 const tarch::la::Vector<Dimensions, double> oldX = particle.getX();
17 auto [newX, newV] = getUpdateDueToFixedBoundaryCondition(
18 particle.getX(),
19 particle.getV(),
20 maxV,
21 maxDt,
22 tarch::la::min( marker.h() ),
23 domainOffset,
24 domainSize,
25 relativeDomainHalo
26 );
27
28 if ( not tarch::la::equals(particle.getX(),newX) ) {
30 toolbox::particles::assignmentchecks::pruneTypeName<Particle>(),
31 particle.getX(),
32 newX,
33 treeId,
34 "swift2::boundaryconditions::applyFixedBoundaryCondition()"
35 );
36 }
37
38 particle.setX( newX );
39 particle.setV( newV );
40}
std::pair< tarch::la::Vector< Dimensions, double >, tarch::la::Vector< Dimensions, double > > getUpdateDueToFixedBoundaryCondition(const tarch::la::Vector< Dimensions, double > &particleX, const tarch::la::Vector< Dimensions, double > &particleV, double maxV, double maxDt, double h, const tarch::la::Vector< Dimensions, double > &domainOffset, const tarch::la::Vector< Dimensions, double > &domainSize, double relativeDomainHalo)
Determine updated position and velocity due to boundary conditions.
void applyFixedBoundaryCondition(Particle &particle, const peano4::datamanagement::VertexMarker &marker, const tarch::la::Vector< Dimensions, double > &domainOffset, const tarch::la::Vector< Dimensions, double > &domainSize, double relativeDomainHalo, int treeId)
Apply fixed boundary conditions to particle.
bool equals(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares to matrices on equality by means of a numerical accuracy.
Scalar min(const Vector< Size, Scalar > &vector)
Returns the element with minimal value (NOT absolute value).
void moveParticle(const std::string &particleName, const tarch::la::Vector< Dimensions, double > &oldParticleX, const tarch::la::Vector< Dimensions, double > &newParticleX, int treeId, const std::string &trace)
Record the movement of a particle.
Vertex marker to provide information about selected vertex.
Simple vector class.
Definition Vector.h:134