13#ifndef DUMUX_NONEQUILIBRIUM_GRID_VARIABLES_HH
14#define DUMUX_NONEQUILIBRIUM_GRID_VARIABLES_HH
17#include <dune/common/fvector.hh>
18#include <dune/grid/common/partitionset.hh>
33template<
class TypeTag>
36 GetPropType<TypeTag, Properties::GridVolumeVariables>,
37 GetPropType<TypeTag, Properties::GridFluxVariablesCache>>
46 static constexpr auto dim = ParentType::GridGeometry::GridView::dimension;
47 static constexpr auto dimWorld = ParentType::GridGeometry::GridView::dimensionworld;
48 static constexpr int numPhases = ParentType::VolumeVariables::numFluidPhases();
57 template<
class Problem>
62 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
65 velocityBackend_ = std::make_unique<VelocityBackend>(*
this);
68 template<
class SolutionVector>
71 using Scalar =
typename SolutionVector::field_type;
72 using VelocityVector =
typename Dune::FieldVector<Scalar, dimWorld>;
74 std::array<std::vector<VelocityVector>, numPhases> velocity;
76 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
79 velocity[phaseIdx].resize(this->
gridGeometry_->gridView().size(0));
88 for (
const auto& element : elements(this->
gridGeometry_->gridView(), Dune::Partitions::interior))
90 const auto eIdxGlobal = this->
gridGeometry_->elementMapper().index(element);
91 fvGeometry.bind(element);
92 elemVolVars.bind(element, fvGeometry, curSol);
93 elemFluxVarsCache.bind(element, fvGeometry, elemVolVars);
95 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
97 velocityBackend_->calculateVelocity(velocity[phaseIdx], element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
99 for (
auto&& scv : scvs(fvGeometry))
101 const auto dofIdxGlobal = scv.dofIndex();
102 if (isBox && dim == 1)
103 velocityNorm_[phaseIdx][dofIdxGlobal] = velocity[phaseIdx][eIdxGlobal].two_norm();
105 velocityNorm_[phaseIdx][dofIdxGlobal] = velocity[phaseIdx][dofIdxGlobal].two_norm();
118 const unsigned int dofIdxGlobal)
const
119 {
return velocityNorm_[phaseIdx][dofIdxGlobal]; }
122 std::array<std::vector<Dune::FieldVector<Scalar, 1> > , numPhases> velocityNorm_;
123 std::unique_ptr<VelocityBackend> velocityBackend_;
The grid variable class for finite volume schemes storing variables on scv and scvf (volume and flux ...
Definition: discretization/fvgridvariables.hh:30
const GridFluxVariablesCache & gridFluxVarsCache() const
return the flux variables cache
Definition: discretization/fvgridvariables.hh:120
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
export type of the finite volume grid geometry
Definition: discretization/fvgridvariables.hh:33
std::shared_ptr< const GridGeometry > gridGeometry_
pointer to the constant grid geometry
Definition: discretization/fvgridvariables.hh:149
const GridVolumeVariables & curGridVolVars() const
return the current volume variables
Definition: discretization/fvgridvariables.hh:128
const GridGeometry & gridGeometry() const
return the finite volume grid geometry
Definition: discretization/fvgridvariables.hh:144
std::decay_t< decltype(std::declval< PrimaryVariables >()[0])> Scalar
export scalar type (TODO get it directly from the volvars)
Definition: discretization/fvgridvariables.hh:45
This class stores the velocities which are used to compute Reynolds numbers for the source terms of n...
Definition: porousmediumflow/nonequilibrium/gridvariables.hh:38
void calcVelocityAverage(const SolutionVector &curSol)
Definition: porousmediumflow/nonequilibrium/gridvariables.hh:69
const Scalar volumeDarcyMagVelocity(const unsigned int phaseIdx, const unsigned int dofIdxGlobal) const
Access to the averaged (magnitude of) velocity for each vertex.
Definition: porousmediumflow/nonequilibrium/gridvariables.hh:117
NonEquilibriumGridVariables(std::shared_ptr< Problem > problem, std::shared_ptr< const GridGeometry > gridGeometry)
Constructor.
Definition: porousmediumflow/nonequilibrium/gridvariables.hh:58
Velocity computation for implicit (porous media) models.
Definition: velocity.hh:59
Defines all properties used in Dumux.
The grid variable class for finite volume schemes, storing variables on scv and scvf (volume and flux...
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:26
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
void assign(To &to, const From &from)
Definition: nonlinear/newtonsolver.hh:130
constexpr Box box
Definition: method.hh:147
Base class for the flux variables in porous medium models.
Velocity computation for implicit (porous media) models.