version 3.10-dev
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
14#define DUMUX_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
15
16#include <memory>
17#include <dune/common/float_cmp.hh>
18
24
25namespace Dumux {
26
31template<class GridVariables, class FluxVariables>
33{
35 using GridGeometry = typename GridVariables::GridGeometry;
36 using FVElementGeometry = typename GridGeometry::LocalView;
37 using GridView = typename GridGeometry::GridView;
38 using Element = typename GridView::template Codim<0>::Entity;
39 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
40 using ElementFluxVarsCache = typename GridVariables::GridFluxVariablesCache::LocalView;
41 using VolumeVariables = typename GridVariables::VolumeVariables;
42 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
43 using FluidSystem = typename VolumeVariables::FluidSystem;
44
46
47public:
49
55 PorousMediumFlowVelocityOutput(const GridVariables& gridVariables)
56 {
57 // check, if velocity output can be used (works only for cubes so far)
58 enableOutput_ = getParamFromGroup<bool>(gridVariables.curGridVolVars().problem().paramGroup(), "Vtk.AddVelocity");
59 if (enableOutput_)
60 velocityBackend = std::make_unique<VelocityBackend>(gridVariables);
61 }
62
64 bool enableOutput() const override { return enableOutput_; }
65
67 std::string phaseName(int phaseIdx) const override { return FluidSystem::phaseName(phaseIdx); }
68
70 int numFluidPhases() const override { return VolumeVariables::numFluidPhases(); }
71
75 const Element& element,
76 const FVElementGeometry& fvGeometry,
77 const ElementVolumeVariables& elemVolVars,
78 const ElementFluxVarsCache& elemFluxVarsCache,
79 int phaseIdx) const override
80 {
81 if (enableOutput_)
82 velocityBackend->calculateVelocity(velocity, element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
83 }
84
85private:
86 bool enableOutput_;
87 std::unique_ptr<VelocityBackend> velocityBackend;
88};
89
90} // end namespace Dumux
91
92#endif
Velocity computation for implicit (porous media) models.
Definition: velocity.hh:59
Velocity output policy for implicit (porous media) models.
Definition: porousmediumflow/velocityoutput.hh:33
std::string phaseName(int phaseIdx) const override
Returns the phase name of a given phase index.
Definition: porousmediumflow/velocityoutput.hh:67
bool enableOutput() const override
Returns whether or not velocity output is enabled.
Definition: porousmediumflow/velocityoutput.hh:64
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, int phaseIdx) const override
Definition: porousmediumflow/velocityoutput.hh:74
PorousMediumFlowVelocityOutput(const GridVariables &gridVariables)
Constructor initializes the static data with the initial solution.
Definition: porousmediumflow/velocityoutput.hh:55
int numFluidPhases() const override
Returns the number of phases.
Definition: porousmediumflow/velocityoutput.hh:70
Velocity output for implicit (porous media) models.
Definition: io/velocityoutput.hh:29
std::vector< Dune::FieldVector< Scalar, dimWorld > > VelocityVector
Definition: io/velocityoutput.hh:38
Element solution classes and factory functions.
Default velocity output policy for porous media models.
The available discretization methods in Dumux.
Definition: adapt.hh:17
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Velocity computation for implicit (porous media) models.