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>
29template<
class Gr
idVariables>
32template<Concept::FVGr
idVariables Gr
idVariables>
36 using GridGeometry =
typename GridVariables::GridGeometry;
37 using FVElementGeometry =
typename GridGeometry::LocalView;
38 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
39 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
40 using ElementFluxVarsCache =
typename GridVariables::GridFluxVariablesCache::LocalView;
41 using VolumeVariables =
typename GridVariables::VolumeVariables;
42 using FluidSystem =
typename VolumeVariables::FluidSystem;
43 using GridView =
typename GridGeometry::GridView;
44 using Element =
typename GridView::template Codim<0>::Entity;
52 enableOutput_ = getParamFromGroup<bool>(paramGroup,
"Vtk.AddVelocity",
true);
59 std::string
phaseName(
int phaseIdx)
const override {
return FluidSystem::phaseName(phaseIdx); }
62 int numFluidPhases()
const override {
return VolumeVariables::numFluidPhases(); }
70 const Element& element,
71 const FVElementGeometry& fvGeometry,
72 const ElementVolumeVariables& elemVolVars,
73 const ElementFluxVarsCache& elemFluxVarsCache,
74 int phaseIdx)
const override
76 using CouplingManager = std::decay_t<
decltype(elemVolVars.gridVolVars().problem().couplingManager())>;
79 calculateVelocityForStaggeredGrid_(velocity, element, fvGeometry, elemVolVars);
80 else if constexpr (DiscretizationMethods::isCVFE<typename MomGG::DiscretizationMethod>)
81 calculateVelocityForCVFESchemes_(velocity, element, fvGeometry, elemVolVars);
83 DUNE_THROW(Dune::NotImplemented,
"Navier-Stokes velocity output for scheme " << MomGG::discMethod);
87 void calculateVelocityForStaggeredGrid_(VelocityVector& velocity,
88 const Element& element,
89 const FVElementGeometry& fvGeometry,
90 const ElementVolumeVariables& elemVolVars)
const
92 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
93 const auto getFaceVelocity = [&](
const FVElementGeometry& fvG,
const auto& scvf)
95 return elemVolVars.gridVolVars().problem().faceVelocity(element, fvGeometry, scvf);
101 void calculateVelocityForCVFESchemes_(VelocityVector& velocity,
102 const Element& element,
103 const FVElementGeometry& fvGeometry,
104 const ElementVolumeVariables& elemVolVars)
const
106 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
107 velocity[eIdx] = elemVolVars.gridVolVars().problem().elementVelocity(fvGeometry);
114template<Concept::Gr
idVariables Gr
idVariables>
115class NavierStokesVelocityOutput<GridVariables> :
public VelocityOutput<GridVariables>
117 using ParentType = VelocityOutput<GridVariables>;
118 using GridGeometry =
typename GridVariables::GridGeometry;
119 using FVElementGeometry =
typename GridGeometry::LocalView;
120 using GridVariablesCache =
typename GridVariables::GridVariablesCache;
121 using ElementVariables =
typename GridVariablesCache::LocalView;
122 using Variables =
typename ElementVariables::Variables;
123 using FluidSystem =
typename Variables::FluidSystem;
124 using GridView =
typename GridGeometry::GridView;
125 using Element =
typename GridView::template Codim<0>::Entity;
133 enableOutput_ = getParamFromGroup<bool>(paramGroup,
"Vtk.AddVelocity",
true);
138 std::string
phaseName(
int phaseIdx)
const override {
return FluidSystem::phaseName(phaseIdx); }
145 const Element& element,
146 const FVElementGeometry& fvGeometry,
147 const ElementVariables& elemVars,
148 int phaseIdx)
const override
150 using CouplingManager = std::decay_t<
decltype(elemVars.gridVariablesCache().problem().couplingManager())>;
153 calculateVelocityForStaggeredGrid_(velocity, element, fvGeometry, elemVars);
154 else if constexpr (DiscretizationMethods::isCVFE<typename MomGG::DiscretizationMethod>)
155 calculateVelocityForCVFESchemes_(velocity, element, fvGeometry, elemVars);
157 DUNE_THROW(Dune::NotImplemented,
"Navier-Stokes velocity output for scheme " << MomGG::discMethod);
161 void calculateVelocityForStaggeredGrid_(VelocityVector& velocity,
162 const Element& element,
163 const FVElementGeometry& fvGeometry,
164 const ElementVariables& elemVars)
const
166 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
167 const auto getFaceVelocity = [&](
const FVElementGeometry& fvG,
const auto& scvf)
169 return elemVars.gridVariablesCache().problem().faceVelocity(element, fvGeometry, scvf);
175 void calculateVelocityForCVFESchemes_(VelocityVector& velocity,
176 const Element& element,
177 const FVElementGeometry& fvGeometry,
178 const ElementVariables& elemVars)
const
180 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
181 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:319
NavierStokesVelocityOutput(const std::string ¶mGroup="")
Definition: freeflow/navierstokes/momentum/velocityoutput.hh:50
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:69
std::string phaseName(int phaseIdx) const override
returns the phase name of a given phase index
Definition: freeflow/navierstokes/momentum/velocityoutput.hh:59
typename ParentType::VelocityVector VelocityVector
Definition: freeflow/navierstokes/momentum/velocityoutput.hh:48
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVariables &elemVars, int phaseIdx) const override
Definition: freeflow/navierstokes/momentum/velocityoutput.hh:144
bool enableOutput() const override
Returns whether to enable the velocity output or not.
Definition: freeflow/navierstokes/momentum/velocityoutput.hh:56
FieldType fieldType() const override
returns the field type
Definition: freeflow/navierstokes/momentum/velocityoutput.hh:65
int numFluidPhases() const override
returns the number of phases
Definition: freeflow/navierstokes/momentum/velocityoutput.hh:62
Velocity output for staggered free-flow models.
Definition: freeflow/navierstokes/momentum/velocityoutput.hh:30
Definition: io/velocityoutput.hh:31
std::vector< Dune::FieldVector< Scalar, dimWorld > > VelocityVector
Definition: io/velocityoutput.hh:40
FieldType
A container for possible velocity data types.
Definition: io/velocityoutput.hh:46
Velocity output for implicit (porous media) models.
Definition: io/velocityoutput.hh:27
Default velocity output policy for porous media models.
The available discretization methods in Dumux.
constexpr FCStaggered fcstaggered
Definition: method.hh:161
static constexpr auto freeFlowMomentumIndex
Definition: multidomain/boundary/freeflowporenetwork/couplingmanager.hh:34
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
static auto cellCenterVelocity(const VelocityHelper &getFaceVelocity, const FVElementGeometry &fvGeometry)
Return the velocity vector at the center of the primal grid.
Definition: velocityreconstruction.hh:30