MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
FvSysEqnRANS< nDim, RANSModel > Class Template Reference

#include <fvcartesiansyseqnrans.h>

Inheritance diagram for FvSysEqnRANS< nDim, RANSModel >:
[legend]
Collaboration diagram for FvSysEqnRANS< nDim, RANSModel >:
[legend]

Classes

struct  ConservativeVariables
 Static indices for accessing conservative variables in nDim spatial dimensions. More...
 
struct  FluxVariables
 
struct  PrimitiveVariables
 Static indices for accessing primitive variables in nDim spatial dimensions. More...
 

Public Member Functions

 FvSysEqnRANS (const MInt solverId, const MInt noSpecies)
 
template<MInt stencil = AUSM>
void Ausm (const MInt orientation, const MFloat upwindCoefficient, const MFloat A, const MFloat *const leftVars, const MFloat *const rightVars, const MFloat *const NotUsed(srfcCoeff), MFloat *const flux)
 
void AusmBndryCorrection (const MInt orientation, const MFloat A, const MFloat *const leftVars, const MFloat *const rightVars, MFloat *const flux)
 
template<MInt stencil>
void viscousFlux (const MInt orientation, const MFloat A, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat *const srfcCoeff, const MFloat f0, const MFloat f1, MFloat *const flux)
 
template<MInt stencil>
void viscousFlux (const MInt orientation, const MFloat A, const MBool isBndry, const MFloat *const surfaceCoords, const MFloat *const coord0, const MFloat *const coord1, const MFloat *const cellVars0, const MFloat *const cellVars1, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat f0, const MFloat f1, MFloat *const flux)
 
void viscousFluxFivePoint (const MInt orientation, const MFloat A, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat *const NotUsed(srfcCoeff), const MFloat f0, const MFloat f1, MFloat *const flux)
 
void viscousFluxThreePoint (const MInt orientation, const MFloat A, const MBool isBndry, const MFloat *const surfaceCoords, const MFloat *const coord0, const MFloat *const coord1, const MFloat *const cellVars0, const MFloat *const cellVars1, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat f0, const MFloat f1, MFloat *const flux)
 
void computePrimitiveVariables (const MFloat *const cvarsCell, MFloat *const pvarsCell, const MFloat *const NotUsed(avarsCell))
 
void computeConservativeVariables (const MFloat *const pvarsCell, MFloat *const cvarsCell, const MFloat *const NotUsed(avarsCell))
 
std::vector< std::vector< MFloat > > conservativeSlopes (const MFloat *const pvarsCell, const MFloat *const cvarsCell, const MFloat *const avarsCell, const MFloat *const slopesCell)
 
void computeVolumeForces (const MInt cellId, MFloat *vars, MFloat *rhs, const MFloat cellVol, const MFloat *const slopes, const MInt recData, const MInt *const recNghbr, const MFloat *const recConst, const MInt noRecNghbr, MFloat dist)
 
void computeVolumeForcesRANS_SA (const MInt cellId, MFloat *vars, MFloat *rhs, const MFloat cellVol, const MFloat *const slopes, const MInt recData, const MInt *const, const MFloat *const, const MInt noRecNghbr, MFloat dist)
 
void computeVolumeForcesRANS_FS (const MInt cellId, MFloat *vars, MFloat *rhs, MFloat cellVol, const MFloat *const slopes, MInt recData, const MInt *const recNghbr, const MFloat *const recConst, MInt noRecNghbr, MFloat)
 
void computeVolumeForcesRANS_KOMEGA (const MInt cellId, MFloat *vars, MFloat *rhs, const MFloat cellVol, const MFloat *const slopes, const MInt, const MInt *const, const MFloat *const, const MInt, MFloat)
 
- Public Member Functions inherited from FvSysEqnNS< nDim >
 FvSysEqnNS (const MInt solverId, const MInt noSpecies)
 
template<MInt scheme = AUSM>
void Ausm (const MInt orientation, const MFloat upwindCoefficient, const MFloat A, const MFloat *const leftVars, const MFloat *const rightVars, const MFloat *const srfcCoeff, MFloat *const flux)
 
void Ausm_ (const MInt orientation, const MFloat upwindCoefficient, const MFloat A, const MFloat *const leftVars, const MFloat *const rightVars, const MFloat *const NotUsed(srfcCoeff), MFloat *const flux)
 
void AusmPlus_ (const MInt orientation, const MFloat upwindCoefficient, const MFloat A, const MFloat *const leftVars, const MFloat *const rightVars, const MFloat *const NotUsed(srfcCoeff), MFloat *const flux)
 
void Slau_ (const MInt orientation, const MFloat NotUsed(upwindCoefficient), const MFloat A, const MFloat *const leftVars, const MFloat *const rightVars, const MFloat *const NotUsed(srfcCoeff), MFloat *const flux)
 
void AusmBndryCorrection (const MInt orientation, const MFloat A, const MFloat *const leftVars, const MFloat *const rightVars, MFloat *const flux)
 
void AusmALECorrection (const MInt orientation, const MFloat A, MFloat *const flux, MFloat *const surfVars, const MFloat *const bndrySurfVars)
 
template<MInt centralizeScheme>
void centralizeSurfaceVariables (MFloat *const varL, MFloat *const varR, const MInt orientation, const MFloat levelFac)
 
template<MInt stencil>
void viscousFlux (const MInt orientation, const MFloat A, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat *const srfcCoeff, const MFloat f0, const MFloat f1, MFloat *const flux)
 
template<MInt stencil>
void viscousFlux (const MInt orientation, const MFloat A, const MBool isBndry, const MFloat *const surfaceCoords, const MFloat *const coord0, const MFloat *const coord1, const MFloat *const cellVars0, const MFloat *const cellVars1, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat f0, const MFloat f1, MFloat *const flux)
 
void viscousFluxFivePoint (const MInt orientation, const MFloat A, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat *const NotUsed(srfcCoeff), const MFloat f0, const MFloat f1, MFloat *const flux)
 
void viscousFluxThreePoint (const MInt orientation, const MFloat A, const MBool isBndry, const MFloat *const surfaceCoords, const MFloat *const coord0, const MFloat *const coord1, const MFloat *const cellVars0, const MFloat *const cellVars1, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat f0, const MFloat f1, MFloat *const flux)
 
void viscousFluxStabilized (const MInt orientation, const MFloat A, const MBool isBndry, const MFloat *const surfaceCoords, const MFloat *const coord0, const MFloat *const coord1, const MFloat *const cellVars0, const MFloat *const cellVars1, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat f0, const MFloat f1, MFloat *const flux)
 Computes the viscous fluxes using a five-point stencil (less dissipative) blended with a compact stencil (increased stability). Short: (1-enhanceThreePointViscFluxFactor)*FIVE_POINT + enhanceThreePointViscFluxFactor*THREE_POINT Default for centralizeViscousFlux is 0.1 if not defined in property file. More...
 
template<MInt stencil>
void wmViscousFluxCorrection (const MInt orientation, const MFloat A, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat f0, const MFloat f1, MFloat *const flux, MFloat const mue_wm)
 
void wmViscousFluxCorrectionFivePoint (const MInt orientation, const MFloat A, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat f0, const MFloat f1, MFloat *const flux, MFloat const mue_wm)
 
void computePrimitiveVariables (const MFloat *const cvarsCell, MFloat *const pvarsCell, const MFloat *const NotUsed(avarsCell))
 
void computeConservativeVariables (const MFloat *const pvarsCell, MFloat *const cvarsCell, const MFloat *const NotUsed(avarsCell))
 
std::vector< std::vector< MFloat > > conservativeSlopes (const MFloat *const pvarsCell, const MFloat *const cvarsCell, const MFloat *const avarsCell, const MFloat *const slopesCell)
 
void computeVolumeForces (const MInt, MFloat *, MFloat *, const MFloat, const MFloat *const, const MInt, const MInt *const, const MFloat *const, const MInt, MFloat)
 
constexpr MFloat speedOfSound (const MFloat density, const MFloat pressure)
 Speed of sound: a = sqrt(gamma * pressure / density) More...
 
constexpr MFloat speedOfSoundSquared (const MFloat density, const MFloat pressure)
 speed of sound squared a^2 = gamma * pressure / density More...
 
constexpr MFloat speedOfSound (const MFloat temperature)
 Speed of sound: a = sqrt(T) More...
 
constexpr MFloat temperature_ES (const MFloat density, const MFloat pressure)
 Temperature: T = gamma * pressure / density (equation of state - ideal gas law) More...
 
constexpr MFloat pressure_ES (const MFloat temperture, const MFloat density)
 pressure: p = rho * T / gamma (equation of state - ideal gas law) More...
 
constexpr MFloat density_ES (const MFloat pressure, const MFloat temperature)
 density: rho = gamma * p / T (equation of state - ideal gas law) More...
 
