3.2-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#include <dune/geometry/referenceelements.hh>
31
37
38namespace Dumux {
39
44template<class GridVariables, class FluxVariables>
46{
48 using GridGeometry = typename GridVariables::GridGeometry;
49 using FVElementGeometry = typename GridGeometry::LocalView;
50 using SubControlVolume = typename GridGeometry::SubControlVolume;
51 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
52 using GridView = typename GridGeometry::GridView;
53 using Element = typename GridView::template Codim<0>::Entity;
54 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
55 using ElementFluxVarsCache = typename GridVariables::GridFluxVariablesCache::LocalView;
56 using VolumeVariables = typename GridVariables::VolumeVariables;
57 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
58 using FluidSystem = typename VolumeVariables::FluidSystem;
59 using Scalar = typename GridVariables::Scalar;
60
61 static constexpr int dim = GridView::dimension;
62 static constexpr int dimWorld = GridView::dimensionworld;
63 static constexpr bool isBox = GridGeometry::discMethod == DiscretizationMethod::box;
64 static constexpr int dofCodim = isBox ? dim : 0;
65
66 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
67 using ReferenceElements = Dune::ReferenceElements<typename GridView::ctype, dim>;
68
69 using Problem = typename GridVolumeVariables::Problem;
70 using BoundaryTypes = typename Problem::Traits::BoundaryTypes;
72
73public:
75
81 PorousMediumFlowVelocityOutput(const GridVariables& gridVariables)
82 {
83 // check, if velocity output can be used (works only for cubes so far)
84 enableOutput_ = getParamFromGroup<bool>(gridVariables.curGridVolVars().problem().paramGroup(), "Vtk.AddVelocity");
85 if (enableOutput_)
86 velocityBackend = std::make_unique<VelocityBackend>(gridVariables);
87 }
88
90 bool enableOutput() const override { return enableOutput_; }
91
93 std::string phaseName(int phaseIdx) const override { return FluidSystem::phaseName(phaseIdx); }
94
96 int numFluidPhases() const override { return VolumeVariables::numFluidPhases(); }
97
101 const Element& element,
102 const FVElementGeometry& fvGeometry,
103 const ElementVolumeVariables& elemVolVars,
104 const ElementFluxVarsCache& elemFluxVarsCache,
105 int phaseIdx) const override
106 {
107 if (enableOutput_)
108 velocityBackend->calculateVelocity(velocity, element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
109 }
110
111private:
112 bool enableOutput_;
113 std::unique_ptr<VelocityBackend> velocityBackend;
114};
115
116} // end namespace Dumux
117
118#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
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:48
Velocity output policy for implicit (porous media) models.
Definition: porousmediumflow/velocityoutput.hh:46
std::string phaseName(int phaseIdx) const override
Returns the phase name of a given phase index.
Definition: porousmediumflow/velocityoutput.hh:93
bool enableOutput() const override
Returns whether or not velocity output is enabled.
Definition: porousmediumflow/velocityoutput.hh:90
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, int phaseIdx) const override
Definition: porousmediumflow/velocityoutput.hh:100
PorousMediumFlowVelocityOutput(const GridVariables &gridVariables)
Constructor initializes the static data with the initial solution.
Definition: porousmediumflow/velocityoutput.hh:81
int numFluidPhases() const override
Returns the number of phases.
Definition: porousmediumflow/velocityoutput.hh:96
Default velocity output policy for porous media models.