42template <
class Double,
class FlowIndices,
int nDim,
size_t nVar = Dynamic>
44 :
public CScalarFluxSpeciesBase<Double, CScalarFlux_Flamelet<Double, FlowIndices, nDim, nVar>, FlowIndices, nDim,
52 preferentialDiffusion(config.GetFlameletParsedOptions().preferential_diffusion),
53 nControlVars(config.GetFlameletParsedOptions().n_control_vars) {}
63 template <
class VariableType>
69 if (!preferentialDiffusion)
return;
72 const Double proj_vector_ij =
dot(vector_ij, normal) / dist2_ij;
73 const Double proj_on_rho_i = proj_vector_ij / rho.
i;
74 const Double proj_on_rho_j = proj_vector_ij / rho.
j;
80 for (
auto iScalar = 0u; iScalar < nControlVars; ++iScalar) {
81 const auto iBeta = betaIndex(iScalar);
88 auto grad_i = gatherVariables<nDim>(iPoint, side_i.
scalarNodes.GetAuxVarGradient(), iBeta);
89 auto grad_j = gatherVariables<nDim>(jPoint, side_j.
scalarNodes.GetAuxVarGradient(), iBeta);
90 const auto gradPhi_i = gatherVariables<nDim>(iPoint, side_i.
scalarNodes.GetGradient(), iScalar);
91 const auto gradPhi_j = gatherVariables<nDim>(jPoint, side_j.
scalarNodes.GetGradient(), iScalar);
92 for (
int iDim = 0; iDim <
nDim; ++iDim) {
93 grad_i(iDim) -= gradPhi_i(iDim);
94 grad_j(iDim) -= gradPhi_j(iDim);
99 const Double D = 0.5 * (rho.
i * D_i + rho.
j * D_j) + diffTurb;
101 const Double projGrad = projectedGradient(opt, grad_i, grad_j, phi_i, phi_j, normal, vector_ij, dist2_ij);
103 res.
flux_i(iScalar) -= D * projGrad;
107 res.
jac_ii(iScalar, iScalar) += D * proj_on_rho_i;
109 res.
jac_ij(iScalar, iScalar) -= D * proj_on_rho_j;
110 res.
jac_ji(iScalar, iScalar) -= D * proj_on_rho_i;
111 res.
jac_jj(iScalar, iScalar) += D * proj_on_rho_j;
117 if (nControlVars <=
I_ENTH)
return;
129 const Double Dth = 0.5 * (rho.
i * Dth_i + rho.
j * Dth_j) + diffTurb;
131 const Double projGradT = projectedGradient(opt, gradT_i, gradT_j, T_i, T_j, normal, vector_ij, dist2_ij);
138 const bool preferentialDiffusion;
139 const unsigned short nControlVars;
144 static FORCEINLINE unsigned short betaIndex(
unsigned short iScalar) {
162 const Double& dist2_ij)
const {
164 for (
int iDim = 0; iDim <
nDim; ++iDim) avgGrad(iDim) = 0.5 * (grad_i(iDim) + grad_j(iDim));
167 const Double corr = (
dot(avgGrad, vector_ij) - phi_j + phi_i) / dist2_ij;
168 for (
int iDim = 0; iDim <
nDim; ++iDim) avgGrad(iDim) -= corr * vector_ij(iDim);
170 return dot(avgGrad, normal);
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
su2double GetGradient_Primitive(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const final
Get the value of the primitive variables gradient.
Definition CFlowVariable.hpp:147
su2double GetPrimitive(unsigned long iPoint, unsigned long iVar) const final
Get a primitive variable.
Definition CFlowVariable.hpp:95
Convection and diffusion of a mass fraction, conservative with a diagonal, i/j-symmetric diffusion ma...
Definition species_edge_flux.hpp:47
Double turbulentDiffusivity(const FlowIndices &idx, Int iPoint, const EdgeSide< VariableType > &side_i, Int jPoint, const EdgeSide< VariableType > &side_j) const
Turbulent contribution to the diffusivity, shared by every species and, in the flamelet model,...
Definition species_edge_flux.hpp:87
typename Base::Int Int
Definition species_edge_flux.hpp:53
Convection and diffusion of the flamelet controlling variables and passive species,...
Definition flamelet_edge_flux.hpp:45
CScalarFlux_Flamelet(const CConfig &config)
Definition flamelet_edge_flux.hpp:50
typename Base::Int Int
Definition flamelet_edge_flux.hpp:48
void extraDiffusionTerms(const FlowIndices &idx, const ScalarFluxOptions &opt, Int iPoint, const EdgeSide< VariableType > &side_i, Int jPoint, const EdgeSide< VariableType > &side_j, const CPair< Double > &rho, const Vector< Double, nDim > &normal, const Vector< Double, nDim > &vector_ij, EdgeResidual< Double, nVar > &res) const
Preferential diffusion, two terms with the shape of the ordinary diffusion but of states the model sy...
Definition flamelet_edge_flux.hpp:64
Double Double
Definition scalar_edge_flux.hpp:318
const FlowIndices idx
Definition scalar_edge_flux.hpp:338
static constexpr int nDim
Definition scalar_edge_flux.hpp:320
#define FORCEINLINE
Definition code_config.hpp:44
auto squaredNorm(ForwardIterator iterator) -> typename std::decay< decltype(*iterator)>::type
Squared norm.
Definition util.hpp:231
auto dot(ForwardIterator iterator, const T *ptr) -> typename std::decay< decltype(*ptr)>::type
Dot product.
Definition util.hpp:203
Double gatherVariables(Int iPoint, const Container &vars, size_t iVar=0)
Gather a single variable, from column iVar (0 by default) of row iPoint of a 2D container,...
Definition util.hpp:277
@ I_BETA_ENTH_THERMAL
Preferential diffusion scalar for temperature.
Definition option_structure.hpp:1543
@ I_BETA_MIXFRAC
Preferential diffusion scalar for mixture fraction.
Definition option_structure.hpp:1545
@ I_BETA_ENTH
Preferential diffusion scalar for total enthalpy.
Definition option_structure.hpp:1544
@ I_BETA_PROGVAR
Preferential diffusion scalar for the progress variable.
Definition option_structure.hpp:1542
constexpr passivedouble EPS
Error scale.
Definition option_structure.hpp:100
@ I_PROGVAR
Definition option_structure.hpp:1516
@ I_ENTH
Definition option_structure.hpp:1517
Species transport as a third-layer scalar flux, see numerics/scalar/scalar_edge_flux....
Simple pair type for i/j variables.
Definition util.hpp:130
T i
Definition util.hpp:131
T j
Definition util.hpp:131
Residual of one edge, accumulated by the convective and the diffusive terms.
Definition util.hpp:169
Vector< Double, Size > flux_j
Definition util.hpp:176
Matrix< Double, Size, Size > jac_jj
Definition util.hpp:177
Matrix< Double, Size, Size > jac_ji
Definition util.hpp:177
Vector< Double, Size > flux_i
Definition util.hpp:176
Matrix< Double, Size, Size > jac_ii
Definition util.hpp:177
Matrix< Double, Size, Size > jac_ij
Definition util.hpp:177
Locates the data of one endpoint of an edge.
Definition scalar_edge_flux.hpp:42
const CFlowVariable * flowNodes
Flow variables, null for solid heat transfer.
Definition scalar_edge_flux.hpp:44
const VariableType & scalarNodes
Scalar solver variables.
Definition scalar_edge_flux.hpp:43
Loop invariant flags for a scalar edge flux, built once outside the edge loop so the compiler can uns...
Definition scalar_edge_flux.hpp:55
bool implicit
Whether the Jacobians are assembled, and so computed.
Definition scalar_edge_flux.hpp:60
bool oneSided
Whether only the row of i is assembled.
Definition scalar_edge_flux.hpp:63
bool correctGradient
Definition scalar_edge_flux.hpp:58