MolSim
Loading...
Searching...
No Matches
Functions
BoundaryConditions.h File Reference

Utility (strategy?) functions for applying boundary conditions. More...

#include "objects/Cell.h"
#include "objects/CellContainer.h"
#include "objects/Particle.h"
#include "utils/CellUtils.h"
#include <utility>

Go to the source code of this file.

Functions

bool handleHaloCell (Particle &p, Cell &targetCell, CellContainer *lc)
 Handles the scenario where a particle enters a halo cell. Returns true if the particle is handled and further processing can be skipped, false otherwise.
 
std::pair< HaloLocation, BoundaryConditiondetermineBoundaryCondition (Particle &p, Cell &targetCell, CellContainer *lc)
 Determines the correct halo location and boundary condition for a particle entering a halo cell.
 
void handleOutflowCondition (Particle &p, Cell &targetCell, CellContainer *lc)
 Handles the outflow condition where the particle is deleted upon entering a halo cell.
 
void handleReflectiveCondition (Particle &p, Cell &fromCell, HaloLocation location, CellContainer *lc)
 Handles the reflective condition where the particle is mirrored and moved to the opposite cell.
 
void handlePeriodicCondition (Particle &p, Cell &targetCell, CellContainer *lc)
 Handles the periodic condition where the particle is moved from the halo cell to the appropriate border cell on the other side.
 
void reflectParticle (Particle &p, Cell &fromCell, Cell &toCell, CellContainer *lc, int direction)
 Reflects a particle by mirroring its position and moving it to a new cell.
 
void mirrorGhostParticles (CellContainer *lc)
 Adds ghost particles to the proper halo cells for periodic conditions.
 
void deleteGhostParticles (CellContainer *lc)
 Deletes references to ghost particles from the halo cells (i.e all particle references in halo cells).
 

Detailed Description

Utility (strategy?) functions for applying boundary conditions.

Date
2024-12-02

Function Documentation

◆ deleteGhostParticles()

void deleteGhostParticles ( CellContainer lc)

Deletes references to ghost particles from the halo cells (i.e all particle references in halo cells).

Parameters
lcThe CellContainer we are operating in.

◆ determineBoundaryCondition()

std::pair< HaloLocation, BoundaryCondition > determineBoundaryCondition ( Particle p,
Cell targetCell,
CellContainer lc 
)

Determines the correct halo location and boundary condition for a particle entering a halo cell.

Parameters
pThe particle entering a halo cell.
targetCellThe halo cell which the particle enters.
lcThe CellContainer containing the cell.
Returns
The chosen cardinal direction and the applied boundary condition.

◆ handleHaloCell()

bool handleHaloCell ( Particle p,
Cell targetCell,
CellContainer lc 
)

Handles the scenario where a particle enters a halo cell. Returns true if the particle is handled and further processing can be skipped, false otherwise.

Parameters
pThe particle that has moved.
targetCellThe target cell that needs to be checked.
lcThe CellContainer containing the cell.
Returns
true if the cell is a halo cell and a suitable boundary condition was applied.
false if the cell is not a halo cell or if a suitable boundary condition could not be applied.

◆ handleOutflowCondition()

void handleOutflowCondition ( Particle p,
Cell targetCell,
CellContainer lc 
)

Handles the outflow condition where the particle is deleted upon entering a halo cell.

Parameters
pThe particle entering a halo cell.
targetCellThe halo cell which the particle enters.
lcThe CellContainer containing the cell.

◆ handlePeriodicCondition()

void handlePeriodicCondition ( Particle p,
Cell targetCell,
CellContainer lc 
)

Handles the periodic condition where the particle is moved from the halo cell to the appropriate border cell on the other side.

Parameters
pThe particle entering a halo cell.
targetCellThe cell the particle has moved to before this function is called.
lcThe CellContainer containing the cell.

◆ handleReflectiveCondition()

void handleReflectiveCondition ( Particle p,
Cell fromCell,
HaloLocation  location,
CellContainer lc 
)

Handles the reflective condition where the particle is mirrored and moved to the opposite cell.

Parameters
pThe particle entering a halo cell.
fromCellThe current cell of the particle.
locationThe cardinal direction of the entered halo cell.
lcThe CellContainer containing the cell.

◆ mirrorGhostParticles()

void mirrorGhostParticles ( CellContainer lc)

Adds ghost particles to the proper halo cells for periodic conditions.

Parameters
lcThe CellContainer we are operating in.

◆ reflectParticle()

void reflectParticle ( Particle p,
Cell fromCell,
Cell toCell,
CellContainer lc,
int  direction 
)

Reflects a particle by mirroring its position and moving it to a new cell.

Parameters
pThe particle entering a halo cell.
fromCellThe current cell of the particle. Passed to the getMirrorPosition() function in CellContainer.
toCellThe target cell of the particle. Passed to the getMirrorPosition() function in CellContainer.
lcThe CellContainer containing the cell.
directionThe direction argument passed to the getMirrorPosition() function in CellContainer.