24#ifndef DUMUX_SST_STAGGERED_FLUXVARIABLES_HH
25#define DUMUX_SST_STAGGERED_FLUXVARIABLES_HH
28#include <dune/common/exceptions.hh>
45template<
class TypeTag,
class BaseFluxVariables,
class DiscretizationMethod>
46class SSTFluxVariablesImpl;
48template<
class TypeTag,
class BaseFluxVariables>
50:
public BaseFluxVariables
52 using ParentType = BaseFluxVariables;
56 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
57 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
58 using VolumeVariables =
typename GridVolumeVariables::VolumeVariables;
60 using GridFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache;
61 using FluxVariablesCache =
typename GridFluxVariablesCache::FluxVariablesCache;
63 using GridFaceVariables =
typename GridVariables::GridFaceVariables;
64 using ElementFaceVariables =
typename GridFaceVariables::LocalView;
65 using FaceVariables =
typename GridFaceVariables::FaceVariables;
70 using FVElementGeometry =
typename GridGeometry::LocalView;
71 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
73 using GridView =
typename GridGeometry::GridView;
75 using Element =
typename GridView::template Codim<0>::Entity;
80 static constexpr int turbulentKineticEnergyEqIdx = Indices::turbulentKineticEnergyEqIdx - ModelTraits::dim();
81 static constexpr int dissipationEqIdx = Indices::dissipationEqIdx - ModelTraits::dim();
89 const Element &element,
90 const FVElementGeometry& fvGeometry,
91 const ElementVolumeVariables& elemVolVars,
92 const ElementFaceVariables& elemFaceVars,
93 const SubControlVolumeFace &scvf,
94 const FluxVariablesCache& fluxVarsCache)
96 CellCenterPrimaryVariables flux = ParentType::computeMassFlux(problem, element, fvGeometry,
97 elemVolVars, elemFaceVars, scvf, fluxVarsCache);
100 auto upwindTermK = [](
const auto& volVars)
101 {
return volVars.turbulentKineticEnergy() * volVars.density(); };
102 auto upwindTermOmega = [](
const auto& volVars)
103 {
return volVars.dissipation() * volVars.density(); };
105 flux[turbulentKineticEnergyEqIdx]
106 = ParentType::advectiveFluxForCellCenter(problem, elemVolVars, elemFaceVars, scvf, upwindTermK);
107 flux[dissipationEqIdx]
108 = ParentType::advectiveFluxForCellCenter(problem, elemVolVars, elemFaceVars, scvf, upwindTermOmega);
111 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
112 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
113 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
114 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
115 Scalar insideCoeff_k = 0.0, insideCoeff_w = 0.0, outsideCoeff_k = 0.0, outsideCoeff_w = 0.0;
119 insideCoeff_k = insideVolVars.viscosity()
120 + ( insideVolVars.sigmaKBSL() * insideVolVars.dynamicEddyViscosity() );
121 outsideCoeff_k = outsideVolVars.viscosity()
122 + ( outsideVolVars.sigmaKBSL() * outsideVolVars.dynamicEddyViscosity() );
123 insideCoeff_w = insideVolVars.viscosity()
124 + ( insideVolVars.sigmaOmegaBSL() * insideVolVars.dynamicEddyViscosity() );
125 outsideCoeff_w = outsideVolVars.viscosity()
126 + ( outsideVolVars.sigmaOmegaBSL() * outsideVolVars.dynamicEddyViscosity() );
130 insideCoeff_k = insideVolVars.viscosity()
131 + ( insideVolVars.sigmaKSST() * insideVolVars.dynamicEddyViscosity() );
132 outsideCoeff_k = outsideVolVars.viscosity()
133 + ( outsideVolVars.sigmaKSST() * outsideVolVars.dynamicEddyViscosity() );
134 insideCoeff_w = insideVolVars.viscosity()
135 + ( insideVolVars.sigmaOmegaSST() * insideVolVars.dynamicEddyViscosity() );
136 outsideCoeff_w = outsideVolVars.viscosity()
137 + ( outsideVolVars.sigmaOmegaSST() * outsideVolVars.dynamicEddyViscosity() );
140 DUNE_THROW(Dune::NotImplemented,
"\nThis SST Model is not implemented.\n");
144 insideCoeff_k *= insideVolVars.extrusionFactor();
145 outsideCoeff_k *= outsideVolVars.extrusionFactor();
146 insideCoeff_w *= insideVolVars.extrusionFactor();
147 outsideCoeff_w *= outsideVolVars.extrusionFactor();
150 Scalar coeff_k = 0.0;
151 Scalar coeff_w = 0.0;
154 distance = (insideScv.dofPosition() - scvf.ipGlobal()).two_norm();
155 coeff_k = insideCoeff_k;
156 coeff_w = insideCoeff_w;
162 (outsideScv.dofPosition() - scvf.ipGlobal()).two_norm(),
163 (insideScv.dofPosition() - scvf.ipGlobal()).two_norm());
165 (outsideScv.dofPosition() - scvf.ipGlobal()).two_norm(),
166 (insideScv.dofPosition() - scvf.ipGlobal()).two_norm());
167 distance = (outsideScv.dofPosition() - insideScv.dofPosition()).two_norm();
170 const auto bcTypes = problem.boundaryTypes(element, scvf);
171 if (!(scvf.boundary() && (bcTypes.isOutflow(Indices::turbulentKineticEnergyEqIdx)
172 || bcTypes.isSymmetry())))
174 flux[turbulentKineticEnergyEqIdx]
176 * (insideVolVars.turbulentKineticEnergy() - outsideVolVars.turbulentKineticEnergy())
177 * Extrusion::area(scvf);
179 if (!(scvf.boundary() && (bcTypes.isOutflow(Indices::dissipationEqIdx)
180 || bcTypes.isSymmetry())))
182 flux[dissipationEqIdx]
184 * (insideVolVars.dissipation() - outsideVolVars.dissipation())
185 * Extrusion::area(scvf);
194 const Element& element,
195 const SubControlVolumeFace& scvf,
196 const FVElementGeometry& fvGeometry,
197 const ElementVolumeVariables& elemVolVars,
198 const ElementFaceVariables& elemFaceVars,
199 const GridFluxVariablesCache& gridFluxVarsCache)
201 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
203 return ParentType::computeFrontalMomentumFlux(problem, element, scvf, fvGeometry, elemVolVars, elemFaceVars, gridFluxVarsCache)
204 + ParentType::computeLateralMomentumFlux(problem, element, scvf, fvGeometry, elemVolVars, elemFaceVars, gridFluxVarsCache)
205 + 2.0 / ModelTraits::dim() * insideVolVars.density() * insideVolVars.turbulentKineticEnergy()
206 * Extrusion::area(scvf) * scvf.directionSign() * insideVolVars.extrusionFactor();
Helper classes to compute the integration elements.
The available discretization methods in Dumux.
Base class for the flux variables living on a sub control volume face.
The available free flow turbulence models in Dumux.
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:292
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:50
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:177
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
The flux variables class for the SST model using the staggered grid discretization.
Definition: freeflow/rans/twoeq/sst/fluxvariables.hh:34
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/sst/staggered/fluxvariables.hh:88
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/sst/staggered/fluxvariables.hh:193
Declares all properties used in Dumux.