3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/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 *****************************************************************************/
25#ifndef DUMUX_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
26#define DUMUX_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
27
28#include <memory>
29#include <dune/common/float_cmp.hh>
30
36
37namespace Dumux {
38
43template<class GridVariables, class FluxVariables>
45{
47 using GridGeometry = typename GridVariables::GridGeometry;
48 using FVElementGeometry = typename GridGeometry::LocalView;
49 using SubControlVolume = typename GridGeometry::SubControlVolume;
50 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
51 using GridView = typename GridGeometry::GridView;
52 using Element = typename GridView::template Codim<0>::Entity;
53 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
54 using ElementFluxVarsCache = typename GridVariables::GridFluxVariablesCache::LocalView;
55 using VolumeVariables = typename GridVariables::VolumeVariables;
56 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
57 using FluidSystem = typename VolumeVariables::FluidSystem;
58 using Scalar = typename GridVariables::Scalar;
59
60 static constexpr int dim = GridView::dimension;
61 static constexpr int dimWorld = GridView::dimensionworld;
62 static constexpr bool isBox = GridGeometry::discMethod == DiscretizationMethods::box;
63 static constexpr int dofCodim = isBox ? dim : 0;
64
65 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
66
67 using Problem = typename GridVolumeVariables::Problem;
69
70public:
72
78 PorousMediumFlowVelocityOutput(const GridVariables& gridVariables)
79 {
80 // check, if velocity output can be used (works only for cubes so far)
81 enableOutput_ = getParamFromGroup<bool>(gridVariables.curGridVolVars().problem().paramGroup(), "Vtk.AddVelocity");
82 if (enableOutput_)
83 velocityBackend = std::make_unique<VelocityBackend>(gridVariables);
84 }
85
87 bool enableOutput() const override { return enableOutput_; }
88
90 std::string phaseName(int phaseIdx) const override { return FluidSystem::phaseName(phaseIdx); }
91
93 int numFluidPhases() const override { return VolumeVariables::numFluidPhases(); }
94
98 const Element& element,
99 const FVElementGeometry& fvGeometry,
100 const ElementVolumeVariables& elemVolVars,
101 const ElementFluxVarsCache& elemFluxVarsCache,
102 int phaseIdx) const override
103 {
104 if (enableOutput_)
105 velocityBackend->calculateVelocity(velocity, element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
106 }
107
108private:
109 bool enableOutput_;
110 std::unique_ptr<VelocityBackend> velocityBackend;
111};
112
113} // end namespace Dumux
114
115#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Element solution classes and factory functions.
The available discretization methods in Dumux.
Velocity computation for implicit (porous media) models.
Definition: adapt.hh:29
constexpr Box box
Definition: method.hh:139
Velocity output for implicit (porous media) models.
Definition: io/velocityoutput.hh:41
std::vector< Dune::FieldVector< Scalar, dimWorld > > VelocityVector
Definition: io/velocityoutput.hh:50
Velocity computation for implicit (porous media) models.
Definition: velocity.hh:71
Velocity output policy for implicit (porous media) models.
Definition: porousmediumflow/velocityoutput.hh:45
std::string phaseName(int phaseIdx) const override
Returns the phase name of a given phase index.
Definition: porousmediumflow/velocityoutput.hh:90
bool enableOutput() const override
Returns whether or not velocity output is enabled.
Definition: porousmediumflow/velocityoutput.hh:87
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, int phaseIdx) const override
Definition: porousmediumflow/velocityoutput.hh:97
PorousMediumFlowVelocityOutput(const GridVariables &gridVariables)
Constructor initializes the static data with the initial solution.
Definition: porousmediumflow/velocityoutput.hh:78
int numFluidPhases() const override
Returns the number of phases.
Definition: porousmediumflow/velocityoutput.hh:93
Default velocity output policy for porous media models.