constexpr MFloat temperature_IR (const MFloat Ma)
 Temperature: T = 1 / (1 + (gamma - 1)/2 * Ma^2) (isentropic relationship) More...
 
constexpr MFloat pressure_IR (const MFloat temperature)
 
constexpr MFloat pressure_IRit (const MFloat pressure, const MFloat massFlux)
 
constexpr MFloat density_IR (const MFloat temperature)
 density: rho = T^(1/(gamma -1 )) (isentropic relationship) More...
 
constexpr MFloat density_IR_P (const MFloat pressure)
 density: rho = (p * gamma)^(1/gamma) (isentropic relationship) More...
 
constexpr MFloat pressure (const MFloat density, const MFloat momentumDensitySquared, const MFloat energyDensity)
 
constexpr MFloat internalEnergy (const MFloat pressure, const MFloat density, const MFloat velocitySquared)
 
constexpr MFloat pressureEnergy (const MFloat pressure)
 
constexpr MFloat enthalpy (const MFloat pressure, const MFloat density)
 enthalpy from primitive variables More...
 
constexpr MFloat entropy (const MFloat pressure, const MFloat density)
 entropy from primitive variables More...
 
constexpr MFloat CroccoBusemann (const MFloat Ma, const MFloat x)
 Crocco-Busemann relation. More...
 
constexpr MFloat vanDriest (const MFloat Ma)
 van-Driest Transformation (correspods to R*H) More...
 
constexpr MFloat sutherlandLaw (const MFloat T)
 
MFloat computeTimeStepEulerMagnitude (const MFloat rho, const std::array< MFloat, nDim > u, const MFloat p, const MFloat C, const MFloat dx)
 
constexpr MFloat gamma_Ref ()
 
constexpr MFloat cp_Ref ()
 
constexpr MFloat cv_Ref ()
 
constexpr MFloat p_Ref ()
 
constexpr MFloat computeTimeStepDiffusion (const MFloat diffusion_coefficient, const MFloat C, const MFloat dx)
 

Public Attributes

ConservativeVariablesCV = nullptr
 
FluxVariablesFV = nullptr
 
PrimitiveVariablesPV = nullptr
 
MFloat m_muInfinity
 
MFloat m_Re0
 
- Public Attributes inherited from FvSysEqnNS< nDim >
MFloat m_Re0 = {}
 
MFloat m_muInfinity = {}
 
ConservativeVariablesCV = nullptr
 
FluxVariablesFV = nullptr
 
PrimitiveVariablesPV = nullptr
 
AdditionalVariablesAV = nullptr
 
SurfaceCoefficientsSC = nullptr
 

Static Public Attributes

static constexpr MInt m_noRansEquations = RANSModel::noRansEquations
 
static constexpr MInt m_ransModel = RANSModel::ransModel
 
static constexpr MBool hasSC = false
 
- Static Public Attributes inherited from FvSysEqnNS< nDim >
static constexpr MInt m_noRansEquations = 0
 
static constexpr MInt m_ransModel = NORANS
 
static constexpr MBool hasAV = false
 
static constexpr MBool hasSC = false
 
static const MUint index0 [nDim]
 
static const MUint index1 [nDim]
 

Private Types

using Base = FvSysEqnNS< nDim >
 

Static Private Member Functions

static constexpr std::array< MInt, nDim > getArray012 ()
 

Private Attributes

const MFloat m_Pr_t = 0.9
 
MBool m_SACurvature = false
 
MUint m_noSpecies
 
MInt m_solverId
 
MFloat m_F1BGammaMinusOne
 
MFloat m_F1BPr
 
MFloat m_gamma
 
MFloat m_gammaMinusOne
 
MFloat m_gFGMOrPr
 
MFloat m_Pr
 
MFloat m_referenceTemperature
 
MFloat m_sutherlandConstant
 
MFloat m_sutherlandConstantThermal
 
MFloat m_sutherlandPlusOne
 
MFloat m_sutherlandPlusOneThermal
 

Static Private Attributes

static const MUint index0 [nDim]
 
static const MUint index1 [nDim]
 

Additional Inherited Members

- Protected Member Functions inherited from FvSysEqnNS< nDim >
void readProperties ()
 
- Static Protected Member Functions inherited from FvSysEqnNS< nDim >
static MFloat sgn (MFloat val)
 
static constexpr std::array< MInt, nDim > getArray012 ()
 
- Protected Attributes inherited from FvSysEqnNS< nDim >
MUint m_noSpecies
 
MInt m_solverId
 
MFloat m_gamma = 1.4
 
MFloat m_gammaMinusOne = m_gamma - 1
 
MFloat m_F1BGammaMinusOne = 1 / m_gammaMinusOne
 
MFloat m_FGammaBGammaMinusOne = m_gamma / m_gammaMinusOne
 
MFloat m_F1BGamma = 1 / m_gamma
 
MFloat m_Pr = 0.72
 
MFloat m_F1BPr = 1 / m_Pr
 
MFloat m_referenceTemperature = {}
 
MFloat m_sutherlandPlusOne = {}
 
MFloat m_sutherlandConstant = {}
 
MFloat m_sutherlandPlusOneThermal = {}
 
MFloat m_sutherlandConstantThermal = {}
 
MFloat m_gFGMOrPr = {}
 
MFloat m_enhanceThreePointViscFluxFactor {}
 
MFloat m_centralizeSurfaceVariablesFactor = 0.0
 

Detailed Description

template<MInt nDim, class RANSModel>
class FvSysEqnRANS< nDim, RANSModel >

Definition at line 29 of file fvcartesiansyseqnrans.h.

Member Typedef Documentation

◆ Base

template<MInt nDim, class RANSModel >
using FvSysEqnRANS< nDim, RANSModel >::Base = FvSysEqnNS<nDim>
private

Definition at line 123 of file fvcartesiansyseqnrans.h.

Constructor & Destructor Documentation

◆ FvSysEqnRANS()

template<MInt nDim, class RANSModel >
FvSysEqnRANS< nDim, RANSModel >::FvSysEqnRANS ( const MInt  solverId,
const MInt  noSpecies 
)

Definition at line 31 of file fvcartesiansyseqnrans.cpp.

32 : FvSysEqnNS<nDim>(solverId, noSpecies) {
33 CV = new ConservativeVariables(noSpecies);
34 PV = new PrimitiveVariables(noSpecies);
35 FV = new FluxVariables(noSpecies);
36}
FluxVariables * FV
ConservativeVariables * CV
PrimitiveVariables * PV

Member Function Documentation

◆ Ausm()

template<MInt nDim, class RANSModel >
template<MInt stencil>
void FvSysEqnRANS< nDim, RANSModel >::Ausm ( const MInt  orientation,
const MFloat  upwindCoefficient,
const MFloat  A,
const MFloat *const  leftVars,
const MFloat *const  rightVars,
const MFloat *const   NotUsedsrfcCoeff,
MFloat *const  flux 
)
inline

Definition at line 233 of file fvcartesiansyseqnrans.h.

