26#ifndef SET_FREE_ENERGY_WALL_BOUNDARY_2D_HH
27#define SET_FREE_ENERGY_WALL_BOUNDARY_2D_HH
42template<
typename T,
typename DESCRIPTOR>
44 int material, T alpha, T kappa1, T kappa2, T h1, T h2,
int latticeNumber)
47 alpha, kappa1, kappa2, h1, h2, latticeNumber);
51template<
typename T,
typename DESCRIPTOR>
53 T alpha, T kappa1, T kappa2, T h1, T h2,
int latticeNumber)
57 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<T,DESCRIPTOR>(sLattice, std::forward<
decltype(indicator)>(indicator), _overlap);
95template<
typename T,
typename DESCRIPTOR>
97 int material, T alpha, T kappa1, T kappa2, T kappa3, T h1, T h2, T h3,
int latticeNumber)
100 alpha, kappa1, kappa2, kappa3, h1, h2, h3, latticeNumber);
104template<
typename T,
typename DESCRIPTOR>
106 T alpha, T kappa1, T kappa2, T kappa3, T h1, T h2, T h3,
int latticeNumber)
109 int _overlap = indicator->getSuperGeometry().getOverlap();
111 bool includeOuterCells =
false;
112 if (indicator->getSuperGeometry().getOverlap() == 1) {
113 includeOuterCells =
true;
114 clout <<
"WARNING: overlap == 1, boundary conditions set on overlap despite unknown neighbor materials" << std::endl;
117 if (latticeNumber==1) {
118 addend = 1./(alpha*alpha) * ( (h1/kappa1) + (h2/kappa2) + (h3/kappa3) );
120 else if (latticeNumber==2) {
121 addend = 1./(alpha*alpha) * ( (h1/kappa1) + (-h2/kappa2) );
123 else if (latticeNumber==3) {
124 addend = 1./(alpha*alpha) * ( (h3/kappa3) );
126 for (
int iCloc = 0; iCloc < sLattice.
getLoadBalancer().size(); ++iCloc) {
127 setFreeEnergyWallBoundary<T,DESCRIPTOR>(sLattice.
getBlock(iCloc),
128 indicator->getBlockIndicatorF(iCloc), addend, latticeNumber, includeOuterCells);
131 addPoints2CommBC<T,DESCRIPTOR>(sLattice, std::forward<
decltype(indicator)>(indicator), _overlap);
137template<
typename T,
typename DESCRIPTOR>
139 T addend,
int latticeNumber,
bool includeOuterCells)
141 using namespace boundaryhelper;
144 const int margin = includeOuterCells ? 0 : 1;
145 std::vector<int> discreteNormal(3, 0);
146 blockGeometryStructure.forSpatialLocations([&](
auto iX,
auto iY) {
147 if (blockGeometryStructure.getNeighborhoodRadius({iX, iY}) >= margin
148 && indicator(iX, iY)) {
149 discreteNormal = blockGeometryStructure.getStatistics().getType(iX,iY);
150 if (discreteNormal[1]!=0 || discreteNormal[2]!=0) {
151 if (latticeNumber == 1) {
152 block.template defineDynamics<BounceBackBulkDensity>({iX,iY});
155 block.template defineDynamics<FreeEnergyWallDynamics>({iX,iY});
160 promisePostProcessorForNormal<T,DESCRIPTOR,FreeEnergyWallProcessor2D>(
162 block.
get(iX, iY).template setField<olb::descriptors::ADDEND>(addend);
164 if(latticeNumber == 1){
167 promisePostProcessorForNormal<T,DESCRIPTOR, FreeEnergyChemPotBoundaryProcessor2DA>(
172 promisePostProcessorForNormal<T,DESCRIPTOR, FreeEnergyChemPotBoundaryProcessor2DB>(
Base block indicator functor (discrete)
BlockGeometry< T, 2 > & 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.
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 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.