OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA > Class Template Referencefinal

Implementation of the Partially Saturated Method (PSM), see Krüger, Timm, et al. More...

#include <porousBGKdynamics.h>

+ Inheritance diagram for olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >:
+ Collaboration diagram for olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >:

Public Types

using MomentaF = typename MOMENTA::template type<DESCRIPTOR>
 
using EquilibriumF = typename equilibria::SecondOrder::template type<DESCRIPTOR,MOMENTA>
 
using parameters = meta::list<descriptors::OMEGA>
 
- Public Types inherited from olb::dynamics::CustomCollision< T, DESCRIPTOR, MOMENTA >
using value_t = T
 
using descriptor_t = DESCRIPTOR
 
using MomentaF = typename MOMENTA::template type<DESCRIPTOR>
 
- Public Types inherited from olb::Dynamics< T, DESCRIPTOR >
using value_t = T
 
using descriptor_t = DESCRIPTOR
 

Public Member Functions

void setMomentaParameters (decltype(_parameters) parameters)
 
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.
 
void computeU (ConstCell< T, DESCRIPTOR > &cell, T u[DESCRIPTOR::d]) const override
 Compute fluid velocity.
 
void computeRhoU (ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d]) const override
 Compute fluid velocity and particle density.
 
template<typename CELL , typename PARAMETERS , typename V = typename CELL::value_t>
CellStatistic< V > apply (CELL &cell, PARAMETERS &parameters)
 
computeEquilibrium (int iPop, T rho, const T u[DESCRIPTOR::d]) const override
 Return iPop equilibrium for given first and second momenta.
 
std::string getName () const override
 Return human-readable name.
 
- Public Member Functions inherited from olb::dynamics::CustomCollision< T, DESCRIPTOR, MOMENTA >
void initialize (Cell< T, DESCRIPTOR > &cell) override
 Initialize dynamics-specific data for cell.
 
computeRho (ConstCell< T, DESCRIPTOR > &cell) const override
 Compute particle density.
 
void computeJ (ConstCell< T, DESCRIPTOR > &cell, T j[DESCRIPTOR::d]) const override
 Compute fluid momentum.
 
void computeStress (ConstCell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], T pi[util::TensorVal< DESCRIPTOR >::n]) const override
 Compute stress tensor.
 
void computeAllMomenta (ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d], T pi[util::TensorVal< DESCRIPTOR >::n]) const override
 Compute all momenta up to second order.
 
void defineRho (Cell< T, DESCRIPTOR > &cell, T rho) override
 Set particle density.
 
void defineU (Cell< T, DESCRIPTOR > &cell, const T u[DESCRIPTOR::d]) override
 Set fluid velocity.
 
void defineRhoU (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d]) override
 Define fluid velocity and particle density.
 
void defineAllMomenta (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], const T pi[util::TensorVal< DESCRIPTOR >::n]) override
 Define all momenta up to second order.
 
void inverseShiftRhoU (ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d]) const override
 Calculate population momenta s.t. the physical momenta are reproduced by the computeRhoU.
 
- Public Member Functions inherited from olb::Dynamics< T, DESCRIPTOR >
virtual ~Dynamics () any_platform
 
virtual CellStatistic< T > collide (Cell< T, DESCRIPTOR > &cell)
 Perform purely-local collision step on Cell interface (legacy, to be deprecated)
 
void iniEquilibrium (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d])
 Initialize to equilibrium distribution.
 
void iniRegularized (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], const T pi[util::TensorVal< DESCRIPTOR >::n])
 Initialize cell to equilibrium and non-equilibrum part.
 

Static Public Attributes

static constexpr bool is_vectorizable = false
 
static constexpr bool has_parametrized_momenta = true
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename MOMENTA = momenta::BulkTuple>
class olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >

Implementation of the Partially Saturated Method (PSM), see Krüger, Timm, et al.

The Lattice Boltzmann Method. Springer, 2017. (p.447-451)

Definition at line 545 of file porousBGKdynamics.h.

Member Typedef Documentation

◆ EquilibriumF

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
using olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::EquilibriumF = typename equilibria::SecondOrder::template type<DESCRIPTOR,MOMENTA>

