version 3.9
slipcondition.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_FREEFLOW_NAVIERSTOKES_SLIPCONDITION_HH
13#define DUMUX_FREEFLOW_NAVIERSTOKES_SLIPCONDITION_HH
14
15#include <dune/common/fvector.hh>
16#include <dumux/common/tag.hh>
19
21
26struct BJ : public Utility::Tag<BJ> {
27 static std::string name() { return "Beavers-Joseph"; }
28};
29
34struct BJS : public Utility::Tag<BJS> {
35 static std::string name() { return "Beavers-Joseph-Saffman"; }
36};
37
42inline constexpr BJ bj{};
43
48inline constexpr BJS bjs{};
49
50} // end namespace Dumux::NavierStokes::SlipConditions
51
52namespace Dumux {
53
58template<class DiscretizationMethod, class SlipCondition>
60
69template<class SlipCondition>
70class NavierStokesSlipVelocity<DiscretizationMethods::FCStaggered, SlipCondition>
71{
72public:
73 static constexpr SlipCondition slipCondition{};
74
84 template<class Problem, class FVElementGeometry, class ElementVolumeVariables, class Scalar>
85 static auto velocity(const Problem& problem,
86 const FVElementGeometry& fvGeometry,
87 const typename FVElementGeometry::SubControlVolumeFace& scvf,
88 const ElementVolumeVariables& elemVolVars,
89 Scalar tangentialVelocityDeriv)
90 {
91 assert(scvf.isLateral());
92 assert(scvf.boundary());
93
94 static constexpr int dimWorld = FVElementGeometry::GridGeometry::GridView::dimensionworld;
95 using Vector = Dune::FieldVector<Scalar, dimWorld>;
96
97 Vector porousMediumVelocity(0.0);
98
99 if constexpr (slipCondition == NavierStokes::SlipConditions::bj)
100 porousMediumVelocity = problem.porousMediumVelocity(fvGeometry, scvf);
101 else if (!(slipCondition == NavierStokes::SlipConditions::bjs))
102 DUNE_THROW(Dune::NotImplemented, "Fcstaggered currently only implements BJ or BJS slip conditions");
103
104 const auto& scv = fvGeometry.scv(scvf.insideScvIdx());
105
106 // create a unit normal vector oriented in positive coordinate direction
107 Vector tangent(0.0);
108 tangent[scv.dofAxis()] = 1.0;
109
110 // du/dy + dv/dx = beta * (u_boundary-uPM)
111 // beta = alpha/sqrt(K)
112 const Scalar betaBJ = problem.betaBJ(fvGeometry, scvf, tangent);
113 const Scalar distanceNormalToBoundary = (scvf.ipGlobal() - scv.dofPosition()).two_norm();
114
115 static const bool onlyNormalGradient = getParamFromGroup<bool>(problem.paramGroup(), "FreeFlow.EnableUnsymmetrizedVelocityGradientForBeaversJoseph", false);
116 if (onlyNormalGradient)
117 tangentialVelocityDeriv = 0.0;
118
119 const Scalar scalarSlipVelocity = (tangentialVelocityDeriv*distanceNormalToBoundary
120 + porousMediumVelocity * tangent * betaBJ * distanceNormalToBoundary
121 + elemVolVars[scv].velocity()) / (betaBJ*distanceNormalToBoundary + 1.0);
122
123 return scalarSlipVelocity*tangent;
124 }
125};
126
127} // end namespace Dumux
128
129#endif
static auto velocity(const Problem &problem, const FVElementGeometry &fvGeometry, const typename FVElementGeometry::SubControlVolumeFace &scvf, const ElementVolumeVariables &elemVolVars, Scalar tangentialVelocityDeriv)
Returns the slip velocity at a porous boundary based on the Beavers-Joseph(-Saffman) condition.
Definition: slipcondition.hh:85
Navier Stokes slip velocity policy.
Definition: slipcondition.hh:59
constexpr BJS bjs
Tag for the Beavers-Joseph-Saffman slip condition.
Definition: slipcondition.hh:48
constexpr BJ bj
Tag for the Beavers-Joseph slip condition.
Definition: slipcondition.hh:42
The available discretization methods in Dumux.
Definition: slipcondition.hh:20
Definition: adapt.hh:17
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Tag for the Beavers-Joseph slip condition.
Definition: slipcondition.hh:26
static std::string name()
Definition: slipcondition.hh:27
Tag for the Beavers-Joseph-Saffman slip condition.
Definition: slipcondition.hh:34
static std::string name()
Definition: slipcondition.hh:35
Helper class to create (named and comparable) tagged types Tags any given type. The tagged type is eq...
Definition: tag.hh:30
Helper class to create (named and comparable) tagged types.