235 {
236 // catch the primitive variables rho and p,
237 // compute speed of sound, and interface mach number
238 const MFloat RHOL = leftVars[PV->RHO];
239 const MFloat PL = leftVars[PV->P];
240 const MFloat AL = sqrt(m_gamma * mMax(MFloatEps, PL / mMax(MFloatEps, RHOL)));
241 const MFloat ML = leftVars[orientation] / AL;
242
243 const MFloat RHOR = rightVars[PV->RHO];
244 const MFloat PR = rightVars[PV->P];
245 const MFloat AR = sqrt(m_gamma * mMax(MFloatEps, PR / mMax(MFloatEps, RHOR)));
246 const MFloat MR = rightVars[orientation] / AR;
247
248 // calculation of the resulting pressure and mach number on the surface
249 const MFloat MLR = 0.5 * (ML + MR);
250 const MFloat PLR = PL * (0.5 + upwindCoefficient * ML) + PR * (0.5 - upwindCoefficient * MR);
251
252 // calculation of the left and right rho*a
253 const MFloat RHO_AL = RHOL * AL;
254 const MFloat RHO_AR = RHOR * AR;
255
256 // calculation of the resulting mass flux through the surface
257 const MFloat RHO_U2 = 0.25 * (MLR * (RHO_AL + RHO_AR) + fabs(MLR) * (RHO_AL - RHO_AR));
258 const MFloat AbsRHO_U2 = fabs(RHO_U2);
259
260 // calculation of the energy:
261 const MFloat PLfRHOL = PL / RHOL;
262 const MFloat PRfRHOR = PR / RHOR;
263
264 // calculation of the velocity magnitude
265 const MFloat U2L = std::inner_product(&leftVars[PV->U], &leftVars[PV->U] + nDim, &leftVars[PV->U], 0.0);
266 const MFloat U2R = std::inner_product(&rightVars[PV->U], &rightVars[PV->U] + nDim, &rightVars[PV->U], 0.0);
267
268 const MFloat e0 = PLfRHOL * m_F1BGammaMinusOne + 0.5 * U2L + PLfRHOL;
269 const MFloat e1 = PRfRHOR * m_F1BGammaMinusOne + 0.5 * U2R + PRfRHOR;
270
271 std::array<MFloat, nDim> pFactor{};
272 pFactor[orientation] = 1.0;
273
274 for(MInt n = 0; n < nDim; n++) {
275 flux[FV->RHO_VV[n]] = (RHO_U2 * (leftVars[PV->VV[n]] + rightVars[PV->VV[n]])
276 + AbsRHO_U2 * (leftVars[PV->VV[n]] - rightVars[PV->VV[n]]) + PLR * pFactor[n])
277 * A;
278 }
279
280 flux[FV->RHO_E] = (RHO_U2 * (e0 + e1) + AbsRHO_U2 * (e0 - e1)) * A;
281 flux[FV->RHO] = 2.0 * RHO_U2 * A;
282
283 // RANS specific flux calculations
284 for(MInt r = 0; r < PV->m_noRansEquations; ++r) {
285 const MFloat NL = leftVars[PV->NN[r]];
286 const MFloat NR = rightVars[PV->NN[r]];
287 flux[FV->RHO_NN[r]] = (RHO_U2 * (NL + NR) + AbsRHO_U2 * (NL - NR)) * A;
288 }
289
290 // Flux calculation for species transport
291 // TODO labels:FV Make noSpecies constexpr
292 for(MUint s = 0; s < PV->m_noSpecies; ++s) {
293 const MFloat YsL = leftVars[PV->Y[s]];
294 const MFloat YsR = rightVars[PV->Y[s]];
295 flux[FV->RHO_Y[s]] = (RHO_U2 * (YsL + YsR) + AbsRHO_U2 * (YsL - YsR)) * A;
296 }
297}
constexpr T mMax(const T &x, const T &y)
Definition: functions.h:94
int32_t MInt
Definition: maiatypes.h:62
uint32_t MUint
Definition: maiatypes.h:63
double MFloat
Definition: maiatypes.h:52
static constexpr std::array< MInt, nDim > RHO_VV
static constexpr std::array< MInt, nDim > VV

◆ AusmBndryCorrection()

template<MInt nDim, class RANSModel >
void FvSysEqnRANS< nDim, RANSModel >::AusmBndryCorrection ( const MInt  orientation,
const MFloat  A,
const MFloat *const  leftVars,
const MFloat *const  rightVars,
MFloat *const  flux 
)
inline

Definition at line 300 of file fvcartesiansyseqnrans.h.

302 {
303 const MFloat PL = leftVars[PV->P];
304 const MFloat PR = rightVars[PV->P];
305 const MFloat PLR = 0.5 * (PR + PL);
306
307 std::array<MFloat, nDim> pFactor{};
308 pFactor[orientation] = 1.0;
309
310 for(MInt n = 0; n < nDim; n++) {
311 flux[FV->RHO_VV[n]] = PLR * pFactor[n] * A;
312 }
313
314 flux[FV->RHO_E] = 0.0;
315 flux[FV->RHO] = 0.0;
316
317 // RANS specific flux calculations
318 for(MInt r = 0; r < PV->m_noRansEquations; ++r) {
319 flux[FV->RHO_NN[r]] = 0.0;
320 }
321
322 // Flux calculation for species transport
323 // TODO labels:FV Make noSpecies constexpr
324 for(MUint s = 0; s < PV->m_noSpecies; ++s) {
325 flux[FV->RHO_Y[s]] = 0.0;
326 }
327}

◆ computeConservativeVariables()

template<MInt nDim, class RANSModel >
void FvSysEqnRANS< nDim, RANSModel >::computeConservativeVariables ( const MFloat *const  pvarsCell,
MFloat *const  cvarsCell,
const MFloat *const   NotUsedavarsCell 
)
inline

Definition at line 652 of file fvcartesiansyseqnrans.h.

654 {
655 // compute rho v
656 MFloat velPOW2 = F0;
657 for(MInt vel = 0; vel < nDim; ++vel) {
658 const MFloat v = pvarsCell[vel];
659 cvarsCell[vel] = v * pvarsCell[PV->RHO];
660 velPOW2 += POW2(v);
661 }
662
663 // compute rho e
664 cvarsCell[CV->RHO_E] = pvarsCell[PV->P] * m_F1BGammaMinusOne + F1B2 * pvarsCell[PV->RHO] * velPOW2;
665
666 // copy the density
667 cvarsCell[CV->RHO] = pvarsCell[PV->RHO];
668
669 for(MInt r = 0; r < PV->m_noRansEquations; r++) {
670 cvarsCell[CV->RHO_NN[r]] = pvarsCell[PV->NN[r]] * pvarsCell[PV->RHO];
671 }
672
673 // compute rho Yi
674 for(MUint s = 0; s < PV->m_noSpecies; ++s) {
675 cvarsCell[CV->RHO_Y[s]] = pvarsCell[PV->Y[s]] * pvarsCell[PV->RHO];
676 }
677}
constexpr Real POW2(const Real x)
Definition: functions.h:119

◆ computePrimitiveVariables()

template<MInt nDim, class RANSModel >
void FvSysEqnRANS< nDim, RANSModel >::computePrimitiveVariables ( const MFloat *const  cvarsCell,
MFloat *const  pvarsCell,
const MFloat *const   NotUsedavarsCell 
)
inline

Definition at line 626 of file fvcartesiansyseqnrans.h.

628 {
629 const MFloat fRho = F1 / cvarsCell[CV->RHO];
630 MFloat velPOW2 = F0;
631 for(MInt n = 0; n < nDim; ++n) { // compute velocity
632 pvarsCell[PV->VV[n]] = cvarsCell[CV->RHO_VV[n]] * fRho;
633 velPOW2 += POW2(pvarsCell[PV->VV[n]]);
634 }
635
636 // density and pressure:
637 pvarsCell[PV->RHO] = cvarsCell[CV->RHO]; // density
638 pvarsCell[PV->P] = m_gammaMinusOne * (cvarsCell[CV->RHO_E] - F1B2 * pvarsCell[PV->RHO] * velPOW2);
639
640 // RANS variables
641 for(MInt r = 0; r < PV->m_noRansEquations; r++) {
642 pvarsCell[PV->NN[r]] = cvarsCell[CV->RHO_NN[r]] * fRho;
643 }
644
645 // compute the species
646 for(MUint s = 0; s < PV->m_noSpecies; ++s) {
647 pvarsCell[PV->Y[s]] = cvarsCell[CV->RHO_Y[s]] * fRho;
648 }
649}

◆ computeVolumeForces()

template<MInt nDim, class RANSModel >
void FvSysEqnRANS< nDim, RANSModel >::computeVolumeForces ( const MInt  cellId,
MFloat vars,
MFloat rhs,
const MFloat  cellVol,
const MFloat *const  slopes,
const MInt  recData,
const MInt *const  recNghbr,
const MFloat *const  recConst,
const MInt  noRecNghbr,
MFloat  dist 
)
inline

Definition at line 93 of file fvcartesiansyseqnrans.h.

95 {
96 IF_CONSTEXPR(m_ransModel == RANS_SA_DV) {
97 computeVolumeForcesRANS_SA(cellId, vars, rhs, cellVol, slopes, recData, recNghbr, recConst, noRecNghbr, dist);
98 }
99 IF_CONSTEXPR(m_ransModel == RANS_FS) {
100 computeVolumeForcesRANS_FS(cellId, vars, rhs, cellVol, slopes, recData, recNghbr, recConst, noRecNghbr, dist);
101 }
102 IF_CONSTEXPR(m_ransModel == RANS_KOMEGA) {
103 computeVolumeForcesRANS_KOMEGA(cellId, vars, rhs, cellVol, slopes, recData, recNghbr, recConst, noRecNghbr, dist);
104 }
105 }
static constexpr MInt m_ransModel
void computeVolumeForcesRANS_FS(const MInt cellId, MFloat *vars, MFloat *rhs, MFloat cellVol, const MFloat *const slopes, MInt recData, const MInt *const recNghbr, const MFloat *const recConst, MInt noRecNghbr, MFloat)
void computeVolumeForcesRANS_SA(const MInt cellId, MFloat *vars, MFloat *rhs, const MFloat cellVol, const MFloat *const slopes, const MInt recData, const MInt *const, const MFloat *const, const MInt noRecNghbr, MFloat dist)
void computeVolumeForcesRANS_KOMEGA(const MInt cellId, MFloat *vars, MFloat *rhs, const MFloat cellVol, const MFloat *const slopes, const MInt, const MInt *const, const MFloat *const, const MInt, MFloat)
@ RANS_SA_DV
Definition: enums.h:54
@ RANS_FS
Definition: enums.h:55
@ RANS_KOMEGA
Definition: enums.h:56
MFloat dist(const Point< DIM > &p, const Point< DIM > &q)
Definition: pointbox.h:54

