3.6-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 GridView = typename GridGeometry::GridView;
50 using Element = typename GridView::template Codim<0>::Entity;
51 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
52 using ElementFluxVarsCache = typename GridVariables::GridFluxVariablesCache::LocalView;
53 using VolumeVariables = typename GridVariables::VolumeVariables;
54 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
55 using FluidSystem = typename VolumeVariables::FluidSystem;
56
58
59public:
61
67 PorousMediumFlowVelocityOutput(const GridVariables& gridVariables)
68 {
69 // check, if velocity output can be used (works only for cubes so far)
70 enableOutput_ = getParamFromGroup<bool>(gridVariables.curGridVolVars().problem().paramGroup(), "Vtk.AddVelocity");
71 if (enableOutput_)
72 velocityBackend = std::make_unique<VelocityBackend>(gridVariables);
73 }
74
76 bool enableOutput() const override { return enableOutput_; }
77
79 std::string phaseName(int phaseIdx) const override { return FluidSystem::phaseName(phaseIdx); }
80
82 int numFluidPhases() const override { return VolumeVariables::numFluidPhases(); }
83
87 const Element& element,
88 const FVElementGeometry& fvGeometry,
89 const ElementVolumeVariables& elemVolVars,
90 const ElementFluxVarsCache& elemFluxVarsCache,
91 int phaseIdx) const override
92 {
93 if (enableOutput_)
94 velocityBackend->calculateVelocity(velocity, element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
95 }
96
97private:
98 bool enableOutput_;
99 std::unique_ptr<VelocityBackend> velocityBackend;
100};
101
102} // end namespace Dumux
103
104#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.
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
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: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:79
bool enableOutput() const override
Returns whether or not velocity output is enabled.
Definition: porousmediumflow/velocityoutput.hh:76
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, int phaseIdx) const override
Definition: porousmediumflow/velocityoutput.hh:86
PorousMediumFlowVelocityOutput(const GridVariables &gridVariables)
Constructor initializes the static data with the initial solution.
Definition: porousmediumflow/velocityoutput.hh:67
int numFluidPhases() const override
Returns the number of phases.
Definition: porousmediumflow/velocityoutput.hh:82
Default velocity output policy for porous media models.