OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA > Struct Template Referencefinal

#include <advectionDiffusionDynamics.h>

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

Public Types

using MomentaF = typename MOMENTA::template type<DESCRIPTOR>
 
using EquilibriumF = typename equilibria::FirstOrder::template type<DESCRIPTOR,MOMENTA>
 
using parameters
 
template<typename NEW_T >
using exchange_value_type = TotalEnthalpyAdvectionDiffusionTRTdynamics<NEW_T,DESCRIPTOR,MOMENTA>
 
template<typename M >
using exchange_momenta = TotalEnthalpyAdvectionDiffusionTRTdynamics<T,DESCRIPTOR,M>
 
- Public Types inherited from olb::dynamics::CustomCollision< T, DESCRIPTOR, momenta::AdvectionDiffusionBulkTuple >
using value_t
 
using descriptor_t
 
using MomentaF
 
- Public Types inherited from olb::Dynamics< T, DESCRIPTOR >
using value_t = T
 
using descriptor_t = DESCRIPTOR
 

Public Member Functions

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.
 
template<typename V , typename PARAMETERS , typename ENTHALPY >
computeTemperature (const PARAMETERS &parameters, const ENTHALPY &enthalpy) const any_platform
 
template<typename V , typename PARAMETERS , typename ENTHALPY >
computeLiquidFraction (const PARAMETERS &parameters, const ENTHALPY &enthalpy) const any_platform
 
template<typename V , typename PARAMETERS , typename RHO , typename U >
computeEquilibrium (int iPop, const PARAMETERS &parameters, RHO &rho, U &u) const any_platform
 
template<typename CELL , typename PARAMETERS , typename V = typename CELL::value_t>
CellStatistic< V > collide (CELL &cell, PARAMETERS &parameters) any_platform
 
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.
 
std::string getName () const override
 Return human-readable name.
 
- Public Member Functions inherited from olb::dynamics::CustomCollision< T, DESCRIPTOR, momenta::AdvectionDiffusionBulkTuple >
void initialize (Cell< T, DESCRIPTOR > &cell) override
 Initialize dynamics-specific data for cell.
 
computeRho (ConstCell< T, DESCRIPTOR > &cell) const override
 Compute particle density.
 
void computeU (ConstCell< T, DESCRIPTOR > &cell, T u[DESCRIPTOR::d]) const override
 Compute fluid velocity.
 
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 computeRhoU (ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d]) const override
 Compute fluid velocity and particle density.
 
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
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
struct olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >

Definition at line 478 of file advectionDiffusionDynamics.h.

Member Typedef Documentation

◆ EquilibriumF

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
using olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::EquilibriumF = typename equilibria::FirstOrder::template type<DESCRIPTOR,MOMENTA>

Definition at line 482 of file advectionDiffusionDynamics.h.

◆ exchange_momenta

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
template<typename M >
using olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::exchange_momenta = TotalEnthalpyAdvectionDiffusionTRTdynamics<T,DESCRIPTOR,M>

Definition at line 500 of file advectionDiffusionDynamics.h.

◆ exchange_value_type

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
template<typename NEW_T >
using olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::exchange_value_type = TotalEnthalpyAdvectionDiffusionTRTdynamics<NEW_T,DESCRIPTOR,MOMENTA>

Definition at line 497 of file advectionDiffusionDynamics.h.

◆ MomentaF

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
using olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::MomentaF = typename MOMENTA::template type<DESCRIPTOR>

Definition at line 481 of file advectionDiffusionDynamics.h.

◆ parameters

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
using olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::parameters
Initial value:
meta::list<
descriptors::OMEGA,
collision::TRT::MAGIC,
TotalEnthalpy::T_S,
TotalEnthalpy::T_L,
TotalEnthalpy::CP_S,
TotalEnthalpy::CP_L,
TotalEnthalpy::LAMBDA_S,
TotalEnthalpy::LAMBDA_L,
TotalEnthalpy::L
>

Definition at line 484 of file advectionDiffusionDynamics.h.

Member Function Documentation

◆ collide()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
template<typename CELL , typename PARAMETERS , typename V = typename CELL::value_t>
CellStatistic< V > olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::collide ( CELL & cell,
PARAMETERS & parameters )
inline

Definition at line 599 of file advectionDiffusionDynamics.h.