◆ computeVolumeForcesRANS_FS()

template<MInt nDim, class RANSModel >
void FvSysEqnRANS< nDim, RANSModel >::computeVolumeForcesRANS_FS ( const MInt  cellId,
MFloat vars,
MFloat rhs,
MFloat  cellVol,
const MFloat *const  slopes,
MInt  recData,
const MInt *const  recNghbr,
const MFloat *const  recConst,
MInt  noRecNghbr,
MFloat   
)

Definition at line 781 of file fvcartesiansyseqnrans.h.

785 {
786 const MFloat rRe = F1 / m_Re0;
787
788 const MFloat rho = vars[cellId * PV->noVariables + PV->RHO];
789 const MFloat p = vars[cellId * PV->noVariables + PV->P];
790 const MFloat nuTilde = vars[cellId * PV->noVariables + PV->N];
791 const MFloat T = m_gamma * p / rho;
792 const MFloat mue = (T * sqrt(T) * m_sutherlandPlusOne) / (T + m_sutherlandConstant);
793 const MFloat nuLaminar = mue / rho;
794
795 MFloat SijSij = F0;
796 MFloat OijOjkSki = F0;
797 MFloat diff2 = F0;
798
799 for(MInt d1 = 0; d1 < nDim; d1++) {
800 MInt indexN1 = cellId * PV->noVariables * nDim + PV->N * nDim + d1;
801 MInt indexRHO1 = cellId * PV->noVariables * nDim + PV->RHO * nDim + d1;
802 diff2 += slopes[indexN1] * slopes[indexRHO1];
803 for(MInt d2 = 0; d2 < nDim; d2++) {
804 MInt indexVV12 = cellId * PV->noVariables * nDim + PV->VV[d1] * nDim + d2;
805 MInt indexVV21 = cellId * PV->noVariables * nDim + PV->VV[d2] * nDim + d1;
806 MFloat sij = 0.5 * (slopes[indexVV12] + slopes[indexVV21]);
807 MFloat wij = 0.5 * (slopes[indexVV12] - slopes[indexVV21]);
808 SijSij += sij * sij;
809 for(MInt d3 = 0; d3 < nDim; d3++) {
810 MInt indexVV13 = cellId * PV->noVariables * nDim + PV->VV[d1] * nDim + d3;
811 MInt indexVV31 = cellId * PV->noVariables * nDim + PV->VV[d3] * nDim + d1;
812 MInt indexVV23 = cellId * PV->noVariables * nDim + PV->VV[d2] * nDim + d3;
813 MInt indexVV32 = cellId * PV->noVariables * nDim + PV->VV[d3] * nDim + d2;
814 MFloat ski = 0.5 * (slopes[indexVV13] + slopes[indexVV31]);
815 MFloat wjk = 0.5 * (slopes[indexVV23] - slopes[indexVV32]);
816 OijOjkSki += wij * wjk * ski;
817 }
818 }
819 }
820
821 diff2 = rRe * (nuLaminar + RM_FS::fasigma * nuTilde) * diff2;
822
823 const MFloat omega = mMax(1e-16, F1 / sqrt(RM_FS::fabetcs) * sqrt(F2 * SijSij));
824 MFloat psi_o = fabs(OijOjkSki / (pow(RM_FS::fabetcs * omega, 3.0)));
825
826 MFloat term1 = 0.0;
827 MFloat term2 = 0.0;
828 MFloat domega[nDim]{};
829 MFloat dnutilde[nDim]{};
830
831 for(MInt nghbr = 0; nghbr < noRecNghbr; nghbr++) {
832 const MInt nghbrId = recNghbr[nghbr];
833
834 // calculation of omega for nghbr
835 MFloat SijSijNgbhr = 0;
836 for(MInt d1 = 0; d1 < nDim; d1++) {
837 for(MInt d2 = 0; d2 < nDim; d2++) {
838 MInt indexVV12 = nghbrId * PV->noVariables * nDim + PV->VV[d1] * nDim + d2;
839 MInt indexVV21 = nghbrId * PV->noVariables * nDim + PV->VV[d2] * nDim + d1;
840 MFloat sijNgbhr = 0.5 * (slopes[indexVV12] + slopes[indexVV21]);
841 SijSijNgbhr += sijNgbhr * sijNgbhr;
842 }
843 }
844 const MFloat omegaNgbhr = 1 / sqrt(RM_FS::fabetcs) * sqrt(2 * SijSijNgbhr);
845
846 const MFloat nutildeNgbhr = vars[nghbrId * PV->noVariables + PV->N];
847 for(MInt d = 0; d < nDim; d++) {
848 const MFloat recConst_ = recConst[nDim * (recData + nghbr) + d];
849 const MFloat deltaOmega = omegaNgbhr - omega;
850 const MFloat deltaNutilde = nutildeNgbhr - nuTilde;
851 domega[d] += recConst_ * deltaOmega;
852 dnutilde[d] += recConst_ * deltaNutilde;
853 }
854 }
855
856 for(MInt d = 0; d < nDim; ++d) {
857 term1 += domega[d] * domega[d];
858 term2 += dnutilde[d] * domega[d];
859 }
860
861 // psi_o = 0;
862 const MFloat psi_k = mMax(F0, F1 / pow(omega, F3) * (nuTilde * term1 + omega * term2));
863 const MFloat f_betc = (1 + RM_FS::fapsio1 * psi_o) / (1 + RM_FS::fapsio2 * psi_o);
864 const MFloat f_betcs = (1 + RM_FS::fapsik1 * psi_k) / (1 + RM_FS::fapsik2 * psi_k);
865 const MFloat beta = f_betc / f_betc * RM_FS::fabetc;
866 const MFloat beta_s = f_betcs / f_betcs * RM_FS::fabetcs;
867
868 MFloat Sijduidxj = F0;
869 MFloat duidxi = F0;
870 for(MInt d1 = 0; d1 < nDim; d1++) {
871 for(MInt d2 = 0; d2 < nDim; d2++) {
872 MInt indexVV12 = cellId * PV->noVariables * nDim + PV->VV[d1] * nDim + d2;
873 MInt indexVV21 = cellId * PV->noVariables * nDim + PV->VV[d2] * nDim + d1;
874 Sijduidxj += 0.5 * slopes[indexVV12] * (slopes[indexVV12] + slopes[indexVV21]);
875 }
876 MInt indexVV11 = cellId * PV->noVariables * nDim + PV->VV[d1] * nDim + d1;
877 duidxi += slopes[indexVV11];
878 }
879
880 // MFloat P_FS = mMin(0.0, 2 * (F1 - RM_FS::faalpha) * nuTilde * (Sijduidxj / omega - F1B3 * duidxi));
881 MFloat P_FS = 2 * (F1 - RM_FS::faalpha) * nuTilde * (Sijduidxj / omega - F1B3 * duidxi);
882 MFloat D_FS = (beta_s - beta) * nuTilde * omega;
883 MFloat diff1 = mMin(0.0, rRe * F2 * rho * (nuLaminar + RM_FS::fasigma * nuTilde) / omega * term2);
884
885 const MFloat prodDest_FS = rho * (P_FS - D_FS);
886 // const MFloat TU = m_turbulenceDegree;
887 // const MFloat T = m_TInfinity;
888 /* const MFloat mue_init = */
889 /* (m_TInfinity * sqrt(m_TInfinity) * m_sutherlandPlusOne) / (m_TInfinity + m_sutherlandConstant); */
890 /* const MFloat nu_init = mue_init / m_rhoInfinity; */
891 /* const MFloat k = Re * F3B2 * rho * pow(TU * m_UInfinity, F2) * RM_FS::faphi * pow(nuTilde / nu_init, F5); */
892
893 const MFloat k = 0.0;
894
895 const MFloat diff_FS = diff1 - diff2;
896
897 rhs[CV->RHO_N] -= cellVol * (prodDest_FS + diff_FS - k);
898}
constexpr T mMin(const T &x, const T &y)
Definition: functions.h:90
void const MInt cellId
Definition: collector.h:239
constexpr std::underlying_type< FcCell >::type p(const FcCell property)
Converts property name to underlying integer value.
static constexpr MFloat faalpha
static constexpr MFloat fapsik2
static constexpr MFloat fabetcs
static constexpr MFloat fapsik1
static constexpr MFloat fasigma
static constexpr MFloat fabetc
static constexpr MFloat fapsio2
static constexpr MFloat fapsio1

◆ computeVolumeForcesRANS_KOMEGA()

template<MInt nDim, class RANSModel >
void FvSysEqnRANS< nDim, RANSModel >::computeVolumeForcesRANS_KOMEGA ( const MInt  cellId,
MFloat vars,
MFloat rhs,
const MFloat  cellVol,
const MFloat *const  slopes,
const  MInt,
const MInt * const  ,
const MFloat * const  ,
const  MInt,
MFloat   
)

