12#ifndef DUMUX_LOWREKEPSILON_STAGGERED_FLUXVARIABLES_HH
13#define DUMUX_LOWREKEPSILON_STAGGERED_FLUXVARIABLES_HH
31template<
class TypeTag,
class BaseFluxVariables,
class DiscretizationMethod>
32class LowReKEpsilonFluxVariablesImpl;
34template<
class TypeTag,
class BaseFluxVariables>
36:
public BaseFluxVariables
38 using ParentType = BaseFluxVariables;
42 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
43 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
44 using VolumeVariables =
typename GridVolumeVariables::VolumeVariables;
46 using GridFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache;
47 using FluxVariablesCache =
typename GridFluxVariablesCache::FluxVariablesCache;
49 using GridFaceVariables =
typename GridVariables::GridFaceVariables;
50 using ElementFaceVariables =
typename GridFaceVariables::LocalView;
51 using FaceVariables =
typename GridFaceVariables::FaceVariables;
56 using FVElementGeometry =
typename GridGeometry::LocalView;
57 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
59 using GridView =
typename GridGeometry::GridView;
61 using Element =
typename GridView::template Codim<0>::Entity;
66 static constexpr int turbulentKineticEnergyEqIdx = Indices::turbulentKineticEnergyEqIdx - ModelTraits::dim();
67 static constexpr int dissipationEqIdx = Indices::dissipationEqIdx - ModelTraits::dim();
75 const Element &element,
76 const FVElementGeometry& fvGeometry,
77 const ElementVolumeVariables& elemVolVars,
78 const ElementFaceVariables& elemFaceVars,
79 const SubControlVolumeFace &scvf,
80 const FluxVariablesCache& fluxVarsCache)
82 CellCenterPrimaryVariables flux = ParentType::computeMassFlux(problem, element, fvGeometry,
83 elemVolVars, elemFaceVars, scvf, fluxVarsCache);
86 auto upwindTermK = [](
const auto& volVars)
88 return volVars.turbulentKineticEnergy() * volVars.density();
90 auto upwindTermEpsilon = [](
const auto& volVars)
92 return volVars.dissipationTilde() * volVars.density();
95 flux[turbulentKineticEnergyEqIdx]
96 = ParentType::advectiveFluxForCellCenter(problem, fvGeometry, elemVolVars, elemFaceVars, scvf, upwindTermK);
97 flux[dissipationEqIdx]
98 = ParentType::advectiveFluxForCellCenter(problem, fvGeometry, elemVolVars, elemFaceVars, scvf, upwindTermEpsilon);
101 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
102 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
103 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
104 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
107 Scalar insideCoeff_k = insideVolVars.viscosity() + insideVolVars.kinematicEddyViscosity()
108 * insideVolVars.density() / insideVolVars.sigmaK();
109 Scalar outsideCoeff_k = outsideVolVars.viscosity() + outsideVolVars.kinematicEddyViscosity()
110 * outsideVolVars.density() / outsideVolVars.sigmaK();
111 Scalar insideCoeff_e = insideVolVars.viscosity() + insideVolVars.kinematicEddyViscosity()
112 * insideVolVars.density() / insideVolVars.sigmaEpsilon();
113 Scalar outsideCoeff_e = outsideVolVars.viscosity() + outsideVolVars.kinematicEddyViscosity()
114 * outsideVolVars.density() / outsideVolVars.sigmaEpsilon();
117 insideCoeff_k *= insideVolVars.extrusionFactor();
118 outsideCoeff_k *= outsideVolVars.extrusionFactor();
119 insideCoeff_e *= insideVolVars.extrusionFactor();
120 outsideCoeff_e *= outsideVolVars.extrusionFactor();
122 Scalar coeff_k = 0.0;
123 Scalar coeff_e = 0.0;
127 coeff_k = insideCoeff_k;
128 coeff_e = insideCoeff_e;
129 distance = (insideScv.dofPosition() - scvf.ipGlobal()).two_norm();
135 (outsideScv.dofPosition() - scvf.ipGlobal()).two_norm(),
136 (insideScv.dofPosition() - scvf.ipGlobal()).two_norm());
138 (outsideScv.dofPosition() - scvf.ipGlobal()).two_norm(),
139 (insideScv.dofPosition() - scvf.ipGlobal()).two_norm());
140 distance = (outsideScv.dofPosition() - insideScv.dofPosition()).two_norm();
143 const auto bcTypes = problem.boundaryTypes(element, scvf);
144 if (!(scvf.boundary() && (bcTypes.isOutflow(Indices::turbulentKineticEnergyEqIdx)
145 || bcTypes.isSymmetry())))
147 flux[turbulentKineticEnergyEqIdx]
149 * (insideVolVars.turbulentKineticEnergy() - outsideVolVars.turbulentKineticEnergy())
150 * Extrusion::area(fvGeometry, scvf);
152 if (!(scvf.boundary() && (bcTypes.isOutflow(Indices::dissipationEqIdx)
153 || bcTypes.isSymmetry())))
155 flux[dissipationEqIdx]
157 * (insideVolVars.dissipationTilde() - outsideVolVars.dissipationTilde())
158 * Extrusion::area(fvGeometry, scvf);
167 const Element& element,
168 const SubControlVolumeFace& scvf,
169 const FVElementGeometry& fvGeometry,
170 const ElementVolumeVariables& elemVolVars,
171 const ElementFaceVariables& elemFaceVars,
172 const GridFluxVariablesCache& gridFluxVarsCache)
174 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
176 return ParentType::computeFrontalMomentumFlux(problem, element, scvf, fvGeometry, elemVolVars, elemFaceVars, gridFluxVarsCache)
177 + ParentType::computeLateralMomentumFlux(problem, element, scvf, fvGeometry, elemVolVars, elemFaceVars, gridFluxVarsCache)
178 + 2.0 / ModelTraits::dim() * insideVolVars.density() * insideVolVars.turbulentKineticEnergy()
179 * Extrusion::area(fvGeometry, scvf) * scvf.directionSign() * insideVolVars.extrusionFactor();
FacePrimaryVariables computeMomentumFlux(const Problem &problem, const Element &element, const SubControlVolumeFace &scvf, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const GridFluxVariablesCache &gridFluxVarsCache)
Returns the momentum flux over all staggered faces.
Definition: freeflow/rans/twoeq/lowrekepsilon/staggered/fluxvariables.hh:166
CellCenterPrimaryVariables computeMassFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf, const FluxVariablesCache &fluxVarsCache)
Computes the flux for the cell center residual.
Definition: freeflow/rans/twoeq/lowrekepsilon/staggered/fluxvariables.hh:74
The flux variables class for the low-Reynolds k-epsilon model using the staggered grid discretization...
Definition: freeflow/rans/twoeq/lowrekepsilon/fluxvariables.hh:22
Defines all properties used in Dumux.
Helper classes to compute the integration elements.
Base class for the flux variables living on a sub control volume face.
constexpr Scalar arithmeticMean(Scalar x, Scalar y, Scalar wx=1.0, Scalar wy=1.0) noexcept
Calculate the (weighted) arithmetic mean of two scalar values.
Definition: math.hh:38
static ctype distance(const Dune::FieldVector< ctype, dimWorld > &a, const Dune::FieldVector< ctype, dimWorld > &b)
Compute the shortest distance between two points.
Definition: distance.hh:282
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:166