24#ifndef DUMUX_STAGGERED_FF_VELOCITYOUTPUT_HH
25#define DUMUX_STAGGERED_FF_VELOCITYOUTPUT_HH
36template<
class Gr
idVariables,
class SolutionVector>
40 using GridGeometry =
typename GridVariables::GridGeometry;
41 using Scalar =
typename GridVariables::Scalar;
42 using FVElementGeometry =
typename GridGeometry::LocalView;
43 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
44 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
45 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
46 using ElementFluxVarsCache =
typename GridVariables::GridFluxVariablesCache::LocalView;
47 using VolumeVariables =
typename GridVariables::VolumeVariables;
48 using FluidSystem =
typename VolumeVariables::FluidSystem;
49 using GridView =
typename GridGeometry::GridView;
51 using Problem =
typename std::decay_t<decltype(std::declval<GridVolumeVariables>().problem())>;
52 using Element =
typename GridView::template Codim<0>::Entity;
53 using CoordScalar =
typename GridView::ctype;
65 : gridVariables_(gridVariables)
70 enableOutput_ = getParamFromGroup<bool>(gridVariables.curGridVolVars().problem().paramGroup(),
"Vtk.AddVelocity",
true);
77 std::string
phaseName(
int phaseIdx)
const override {
return FluidSystem::phaseName(phaseIdx); }
80 int numFluidPhases()
const override {
return VolumeVariables::numFluidPhases(); }
84 [[deprecated(
"Use the new interface signature with elemFluxVarsCache")]]
86 const ElementVolumeVariables& elemVolVars,
87 const FVElementGeometry& fvGeometry,
88 const Element& element,
89 int phaseIdx)
const override
91 auto elemFluxVarsCache =
localView(gridVariables_.gridFluxVarsCache());
92 elemFluxVarsCache.bind(element, fvGeometry, elemVolVars);
93 calculateVelocity(velocity, element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
99 const Element& element,
100 const FVElementGeometry& fvGeometry,
101 const ElementVolumeVariables& elemVolVars,
102 const ElementFluxVarsCache& elemFluxVarsCache,
103 int phaseIdx)
const override
105 auto elemFaceVars =
localView(gridVariables_.curGridFaceVars());
106 elemFaceVars.bindElement(element, fvGeometry, sol_);
107 for (
auto&& scv : scvs(fvGeometry))
109 auto dofIdxGlobal = scv.dofIndex();
111 for (
auto&& scvf : scvfs(fvGeometry))
113 auto dirIdx = scvf.directionIndex();
114 velocity[dofIdxGlobal][dirIdx] += 0.5*elemFaceVars[scvf].velocitySelf();
120 const GridVariables& gridVariables_;
121 const SolutionVector& sol_;
123 bool enableOutput_ =
true;
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
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 staggered free-flow models.
Definition: discretization/staggered/freeflow/velocityoutput.hh:38
void calculateVelocity(VelocityVector &velocity, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, int phaseIdx) const override
Definition: discretization/staggered/freeflow/velocityoutput.hh:98
void calculateVelocity(VelocityVector &velocity, const ElementVolumeVariables &elemVolVars, const FVElementGeometry &fvGeometry, const Element &element, int phaseIdx) const override
Definition: discretization/staggered/freeflow/velocityoutput.hh:85
StaggeredFreeFlowVelocityOutput(const GridVariables &gridVariables, const SolutionVector &sol)
Constructor initializes the static data with the initial solution.
Definition: discretization/staggered/freeflow/velocityoutput.hh:64
bool enableOutput() const override
Returns whether to enable the velocity output or not.
Definition: discretization/staggered/freeflow/velocityoutput.hh:74
std::string phaseName(int phaseIdx) const override
returns the phase name of a given phase index
Definition: discretization/staggered/freeflow/velocityoutput.hh:77
int numFluidPhases() const override
returns the number of phases
Definition: discretization/staggered/freeflow/velocityoutput.hh:80
typename ParentType::VelocityVector VelocityVector
Definition: discretization/staggered/freeflow/velocityoutput.hh:56
Velocity output for implicit (porous media) models.
Definition: io/velocityoutput.hh:41
std::vector< Dune::FieldVector< Scalar, dimWorld > > VelocityVector
Definition: io/velocityoutput.hh:50
Default velocity output policy for porous media models.