Definition at line 901 of file fvcartesiansyseqnrans.h.

906 {
907 const MFloat Re = m_Re0;
908 const MFloat rRe = F1 / m_Re0;
909 const MFloat rho = vars[cellId * PV->noVariables + PV->RHO]; // vars(cellId,PV->RHO);//
910 const MFloat k = vars[cellId * PV->noVariables + PV->K]; // vars(cellId,PV->K);//
911 const MFloat omega = vars[cellId * PV->noVariables + PV->OMEGA]; // vars(cellId,PV->OMEGA);//
912
913 MFloat dukdxk = F0;
914 for(MInt d = 0; d < nDim; d++) {
915 dukdxk += slopes[PV->VV[d] * nDim + d];
916 }
917
918 MFloat omega_hat = omega; // max(omega,rRe*RM_KOMEGA::C_lim/sqrt(RM_KOMEGA::betas)*sqrt(2*Sij_Sij_));
919 // MFloat omega_hat = RM_KOMEGA::C_lim/sqrt(RM_KOMEGA::betas)*sqrt(2*SijSij));
920
921 const MFloat mue_Turb = /*m_Re0 */ rho * k / omega_hat;
922
923 MFloat tau = F0;
924 MFloat P = F0;
925 MFloat term = F0;
926 for(MInt d1 = 0; d1 < nDim; d1++) {
927 for(MInt d2 = 0; d2 < nDim; d2++) {
928 tau = rRe * mue_Turb * (slopes[PV->VV[d1] * nDim + d2] + slopes[PV->VV[d2] * nDim + d1]);
929 if(d1 == d2) {
930 tau -= (/*rRe * mue_Turb * F2B3 * dukdxk +*/ F2B3 * rho * k);
931 }
932 P += slopes[PV->VV[d1] * nDim + d2] * tau;
933 }
934 term += slopes[PV->K * nDim + d1] * slopes[PV->OMEGA * nDim + d1];
935 }
936
937 MFloat OijOjkSki = F0;
938 for(MInt d1 = 0; d1 < nDim; d1++) {
939 for(MInt d2 = 0; d2 < nDim; d2++) {
940 MFloat wij = 0.5 * (slopes[PV->VV[d1] * nDim + d2] - slopes[PV->VV[d2] * nDim + d1]);
941 for(MInt d3 = 0; d3 < nDim; d3++) {
942 MFloat ski = 0.5 * (slopes[PV->VV[d3] * nDim + d1] + slopes[PV->VV[d1] * nDim + d3]);
943 MFloat wjk = 0.5 * (slopes[PV->VV[d2] * nDim + d3] - slopes[PV->VV[d3] * nDim + d2]);
944 OijOjkSki += wij * wjk * ski;
945 }
946 }
947 }
948
949 MFloat X_omega = fabs(OijOjkSki / pow(RM_KOMEGA::betas * omega, F3));
950 MFloat f_beta = (F1 + RM_KOMEGA::fbeta1 * X_omega) / (F1 + RM_KOMEGA::fbeta2 * X_omega);
951 MFloat beta = RM_KOMEGA::beta * f_beta;
952
953 const MFloat P_k = P;
954 const MFloat P_o = RM_KOMEGA::alpha * omega / k * P;
955
956 const MFloat D_k = Re * RM_KOMEGA::betas * rho * k * omega;
957 const MFloat D_o = Re * beta * rho * POW2(omega);
958
959 // MFloat diff_o = F0;
960 // if(term > 0) {
961 // diff_o = rRe * rho * RM_KOMEGA::sigma_d / omega * term;
962 // }
963
964 const MFloat prodDest_K = P_k - D_k;
965 const MFloat prodDest_OMEGA = P_o - D_o;
966
967 rhs[CV->RHO_K] -= cellVol * (prodDest_K);
968 rhs[CV->RHO_OMEGA] -= cellVol * (prodDest_OMEGA);
969}

◆ computeVolumeForcesRANS_SA()

template<MInt nDim, class RANSModel >
void FvSysEqnRANS< nDim, RANSModel >::computeVolumeForcesRANS_SA ( const MInt  cellId,
MFloat vars,
MFloat rhs,
const MFloat  cellVol,
const MFloat *const  slopes,
const MInt  recData,
const MInt * const  ,
const MFloat * const  ,
const MInt  noRecNghbr,
MFloat  dist 
)

Definition at line 716 of file fvcartesiansyseqnrans.h.

720 {
721 // return;
722
723 std::ignore = recData;
724 std::ignore = noRecNghbr;
725
726 const MFloat rRe = F1 / m_Re0;
727 const MFloat rho = vars[cellId * PV->noVariables + PV->RHO];
728 const MFloat p = vars[cellId * PV->noVariables + PV->P];
729 const MFloat nuTilde = vars[cellId * PV->noVariables + PV->N];
730 const MFloat T = m_gamma * p / rho;
731 const MFloat mue = (T * sqrt(T) * m_sutherlandPlusOne) / (T + m_sutherlandConstant);
732 const MFloat nuLaminar = mue / rho;
733
734 MFloat s = 0.0;
735 MFloat diff = 0.0;
736
737 // calculation of d(sqrt(rho) nu_tilde)/dx
738 // source: "Density Corrections for Turbulence Models", Aerospace Science and Technology, Vol. 4, 2000, pp. 1--11
739 for(MInt d = 0; d < nDim; d++) {
740 MInt indexRho = cellId * PV->noVariables * nDim + PV->RHO * nDim + d;
741 MInt indexNT = cellId * PV->noVariables * nDim + PV->N * nDim + d;
742 diff += rRe * RM_SA_DV::Fsigma * RM_SA_DV::cb2
743 * POW2((sqrt(rho) * slopes[indexNT] + nuTilde * slopes[indexRho] / (2 * sqrt(rho))));
744 // no correction model
745 // diff += rRe * RM_SA_DV::Fsigma * (rho * RM_SA_DV::cb2 * POW2(slopes[indexNT]) - (nuTilde + nuLaminar) *
746 // slopes[indexNT] * slopes[indexRho]);
747 }
748
749
750 for(MInt d1 = 0; d1 < nDim; d1++) {
751 for(MInt d2 = 0; d2 < nDim; d2++) {
752 MInt indexVV12 = cellId * PV->noVariables * nDim + PV->VV[d1] * nDim + d2;
753 MInt indexVV21 = cellId * PV->noVariables * nDim + PV->VV[d2] * nDim + d1;
754 MFloat wij = 0.5 * (slopes[indexVV12] - slopes[indexVV21]);
755 s += wij * wij;
756 }
757 }
758 s = sqrt(2 * s);
759
760 const MFloat chi = nuTilde / (nuLaminar);
761 const MFloat fv1 = pow(chi, 3) / (pow(chi, 3) + RM_SA_DV::cv1to3);
762 const MFloat Fv2 = F1 - (chi / (F1 + chi * fv1));
763 const MFloat Fdist2 = 1.0 / (dist * dist);
764 const MFloat term = nuTilde * Fdist2 * RM_SA_DV::Fkap2;
765 const MFloat stilde = s + term * Fv2 * rRe;
766 const MFloat r = mMin(10.0, rRe * term / stilde);
767 const MFloat g = r + RM_SA_DV::cw2 * (pow(r, 6) - r);
768 const MFloat Fwterm = (1 + RM_SA_DV::cw3to6) / (pow(g, 6) + RM_SA_DV::cw3to6);
769 const MFloat Fw = g * pow(Fwterm, (1.0 / 6.0));
770 const MFloat Ft2 = RM_SA_DV::Ft2; // RM_SA_DV::ct3 * exp(-RM_SA_DV::ct4*POW2(chi));
771
772 // RM_SA_DV::Ft2 = 0.0 (because simulations with no tripping term)
773 MFloat P = (F1 - Ft2) * RM_SA_DV::cb1 * /* fabs( */ nuTilde /* ) */ * mMax(stilde, 0.3 * s);
774 MFloat D = rRe * (RM_SA_DV::cw1 * Fw - RM_SA_DV::cb1 * RM_SA_DV::Fkap2 * Ft2) * pow(nuTilde, 2.0) * Fdist2;
775 MFloat prodDest = rho * (P - D);
776
777 rhs[CV->RHO_N] -= cellVol * (prodDest + diff);
778}

◆ conservativeSlopes()

template<MInt nDim, class RANSModel >
std::vector< std::vector< MFloat > > FvSysEqnRANS< nDim, RANSModel >::conservativeSlopes ( const MFloat *const  pvarsCell,
const MFloat *const  cvarsCell,
const MFloat *const  avarsCell,
const MFloat *const  slopesCell 
)
inline

Definition at line 681 of file fvcartesiansyseqnrans.h.

