23#ifndef SET_FREE_ENERGY_WALL_BOUNDARY_3D_HH
24#define SET_FREE_ENERGY_WALL_BOUNDARY_3D_HH
41template<
typename T,
typename DESCRIPTOR>
43 T alpha, T kappa1, T kappa2, T h1, T h2,
int latticeNumber)
46 alpha, kappa1, kappa2, h1, h2, latticeNumber);
51template<
typename T,
typename DESCRIPTOR>
53 T alpha, T kappa1, T kappa2, T h1, T h2,
int latticeNumber)
56 bool includeOuterCells =
false;
58 if (indicator->getSuperGeometry().getOverlap() == 1) {
59 includeOuterCells =
true;
60 clout <<
"WARNING: overlap == 1, boundary conditions set on overlap despite unknown neighbor materials" << std::endl;
63 if (latticeNumber==1) {
64 addend = 1./(alpha*alpha) * ( (h1/kappa1) + (h2/kappa2) );
66 else if (latticeNumber==2) {
67 addend = 1./(alpha*alpha) * ( (h1/kappa1) + (-h2/kappa2) );
69 else if (latticeNumber==3) {
70 addend = 1./(alpha*alpha) * ( (h1/kappa1) + (h2/kappa2) );
72 for (
int iCloc = 0; iCloc < sLattice.
getLoadBalancer().size(); ++iCloc) {
73 setFreeEnergyWallBoundary<T,DESCRIPTOR>(sLattice.
getBlock(iCloc),
74 indicator->getBlockIndicatorF(iCloc), addend, latticeNumber, includeOuterCells);
77 addPoints2CommBC(sLattice, std::forward<
decltype(indicator)>(indicator), _overlap);
97template<
typename T,
typename DESCRIPTOR>
99 T alpha, T kappa1, T kappa2, T kappa3, T h1, T h2,T h3,
int latticeNumber)
102 alpha, kappa1, kappa2, kappa3, h1, h2, h3, latticeNumber);
107template<
typename T,
typename DESCRIPTOR>
109 T alpha, T kappa1, T kappa2, T kappa3, T h1, T h2, T h3,
int latticeNumber)
112 bool includeOuterCells =
false;
113 int _overlap = indicator->getSuperGeometry().getOverlap();
114 if (indicator->getSuperGeometry().getOverlap() == 1) {
115 includeOuterCells =
true;
116 clout <<
"WARNING: overlap == 1, boundary conditions set on overlap despite unknown neighbor materials" << std::endl;
119 if (latticeNumber==1) {
120 addend = 1./(alpha*alpha) * ( (h1/kappa1) + (h2/kappa2) + (h3/kappa3) );
122 else if (latticeNumber==2) {
123 addend = 1./(alpha*alpha) * ( (h1/kappa1) + (-h2/kappa2) );
125 else if (latticeNumber==3) {
126 addend = 1./(alpha*alpha) * ( (h3/kappa3) );
128 for (
int iCloc = 0; iCloc < sLattice.
getLoadBalancer().size(); ++iCloc) {
129 setFreeEnergyWallBoundary<T,DESCRIPTOR>(sLattice.
getBlock(iCloc),
130 indicator->getBlockIndicatorF(iCloc), addend, latticeNumber, includeOuterCells);
133 addPoints2CommBC(sLattice, std::forward<
decltype(indicator)>(indicator), _overlap);
141template<
typename T,
typename DESCRIPTOR>
143 T addend,
int latticeNumber,
bool includeOuterCells)
145 using namespace boundaryhelper;
148 const int margin = includeOuterCells ? 0 : 1;
149 std::vector<int> discreteNormal(4, 0);
150 blockGeometryStructure.forSpatialLocations([&](
auto iX,
auto iY,
auto iZ) {
151 if (blockGeometryStructure.getNeighborhoodRadius({iX, iY, iZ}) >= margin
152 && indicator(iX, iY, iZ)) {
153 discreteNormal = blockGeometryStructure.getStatistics().getType(iX, iY, iZ,
true);
154 if (discreteNormal[1]!=0 || discreteNormal[2]!=0 || discreteNormal[3]!=0) {
155 if (latticeNumber == 1) {
156 _block.template defineDynamics<BounceBackBulkDensity>({iX,iY,iZ});
159 _block.template defineDynamics<FreeEnergyWallDynamics>({iX,iY,iZ});
164 olb::boundaryhelper::promisePostProcessorForNormal<T,DESCRIPTOR,FreeEnergyWallProcessor3D>(
166 _block.
get(iX, iY, iZ).template setField<olb::descriptors::ADDEND>(addend);
169 if(latticeNumber == 1){
172 promisePostProcessorForNormal<T,DESCRIPTOR,FreeEnergyChemPotBoundaryProcessor3DA>(
177 promisePostProcessorForNormal<T,DESCRIPTOR,FreeEnergyChemPotBoundaryProcessor3DB>(
Base block indicator functor.
BlockGeometry< T, 3 > & getBlockGeometry()
Get underlying block geometry structure.
Platform-abstracted block lattice for external access and inter-block interaction.
virtual void addPostProcessor(std::type_index stage, LatticeR< DESCRIPTOR::d > latticeR, PostProcessorPromise< T, DESCRIPTOR > &&promise)=0
Schedule post processor for application to latticeR in stage.
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
Smart pointer for managing the various ways of passing functors around.
class for marking output with some text
Representation of a statistic for a parallel 2D geometry.
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator(std::vector< int > &&materials)
Returns a material indicator using the given vector of materials.
Base indicator functor (discrete)
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Top level namespace for all of OpenLB.
void addPoints2CommBC(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperIndicatorF2D< T > > &&indicator, int _overlap)
Adds needed Cells to the Communicator _commBC in SuperLattice.
void setFreeEnergyWallBoundary(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 2 > &superGeometry, int material, T alpha, T kappa1, T kappa2, T h1, T h2, int latticeNumber)
Implementation of a wetting boundary condition for the ternary free energy model, consisting of a Bou...
Communication after propagation.