OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
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 parameters
 
template<typename M >
using exchange_momenta = TotalEnthalpyAdvectionDiffusionTRTdynamics<T,DESCRIPTOR,M>
 
- 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

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
 
template<typename V , typename PARAMETERS , typename ENTHALPY >
computeLiquidFraction (const PARAMETERS &parameters, const ENTHALPY &enthalpy) const
 
template<typename V , typename PARAMETERS , typename RHO , typename U >
computeEquilibrium (int iPop, const PARAMETERS &parameters, RHO &rho, U &u) const
 
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 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 418 of file advectionDiffusionDynamics.h.

Member Typedef Documentation

◆ 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 436 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 421 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 423 of file advectionDiffusionDynamics.h.

Member Function Documentation

◆ apply()

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 >::apply ( CELL & cell,
PARAMETERS & parameters )
inline

Definition at line 535 of file advectionDiffusionDynamics.h.

535 {
536 using namespace TotalEnthalpy;
537
538 const V lambda_s = parameters.template get<LAMBDA_S>();
539 const V lambda_l = parameters.template get<LAMBDA_L>();
540 const V cp_s = parameters.template get<CP_S>();
541 const V cp_l = parameters.template get<CP_L>();
542 const V cp_ref = V{2} * cp_s * cp_l / (cp_s + cp_l);
543
544 const V enthalpy = MomentaF().computeRho( cell );
545 const V liquid_fraction = computeLiquidFraction<V>( parameters, enthalpy );
546 const V lambda = (V{1} - liquid_fraction) * lambda_s + liquid_fraction * lambda_l;
547 const V omega = V{1} / ( lambda / cp_ref * descriptors::invCs2<T,DESCRIPTOR>() + V{0.5} );
548 const V magic_parameter = parameters.template get<collision::TRT::MAGIC>();
549 const V omega2 = V{1} / (magic_parameter/(V{1}/omega-V{0.5})+V{0.5});
550
551 const auto u = cell.template getField<descriptors::VELOCITY>();
552
553 const V uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
554
555 V fPlus[DESCRIPTOR::q], fMinus[DESCRIPTOR::q] { };
556 V fEq[DESCRIPTOR::q], fEqPlus[DESCRIPTOR::q], fEqMinus[DESCRIPTOR::q] { };
557
558 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
559 fPlus[iPop] = 0.5 * ( cell[iPop] + cell[descriptors::opposite<DESCRIPTOR>(iPop)] );
560 fMinus[iPop] = 0.5 * ( cell[iPop] - cell[descriptors::opposite<DESCRIPTOR>(iPop)] );
561 fEq[iPop] = computeEquilibrium<V>(iPop, parameters, enthalpy, u);
562 }
563
564 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
565 fEqPlus[iPop] = 0.5 * ( fEq[iPop] + fEq[descriptors::opposite<DESCRIPTOR>(iPop)] );
566 fEqMinus[iPop] = 0.5 * ( fEq[iPop] - fEq[descriptors::opposite<DESCRIPTOR>(iPop)] );
567 }
568
569 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
570 cell[iPop] -= omega2 * (fPlus[iPop] - fEqPlus[iPop]) + omega * (fMinus[iPop] - fEqMinus[iPop]);
571 }
572
573 return {enthalpy, uSqr};
574 };
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

◆ computeEquilibrium() [1/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 499 of file advectionDiffusionDynamics.h.

500 {
501 using namespace TotalEnthalpy;
502
503 const V temperature = computeTemperature<V>(parameters, rho);
504 const V liquid_fraction = computeLiquidFraction<V>(parameters, rho);
505
506 const V uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
507 const V cp_s = parameters.template get<CP_S>();
508 const V cp_l = parameters.template get<CP_L>();
509 const V cp = (V{1} - liquid_fraction) * cp_s + liquid_fraction * cp_l;
510 const V cp_ref = V{2} * cp_s * cp_l / (cp_s + cp_l);
511
512 V c_u{};
513 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
514 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
515 }
516
517 V f_eq{};
518 if (iPop == 0) {
519 f_eq = rho - cp_ref * temperature
520 + cp * temperature * descriptors::t<T,DESCRIPTOR>(0) * ( cp_ref / cp
521 - descriptors::invCs2<T,DESCRIPTOR>() * V{0.5} * uSqr )
522 - descriptors::t<T,DESCRIPTOR>(0);
523 }
524 else {
525 f_eq = cp * temperature * descriptors::t<T,DESCRIPTOR>(iPop) * ( cp_ref / cp + descriptors::invCs2<T,DESCRIPTOR>() * c_u
526 + descriptors::invCs2<T,DESCRIPTOR>() * descriptors::invCs2<T,DESCRIPTOR>() * V{0.5} * c_u *c_u
527 - descriptors::invCs2<T,DESCRIPTOR>() * V{0.5} * uSqr )
528 - descriptors::t<T,DESCRIPTOR>(iPop);
529 }
530
531 return f_eq;
532 }

◆ computeEquilibrium() [2/2]

template<typename T , typename DESCRIPTOR , typename MOMENTA = momenta::AdvectionDiffusionBulkTuple>
T olb::TotalEnthalpyAdvectionDiffusionTRTdynamics< 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 576 of file advectionDiffusionDynamics.h.

577 {
578 return equilibrium<DESCRIPTOR>::template firstOrder(iPop, rho, u);
579 }

◆ 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 473 of file advectionDiffusionDynamics.h.

474 {
475 using namespace TotalEnthalpy;
476
477 const V cp_s = parameters.template get<CP_S>();
478 const V cp_l = parameters.template get<CP_L>();
479 const V T_s = parameters.template get<T_S>();
480 const V T_l = parameters.template get<T_L>();
481 const V l = parameters.template get<L>();
482 const V H_s = cp_s * T_s;
483 const V H_l = cp_l * T_l + l;
484 V liquid_fraction{};
485
486 if (enthalpy <= H_s) {
487 liquid_fraction = 0.;
488 }
489 else if (enthalpy >= H_l) {
490 liquid_fraction = 1.;
491 }
492 else {
493 liquid_fraction = (enthalpy - H_s) / l;
494 }
495 return liquid_fraction;
496 }

◆ 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 447 of file advectionDiffusionDynamics.h.

448 {
449 using namespace TotalEnthalpy;
450
451 const V cp_s = parameters.template get<CP_S>();
452 const V cp_l = parameters.template get<CP_L>();
453 const V T_s = parameters.template get<T_S>();
454 const V T_l = parameters.template get<T_L>();
455 const V l = parameters.template get<L>();
456 const V H_s = cp_s * T_s;
457 const V H_l = cp_l * T_l + l;
458 V temperature{};
459
460 if (enthalpy <= H_s) {
461 temperature = T_s - (H_s - enthalpy) / cp_s;
462 }
463 else if (enthalpy >= H_l) {
464 temperature = T_l + (enthalpy - H_l) / cp_l;
465 }
466 else {
467 temperature = (H_l - enthalpy) / (H_l - H_s) * T_s + (enthalpy - H_s) / (H_l - H_s) * T_l;
468 }
469 return temperature;
470 }

◆ 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 581 of file advectionDiffusionDynamics.h.

581 {
582 return "TotalEnthalpyAdvectionDiffusionTRTdynamics<" + MomentaF().getName() + ">";
583 };

◆ 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 442 of file advectionDiffusionDynamics.h.

442 {
443 return block.template getData<OperatorParameters<TotalEnthalpyAdvectionDiffusionTRTdynamics>>();
444 }

◆ 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 438 of file advectionDiffusionDynamics.h.

438 {
439 return typeid(TotalEnthalpyAdvectionDiffusionTRTdynamics);
440 };

Member Data Documentation

◆ is_vectorizable

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

Definition at line 419 of file advectionDiffusionDynamics.h.


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