683 {
684 MFloat U2 = F0;
685 for(MInt i = 0; i < nDim; i++) {
686 U2 += POW2(pvarsCell[PV->VV[i]]);
687 }
688
689 std::vector<std::vector<MFloat>> dQ(CV->noVariables, std::vector<MFloat>(nDim));
690
691 for(MInt d = 0; d < nDim; d++) {
692 dQ[CV->RHO][d] = slopesCell[PV->RHO * nDim + d];
693 dQ[CV->RHO_E][d] = slopesCell[PV->P * nDim + d] / (m_gamma - F1) + F1B2 * U2 * slopesCell[PV->RHO * nDim + d];
694
695 for(MInt j = 0; j < nDim; j++) {
696 dQ[CV->RHO_VV[j]][d] =
697 pvarsCell[PV->VV[j]] * slopesCell[PV->RHO * nDim + d] + pvarsCell[PV->RHO] * slopesCell[PV->VV[j] * nDim + d];
698 dQ[CV->RHO_E][d] += pvarsCell[PV->RHO] * pvarsCell[PV->VV[j]] * slopesCell[PV->VV[j] * nDim + d];
699 }
700
701 for(MInt r = 0; r < m_noRansEquations; r++) {
702 dQ[CV->RHO_NN[r]][d] =
703 pvarsCell[PV->NN[r]] * slopesCell[PV->RHO * nDim + d] + pvarsCell[PV->RHO] * slopesCell[PV->NN[r] * nDim + d];
704 }
705
706 for(MUint s = 0; s < CV->m_noSpecies; ++s) {
707 dQ[CV->RHO_Y[s]][d] =
708 pvarsCell[PV->Y[s]] * slopesCell[PV->RHO * nDim + d] + pvarsCell[PV->RHO] * slopesCell[PV->Y[s] * nDim + d];
709 }
710 }
711
712 return dQ;
713}
static constexpr MInt m_noRansEquations

◆ getArray012()

template<MInt nDim, class RANSModel >
static constexpr std::array< MInt, nDim > FvSysEqnNS< nDim >::getArray012 ( )
inlinestaticconstexprprivate

Definition at line 316 of file fvcartesiansyseqnns.h.

316 {
317 IF_CONSTEXPR(nDim == 2) {
318 std::array<MInt, 2> a = {0, 1};
319 return a;
320 }
321 else {
322 std::array<MInt, 3> a = {0, 1, 2};
323 return a;
324 }
325 }
Definition: contexttypes.h:19

◆ viscousFlux() [1/2]

template<MInt nDim, class RANSModel >
template<MInt stencil>
void FvSysEqnRANS< nDim, RANSModel >::viscousFlux ( const MInt  orientation,
const MFloat  A,
const MBool  isBndry,
const MFloat *const  surfaceCoords,
const MFloat *const  coord0,
const MFloat *const  coord1,
const MFloat *const  cellVars0,
const MFloat *const  cellVars1,
const MFloat *const  vars0,
const MFloat *const  vars1,
const MFloat *const  slope0,
const MFloat *const  slope1,
const MFloat  f0,
const MFloat  f1,
MFloat *const  flux 
)
inline

Definition at line 57 of file fvcartesiansyseqnrans.h.

61 {
62 if(stencil == THREE_POINT) {
63 viscousFluxThreePoint(orientation, A, isBndry, surfaceCoords, coord0, coord1, cellVars0, cellVars1, vars0, vars1,
64 slope0, slope1, f0, f1, flux);
65 } else {
66 TERMM(1, "Viscous Flux Scheme not implemented.");
67 }
68 }
void viscousFluxThreePoint(const MInt orientation, const MFloat A, const MBool isBndry, const MFloat *const surfaceCoords, const MFloat *const coord0, const MFloat *const coord1, const MFloat *const cellVars0, const MFloat *const cellVars1, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat f0, const MFloat f1, MFloat *const flux)
@ THREE_POINT
Definition: enums.h:184

◆ viscousFlux() [2/2]

template<MInt nDim, class RANSModel >
template<MInt stencil>
void FvSysEqnRANS< nDim, RANSModel >::viscousFlux ( const MInt  orientation,
const MFloat  A,
const MFloat *const  vars0,
const MFloat *const  vars1,
const MFloat *const  slope0,
const MFloat *const  slope1,
const MFloat *const  srfcCoeff,
const MFloat  f0,
const MFloat  f1,
MFloat *const  flux 
)
inline

Definition at line 45 of file fvcartesiansyseqnrans.h.

47 {
48 if(stencil == FIVE_POINT) {
49 viscousFluxFivePoint(orientation, A, vars0, vars1, slope0, slope1, srfcCoeff, f0, f1, flux);
50 } else {
51 TERMM(1, "Viscous Flux Scheme not implemented.");
52 }
53 }
void viscousFluxFivePoint(const MInt orientation, const MFloat A, const MFloat *const vars0, const MFloat *const vars1, const MFloat *const slope0, const MFloat *const slope1, const MFloat *const NotUsed(srfcCoeff), const MFloat f0, const MFloat f1, MFloat *const flux)
@ FIVE_POINT
Definition: enums.h:184

◆ viscousFluxFivePoint()

template<MInt nDim, class RANSModel >
void FvSysEqnRANS< nDim, RANSModel >::viscousFluxFivePoint ( const MInt  orientation,
const MFloat  A,
const MFloat *const  vars0,
const MFloat *const  vars1,
const MFloat *const  slope0,
const MFloat *const  slope1,
const MFloat *const   NotUsedsrfcCoeff,
const MFloat  f0,
const MFloat  f1,
MFloat *const  flux 
)
inline

Definition at line 330 of file fvcartesiansyseqnrans.h.