599 {
600 using namespace TotalEnthalpy;
601
602 const V lambda_s = parameters.template get<LAMBDA_S>();
603 const V lambda_l = parameters.template get<LAMBDA_L>();
604 const V cp_s = parameters.template get<CP_S>();
605 const V cp_l = parameters.template get<CP_L>();
606 const V cp_ref = V{2} * cp_s * cp_l / (cp_s + cp_l);
607
608 const V enthalpy = MomentaF().computeRho( cell );
609 const V liquid_fraction = computeLiquidFraction<V>( parameters, enthalpy );
610 const V lambda = (V{1} - liquid_fraction) * lambda_s + liquid_fraction * lambda_l;
611 const V omega = V{1} / ( lambda / cp_ref * descriptors::invCs2<T,DESCRIPTOR>() + V{0.5} );
612 const V magic_parameter = parameters.template get<collision::TRT::MAGIC>();
613 const V omega2 = V{1} / (magic_parameter/(V{1}/omega-V{0.5})+V{0.5});
614
615 const auto u = cell.template getField<descriptors::VELOCITY>();
616
617 const V uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
618
619 V fPlus[DESCRIPTOR::q], fMinus[DESCRIPTOR::q] { };
620 V fEq[DESCRIPTOR::q], fEqPlus[DESCRIPTOR::q], fEqMinus[DESCRIPTOR::q] { };
621
622 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
623 fPlus[iPop] = 0.5 * ( cell[iPop] + cell[descriptors::opposite<DESCRIPTOR>(iPop)] );
624 fMinus[iPop] = 0.5 * ( cell[iPop] - cell[descriptors::opposite<DESCRIPTOR>(iPop)] );
625 fEq[iPop] = computeEquilibrium<V>(iPop, parameters, enthalpy, u);
626 }
627
628 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
629 fEqPlus[iPop] = 0.5 * ( fEq[iPop] + fEq[descriptors::opposite<DESCRIPTOR>(iPop)] );
630 fEqMinus[iPop] = 0.5 * ( fEq[iPop] - fEq[descriptors::opposite<DESCRIPTOR>(iPop)] );
631 }
632
633 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
634 cell[iPop] -= omega2 * (fPlus[iPop] - fEqPlus[iPop]) + omega * (fMinus[iPop] - fEqMinus[iPop]);
635 }
636
637 return {enthalpy, uSqr};
638 };
constexpr T invCs2() any_platform
Definition functions.h:107
constexpr int opposite(unsigned iPop) any_platform
Definition functions.h:95
auto normSqr(const ARRAY_LIKE &u) any_platform
Compute norm square of a d-dimensional vector.
Definition util.h:145
V computeEquilibrium(int iPop, const PARAMETERS &parameters, RHO &rho, U &u) const any_platform
V computeLiquidFraction(const PARAMETERS &parameters, const ENTHALPY &enthalpy) const any_platform
typename MOMENTA::template type< DESCRIPTOR > MomentaF
meta::list< descriptors::OMEGA, collision::TRT::MAGIC, TotalEnthalpy::T_S, TotalEnthalpy::T_L, TotalEnthalpy::CP_S, TotalEnthalpy::CP_L, TotalEnthalpy::LAMBDA_S, TotalEnthalpy::LAMBDA_L, TotalEnthalpy::L > parameters

References olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::computeEquilibrium(), olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::computeLiquidFraction(), olb::descriptors::invCs2(), olb::util::normSqr(), and olb::descriptors::opposite().

+ Here is the call graph for this function:

◆ computeEquilibrium() [1/2]

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
void olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::computeEquilibrium ( ConstCell< T, DESCRIPTOR > & cell,
T rho,
const T u[DESCRIPTOR::d],
T fEq[DESCRIPTOR::q] ) const
inlineoverridevirtual

Return iPop equilibrium for given first and second momenta.

Implements olb::Dynamics< T, DESCRIPTOR >.

Definition at line 640 of file advectionDiffusionDynamics.h.

640 {
641 for ( int iPop = 0; iPop < DESCRIPTOR::q; iPop++ ) {
642 fEq[iPop] = equilibrium<DESCRIPTOR>::firstOrder(iPop, rho, u);
643 }
644 };
static V firstOrder(int iPop, const RHO &rho, const U &u) any_platform
Computation of equilibrium distribution, first order in u.
Definition lbm.h:37

References olb::equilibrium< DESCRIPTOR >::firstOrder().

+ Here is the call graph for this function:

◆ computeEquilibrium() [2/2]

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
template<typename V , typename PARAMETERS , typename RHO , typename U >
V olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::computeEquilibrium ( int iPop,
const PARAMETERS & parameters,
RHO & rho,
U & u ) const
inline

Definition at line 563 of file advectionDiffusionDynamics.h.

