3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
freeflow/navierstokes/velocityoutput.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_FREEFLOW_NAVIERSTOKES_VELOCITYOUTPUT_HH
25#define DUMUX_FREEFLOW_NAVIERSTOKES_VELOCITYOUTPUT_HH
26
31
32namespace Dumux {
33
38template<class GridVariables>
39class NavierStokesVelocityOutput : public VelocityOutput<GridVariables>
40{
42 using GridGeometry = typename GridVariables::GridGeometry;
43 using FVElementGeometry = typename GridGeometry::LocalView;
44 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
45 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
46 using ElementFluxVarsCache = typename GridVariables::GridFluxVariablesCache::LocalView;
47 using VolumeVariables = typename GridVariables::VolumeVariables;
48 using FluidSystem = typename VolumeVariables::FluidSystem;
49 using GridView = typename GridGeometry::GridView;
50 using Element = typename GridView::template Codim<0>::Entity;
51
52public:
54
55 NavierStokesVelocityOutput(const std::string& paramGroup = "")
56 {
57 enableOutput_ = getParamFromGroup<bool>(paramGroup, "Vtk.AddVelocity", true);
58 }
59
61 bool enableOutput() const override { return enableOutput_; }
62
64 std::string phaseName(int phaseIdx) const override { return FluidSystem::phaseName(phaseIdx); }
65
67 int numFluidPhases() const override { return VolumeVariables::numFluidPhases(); }
68
72 const Element& element,
73 const FVElementGeometry& fvGeometry,
74 const ElementVolumeVariables& elemVolVars,
75 const ElementFluxVarsCache& elemFluxVarsCache,
76 int phaseIdx) const override
77 {
78 using CouplingManager = std::decay_t<decltype(elemVolVars.gridVolVars().problem().couplingManager())>;
79 using MomGG = std::decay_t<decltype(std::declval<CouplingManager>().problem(CouplingManager::freeFlowMomentumIndex).gridGeometry())>;
80 if constexpr (MomGG::discMethod == DiscretizationMethods::fcstaggered)
81 calculateVelocityForStaggeredGrid_(velocity, element, fvGeometry, elemVolVars);
82 }
83
84private:
85 void calculateVelocityForStaggeredGrid_(VelocityVector& velocity,
86 const Element& element,
87 const FVElementGeometry& fvGeometry,
88 const ElementVolumeVariables& elemVolVars) const
89 {
90 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
91 const auto getFaceVelocity = [&](const FVElementGeometry& fvG, const auto& scvf)
92 {
93 return elemVolVars.gridVolVars().problem().faceVelocity(element, fvGeometry, scvf);
94 };
95
96 velocity[eIdx] = StaggeredVelocityReconstruction::cellCenterVelocity(getFaceVelocity, fvGeometry);
97 }
98
99 bool enableOutput_;
100};
101
102} // end namespace Dumux
103
104#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
The available discretization methods in Dumux.
Definition: adapt.hh:29
constexpr FCStaggered fcstaggered
Definition: method.hh:142
static constexpr auto freeFlowMomentumIndex
Definition: multidomain/boundary/freeflowporenetwork/couplingmanager.hh:46
static auto cellCenterVelocity(const VelocityHelper &getFaceVelocity, const FVElementGeometry &fvGeometry)
Return the velocity vector at the center of the primal grid.
Definition: velocityreconstruction.hh:39
Velocity output for staggered free-flow models.
Definition: freeflow/navierstokes/velocityoutput.hh:40
NavierStokesVelocityOutput(const std::string &paramGroup="")
Definition: freeflow/navierstokes/velocityoutput.hh:55
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, int phaseIdx) const override
Definition: freeflow/navierstokes/velocityoutput.hh:71
std::string phaseName(int phaseIdx) const override
returns the phase name of a given phase index
Definition: freeflow/navierstokes/velocityoutput.hh:64
typename ParentType::VelocityVector VelocityVector
Definition: freeflow/navierstokes/velocityoutput.hh:53
bool enableOutput() const override
Returns whether to enable the velocity output or not.
Definition: freeflow/navierstokes/velocityoutput.hh:61
int numFluidPhases() const override
returns the number of phases
Definition: freeflow/navierstokes/velocityoutput.hh:67
Velocity output for implicit (porous media) models.
Definition: io/velocityoutput.hh:41
std::vector< Dune::FieldVector< Scalar, dimWorld > > VelocityVector
Definition: io/velocityoutput.hh:50
The interface of the coupling manager for multi domain problems.
Definition: multidomain/couplingmanager.hh:60
const Problem< i > & problem(Dune::index_constant< i > domainIdx) const
Return a reference to the sub problem.
Definition: multidomain/couplingmanager.hh:321
Default velocity output policy for porous media models.