Definition at line 551 of file porousBGKdynamics.h.

◆ MomentaF

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
using olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::MomentaF = typename MOMENTA::template type<DESCRIPTOR>

Definition at line 550 of file porousBGKdynamics.h.

◆ parameters

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
using olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::parameters = meta::list<descriptors::OMEGA>

Definition at line 553 of file porousBGKdynamics.h.

Member Function Documentation

◆ apply()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
template<typename CELL , typename PARAMETERS , typename V = typename CELL::value_t>
CellStatistic< V > olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::apply ( CELL & cell,
PARAMETERS & parameters )
inline

Definition at line 599 of file porousBGKdynamics.h.

600 {
601 V omega = parameters.template get<descriptors::OMEGA>();
602 V rho, u[DESCRIPTOR::d], uSqr;
603 MomentaF().computeRhoU(cell, rho, u);
604 auto force = cell.template getField<descriptors::FORCE>();
605 for (int iVel=0; iVel < DESCRIPTOR::d; ++iVel) {
606 u[iVel] += force[iVel] * V{0.5};
607 }
608 auto u_s = cell.template getField<descriptors::VELOCITY_SOLID>();
609
610 V epsilon = V{1} - cell.template getField<descriptors::POROSITY>();
611 if (epsilon < 1e-5) {
612 uSqr = lbm<DESCRIPTOR>::bgkCollision(cell, rho, u, omega);
613 lbm<DESCRIPTOR>::addExternalForce(cell, rho, u, omega, force);
614 }
615 else {
616 V paramA = V{1} / omega - V{0.5};
617 V paramB = (epsilon * paramA) / ((V{1} - epsilon) + paramA);
618 V paramC = (V{1} - paramB);
619
620 V omega_s[DESCRIPTOR::q];
621 V cell_tmp[DESCRIPTOR::q];
622
623 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
624 cell_tmp[iPop] = cell[iPop];
625 omega_s[iPop] = (equilibrium<DESCRIPTOR>::secondOrder(iPop, rho, u_s) - cell[iPop])
626 + (V{1} - omega) * (cell[iPop] - equilibrium<DESCRIPTOR>::secondOrder(iPop, rho, u));
627 }
628
629 uSqr = lbm<DESCRIPTOR>::bgkCollision(cell, rho, u, omega);
630 lbm<DESCRIPTOR>::addExternalForce(cell, rho, u, omega, force);
631
632 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
633 cell[iPop] = cell_tmp[iPop] + paramC * (cell[iPop] - cell_tmp[iPop]);
634 cell[iPop] += paramB * omega_s[iPop];
635 }
636 for (int iVel=0; iVel < DESCRIPTOR::d; ++iVel) {
637 u[iVel] = paramC * u[iVel] + paramB * u_s[iVel];
638 }
639 uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
640 }
641 return {rho, uSqr};
642 }
typename MOMENTA::template type< DESCRIPTOR > MomentaF
meta::list< descriptors::OMEGA > parameters
static V secondOrder(int iPop, const RHO &rho, const U &u, const USQR &uSqr) any_platform
Computation of equilibrium distribution, second order in u.
Definition lbm.h:51
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.
Definition lbm.h:463
static V bgkCollision(CELL &cell, const RHO &rho, const VELOCITY &u, const OMEGA &omega) any_platform
BGK collision step.
Definition lbm.h:290

References olb::lbm< DESCRIPTOR >::addExternalForce(), olb::lbm< DESCRIPTOR >::bgkCollision(), and olb::equilibrium< DESCRIPTOR >::secondOrder().

+ Here is the call graph for this function:

◆ computeEquilibrium()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
T olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::computeEquilibrium ( int iPop,
T rho,
const T u[DESCRIPTOR::d] ) const
inlineoverridevirtual

Return iPop equilibrium for given first and second momenta.

Implements olb::Dynamics< T, DESCRIPTOR >.

Definition at line 644 of file porousBGKdynamics.h.

644 {
645 return EquilibriumF().compute(iPop, rho, u);
646 };
typename equilibria::SecondOrder::template type< DESCRIPTOR, MOMENTA > EquilibriumF

