25#ifndef DUMUX_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
26#define DUMUX_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
29#include <dune/common/float_cmp.hh>
30#include <dune/geometry/referenceelements.hh>
45template<
class Gr
idVariables,
class FluxVariables>
49 using GridGeometry =
typename GridVariables::GridGeometry;
50 using FVElementGeometry =
typename GridGeometry::LocalView;
51 using SubControlVolume =
typename GridGeometry::SubControlVolume;
52 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
53 using GridView =
typename GridGeometry::GridView;
54 using Element =
typename GridView::template Codim<0>::Entity;
55 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
56 using ElementFluxVarsCache =
typename GridVariables::GridFluxVariablesCache::LocalView;
57 using VolumeVariables =
typename GridVariables::VolumeVariables;
58 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
59 using FluidSystem =
typename VolumeVariables::FluidSystem;
60 using Scalar =
typename GridVariables::Scalar;
62 static constexpr int dim = GridView::dimension;
63 static constexpr int dimWorld = GridView::dimensionworld;
65 static constexpr int dofCodim = isBox ? dim : 0;
67 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
68 using ReferenceElements = Dune::ReferenceElements<typename GridView::ctype, dim>;
70 using Problem =
typename GridVolumeVariables::Problem;
71 using BoundaryTypes =
typename Problem::Traits::BoundaryTypes;
83 : gridVariables_(gridVariables)
86 enableOutput_ = getParamFromGroup<bool>(gridVariables.curGridVolVars().problem().paramGroup(),
"Vtk.AddVelocity");
88 velocityBackend = std::make_unique<VelocityBackend>(gridVariables);
95 std::string
phaseName(
int phaseIdx)
const override {
return FluidSystem::phaseName(phaseIdx); }
98 int numFluidPhases()
const override {
return VolumeVariables::numFluidPhases(); }
102 [[deprecated(
"Use the new interface signature with elemFluxVarsCache")]]
104 const ElementVolumeVariables& elemVolVars,
105 const FVElementGeometry& fvGeometry,
106 const Element& element,
107 int phaseIdx)
const override
109 auto elemFluxVarsCache =
localView(gridVariables_.gridFluxVarsCache());
110 elemFluxVarsCache.bind(element, fvGeometry, elemVolVars);
111 calculateVelocity(velocity, element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
117 const Element& element,
118 const FVElementGeometry& fvGeometry,
119 const ElementVolumeVariables& elemVolVars,
120 const ElementFluxVarsCache& elemFluxVarsCache,
121 int phaseIdx)
const override
124 velocityBackend->calculateVelocity(velocity, element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
128 const GridVariables& gridVariables_;
130 std::unique_ptr<VelocityBackend> velocityBackend;
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.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
make the local view function available whenever we use the grid geometry
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:47
Velocity output policy for implicit (porous media) models.
Definition: porousmediumflow/velocityoutput.hh:47
std::string phaseName(int phaseIdx) const override
Returns the phase name of a given phase index.
Definition: porousmediumflow/velocityoutput.hh:95
bool enableOutput() const override
Returns whether or not velocity output is enabled.
Definition: porousmediumflow/velocityoutput.hh:92
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, int phaseIdx) const override
Definition: porousmediumflow/velocityoutput.hh:116
PorousMediumFlowVelocityOutput(const GridVariables &gridVariables)
Constructor initializes the static data with the initial solution.
Definition: porousmediumflow/velocityoutput.hh:82
int numFluidPhases() const override
Returns the number of phases.
Definition: porousmediumflow/velocityoutput.hh:98
void calculateVelocity(VelocityVector &velocity, const ElementVolumeVariables &elemVolVars, const FVElementGeometry &fvGeometry, const Element &element, int phaseIdx) const override
Definition: porousmediumflow/velocityoutput.hh:103
Default velocity output policy for porous media models.