24#ifndef PHASE_FIELD_BOUNDARY_DYNAMICS_H
25#define PHASE_FIELD_BOUNDARY_DYNAMICS_H
34template<
typename T,
typename DESCRIPTOR,
typename DYNAMICS,
typename MOMENTA,
int direction,
int orientation>
41 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
44 using parameters =
typename CORRECTED_DYNAMICS::parameters;
49 std::type_index
id()
override {
54 return block.template getData<OperatorParameters<PhaseFieldInletDynamics>>();
57 template <
typename CELL,
typename PARAMETERS,
typename V=
typename CELL::value_t>
69 V missingPhi = phi - 1.;
70 V missingWeightSum = 0;
71 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
73 bool contains =
false;
74 for(
unsigned i=0; i < missingIndices.size(); i++){
75 if(missingIndices[i] == (
unsigned)iPop){
83 missingPhi -= cell[iPop];
87 for (
unsigned iPop=0; iPop < missingIndices.size(); ++iPop) {
91 return typename CORRECTED_DYNAMICS::CollisionO().apply(cell,
parameters);
99 return "PhaseFieldInletDynamics<" + CORRECTED_DYNAMICS().getName() +
">";
107template<
typename T,
typename DESCRIPTOR,
typename DYNAMICS,
typename MOMENTA,
int direction,
int orientation>
109 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
115 std::type_index
id()
override {
120 return block.template getData<OperatorParameters<PhaseFieldConvectiveOutletDynamics>>();
125 template <
typename CELL,
typename PARAMETERS,
typename V=
typename CELL::value_t>
127 V phi =
MomentaF().computeRho(cell);
139 return "PhaseFieldConvectiveOutletDynamics<" + DYNAMICS().getName() +
">";
144template <
typename T,
typename DESCRIPTOR>
152template<
typename T,
typename DESCRIPTOR>
159template<
typename T,
typename DESCRIPTOR>
162 OstreamManager clout(std::cout,
"setConvectivePhaseFieldBoundary");
164 for (
int iCloc = 0; iCloc < sLattice.
getLoadBalancer().size(); iCloc++) {
171 communicator.template requestField<descriptors::POPULATION>();
174 communicator.requestOverlap(_overlap, neighborIndicator);
175 communicator.exchangeRequests();
181template<
typename T,
typename DESCRIPTOR>
184 using namespace boundaryhelper;
186 const int margin = 1;
187 std::vector<int> discreteNormal(3,0);
188 blockGeometryStructure.forSpatialLocations([&](
auto iX,
auto iY) {
189 if (blockGeometryStructure.getNeighborhoodRadius({iX, iY}) >= margin && indicator(iX, iY)) {
190 discreteNormal = blockGeometryStructure.getStatistics().getType(iX, iY);
191 if ((
abs(discreteNormal[1]) +
abs(discreteNormal[2])) == 1) {
192 block.addPostProcessor(
194 promisePostProcessorForNormal<T,DESCRIPTOR,FlatConvectivePhaseFieldPostProcessorA2D>(
196 block.addPostProcessor(
198 promisePostProcessorForNormal<T,DESCRIPTOR,FlatConvectivePhaseFieldPostProcessorB2D>(
200 block.template defineDynamics<NoCollideDynamicsExternalVelocity>({iX, iY});
202 throw std::runtime_error(
"No valid discrete normal found. This BC is not suited for curved walls.");
Base block indicator functor (discrete)
BlockGeometry< T, 2 > & getBlockGeometry()
Get underlying block geometry structure.
Highest-level interface to read-only Cell data.
Smart pointer for managing the various ways of passing functors around.
class for marking output with some text
Implementation of Dirichlet boundary condition for the order parameter.
typename CORRECTED_DYNAMICS::EquilibriumF EquilibriumF
void computeEquilibrium(ConstCell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], T fEq[DESCRIPTOR::q]) const override
Return iPop equilibrium for given first and second momenta.
typename MOMENTA::template type< DESCRIPTOR > MomentaF
std::type_index id() override
Expose unique type-identifier for RTTI.
AbstractParameters< T, DESCRIPTOR > & getParameters(BlockLattice< T, DESCRIPTOR > &block) override
Parameters access for legacy post processors.
CellStatistic< V > collide(CELL &cell, PARAMETERS ¶meters) any_platform
std::string getName() const override
Return human-readable name.
typename CORRECTED_DYNAMICS::parameters parameters
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.
SuperCommunicator< T, SuperLattice > & getCommunicator(STAGE stage=STAGE())
Return communicator for given communication stage.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
constexpr T t(unsigned iPop, tag::CUM) any_platform
Tuple< BulkDensity, FixedVelocityMomentum, BulkStress, DefineUSeparately > ExternalVelocityTuple
The Velocity is stored in descriptors::VELOCITY (and computed e.g.
constexpr auto subIndexOutgoing() any_platform
Compute opposites of wall-incoming population indices.
auto normSqr(const ARRAY_LIKE &u) any_platform
Compute norm square of a d-dimensional vector.
Top level namespace for all of OpenLB.
std::conditional_t< D==2, SuperIndicatorBoundaryNeighbor2D< T >, SuperIndicatorBoundaryNeighbor3D< T > > SuperIndicatorBoundaryNeighbor
std::enable_if_t< std::is_arithmetic< T >::type::value, T > abs(T x) any_platform
void setConvectivePhaseFieldBoundary(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 2 > &superGeometry, int material)
Initialising the setConvectivePhaseFieldBoundary function on the superLattice domain.
Dynamic access interface for FIELD-valued parameters.
Return value of any collision.
Implementation of convective boundary condition for the order parameter.
typename MOMENTA::template type< DESCRIPTOR > MomentaF
void computeEquilibrium(ConstCell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], T fEq[DESCRIPTOR::q]) const override
Return iPop equilibrium for given first and second momenta.
CellStatistic< V > collide(CELL &cell, PARAMETERS ¶meters) any_platform
static constexpr bool is_vectorizable
std::string getName() const override
Return human-readable name.
typename DYNAMICS::EquilibriumF EquilibriumF
std::type_index id() override
Expose unique type-identifier for RTTI.
AbstractParameters< T, DESCRIPTOR > & getParameters(BlockLattice< T, DESCRIPTOR > &block) override
Parameters access for legacy post processors.
Dynamics constructed as a tuple of momenta, equilibrium and collision.
Communication after collision.
Communication after propagation.