Peano 4
Loading...
Searching...
No Matches
swift2::boundaryconditions Namespace Reference

Functions

template<typename Particle >
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.
 
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.
 
bool isVertexOnGlobalBoundary (const peano4::datamanagement::VertexMarker &marker, const tarch::la::Vector< Dimensions, double > &domainOffset, const tarch::la::Vector< Dimensions, double > &domainSize)
 

Function Documentation

◆ applyFixedBoundaryCondition()

template<typename Particle >
void swift2::boundaryconditions::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.

This routine is usually inserted into your code by the action set swift2.api.boundaryconditions.Fixed. It serves as a proxy to the other applyFixedBoundaryCondition(), i.e. forwards the actual position update computation to this routine, and then takes the updated position, writes it into the particle, and logs the position update within the particle database (so all assertions are still correct).

See also
getUpdateDueToFixedBoundaryCondition()

Definition at line 5 of file FixedBoundary.cpph.

References tarch::la::equals(), getUpdateDueToFixedBoundaryCondition(), tarch::la::min(), and toolbox::particles::assignmentchecks::moveParticle().

Here is the call graph for this function:

◆ getUpdateDueToFixedBoundaryCondition()

std::pair< tarch::la::Vector< Dimensions, double >, tarch::la::Vector< Dimensions, double > > swift2::boundaryconditions::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.

See applyFixedBoundaryCondition() and notably swift2.api.boundaryconditions.Fixed for some context where this routine is used. Please study notably the generic boundary condition discussion of the project. It provides code snippets how to use this routine.

Algorithm

Our boundary condition handling consists of a series of checks:

  • If particles have left the computational domain, we reset them hard to the boundary.
  • If particles are close to the boundary and approach it, we damp their velocity.

Close in the last sentence means that they are within a fraction of relativeDomainHalo of the current particle's mesh size. The damping factor is subject to a linear interpolation, i.e. if a particle sits directly on the boundary and moves outside, we damp its velocity by 0. We set the velocity of 0. If it is relativeDomainHalo of the mesh size away from the boundary and approaches it, we multiply this velocity by 1, i.e. we do not damp it. If it is halfway close to the boundary, we multiply the velocity with 0.5 and therefore damp the approach velocity of the particle.

Parameters
relativeDomainHaloFloating point value between zero and one. If you set it to zero, you disable the velocity damping.
Returns
Tuple of new position and velocity

Definition at line 4 of file FixedBoundary.cpp.

References _log, assertion1, assertion5, tarch::la::greaterEquals(), h, logWarning, and tarch::la::smallerEquals().

Referenced by applyFixedBoundaryCondition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isVertexOnGlobalBoundary()

bool swift2::boundaryconditions::isVertexOnGlobalBoundary ( const peano4::datamanagement::VertexMarker & marker,
const tarch::la::Vector< Dimensions, double > & domainOffset,
const tarch::la::Vector< Dimensions, double > & domainSize )

Definition at line 3 of file Utils.cpp.

References tarch::la::oneGreaterEquals(), and tarch::la::oneSmallerEquals().

Here is the call graph for this function: