OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::forcing::LiangTRT< Forced >::combined_collision< DESCRIPTOR, MOMENTA, EQUILIBRIUM, COLLISION > Struct Template Reference

#include <forcing.h>

+ Collaboration diagram for olb::forcing::LiangTRT< Forced >::combined_collision< DESCRIPTOR, MOMENTA, EQUILIBRIUM, COLLISION >:

Public Types

using MomentaF = typename Forced<MOMENTA>::template type<DESCRIPTOR>
 
using CollisionO = typename COLLISION::template type<DESCRIPTOR,Forced<MOMENTA>,EQUILIBRIUM>
 

Public Member Functions

template<typename CELL , typename PARAMETERS , typename V = typename CELL::value_t>
CellStatistic< V > apply (CELL &cell, PARAMETERS &parameters) any_platform
 

Static Public Attributes

static constexpr bool is_vectorizable
 

Detailed Description

template<template< typename > typename Forced = momenta::Forced>
template<typename DESCRIPTOR, typename MOMENTA, typename EQUILIBRIUM, typename COLLISION>
struct olb::forcing::LiangTRT< Forced >::combined_collision< DESCRIPTOR, MOMENTA, EQUILIBRIUM, COLLISION >

Definition at line 205 of file forcing.h.

Member Typedef Documentation

◆ CollisionO

template<template< typename > typename Forced = momenta::Forced>
template<typename DESCRIPTOR , typename MOMENTA , typename EQUILIBRIUM , typename COLLISION >
using olb::forcing::LiangTRT< Forced >::combined_collision< DESCRIPTOR, MOMENTA, EQUILIBRIUM, COLLISION >::CollisionO = typename COLLISION::template type<DESCRIPTOR,Forced<MOMENTA>,EQUILIBRIUM>

Definition at line 207 of file forcing.h.

◆ MomentaF

template<template< typename > typename Forced = momenta::Forced>
template<typename DESCRIPTOR , typename MOMENTA , typename EQUILIBRIUM , typename COLLISION >
using olb::forcing::LiangTRT< Forced >::combined_collision< DESCRIPTOR, MOMENTA, EQUILIBRIUM, COLLISION >::MomentaF = typename Forced<MOMENTA>::template type<DESCRIPTOR>

Definition at line 206 of file forcing.h.

Member Function Documentation

◆ apply()

template<template< typename > typename Forced = momenta::Forced>
template<typename DESCRIPTOR , typename MOMENTA , typename EQUILIBRIUM , typename COLLISION >
template<typename CELL , typename PARAMETERS , typename V = typename CELL::value_t>
CellStatistic< V > olb::forcing::LiangTRT< Forced >::combined_collision< DESCRIPTOR, MOMENTA, EQUILIBRIUM, COLLISION >::apply ( CELL & cell,
PARAMETERS & parameters )
inline

Definition at line 217 of file forcing.h.

217 {
218 V u[DESCRIPTOR::d];
219 MomentaF().computeU(cell, u);
220 CollisionO().apply(cell, parameters);
221 const V omega = parameters.template get<descriptors::OMEGA>();
222 const auto force = cell.template getField<descriptors::FORCE>();
223 const auto rho = cell.template getField<descriptors::RHO>();
224 const auto gradRho = cell.template getField<descriptors::NABLARHO>();
225
226 V fTerm[DESCRIPTOR::q], fTermPlus[DESCRIPTOR::q], fTermMinus[DESCRIPTOR::q];
227
228 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
229 V c_u{};
230 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
231 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
232 }
233 fTerm[iPop] = 0.;
234 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
235 fTerm[iPop] += descriptors::c<DESCRIPTOR>(iPop,iD) * force[iD] * rho +c_u * descriptors::c<DESCRIPTOR>(iPop,iD) * gradRho[iD];
236 }
238 }
239
240 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
241 fTermPlus[iPop] = V{0.5} * (fTerm[iPop] + fTerm[descriptors::opposite<DESCRIPTOR>(iPop)]);
242 fTermMinus[iPop] = V{0.5} * (fTerm[iPop] - fTerm[descriptors::opposite<DESCRIPTOR>(iPop)]);
243 }
244
245 V tau = V{1} / omega;
246 const V tau2 = parameters.template get<collision::ITRT::TAU_MINUS>();
247 const auto nablaRho = cell.template getField<descriptors::NABLARHO>();
248 V ratio = util::norm<DESCRIPTOR::d>(nablaRho) / parameters.template get<collision::ITRT::MAXNABLARHO>();
249 const V omega2 = V{1} / (tau + ratio * (tau2 - tau));
250
251 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
252 cell[iPop] += ( V{1} - omega * V{0.5} ) * fTermPlus[iPop]
253 + ( V{1} - omega2 * V{0.5} ) * fTermMinus[iPop];
254 }
255
256 return {rho, util::normSqr<V,DESCRIPTOR::d>(u)};
257 };
constexpr T invCs2() any_platform
Definition functions.h:107
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
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
T norm(const std::vector< T > &a)
l2 norm of a vector of arbitrary length
typename Forced< MOMENTA >::template type< DESCRIPTOR > MomentaF
Definition forcing.h:206
typename COLLISION::template type< DESCRIPTOR, Forced< MOMENTA >, EQUILIBRIUM > CollisionO
Definition forcing.h:207

References olb::descriptors::c(), olb::descriptors::invCs2(), olb::util::norm(), olb::util::normSqr(), olb::descriptors::opposite(), and olb::descriptors::t().

+ Here is the call graph for this function:

Member Data Documentation

◆ is_vectorizable

template<template< typename > typename Forced = momenta::Forced>
template<typename DESCRIPTOR , typename MOMENTA , typename EQUILIBRIUM , typename COLLISION >
bool olb::forcing::LiangTRT< Forced >::combined_collision< DESCRIPTOR, MOMENTA, EQUILIBRIUM, COLLISION >::is_vectorizable
staticconstexpr
Initial value:
= dynamics::is_vectorizable_v<CollisionO>
&& !std::is_same_v<MOMENTA, momenta::IncBulkTuple<momenta::ForcedMomentum<momenta::IncompressibleBulkMomentum>>>

Definition at line 212 of file forcing.h.


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