25#ifndef DUMUX_NONEQUILIBRIUM_GRID_VARIABLES_HH
26#define DUMUX_NONEQUILIBRIUM_GRID_VARIABLES_HH
29#include <dune/common/fvector.hh>
30#include <dune/grid/common/partitionset.hh>
45template<
class TypeTag>
48 GetPropType<TypeTag, Properties::GridVolumeVariables>,
49 GetPropType<TypeTag, Properties::GridFluxVariablesCache>>
58 static constexpr auto dim = ParentType::GridGeometry::GridView::dimension;
59 static constexpr auto dimWorld = ParentType::GridGeometry::GridView::dimensionworld;
60 static constexpr int numPhases = ParentType::VolumeVariables::numFluidPhases();
69 template<
class Problem>
74 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
75 velocityNorm_[phaseIdx].assign(
gridGeometry->numDofs(), 0.0);
77 velocityBackend_ = std::make_unique<VelocityBackend>(*
this);
80 template<
class SolutionVector>
83 using Scalar =
typename SolutionVector::field_type;
84 using VelocityVector =
typename Dune::FieldVector<Scalar, dimWorld>;
86 std::array<std::vector<VelocityVector>, numPhases> velocity;
88 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
91 velocity[phaseIdx].resize(this->
gridGeometry_->gridView().size(0));
95 for (
const auto& element : elements(this->
gridGeometry_->gridView(), Dune::Partitions::interior))
97 const auto eIdxGlobal = this->
gridGeometry_->elementMapper().index(element);
103 fvGeometry.bind(element);
104 elemVolVars.bind(element, fvGeometry, curSol);
105 elemFluxVarsCache.bind(element, fvGeometry, elemVolVars);
107 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
109 velocityBackend_->calculateVelocity(velocity[phaseIdx], element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
111 for (
auto&& scv : scvs(fvGeometry))
113 const auto dofIdxGlobal = scv.dofIndex();
114 if (isBox && dim == 1)
115 velocityNorm_[phaseIdx][dofIdxGlobal] = velocity[phaseIdx][eIdxGlobal].two_norm();
117 velocityNorm_[phaseIdx][dofIdxGlobal] = velocity[phaseIdx][dofIdxGlobal].two_norm();
130 const unsigned int dofIdxGlobal)
const
131 {
return velocityNorm_[phaseIdx][dofIdxGlobal]; }
134 std::array<std::vector<Dune::FieldVector<Scalar, 1> > , numPhases> velocityNorm_;
135 std::unique_ptr<VelocityBackend> velocityBackend_;
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
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
The grid variable class for finite volume schemes storing variables on scv and scvf (volume and flux ...
Definition: discretization/fvgridvariables.hh:42
const GridFluxVariablesCache & gridFluxVarsCache() const
return the flux variables cache
Definition: discretization/fvgridvariables.hh:132
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
export type of the finite volume grid geometry
Definition: discretization/fvgridvariables.hh:45
std::shared_ptr< const GridGeometry > gridGeometry_
pointer to the constant grid geometry
Definition: discretization/fvgridvariables.hh:161
const GridVolumeVariables & curGridVolVars() const
return the current volume variables
Definition: discretization/fvgridvariables.hh:140
const GridGeometry & gridGeometry() const
return the finite volume grid geometry
Definition: discretization/fvgridvariables.hh:156
std::decay_t< decltype(std::declval< PrimaryVariables >()[0])> Scalar
export scalar type (TODO get it directly from the volvars)
Definition: discretization/fvgridvariables.hh:57
This class stores the velocities which are used to compute Reynolds numbers for the source terms of n...
Definition: porousmediumflow/nonequilibrium/gridvariables.hh:50
void calcVelocityAverage(const SolutionVector &curSol)
Definition: porousmediumflow/nonequilibrium/gridvariables.hh:81
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:129
NonEquilibriumGridVariables(std::shared_ptr< Problem > problem, std::shared_ptr< const GridGeometry > gridGeometry)
Constructor.
Definition: porousmediumflow/nonequilibrium/gridvariables.hh:70
Velocity computation for implicit (porous media) models.
Definition: velocity.hh:48
Declares all properties used in Dumux.
The grid variable class for finite volume schemes storing variables on scv and scvf (volume and flux ...
Base class for the flux variables in porous medium models.