12#ifndef DUMUX_FREEFLOW_NAVIERSTOKES_MOMENTUM_VELOCITYOUTPUT_HH
13#define DUMUX_FREEFLOW_NAVIERSTOKES_MOMENTUM_VELOCITYOUTPUT_HH
16#include <dune/common/exceptions.hh>
19#include <dumux/common/concepts/variables_.hh>
30template<
class Gr
idVariables>
33template<Concept::FVGr
idVariables Gr
idVariables>
37 using GridGeometry =
typename GridVariables::GridGeometry;
38 using FVElementGeometry =
typename GridGeometry::LocalView;
39 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
40 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
41 using ElementFluxVarsCache =
typename GridVariables::GridFluxVariablesCache::LocalView;
42 using VolumeVariables =
typename GridVariables::VolumeVariables;
43 using FluidSystem =
typename VolumeVariables::FluidSystem;
44 using GridView =
typename GridGeometry::GridView;
45 using Element =
typename GridView::template Codim<0>::Entity;
60 std::string
phaseName(
int phaseIdx)
const override {
return FluidSystem::phaseName(phaseIdx); }
63 int numFluidPhases()
const override {
return VolumeVariables::numFluidPhases(); }
66 FieldType
fieldType()
const override {
return FieldType::element; }
71 const Element& element,
72 const FVElementGeometry& fvGeometry,
73 const ElementVolumeVariables& elemVolVars,
74 const ElementFluxVarsCache& elemFluxVarsCache,
75 int phaseIdx)
const override
77 using CouplingManager = std::decay_t<
decltype(elemVolVars.gridVolVars().problem().couplingManager())>;
78 using MomentumProblem = std::decay_t<decltype(std::declval<CouplingManager>().
problem(CouplingManager::freeFlowMomentumIndex))>;
81 calculateVelocityForStaggeredGrid_(velocity, element, fvGeometry, elemVolVars);
83 calculateVelocityForCVFESchemes_(velocity, element, fvGeometry, elemVolVars);
85 DUNE_THROW(Dune::NotImplemented,
"Navier-Stokes velocity output for scheme " << MomGG::discMethod);
89 void calculateVelocityForStaggeredGrid_(VelocityVector& velocity,
90 const Element& element,
91 const FVElementGeometry& fvGeometry,
92 const ElementVolumeVariables& elemVolVars)
const
94 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
95 const auto getFaceVelocity = [&](
const FVElementGeometry& fvG,
const auto& scvf)
97 return elemVolVars.gridVolVars().problem().faceVelocity(element, fvGeometry, scvf);
103 void calculateVelocityForCVFESchemes_(VelocityVector& velocity,
104 const Element& element,
105 const FVElementGeometry& fvGeometry,
106 const ElementVolumeVariables& elemVolVars)
const
108 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
109 velocity[eIdx] = elemVolVars.gridVolVars().problem().elementVelocity(fvGeometry);
116template<Concept::Gr
idVariables Gr
idVariables>
119 using ParentType = VelocityOutput<GridVariables>;
120 using GridGeometry =
typename GridVariables::GridGeometry;
121 using FVElementGeometry =
typename GridGeometry::LocalView;
122 using GridVariablesCache =
typename GridVariables::GridVariablesCache;
123 using ElementVariables =
typename GridVariablesCache::LocalView;
124 using Variables =
typename ElementVariables::Variables;
125 using FluidSystem =
typename Variables::FluidSystem;
126 using GridView =
typename GridGeometry::GridView;
127 using Element =
typename GridView::template Codim<0>::Entity;
128 using FieldType =
typename ParentType::FieldType;
140 std::string
phaseName(
int phaseIdx)
const override {
return FluidSystem::phaseName(phaseIdx); }
144 FieldType
fieldType()
const override {
return FieldType::element; }
147 const Element& element,
148 const FVElementGeometry& fvGeometry,
149 const ElementVariables& elemVars,
150 int phaseIdx)
const override
152 using CouplingManager = std::decay_t<
decltype(elemVars.gridVariablesCache().problem().couplingManager())>;
153 using MomentumProblem = std::decay_t<decltype(std::declval<CouplingManager>().
problem(CouplingManager::freeFlowMomentumIndex))>;
156 calculateVelocityForStaggeredGrid_(velocity, element, fvGeometry, elemVars);
158 calculateVelocityForCVFESchemes_(velocity, element, fvGeometry, elemVars);
160 DUNE_THROW(Dune::NotImplemented,
"Navier-Stokes velocity output for scheme " << MomGG::discMethod);
164 void calculateVelocityForStaggeredGrid_(VelocityVector& velocity,
165 const Element& element,
166 const FVElementGeometry& fvGeometry,
167 const ElementVariables& elemVars)
const
169 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
170 const auto getFaceVelocity = [&](
const FVElementGeometry& fvG,
const auto& scvf)
172 return elemVars.gridVariablesCache().problem().faceVelocity(element, fvGeometry, scvf);
178 void calculateVelocityForCVFESchemes_(VelocityVector& velocity,
179 const Element& element,
180 const FVElementGeometry& fvGeometry,
181 const ElementVariables& elemVars)
const
183 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
184 velocity[eIdx] = elemVars.gridVariablesCache().problem().elementVelocity(fvGeometry);
The interface of the coupling manager for multi domain problems.
Definition multidomain/couplingmanager.hh:37
const Problem< i > & problem(Dune::index_constant< i > domainIdx) const
Return a reference to the sub problem.
Definition multidomain/couplingmanager.hh:318
NavierStokesVelocityOutput(const std::string ¶mGroup="")
Definition freeflow/navierstokes/momentum/velocityoutput.hh:51
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, int phaseIdx) const override
Definition freeflow/navierstokes/momentum/velocityoutput.hh:70
std::string phaseName(int phaseIdx) const override
returns the phase name of a given phase index
Definition freeflow/navierstokes/momentum/velocityoutput.hh:60
typename ParentType::VelocityVector VelocityVector
Definition freeflow/navierstokes/momentum/velocityoutput.hh:49
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, int phaseIdx) const override
Definition freeflow/navierstokes/momentum/velocityoutput.hh:146
bool enableOutput() const override
Returns whether to enable the velocity output or not.
Definition freeflow/navierstokes/momentum/velocityoutput.hh:57
FieldType fieldType() const override
returns the field type
Definition freeflow/navierstokes/momentum/velocityoutput.hh:66
int numFluidPhases() const override
returns the number of phases
Definition freeflow/navierstokes/momentum/velocityoutput.hh:63
Velocity output for staggered free-flow models.
Definition freeflow/navierstokes/momentum/velocityoutput.hh:31
FieldType
A container for possible velocity data types.
Definition io/velocityoutput.hh:46
VelocityOutput()=default
Default constructor.
std::vector< Dune::FieldVector< Scalar, dimWorld > > VelocityVector
Definition io/velocityoutput.hh:40
Velocity output for implicit (porous media) models.
Definition io/velocityoutput.hh:27
Type traits for problem classes.
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition parameters.hh:149
Default velocity output policy for porous media models.
The available discretization methods in Dumux.
constexpr bool isCVFE
Definition method.hh:67
constexpr FCStaggered fcstaggered
Definition method.hh:183
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Detail::ProblemGridGeometry< Problem > GridGeometry
Definition common/typetraits/problem.hh:50
static auto cellCenterVelocity(const VelocityHelper &getFaceVelocity, const FVElementGeometry &fvGeometry)
Return the velocity vector at the center of the primal grid.
Definition velocityreconstruction.hh:30
Helper class for reconstructing the velocity.