334 {
335 static const MFloat rhoUDth = m_muInfinity * m_F1BPr;
336 static const MFloat F1BRe0 = F1 / m_Re0;
337
338 // calculate the primitve variables on the surface u,v,rho,p
339 const std::array<MFloat, nDim> velocity = [&] {
340 std::array<MFloat, nDim> tmp{};
341 for(MUint n = 0; n < nDim; n++) {
342 tmp[n] = F1B2 * (vars0[PV->VV[n]] + vars1[PV->VV[n]]);
343 }
344 return tmp;
345 }();
346
347 const MFloat rho = F1B2 * (vars0[PV->RHO] + vars1[PV->RHO]);
348 const MFloat Frho = F1 / rho;
349 const MFloat p = F1B2 * (vars0[PV->P] + vars1[PV->P]);
350
351 // Temperature on the surface T = gamma * p / rho
352 const MFloat T = m_gamma * p * Frho;
353
354 // Indices for the orientations
355 const MUint id0 = orientation;
356 const MUint id1 = index0[orientation];
357 const MUint id2 = index1[orientation];
358
359 // Compute A / Re
360 const MFloat dAOverRe = A * F1BRe0;
361
362 // calculate the viscosity with the sutherland law mue = T^3/2 * (1+S/T_0)(T + S/T_0)
363 const MFloat mue = (T * sqrt(T) * m_sutherlandPlusOne) / (T + m_sutherlandConstant);
364
365 // Turbulence modelling
366 MFloat mue_t = 0.0;
367
368 IF_CONSTEXPR(m_ransModel == RANS_SA_DV) {
369 const MFloat nuTilde = F1B2 * (vars0[PV->N] + vars1[PV->N]);
370 const MFloat nuLaminar = mue / rho;
371 const MFloat chi = nuTilde / (nuLaminar);
372 const MFloat fv1 = pow(chi, 3) / (pow(chi, 3) + RM_SA_DV::cv1to3);
373 const MFloat nuTurb = fv1 * nuTilde;
374 if(nuTilde > 0.0) {
375 mue_t = rho * nuTurb;
376 }
377 }
378 IF_CONSTEXPR(m_ransModel == RANS_FS) {
379 const MFloat nuTilde = F1B2 * (vars0[PV->N] + vars1[PV->N]);
380 const MFloat nuLaminar = mue / rho;
381 const MFloat chi = nuTilde / (nuLaminar);
382 const MFloat fv1 = pow(chi, 3) / (pow(chi, 3) + RM_FS::facv1to3);
383 const MFloat nuTurb = fv1 * nuTilde;
384 if(nuTilde > 0.0) {
385 mue_t = rho * nuTurb;
386 }
387 }
388 IF_CONSTEXPR(m_ransModel == RANS_KOMEGA) {
389 const MFloat k = F1B2 * (vars0[PV->K] + vars1[PV->K]);
390 const MFloat o = F1B2 * (vars0[PV->OMEGA] + vars1[PV->OMEGA]);
391 const MFloat nuTurb = k / o;
392 if(nuTurb > 0.0) {
393 mue_t = rho * nuTurb;
394 }
395 }
396
397
398 const MFloat lambda_t = mue_t / m_Pr_t;
399
400 // Wall-modeling with precomputed, approximated mue_wm
401 MFloat mue_wm = 0.0;
402 /*if(m_wmLES) {
403 if(*srfcs[srfcId].m_bndryCndId == 3399) {
404 MInt cellId = nghbrCellIds[2 * srfcId];
405 if(!a_isBndryCell(cellId)) cellId = nghbrCellIds[2 * srfcId + 1];
406 if(a_isBndryCell(cellId) && !a_isHalo(cellId)) {
407 mue_wm = computeWMViscositySpalding(cellId);
408 }
409 }
410 }*/
411
412 const MFloat lambda = (T * sqrt(T) * m_sutherlandPlusOneThermal) / (T + m_sutherlandConstantThermal);
413
414 const MUint sq0 = PV->P * nDim + id0;
415 const MUint sq1 = PV->RHO * nDim + id0;
416 const MFloat q = (lambda + lambda_t) * m_gFGMOrPr * Frho
417 * ((f0 * slope0[sq0] + f1 * slope1[sq0]) - p * Frho * (f0 * slope0[sq1] + f1 * slope1[sq1]));
418
419 // Compute the stress terms
420 const MUint s00 = id0 * nDim + id0;
421 const MUint s01 = id0 * nDim + id1;
422 const MUint s10 = id1 * nDim + id0;
423 const MUint s11 = id1 * nDim + id1;
424
425 std::array<MFloat, nDim> tau{};
426 IF_CONSTEXPR(nDim == 2) {
427 tau[id0] = (mue + mue_t + mue_wm)
428 * (f0 * (F4B3 * slope0[s00] - F2B3 * slope0[s11]) + f1 * (F4B3 * slope1[s00] - F2B3 * slope1[s11]));
429 tau[id1] = (mue + mue_t + mue_wm) * (f0 * (slope0[s01] + slope0[s10]) + f1 * (slope1[s01] + slope1[s10]));
430 }
431 else IF_CONSTEXPR(nDim == 3) {
432 const MUint s22 = id2 * nDim + id2;
433 const MUint s02 = id0 * nDim + id2;
434 const MUint s20 = id2 * nDim + id0;
435 tau[id0] = (mue + mue_t + mue_wm)
436 * (f0 * (F4B3 * slope0[s00] - F2B3 * (slope0[s11] + slope0[s22]))
437 + f1 * (F4B3 * slope1[s00] - F2B3 * (slope1[s11] + slope1[s22])));
438 tau[id1] = (mue + mue_t + mue_wm) * (f0 * (slope0[s01] + slope0[s10]) + f1 * (slope1[s01] + slope1[s10]));
439 tau[id2] = (mue + mue_t + mue_wm) * (f0 * (slope0[s02] + slope0[s20]) + f1 * (slope1[s02] + slope1[s20]));
440 }
441
442 // Compute the flux
443 for(MUint n = 0; n < nDim; n++) {
444 flux[FV->RHO_VV[n]] -= dAOverRe * tau[n];
445 }
446 flux[FV->RHO_E] -= dAOverRe * (std::inner_product(velocity.begin(), velocity.end(), tau.begin(), 0.0) + q);
447
448 IF_CONSTEXPR(m_ransModel == RANS_SA_DV) {
449 const MUint n0 = PV->N * nDim + id0;
450 const MUint rho0 = PV->RHO * nDim + id0;
451
452 const MFloat nuTilde = F1B2 * (vars0[PV->N] + vars1[PV->N]);
453 // const MFloat nuLaminar = mue/rho;
454 // source: Density Corrections for Turbulence Models," Aerospace Science and Technology, Vol. 4, 2000, pp. 1--11
455 MFloat viscflux_nu = RM_SA_DV::Fsigma
456 * (mue * (f0 * slope0[n0] + f1 * slope1[n0])
457 + sqrt(rho) * nuTilde
458 * (sqrt(rho) * (f0 * slope0[n0] + f1 * slope1[n0])
459 + nuTilde * F1 / (F2 * sqrt(rho)) * (f0 * slope0[rho0] + f1 * slope1[rho0])));
460
461 // no correction model
462 // MFloat viscflux_nu = RM_SA_DV::Fsigma * (nuLaminar + nuTilde) * (f0 * slope0[n0] + f1 * slope1[n0]);
463
464 flux[FV->RHO_N] -= dAOverRe * (viscflux_nu);
465 }
466
467 IF_CONSTEXPR(m_ransModel == RANS_FS) {
468 const MUint n0 = PV->N * nDim + id0;
469 const MFloat nuTilde = F1B2 * (vars0[PV->N] + vars1[PV->N]);
470 const MFloat nuLaminar = mue / rho;
471 MFloat viscflux_nu = rho * (nuLaminar + RM_FS::fasigma * nuTilde) * (f0 * slope0[n0] + f1 * slope1[n0]);
472 flux[FV->RHO_N] -= dAOverRe * (viscflux_nu);
473 }
474
475 IF_CONSTEXPR(m_ransModel == RANS_KOMEGA) {
476 const MUint n0 = PV->N * nDim + id0;
477 const MUint rho0 = PV->RHO * nDim + id0;
478
479 const MFloat nuTilde = F1B2 * (vars0[PV->N] + vars1[PV->N]);
480 MFloat viscflux_nu = RM_SA_DV::Fsigma
481 * (mue * (f0 * slope0[n0] + f1 * slope1[n0])
482 + sqrt(rho) * nuTilde
483 * (sqrt(rho) * (f0 * slope0[n0] + f1 * slope1[n0])
484 + nuTilde * F1 / (F2 * sqrt(rho)) * (f0 * slope0[rho0] + f1 * slope1[rho0])));
485
486 flux[FV->RHO_N] -= dAOverRe * (viscflux_nu);
487 const MUint nk = PV->K * nDim + id0;
488 const MUint no = PV->OMEGA * nDim + id0;
489
490 const MFloat k = F1B2 * (vars0[PV->K] + vars1[PV->K]);
491 const MFloat omega = F1B2 * (vars0[PV->OMEGA] + vars1[PV->OMEGA]);
492 const MFloat mueTurb = rho * k / omega;
493
494 MFloat viscflux_k = (mue + RM_KOMEGA::sigma_k * mueTurb) * (f0 * slope0[nk] + f1 * slope1[nk]);
495 MFloat viscflux_omega = (mue + RM_KOMEGA::sigma_o * mueTurb) * (f0 * slope0[no] + f1 * slope1[no]);
496
497 flux[FV->RHO_K] -= dAOverRe * (viscflux_k);
498 flux[FV->RHO_OMEGA] -= dAOverRe * (viscflux_omega);
499 }
500
501
502 // progress variable
503 const MFloat c = dAOverRe * rhoUDth;
504 for(MUint s = 0; s < PV->m_noSpecies; ++s) {
505 const MUint i = PV->Y[s] * nDim + id0;
506 flux[FV->RHO_Y[s]] -= c * (f0 * slope0[i] + f1 * slope1[i]);
507 }
508}
MFloat m_sutherlandPlusOneThermal
static const MUint index1[nDim]
static const MUint index0[nDim]
MFloat m_sutherlandConstantThermal
@ no
Definition: enums.h:208
static constexpr MFloat facv1to3

◆ viscousFluxThreePoint()

template<MInt nDim, class RANSModel >
void FvSysEqnRANS< nDim, RANSModel >::viscousFluxThreePoint ( const MInt  orientation,
const MFloat  A,
const MBool  isBndry,
const MFloat *const  surfaceCoords,
const MFloat *const  coord0,
const MFloat *const  coord1,
const MFloat *const  cellVars0,
const MFloat *const  cellVars1,
const MFloat *const  vars0,
const MFloat *const  vars1,
const MFloat *const  slope0,
const MFloat *const  slope1,
const MFloat  f0,
const MFloat  f1,
MFloat *const  flux 
)
inline

Definition at line 511 of file fvcartesiansyseqnrans.h.

