12#ifndef DUMUX_STAGGERED_FF_VELOCITYOUTPUT_HH
13#define DUMUX_STAGGERED_FF_VELOCITYOUTPUT_HH
24template<
class Gr
idVariables,
class SolutionVector>
28 using GridGeometry =
typename GridVariables::GridGeometry;
29 using Scalar =
typename GridVariables::Scalar;
30 using FVElementGeometry =
typename GridGeometry::LocalView;
31 using SubControlVolumeFace =
typename GridGeometry::SubControlVolumeFace;
32 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
33 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
34 using ElementFluxVarsCache =
typename GridVariables::GridFluxVariablesCache::LocalView;
35 using VolumeVariables =
typename GridVariables::VolumeVariables;
36 using FluidSystem =
typename VolumeVariables::FluidSystem;
37 using GridView =
typename GridGeometry::GridView;
39 using Problem =
typename std::decay_t<decltype(std::declval<GridVolumeVariables>().problem())>;
40 using Element =
typename GridView::template Codim<0>::Entity;
41 using CoordScalar =
typename GridView::ctype;
53 : gridVariables_(gridVariables)
58 enableOutput_ = getParamFromGroup<bool>(gridVariables.curGridVolVars().problem().paramGroup(),
"Vtk.AddVelocity",
true);
65 std::string
phaseName(
int phaseIdx)
const override {
return FluidSystem::phaseName(phaseIdx); }
68 int numFluidPhases()
const override {
return VolumeVariables::numFluidPhases(); }
73 const Element& element,
74 const FVElementGeometry& fvGeometry,
75 const ElementVolumeVariables& elemVolVars,
76 const ElementFluxVarsCache& elemFluxVarsCache,
77 int phaseIdx)
const override
79 auto elemFaceVars =
localView(gridVariables_.curGridFaceVars());
80 elemFaceVars.bindElement(element, fvGeometry, sol_);
81 for (
auto&& scv : scvs(fvGeometry))
83 auto dofIdxGlobal = scv.dofIndex();
85 for (
auto&& scvf : scvfs(fvGeometry))
87 auto dirIdx = scvf.directionIndex();
88 velocity[dofIdxGlobal][dirIdx] += 0.5*elemFaceVars[scvf].velocitySelf();
94 const GridVariables& gridVariables_;
95 const SolutionVector& sol_;
97 bool enableOutput_ =
true;
Velocity output for staggered free-flow models.
Definition: discretization/staggered/freeflow/velocityoutput.hh:26
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:72
StaggeredFreeFlowVelocityOutput(const GridVariables &gridVariables, const SolutionVector &sol)
Constructor initializes the static data with the initial solution.
Definition: discretization/staggered/freeflow/velocityoutput.hh:52
bool enableOutput() const override
Returns whether to enable the velocity output or not.
Definition: discretization/staggered/freeflow/velocityoutput.hh:62
std::string phaseName(int phaseIdx) const override
returns the phase name of a given phase index
Definition: discretization/staggered/freeflow/velocityoutput.hh:65
int numFluidPhases() const override
returns the number of phases
Definition: discretization/staggered/freeflow/velocityoutput.hh:68
typename ParentType::VelocityVector VelocityVector
Definition: discretization/staggered/freeflow/velocityoutput.hh:44
Velocity output for implicit (porous media) models.
Definition: io/velocityoutput.hh:29
std::vector< Dune::FieldVector< Scalar, dimWorld > > VelocityVector
Definition: io/velocityoutput.hh:38
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:26
Default velocity output policy for porous media models.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.