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)
 
   63            velocityNorm_[phaseIdx].assign(
gridGeometry->numDofs(), 0.0);
 
   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_;
 
 
const GridFluxVariablesCache & gridFluxVarsCache() const
Definition discretization/fvgridvariables.hh:120
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition discretization/fvgridvariables.hh:33
std::shared_ptr< const GridGeometry > gridGeometry_
Definition discretization/fvgridvariables.hh:149
const GridVolumeVariables & curGridVolVars() const
Definition discretization/fvgridvariables.hh:128
const GridGeometry & gridGeometry() const
Definition discretization/fvgridvariables.hh:144
FVGridVariables(std::shared_ptr< Problem > problem, std::shared_ptr< const GridGeometry > gridGeometry)
Definition discretization/fvgridvariables.hh:51
std::decay_t< decltype(std::declval< PrimaryVariables >()[0])> Scalar
Definition discretization/fvgridvariables.hh:45
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:60
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.
constexpr Box box
Definition method.hh:147
Base class for the flux variables in porous medium models.
Velocity computation for implicit (porous media) models.