515 {
516 static const MFloat rhoUDth = m_muInfinity * m_F1BPr;
517 static const MFloat F1BRe0 = F1 / m_Re0;
518
519 // calculate the primitve variables on the surface u,v,rho,p
520 const std::array<MFloat, nDim> velocity = [&] {
521 std::array<MFloat, nDim> tmp{};
522 for(MUint n = 0; n < nDim; n++) {
523 tmp[n] = F1B2 * (vars0[PV->VV[n]] + vars1[PV->VV[n]]);
524 }
525 return tmp;
526 }();
527
528 const MFloat rho = F1B2 * (vars0[PV->RHO] + vars1[PV->RHO]);
529 const MFloat Frho = F1 / rho;
530 const MFloat p = F1B2 * (vars0[PV->P] + vars1[PV->P]);
531
532 // Temperature on the surface T = gamma * p / rho
533 const MFloat T = m_gamma * p * Frho;
534
535 // Indices for the orientations
536 const MUint id0 = orientation;
537 const MUint id1 = index0[orientation];
538 const MUint id2 = index1[orientation];
539
540 // Compute A / Re
541 const MFloat dAOverRe = A * F1BRe0;
542
543 // calculate the viscosity with the sutherland law mue = T^3/2 * (1+S/T_0)(T + S/T_0)
544 const MFloat mue = (T * sqrt(T) * m_sutherlandPlusOne) / (T + m_sutherlandConstant);
545
546 const MFloat lambda = (T * sqrt(T) * m_sutherlandPlusOneThermal) / (T + m_sutherlandConstantThermal);
547
548 // TODO labels:FV @Julian, change to stack alloc
549 std::vector<MFloat> slopes(PV->noVariables * nDim);
550
551 /*#ifdef _VISCOUS_SLOPES_COMPACT_VARIANT_
552 const MFloat dx = F1B2 * (coord1[id0] - coord0[id0]);
553 #endif*/
554 for(MInt var = 0; var < PV->noVariables; var++) {
555 slopes[nDim * var + id0] =
556 cellVars1[var]
557 - cellVars0[var]
558 /*#ifdef _VISCOUS_SLOPES_COMPACT_VARIANT_
559 + (surfaceCoords[id0] - coord1[id0] + dx) * slope1[var * nDim + id0]
560 - (surfaceCoords[id0] - coord0[id0] - dx) * slope0[var * nDim + id0]
561 #endif*/
562 + (surfaceCoords[id1] - coord1[id1]) * slope1[var * nDim + id1]
563 - (surfaceCoords[id1] - coord0[id1]) * slope0[var * nDim + id1];
564 IF_CONSTEXPR(nDim == 3) {
565 slopes[nDim * var + id0] += (surfaceCoords[id2] - coord1[id2]) * slope1[var * nDim + id2]
566 - (surfaceCoords[id2] - coord0[id2]) * slope0[var * nDim + id2];
567 }
568 /*#ifdef _VISCOUS_SLOPES_COMPACT_VARIANT_
569 )
570 / (F2 * dx);
571 #else*/
572 // )
573 slopes[nDim * var + id0] /= (coord1[id0] - coord0[id0]);
574
575
576 //#endif
577 slopes[nDim * var + id1] = f0 * slope0[var * nDim + id1] + f1 * slope1[var * nDim + id1];
578 IF_CONSTEXPR(nDim == 3) {
579 slopes[nDim * var + id2] = f0 * slope0[var * nDim + id2] + f1 * slope1[var * nDim + id2];
580 }
581 if(isBndry) {
582 slopes[nDim * var + id0] = f0 * slope0[var * nDim + id0] + f1 * slope1[var * nDim + id0];
583 }
584 }
585
586 const MUint sq0 = PV->P * nDim + id0;
587 const MUint sq1 = PV->RHO * nDim + id0;
588
589 const MFloat q = lambda * m_gFGMOrPr * Frho * (slopes[sq0] - p * Frho * slopes[sq1]);
590
591 // Compute the stress terms
592 const MUint s00 = id0 * nDim + id0;
593 const MUint s01 = id0 * nDim + id1;
594 const MUint s10 = id1 * nDim + id0;
595 const MUint s11 = id1 * nDim + id1;
596
597 std::array<MFloat, nDim> tau{};
598 IF_CONSTEXPR(nDim == 2) {
599 tau[id0] = mue * (F4B3 * slopes[s00] - F2B3 * slopes[s11]);
600 tau[id1] = mue * (slopes[s01] + slopes[s10]);
601 }
602 else IF_CONSTEXPR(nDim == 3) {
603 const MUint s22 = id2 * nDim + id2;
604 const MUint s02 = id0 * nDim + id2;
605 const MUint s20 = id2 * nDim + id0;
606 tau[id0] = mue * (F4B3 * slopes[s00] - F2B3 * (slopes[s11] + slopes[s22]));
607 tau[id1] = mue * (slopes[s01] + slopes[s10]);
608 tau[id2] = mue * (slopes[s02] + slopes[s20]);
609 }
610
611 // Compute the flux
612 for(MUint n = 0; n < nDim; n++) {
613 flux[FV->RHO_VV[n]] -= dAOverRe * tau[n];
614 }
615 flux[FV->RHO_E] -= dAOverRe * (std::inner_product(velocity.begin(), velocity.end(), tau.begin(), 0.0) + q);
616
617 // progress variable
618 const MFloat c = dAOverRe * rhoUDth;
619 for(MUint s = 0; s < PV->m_noSpecies; ++s) {
620 const MUint i = PV->Y[s] * nDim + id0;
621 flux[FV->RHO_Y[s]] -= c * (f0 * slope0[i] + f1 * slope1[i]);
622 }
623}

Member Data Documentation

◆ CV

template<MInt nDim, class RANSModel >
ConservativeVariables* FvSysEqnRANS< nDim, RANSModel >::CV = nullptr

Definition at line 157 of file fvcartesiansyseqnrans.h.

◆ FV

template<MInt nDim, class RANSModel >
FluxVariables* FvSysEqnRANS< nDim, RANSModel >::FV = nullptr

Definition at line 158 of file fvcartesiansyseqnrans.h.

◆ hasSC

template<MInt nDim, class RANSModel >
constexpr MBool FvSysEqnRANS< nDim, RANSModel >::hasSC = false
staticconstexpr

Definition at line 156 of file fvcartesiansyseqnrans.h.

◆ index0

template<MInt nDim, class RANSModel >
const MUint FvSysEqnNS< nDim >::index0[nDim]
staticprivate

Definition at line 350 of file fvcartesiansyseqnns.h.

◆ index1

template<MInt nDim, class RANSModel >
const MUint FvSysEqnNS< nDim >::index1[nDim]
staticprivate

Definition at line 353 of file fvcartesiansyseqnns.h.

◆ m_F1BGammaMinusOne

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_F1BGammaMinusOne
private

Definition at line 296 of file fvcartesiansyseqnns.h.

◆ m_F1BPr

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_F1BPr
private

Definition at line 300 of file fvcartesiansyseqnns.h.

◆ m_gamma

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_gamma
private

Definition at line 294 of file fvcartesiansyseqnns.h.

◆ m_gammaMinusOne

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_gammaMinusOne
private

Definition at line 295 of file fvcartesiansyseqnns.h.

◆ m_gFGMOrPr

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_gFGMOrPr
private

Definition at line 306 of file fvcartesiansyseqnns.h.

◆ m_muInfinity

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_muInfinity

Definition at line 330 of file fvcartesiansyseqnns.h.

◆ m_noRansEquations

template<MInt nDim, class RANSModel >
constexpr MInt FvSysEqnRANS< nDim, RANSModel >::m_noRansEquations = RANSModel::noRansEquations
staticconstexpr

Definition at line 119 of file fvcartesiansyseqnrans.h.

◆ m_noSpecies

template<MInt nDim, class RANSModel >
MUint FvSysEqnNS< nDim >::m_noSpecies
private

Definition at line 289 of file fvcartesiansyseqnns.h.

◆ m_Pr

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_Pr
private

Definition at line 299 of file fvcartesiansyseqnns.h.

◆ m_Pr_t

template<MInt nDim, class RANSModel >
const MFloat FvSysEqnRANS< nDim, RANSModel >::m_Pr_t = 0.9
private

Definition at line 144 of file fvcartesiansyseqnrans.h.

◆ m_ransModel

template<MInt nDim, class RANSModel >
constexpr MInt FvSysEqnRANS< nDim, RANSModel >::m_ransModel = RANSModel::ransModel
staticconstexpr

Definition at line 120 of file fvcartesiansyseqnrans.h.

◆ m_Re0

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_Re0

Definition at line 329 of file fvcartesiansyseqnns.h.

◆ m_referenceTemperature

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_referenceTemperature
private

Definition at line 301 of file fvcartesiansyseqnns.h.

◆ m_SACurvature

template<MInt nDim, class RANSModel >
MBool FvSysEqnRANS< nDim, RANSModel >::m_SACurvature = false
private

Definition at line 146 of file fvcartesiansyseqnrans.h.

◆ m_solverId

template<MInt nDim, class RANSModel >
MInt FvSysEqnNS< nDim >::m_solverId
private

Definition at line 291 of file fvcartesiansyseqnns.h.

◆ m_sutherlandConstant

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_sutherlandConstant
private

Definition at line 303 of file fvcartesiansyseqnns.h.

◆ m_sutherlandConstantThermal

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_sutherlandConstantThermal
private

Definition at line 305 of file fvcartesiansyseqnns.h.

◆ m_sutherlandPlusOne

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_sutherlandPlusOne
private

Definition at line 302 of file fvcartesiansyseqnns.h.

◆ m_sutherlandPlusOneThermal

template<MInt nDim, class RANSModel >
MFloat FvSysEqnNS< nDim >::m_sutherlandPlusOneThermal
private

Definition at line 304 of file fvcartesiansyseqnns.h.

◆ PV

template<MInt nDim, class RANSModel >
PrimitiveVariables* FvSysEqnRANS< nDim, RANSModel >::PV = nullptr

Definition at line 159 of file fvcartesiansyseqnrans.h.


The documentation for this class was generated from the following files: