25#ifndef DYNAMICS_DYNAMICS_H
26#define DYNAMICS_DYNAMICS_H
47template <
typename T,
typename DESCRIPTOR>
62template <
typename T,
typename DESCRIPTOR>
71template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
75 std::conditional_t< (DESCRIPTOR::d == 3 && DESCRIPTOR::q == 7)
76 || (DESCRIPTOR::d == 2 && DESCRIPTOR::q == 5),
83template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
97template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
107template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::ExternalVelocityTuple>
122template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
137template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
147template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
154template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
164template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
179template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
192template <
typename T,
typename DESCRIPTOR,
typename DYNAMICS,
typename MOMENTA>
199 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
203 template <
typename M>
206 std::type_index
id()
override {
211 return block.template getData<OperatorParameters<CombinedRLBdynamics>>();
214 template <CONCEPT(MinimalCell) CELL,
typename PARAMETERS,
typename V=
typename CELL::value_t>
217 MomentaF().computeAllMomenta(cell,rho,u,pi);
219 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
220 cell[iPop] =
typename CORRECTED_DYNAMICS::EquilibriumF().compute(iPop, rho, u)
224 return typename CORRECTED_DYNAMICS::CollisionO().apply(cell,
parameters);
228 return typename CORRECTED_DYNAMICS::EquilibriumF().compute(iPop, rho, u);
232 return "CombinedRLBdynamics<" + CORRECTED_DYNAMICS().getName() +
">";
238template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
250template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
265template <
typename T,
typename DESCRIPTOR>
284template <
typename T,
typename DESCRIPTOR>
303template <
typename T,
typename DESCRIPTOR>
315template <
typename T,
typename DESCRIPTOR>
324template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::PoissonTuple>
333template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::P1Tuple>
342template <
typename T,
typename DESCRIPTOR>
346 momenta::BulkDensity,
347 momenta::ZeroMomentum,
349 momenta::DefineSeparately
354 std::type_index
id()
override {
359 return block.template getData<OperatorParameters<ZeroDistributionDynamics>>();
362 template <
typename CELL,
typename PARAMETERS,
typename V=
typename CELL::value_t>
364 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
365 cell[iPop] = -descriptors::t<T,DESCRIPTOR>(iPop);
375 return "ZeroDistributionDynamics";
379template <
typename T,
typename DESCRIPTOR,
typename MOMENTA>
392template <
typename T,
typename DESCRIPTOR>
405template <
typename T,
typename DESCRIPTOR>
418template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::BulkTuple>
420 using MomentaF =
typename MOMENTA::template type<DESCRIPTOR>;
424 std::type_index
id()
override {
429 return block.template getData<OperatorParameters<ForcedVANSBGKdynamics>>();
434 T porosity = cell.template getField<descriptors::POROSITY>();
435 MomentaF().computeVANSRhoU(cell, rho, u, &porosity);
436 auto force = cell.template getFieldPointer<descriptors::FORCE>();
437 for (
int iVel=0; iVel < DESCRIPTOR::d; ++iVel) {
438 u[iVel] += force[iVel] * T{0.5};
443 T porosity = cell.template getField<descriptors::POROSITY>();
444 MomentaF().computeVANSRhoU(cell, rho, u, &porosity);
445 auto force = cell.template getFieldPointer<descriptors::FORCE>();
446 for (
int iVel=0; iVel<DESCRIPTOR::d; ++iVel) {
447 u[iVel] += force[iVel] * T{0.5};
451 template <
typename CELL,
typename PARAMETERS,
typename V=
typename CELL::value_t>
453 V rho, u[DESCRIPTOR::d];
454 V porosity = cell.template getField<descriptors::POROSITY>();
455 MomentaF().computeVANSRhoU(cell, rho, u, &porosity);
456 auto force = cell.template getFieldPointer<descriptors::FORCE>();
457 for (
int iVel=0; iVel < DESCRIPTOR::d; ++iVel) {
458 u[iVel] += force[iVel] * V{0.5};
462 const auto omega =
parameters.template get<descriptors::OMEGA>();
465 return {rho / porosity, uSqr * porosity * porosity};
Platform-abstracted block lattice for external access and inter-block interaction.
Regularized BGK collision followed by any other Dynamics.
AbstractParameters< T, DESCRIPTOR > & getParameters(BlockLattice< T, DESCRIPTOR > &block) override
Parameters access for legacy post processors.
std::string getName() const override
Return human-readable name.
typename MOMENTA::template type< DESCRIPTOR > MomentaF
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const override any_platform
Return iPop equilibrium for given first and second momenta.
CellStatistic< V > apply(CELL &cell, PARAMETERS ¶meters) any_platform
typename CORRECTED_DYNAMICS::parameters parameters
std::type_index id() override
Expose unique type-identifier for RTTI.
Highest-level interface to read-only Cell data.
Dynamics combination rule implementing the forcing scheme by Shan and Chen.
Instantiation of Momenta tuples which define the computation and definition of momenta in a specific ...
Descriptor for all types of 2D and 3D lattices.
Interface for post-processing steps – header file.
File provides a generic interface for the computation and definition of momenta (density,...
Tuple< ZeroDensity, ZeroMomentum, ZeroStress, DefineSeparately > None
Tuple< FixedDensity, FixedVelocityMomentumGeneric, ZeroStress, DefineSeparately > EquilibriumBoundaryTuple
Velocity and density are stored in external fields.
Tuple< BulkDensity, FixedVelocityMomentum, BulkStress, DefineUSeparately > ExternalVelocityTuple
The Velocity is stored in descriptors::VELOCITY (and computed e.g.
Top level namespace for all of OpenLB.
Interface for post-processing steps – header file.
Dynamic access interface for FIELD-valued parameters.
Return value of any collision.
VANS BGK collision step with external force.
CellStatistic< V > apply(CELL &cell, PARAMETERS ¶meters)
void computeU(ConstCell< T, DESCRIPTOR > &cell, T u[DESCRIPTOR::d]) const override
Compute fluid velocity.
typename MOMENTA::template type< DESCRIPTOR > MomentaF
AbstractParameters< T, DESCRIPTOR > & getParameters(BlockLattice< T, DESCRIPTOR > &block) override
Parameters access for legacy post processors.
std::type_index id() override
Expose unique type-identifier for RTTI.
void computeRhoU(ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d]) const override
Compute fluid velocity and particle density.
Models a density sink by enforcing a zero distribution on the cell.
AbstractParameters< T, DESCRIPTOR > & getParameters(BlockLattice< T, DESCRIPTOR > &block) override
Parameters access for legacy post processors.
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const any_platform override
Return iPop equilibrium for given first and second momenta.
CellStatistic< V > apply(CELL &cell, PARAMETERS ¶meters) any_platform
std::string getName() const override
Return human-readable name.
std::type_index id() override
Expose unique type-identifier for RTTI.
Nguyen-Ladd Velocity Correction using momenta-defined velocity.
Override COLLISION parameter OMEGA with inverse of cell field TAU_EFF.
Dynamics constructed as a tuple of momenta, equilibrium and collision.
Dynamics combination rule implementing the forcing scheme by Guo et al.
Dynamics combination rule implementing the forcing scheme by Kupershtokh et al.
Dynamics combination rule implementing the forcing scheme by Guo et al. with barycentric velocity.
static void addExternalForce(CELL &cell, const RHO &rho, const U &u, const OMEGA &omega, const FORCE &force) any_platform
Add a force term after BGK collision.
static V bgkCollision(CELL &cell, const RHO &rho, const VELOCITY &u, const OMEGA &omega) any_platform
BGK collision step.
Standard computation for density in the bulk as zeroth moment of the population.
The momenta are defined one after the other.
The density is fixed and stored in the external field RHO.
Momentum is zero at solid material.
The stress is always zero.
Compute number of elements of a symmetric d-dimensional tensor.
Set of functions commonly used in LB computations – header file.