3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 using FieldType = typename ParentType::FieldType;
52
53public:
55
56 NavierStokesVelocityOutput(const std::string& paramGroup = "")
57 {
58 enableOutput_ = getParamFromGroup<bool>(paramGroup, "Vtk.AddVelocity", true);
59 }
60
62 bool enableOutput() const override { return enableOutput_; }
63
65 std::string phaseName(int phaseIdx) const override { return FluidSystem::phaseName(phaseIdx); }
66
68 int numFluidPhases() const override { return VolumeVariables::numFluidPhases(); }
69
71 FieldType fieldType() const override { return FieldType::element; }
72
76 const Element& element,
77 const FVElementGeometry& fvGeometry,
78 const ElementVolumeVariables& elemVolVars,
79 const ElementFluxVarsCache& elemFluxVarsCache,
80 int phaseIdx) const override
81 {
82 using CouplingManager = std::decay_t<decltype(elemVolVars.gridVolVars().problem().couplingManager())>;
83 using MomGG = std::decay_t<decltype(std::declval<CouplingManager>().problem(CouplingManager::freeFlowMomentumIndex).gridGeometry())>;
84 if constexpr (MomGG::discMethod == DiscretizationMethods::fcstaggered)
85 calculateVelocityForStaggeredGrid_(velocity, element, fvGeometry, elemVolVars);
86 else if constexpr (
87 MomGG::discMethod == DiscretizationMethods::fcdiamond
88 || MomGG::discMethod == DiscretizationMethods::pq1bubble
89 || MomGG::discMethod == DiscretizationMethods::box
90 )
91 calculateVelocityForCVFESchemes_(velocity, element, fvGeometry, elemVolVars);
92 }
93
94private:
95 void calculateVelocityForStaggeredGrid_(VelocityVector& velocity,
96 const Element& element,
97 const FVElementGeometry& fvGeometry,
98 const ElementVolumeVariables& elemVolVars) const
99 {
100 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
101 const auto getFaceVelocity = [&](const FVElementGeometry& fvG, const auto& scvf)
102 {
103 return elemVolVars.gridVolVars().problem().faceVelocity(element, fvGeometry, scvf);
104 };
105
106 velocity[eIdx] = StaggeredVelocityReconstruction::cellCenterVelocity(getFaceVelocity, fvGeometry);
107 }
108
109 void calculateVelocityForCVFESchemes_(VelocityVector& velocity,
110 const Element& element,
111 const FVElementGeometry& fvGeometry,
112 const ElementVolumeVariables& elemVolVars) const
113 {
114 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
115 velocity[eIdx] = elemVolVars.gridVolVars().problem().elementVelocity(fvGeometry);
116 }
117
118
119 bool enableOutput_;
120};
121
122} // end namespace Dumux
123
124#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
The available discretization methods in Dumux.
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
constexpr FCDiamond fcdiamond
Definition: method.hh:141
constexpr Box box
Definition: method.hh:136
constexpr PQ1Bubble pq1bubble
Definition: method.hh:137
constexpr FCStaggered fcstaggered
Definition: method.hh:140
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:56
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:75
std::string phaseName(int phaseIdx) const override
returns the phase name of a given phase index
Definition: freeflow/navierstokes/velocityoutput.hh:65
typename ParentType::VelocityVector VelocityVector
Definition: freeflow/navierstokes/velocityoutput.hh:54
bool enableOutput() const override
Returns whether to enable the velocity output or not.
Definition: freeflow/navierstokes/velocityoutput.hh:62
FieldType fieldType() const override
returns the field type
Definition: freeflow/navierstokes/velocityoutput.hh:71
int numFluidPhases() const override
returns the number of phases
Definition: freeflow/navierstokes/velocityoutput.hh:68
Velocity output for implicit (porous media) models.
Definition: io/velocityoutput.hh:41
std::vector< Dune::FieldVector< Scalar, dimWorld > > VelocityVector
Definition: io/velocityoutput.hh:50
FieldType
A container for possible velocity data types.
Definition: io/velocityoutput.hh:56
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.