◆ computeRhoU()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
void olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::computeRhoU ( ConstCell< T, DESCRIPTOR > & cell,
T & rho,
T u[DESCRIPTOR::d] ) const
inlineoverridevirtual

Compute fluid velocity and particle density.

Reimplemented from olb::dynamics::CustomCollision< T, DESCRIPTOR, MOMENTA >.

Definition at line 584 of file porousBGKdynamics.h.

585 {
586 MomentaF().computeRhoU(cell, rho, u);
587 T epsilon = 1. - cell.template getField<descriptors::POROSITY>();
588 T omega = _parameters->template get<descriptors::OMEGA>();
589 T paramA = 1 / omega - 0.5;
590 T paramB = (epsilon * paramA) / ((1. - epsilon) + paramA);
591 T paramC = (1. - paramB);
592 for (int iVel=0; iVel < DESCRIPTOR::d; ++iVel) {
593 u[iVel] = paramC * (u[iVel] + cell.template getFieldComponent<descriptors::FORCE>(iVel) * 0.5)
594 + paramB * cell.template getFieldComponent<descriptors::VELOCITY_SOLID>(iVel);
595 }
596 }

◆ computeU()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
void olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::computeU ( ConstCell< T, DESCRIPTOR > & cell,
T u[DESCRIPTOR::d] ) const
inlineoverridevirtual

Compute fluid velocity.

Reimplemented from olb::dynamics::CustomCollision< T, DESCRIPTOR, MOMENTA >.

Definition at line 570 of file porousBGKdynamics.h.

571 {
572 MomentaF().computeU(cell, u);
573 T epsilon = 1. - cell.template getField<descriptors::POROSITY>();
574 T omega = _parameters->template get<descriptors::OMEGA>();
575 T paramA = 1 / omega - 0.5;
576 T paramB = (epsilon * paramA) / ((1. - epsilon) + paramA);
577 T paramC = (1. - paramB);
578 for (int iVel=0; iVel < DESCRIPTOR::d; ++iVel) {
579 u[iVel] = paramC * (u[iVel] + cell.template getFieldComponent<descriptors::FORCE>(iVel) * 0.5)
580 + paramB * cell.template getFieldComponent<descriptors::VELOCITY_SOLID>(iVel);
581 }
582 }

◆ getName()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
std::string olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::getName ( ) const
inlineoverridevirtual

Return human-readable name.

Reimplemented from olb::Dynamics< T, DESCRIPTOR >.

Definition at line 648 of file porousBGKdynamics.h.

648 {
649 return "ForcedPSMBGKdynamics<" + MomentaF().getName() + ">";
650 };

◆ getParameters()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
AbstractParameters< T, DESCRIPTOR > & olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::getParameters ( BlockLattice< T, DESCRIPTOR > & block)
inlineoverridevirtual

Parameters access for legacy post processors.

Implements olb::Dynamics< T, DESCRIPTOR >.

Definition at line 566 of file porousBGKdynamics.h.

566 {
567 return block.template getData<OperatorParameters<ForcedPSMBGKdynamics>>();
568 }

◆ id()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
std::type_index olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::id ( )
inlineoverridevirtual

Expose unique type-identifier for RTTI.

Implements olb::Dynamics< T, DESCRIPTOR >.

Definition at line 562 of file porousBGKdynamics.h.

562 {
563 return typeid(ForcedPSMBGKdynamics);
564 }

◆ setMomentaParameters()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
void olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::setMomentaParameters ( decltype(_parameters) parameters)
inline

Definition at line 558 of file porousBGKdynamics.h.

558 {
559 _parameters = parameters;
560 }

Member Data Documentation

◆ has_parametrized_momenta

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
constexpr bool olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::has_parametrized_momenta = true
staticconstexpr

Definition at line 556 of file porousBGKdynamics.h.

◆ is_vectorizable

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::BulkTuple>
constexpr bool olb::ForcedPSMBGKdynamics< T, DESCRIPTOR, MOMENTA >::is_vectorizable = false
staticconstexpr

Definition at line 555 of file porousBGKdynamics.h.


The documentation for this class was generated from the following file: