Question about ExternalTauEffLESBGKadvectionDiffusionDynamics
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Question about ExternalTauEffLESBGKadvectionDiffusionDynamics
- This topic has 3 replies, 2 voices, and was last updated 1 year, 3 months ago by jflorezgi.
-
AuthorPosts
-
June 23, 2023 at 3:34 pm #7598jflorezgiParticipant
Hi everyone, there is only one dynamic created for advection-diffusion equation coupled with a LES model to calculate the effective diffusion coefficient in each cell in OpenLB libraries.
/// LES BGK collision for advection diffusion using non-local TAU_EFF per-cell field
template<typename T, typename DESCRIPTOR, typename MOMENTA=momenta::BulkTuple>
using ExternalTauEffLESBGKadvectionDiffusionDynamics = dynamics::Tuple<
T, DESCRIPTOR,
MOMENTA,
equilibria::FirstOrder,
collision::OmegaFromCellTauEff<collision::BGK>,
AdvectionDiffusionExternalVelocityCollision
>;In this collision model (OmegaFromCellTauEff<collision::BGK>), the struct override the omega parameter with the inverse of cell field TAU_EFF.
/// Override dynamics parameter OMEGA with inverse of cell field TAU_EFF
template <typename COLLISION>
struct OmegaFromCellTauEff {
using parameters = typename COLLISION::parameters::template include<
descriptors::OMEGA
>;static std::string getName() {
return “OmegaFromCellTauEff<” + COLLISION::getName() + “>”;
}template <typename DESCRIPTOR, typename MOMENTA, typename EQUILIBRIUM>
struct type {
using CollisionO = typename COLLISION::template type<DESCRIPTOR, MOMENTA, EQUILIBRIUM>;template <CONCEPT(MinimalCell) CELL, typename PARAMETERS, typename V=typename CELL::value_t>
CellStatistic<V> apply(CELL& cell, PARAMETERS& parameters) any_platform {
parameters.template set<descriptors::OMEGA>(
V{1} / cell.template getField<descriptors::TAU_EFF>());
return CollisionO().apply(cell, parameters);
}
};
};The TAU_EFF cell field is filled with the molecular relaxation time in both meshes as shown in the squareCavity2d.cpp example
#ifdef SMAGORINSKY
AnalyticalConst2D<T,T> tauNS(1./omega);
AnalyticalConst2D<T,T> tauAD(1./Tomega);NSlattice.defineField<descriptors::TAU_EFF>( superGeometry.getMaterialIndicator({1, 2, 3}), tauNS );
ADlattice.defineField<descriptors::TAU_EFF>( superGeometry.getMaterialIndicator({1, 2, 3}), tauAD );
#endifI understand then that what the collision struct does is override the omega parameter with the value of the cell field TAU_EFF, which in turn was filled in with the value of the molecular relaxation parameter.
My question is that I don’t know in which part the calculation of the turbulent relaxation parameter of the LES model is being done to finally use the effective tau in the BGK collision step, as it can be clearly seen in other dynamics such as SmagorinskyBGKDynamics:
/// Smagorinsky BGK collision step
template<typename T, typename DESCRIPTOR, typename MOMENTA=momenta::BulkTuple>
using SmagorinskyBGKdynamics = dynamics::Tuple<
T, DESCRIPTOR,
MOMENTA,
equilibria::SecondOrder,
collision::SmagorinskyEffectiveOmega<collision::BGK>
>;where the collision struct SmagorinskyEffectiveOmega<collision::BGK> shows the calculation of the tau-eff explicitly:
template <typename COLLISION, typename DESCRIPTOR, typename MOMENTA, typename EQUILIBRIUM>
struct SmagorinskyEffectiveOmega {
using MomentaF = typename MOMENTA::template type<DESCRIPTOR>;
using CollisionO = typename COLLISION::template type<DESCRIPTOR, MOMENTA, EQUILIBRIUM>;template <typename CELL, typename PARAMETERS, typename V=typename CELL::value_t>
V computeEffectiveOmega(CELL& cell, PARAMETERS& parameters) any_platform {
V piNeqNormSqr { };
MomentaF().computePiNeqNormSqr(cell, piNeqNormSqr);
const V rho = MomentaF().computeRho(cell);
const V omega = parameters.template get<descriptors::OMEGA>();
const V smagorinsky = parameters.template get<collision::LES::Smagorinsky>();
V piNeqNorm = util::sqrt(piNeqNormSqr);
V preFactor = smagorinsky*smagorinsky
* descriptors::invCs2<V,DESCRIPTOR>()*descriptors::invCs2<V,DESCRIPTOR>()
* 2 * util::sqrt(2);
/// Molecular realaxation time
V tauMol = V{1} / omega;
/// Turbulent realaxation time
V tauTurb = V{0.5} * (util::sqrt(tauMol*tauMol + preFactor / rho * piNeqNorm) – tauMol);
/// Effective realaxation time
V tauEff = tauMol + tauTurb;
return V{1} / tauEff;
}template <typename CELL, typename PARAMETERS, typename V=typename CELL::value_t>
CellStatistic<V> apply(CELL& cell, PARAMETERS& parameters) any_platform {
parameters.template set<descriptors::OMEGA>(
computeEffectiveOmega(cell, parameters));
return CollisionO().apply(cell, parameters);
}
};thank you in advance.
Jonathan.
June 26, 2023 at 7:37 pm #7599FBukreevKeymasterHello Jonathan,
do you mean the SmagorinskyBoussinesqueCoupling in dynamics/navierStokesAdvectionDiffusionCoupling.h?
Greetings
FedorJune 26, 2023 at 7:37 pm #7600FBukreevKeymasterHello Jonathan,
do you mean the SmagorinskyBoussinesqueCoupling in dynamics/navierStokesAdvectionDiffusionCoupling.h?
Greetings
FedorJune 27, 2023 at 3:25 pm #7614jflorezgiParticipantHi Fedor, yes now I understand,
thank you
Jonathan
-
AuthorPosts
- You must be logged in to reply to this topic.