564 {
565 using namespace TotalEnthalpy;
566
567 const V temperature = computeTemperature<V>(parameters, rho);
568 const V liquid_fraction = computeLiquidFraction<V>(parameters, rho);
569
570 const V uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
571 const V cp_s = parameters.template get<CP_S>();
572 const V cp_l = parameters.template get<CP_L>();
573 const V cp = (V{1} - liquid_fraction) * cp_s + liquid_fraction * cp_l;
574 const V cp_ref = V{2} * cp_s * cp_l / (cp_s + cp_l);
575
576 V c_u{};
577 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
578 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
579 }
580
581 V f_eq{};
582 if (iPop == 0) {
583 f_eq = rho - cp_ref * temperature
584 + cp * temperature * descriptors::t<T,DESCRIPTOR>(0) * ( cp_ref / cp
585 - descriptors::invCs2<T,DESCRIPTOR>() * V{0.5} * uSqr )
587 }
588 else {
589 f_eq = cp * temperature * descriptors::t<T,DESCRIPTOR>(iPop) * ( cp_ref / cp + descriptors::invCs2<T,DESCRIPTOR>() * c_u
591 - descriptors::invCs2<T,DESCRIPTOR>() * V{0.5} * uSqr )
593 }
594
595 return f_eq;
596 }
constexpr T t(unsigned iPop, tag::CUM) any_platform
Definition cum.h:108
constexpr int c(unsigned iPop, unsigned iDim) any_platform
Definition functions.h:83
V computeTemperature(const PARAMETERS &parameters, const ENTHALPY &enthalpy) const any_platform

References olb::descriptors::c(), olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::computeLiquidFraction(), olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::computeTemperature(), olb::descriptors::invCs2(), olb::util::normSqr(), and olb::descriptors::t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ computeLiquidFraction()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
template<typename V , typename PARAMETERS , typename ENTHALPY >
V olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::computeLiquidFraction ( const PARAMETERS & parameters,
const ENTHALPY & enthalpy ) const
inline

Definition at line 537 of file advectionDiffusionDynamics.h.

538 {
539 using namespace TotalEnthalpy;
540
541 const V cp_s = parameters.template get<CP_S>();
542 const V cp_l = parameters.template get<CP_L>();
543 const V T_s = parameters.template get<T_S>();
544 const V T_l = parameters.template get<T_L>();
545 const V l = parameters.template get<L>();
546 const V H_s = cp_s * T_s;
547 const V H_l = cp_l * T_l + l;
548 V liquid_fraction{};
549
550 if (enthalpy <= H_s) {
551 liquid_fraction = 0.;
552 }
553 else if (enthalpy >= H_l) {
554 liquid_fraction = 1.;
555 }
556 else {
557 liquid_fraction = (enthalpy - H_s) / l;
558 }
559 return liquid_fraction;
560 }
+ Here is the caller graph for this function:

◆ computeTemperature()

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
template<typename V , typename PARAMETERS , typename ENTHALPY >
V olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::computeTemperature ( const PARAMETERS & parameters,
const ENTHALPY & enthalpy ) const
inline

Definition at line 511 of file advectionDiffusionDynamics.h.

512 {
513 using namespace TotalEnthalpy;
514
515 const V cp_s = parameters.template get<CP_S>();
516 const V cp_l = parameters.template get<CP_L>();
517 const V T_s = parameters.template get<T_S>();
518 const V T_l = parameters.template get<T_L>();
519 const V l = parameters.template get<L>();
520 const V H_s = cp_s * T_s;
521 const V H_l = cp_l * T_l + l;
522 V temperature{};
523
524 if (enthalpy <= H_s) {
525 temperature = T_s - (H_s - enthalpy) / cp_s;
526 }
527 else if (enthalpy >= H_l) {
528 temperature = T_l + (enthalpy - H_l) / cp_l;
529 }
530 else {
531 temperature = (H_l - enthalpy) / (H_l - H_s) * T_s + (enthalpy - H_s) / (H_l - H_s) * T_l;
532 }
533 return temperature;
534 }
+ Here is the caller graph for this function:

◆ getName()

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

Return human-readable name.

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

Definition at line 646 of file advectionDiffusionDynamics.h.

646 {
647 return "TotalEnthalpyAdvectionDiffusionTRTdynamics<" + MomentaF().getName() + ">";
648 };

◆ getParameters()

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

Parameters access for legacy post processors.

Implements olb::Dynamics< T, DESCRIPTOR >.

Definition at line 506 of file advectionDiffusionDynamics.h.

506 {
507 return block.template getData<OperatorParameters<TotalEnthalpyAdvectionDiffusionTRTdynamics>>();
508 }

◆ id()

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

Expose unique type-identifier for RTTI.

Implements olb::Dynamics< T, DESCRIPTOR >.

Definition at line 502 of file advectionDiffusionDynamics.h.

502 {
503 return typeid(TotalEnthalpyAdvectionDiffusionTRTdynamics);
504 };

Member Data Documentation

◆ is_vectorizable

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
bool olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< T, DESCRIPTOR, MOMENTA >::is_vectorizable = false
staticconstexpr

Definition at line 479 of file advectionDiffusionDynamics.h.


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