24#ifndef DUMUX_NAVIERSTOKES_STAGGERED_PROBLEM_HH
25#define DUMUX_NAVIERSTOKES_STAGGERED_PROBLEM_HH
27#include <dune/common/exceptions.hh>
28#include <dune/common/typetraits.hh>
43template<
class TypeTag>
50 using GridView =
typename GridGeometry::GridView;
51 using Element =
typename GridView::template Codim<0>::Entity;
54 using GridFaceVariables =
typename GridVariables::GridFaceVariables;
55 using ElementFaceVariables =
typename GridFaceVariables::LocalView;
56 using FaceVariables =
typename GridFaceVariables::FaceVariables;
57 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
58 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
61 using FVElementGeometry =
typename GridGeometry::LocalView;
62 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
63 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
68 dim = GridView::dimension,
69 dimWorld = GridView::dimensionworld
72 using GlobalPosition =
typename SubControlVolumeFace::GlobalPosition;
73 using VelocityVector = Dune::FieldVector<Scalar, dimWorld>;
74 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
86 if (getParamFromGroup<bool>(
paramGroup,
"Problem.EnableGravity"))
87 gravity_[dim-1] = -9.81;
89 enableInertiaTerms_ = getParamFromGroup<bool>(
paramGroup,
"Problem.EnableInertiaTerms");
106 {
return enableInertiaTerms_; }
109 template <
class SolutionVector,
class G = Gr
idGeometry>
110 typename std::enable_if<G::discMethod == DiscretizationMethods::staggered, void>::type
112 const SubControlVolumeFace& scvf,
113 const PrimaryVariables& initSol)
const
115 sol[GridGeometry::faceIdx()][scvf.dofIndex()][0] = initSol[Indices::velocity(scvf.directionIndex())];
134 const Scalar factor = 8.0)
const
136 static_assert(dim == 2,
"Pseudo 3D wall friction may only be used in 2D");
137 return -factor * velocity *
viscosity / (height*height);
141 template <
class ElementVolumeVariables,
class ElementFaceVariables,
class G = Gr
idGeometry>
142 typename std::enable_if<G::discMethod == DiscretizationMethods::staggered, Scalar>::type
144 const ElementVolumeVariables& elemVolVars,
145 const ElementFaceVariables& elemFaceVars,
147 const Scalar factor = 8.0)
const
149 const Scalar velocity = elemFaceVars[scvf].velocitySelf();
150 const Scalar
viscosity = elemVolVars[scvf.insideScvIdx()].effectiveViscosity();
159 Scalar
permeability(
const Element& element,
const SubControlVolumeFace& scvf)
const
161 DUNE_THROW(Dune::NotImplemented,
162 "When using the Beavers-Joseph-Saffman boundary condition, "
163 "the permeability must be returned in the actual problem"
172 Scalar
alphaBJ(
const SubControlVolumeFace& scvf)
const
174 DUNE_THROW(Dune::NotImplemented,
175 "When using the Beavers-Joseph-Saffman boundary condition, "
176 "the alpha value must be returned in the actual problem"
183 Scalar
betaBJ(
const Element& element,
const SubControlVolumeFace& scvf,
const GlobalPosition& tangentialVector)
const
185 const Scalar interfacePermeability = interfacePermeability_(element, scvf, tangentialVector);
187 return asImp_().alphaBJ(scvf) / sqrt(interfacePermeability);
195 return VelocityVector(0.0);
202 const SubControlVolume& scv,
203 const SubControlVolumeFace& ownScvf,
204 const SubControlVolumeFace& faceOnPorousBoundary,
205 const Scalar velocitySelf,
206 const Scalar tangentialVelocityGradient)
const
209 GlobalPosition orientation = ownScvf.unitOuterNormal();
210 orientation[ownScvf.directionIndex()] = 1.0;
214 const Scalar
betaBJ = asImp_().betaBJ(element, faceOnPorousBoundary, orientation);
215 const Scalar distanceNormalToBoundary = (faceOnPorousBoundary.center() - scv.center()).two_norm();
217 return (tangentialVelocityGradient*distanceNormalToBoundary
218 + asImp_().porousMediumVelocity(element, faceOnPorousBoundary) * orientation *
betaBJ * distanceNormalToBoundary
219 + velocitySelf) / (
betaBJ*distanceNormalToBoundary + 1.0);
224 Scalar interfacePermeability_(
const Element& element,
const SubControlVolumeFace& scvf,
const GlobalPosition& tangentialVector)
const
226 const auto& K = asImp_().permeability(element, scvf);
229 if constexpr (Dune::IsNumber<std::decay_t<
decltype(K)>>::value)
232 return vtmv(tangentialVector, K, tangentialVector);
236 Implementation &asImp_()
237 {
return *
static_cast<Implementation *
>(
this); }
240 const Implementation &asImp_()
const
241 {
return *
static_cast<const Implementation *
>(
this); }
243 GravityVector gravity_;
244 bool enableInertiaTerms_;
Base class for all staggered fv problems.
The available discretization methods in Dumux.
Dune::DenseMatrix< MAT >::value_type vtmv(const Dune::DenseVector< V1 > &v1, const Dune::DenseMatrix< MAT > &M, const Dune::DenseVector< V2 > &v2)
Evaluates the scalar product of a vector v2, projected by a matrix M, with a vector v1.
Definition: math.hh:863
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:180
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:55
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:544
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:540
Base class for all staggered finite-volume problems.
Definition: staggeredfvproblem.hh:48
Navier-Stokes staggered problem base class.
Definition: freeflow/navierstokes/staggered/problem.hh:45
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: freeflow/navierstokes/staggered/problem.hh:99
const Scalar beaversJosephVelocity(const Element &element, const SubControlVolume &scv, const SubControlVolumeFace &ownScvf, const SubControlVolumeFace &faceOnPorousBoundary, const Scalar velocitySelf, const Scalar tangentialVelocityGradient) const
Returns the slip velocity at a porous boundary based on the Beavers-Joseph(-Saffman) condition.
Definition: freeflow/navierstokes/staggered/problem.hh:201
std::enable_if< G::discMethod==DiscretizationMethods::staggered, Scalar >::type pseudo3DWallFriction(const SubControlVolumeFace &scvf, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const Scalar height, const Scalar factor=8.0) const
Convenience function for staggered grid implementation.
Definition: freeflow/navierstokes/staggered/problem.hh:143
NavierStokesStaggeredProblem(std::shared_ptr< const GridGeometry > gridGeometry, const std::string ¶mGroup="")
The constructor.
Definition: freeflow/navierstokes/staggered/problem.hh:82
bool enableInertiaTerms() const
Returns whether interia terms should be considered.
Definition: freeflow/navierstokes/staggered/problem.hh:105
Scalar permeability(const Element &element, const SubControlVolumeFace &scvf) const
Returns the intrinsic permeability of required as input parameter for the Beavers-Joseph-Saffman boun...
Definition: freeflow/navierstokes/staggered/problem.hh:159
Scalar pseudo3DWallFriction(const Scalar velocity, const Scalar viscosity, const Scalar height, const Scalar factor=8.0) const
An additional drag term can be included as source term for the momentum balance to mimic 3D flow beha...
Definition: freeflow/navierstokes/staggered/problem.hh:131
Scalar alphaBJ(const SubControlVolumeFace &scvf) const
Returns the alpha value required as input parameter for the Beavers-Joseph-Saffman boundary condition...
Definition: freeflow/navierstokes/staggered/problem.hh:172
VelocityVector porousMediumVelocity(const Element &element, const SubControlVolumeFace &scvf) const
Returns the velocity in the porous medium (which is 0 by default according to Saffmann).
Definition: freeflow/navierstokes/staggered/problem.hh:193
Scalar betaBJ(const Element &element, const SubControlVolumeFace &scvf, const GlobalPosition &tangentialVector) const
Returns the beta value which is the alpha value divided by the square root of the (scalar-valued) int...
Definition: freeflow/navierstokes/staggered/problem.hh:183
std::enable_if< G::discMethod==DiscretizationMethods::staggered, void >::type applyInitialFaceSolution(SolutionVector &sol, const SubControlVolumeFace &scvf, const PrimaryVariables &initSol) const
Applies the initial face solution (velocities on the faces). Specialization for staggered grid discre...
Definition: freeflow/navierstokes/staggered/problem.hh:111
Declares all properties used in Dumux.