Palabos-OnLatticeBoundaryCondition
The boundary conditions implemented in Palabos can be generally divided in two categories
OnLatticeBoundaryCondition, mainly implemented in src/boundaryCondition/OffLatticeModel, mainly implemented in src/offLattice/
This article mainly focuses on the OnLatticeBoundaryCondition.
Basic structure
- Here follows some key points of the structure:
OnLatticeBoundaryCondition2Dis the base class, and is the one that is "visible" to users. It provides the functions to be called directly by users likesetVelocityConditionOnBlockBoundaries()setPressureConditionOnBlockBoundaries()
- The instantiator
BoundaryConditionInstantiator2Dinherits fromOnLatticeBoundaryCondition2D- The instantiator to me is a glue that binds the implementation to the user interface.
- The instantiator helps hide the detailed boundary implementation from the user. It provides specific boundary setup corresponding to different boundary positions in the domain.
- It integrates the boundary condition to the main simulation setup by setting a composite dynamics using
setCompositeDynamics(), and may (not) integrate a boundary functional throughintegrateProcessingFunctional() - The instantiator
BoundaryConditionInstantiator2Dtakes a Boundary Manager as one of its template parameters, and such a Boundary Manager is in charge of actual boundary operations.
creatXXXBoundaryCondition2D()is a factory funtion that returns an instance ofBoundaryConditionInstantiator2D. One may find examples stored in/src/boundaryCondition/boundaryCondition2DlikecreateLocalBoundaryCondition2D()createDynamicsBasedLocalBoundaryCondition2D()createEquilibriumBoundaryCondition2D()createInterpBoundaryCondition2D()
createZouHeBoundaryCondition2D()saved separately in/src/boundaryCondition/zouHeBoundary2D.h- The Boundary Manager is the core of boundary condition implementation.
- The boundary instantiator makes use of the boundary manager by taking it as a template parameter.
- There are two different ways of implementing the boundary condition:
- create a composite dynamics
- create a processor (boundary functional)
- The boundary condition normally has both a dynamics class (
XXXBoundaryDynamics) and a processor class (XXXBoundaryFunctional2D)
Take zouHeBoundary2D as an example
- The factory functions are in
/src/boundaryCondition/zouHeBoundary2D.hnamedcreateZouHeBoundaryCondition2D()createDynamicsBasedZouHeBoundaryCondition2D()
- Each factory function returns a instance of
BoundaryConditionInstantiator2Dwith different Boundary ManagersWrappedZouHeBoundaryManager2DZouHeBoundaryManager2D
- Each Boundary Manager has a series of functions named
getVelocityBoundaryDynamics(),getVelocityBoundaryFunctional()and so on. Take the velocity boundary condition as an example, it returns (or not) eitherZouHeVelocityDynamics, orWrappedLocalBoundaryFunctional2D
- No matter how, they all leads to the
ZouHeClosurefunction saved in/src/boundaryCondition/zouHeDynamics.hh, where the core of the algorithm sits.