24#ifndef DUMUX_PNM_2P_GRID_FLUXVARSCACHE_HH
25#define DUMUX_PNM_2P_GRID_FLUXVARSCACHE_HH
39template<
class P,
class FVC,
class IS = TwoPInvasionState<P>>
46 template<
class Gr
idFluxVariablesCache,
bool cachingEnabled>
55template<
class Problem,
56 class FluxVariablesCache,
66template<
class P,
class FVC,
class Traits>
69 using Problem =
typename Traits::Problem;
71 using InvasionState =
typename Traits::InvasionState;
87 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
89 const GridVolumeVariables& gridVolVars,
90 const SolutionVector& sol,
91 bool forceUpdate =
true)
93 fluxVarsCache_.resize(gridGeometry.gridView().size(0));
94 for (
const auto& element : elements(gridGeometry.gridView()))
96 auto eIdx = gridGeometry.elementMapper().index(element);
98 auto fvGeometry =
localView(gridGeometry);
99 fvGeometry.bind(element);
101 auto elemVolVars =
localView(gridVolVars);
102 elemVolVars.bind(element, fvGeometry, sol);
104 for (
auto&& scvf : scvfs(fvGeometry))
110 {
return *problemPtr_; }
114 {
return fluxVarsCache_[eIdx]; }
118 {
return fluxVarsCache_[eIdx]; }
121 {
return invasionState_; }
124 {
return invasionState_; }
127 const Problem* problemPtr_;
128 std::vector<FluxVariablesCache> fluxVarsCache_;
129 InvasionState invasionState_;
137template<
class P,
class FVC,
class Traits>
140 using Problem =
typename Traits::Problem;
142 using InvasionState =
typename Traits::InvasionState;
158 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
160 const GridVolumeVariables& gridVolVars,
161 const SolutionVector& sol,
162 bool forceUpdate =
true) {}
165 {
return *problemPtr_; }
168 {
return invasionState_; }
171 {
return invasionState_; }
174 const Problem* problemPtr_;
175 InvasionState invasionState_;
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Free function to get the local view of a grid cache object.
Invasion state class for the two-phase PNM.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition localview.hh:38
Definition discretization/porenetwork/fvelementgeometry.hh:33
Base class for the finite volume geometry for porenetwork models.
Definition discretization/porenetwork/gridgeometry.hh:488
The flux variables caches for an element.
Definition porenetwork/2p/elementfluxvariablescache.hh:38
Flux variable caches traits.
Definition porenetwork/2p/gridfluxvariablescache.hh:41
FVC FluxVariablesCache
Definition porenetwork/2p/gridfluxvariablescache.hh:43
IS InvasionState
Definition porenetwork/2p/gridfluxvariablescache.hh:44
PNMTwoPElementFluxVariablesCache< GridFluxVariablesCache, cachingEnabled > LocalView
Definition porenetwork/2p/gridfluxvariablescache.hh:47
P Problem
Definition porenetwork/2p/gridfluxvariablescache.hh:42
Flux variable caches on a gridview.
Definition porenetwork/2p/gridfluxvariablescache.hh:59
const FluxVariablesCache & cache(std::size_t eIdx, std::size_t scvfIdx) const
Definition porenetwork/2p/gridfluxvariablescache.hh:113
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=true)
Definition porenetwork/2p/gridfluxvariablescache.hh:88
const Problem & problem() const
Definition porenetwork/2p/gridfluxvariablescache.hh:109
FluxVariablesCache & cache(std::size_t eIdx, std::size_t scvfIdx)
Definition porenetwork/2p/gridfluxvariablescache.hh:117
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition porenetwork/2p/gridfluxvariablescache.hh:81
InvasionState & invasionState()
Definition porenetwork/2p/gridfluxvariablescache.hh:123
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition porenetwork/2p/gridfluxvariablescache.hh:75
static constexpr bool cachingEnabled
make it possible to query if caching is enabled
Definition porenetwork/2p/gridfluxvariablescache.hh:78
const InvasionState & invasionState() const
Definition porenetwork/2p/gridfluxvariablescache.hh:120
PNMTwoPGridFluxVariablesCache(const Problem &problem)
Definition porenetwork/2p/gridfluxvariablescache.hh:83
static constexpr bool cachingEnabled
make it possible to query if caching is enabled
Definition porenetwork/2p/gridfluxvariablescache.hh:149
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition porenetwork/2p/gridfluxvariablescache.hh:152
const Problem & problem() const
Definition porenetwork/2p/gridfluxvariablescache.hh:164
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition porenetwork/2p/gridfluxvariablescache.hh:146
InvasionState & invasionState()
Definition porenetwork/2p/gridfluxvariablescache.hh:170
const InvasionState & invasionState() const
Definition porenetwork/2p/gridfluxvariablescache.hh:167
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=true)
Definition porenetwork/2p/gridfluxvariablescache.hh:159
PNMTwoPGridFluxVariablesCache(const Problem &problem)
Definition porenetwork/2p/gridfluxvariablescache.hh:154
Element flux variable cache.
Global flux variable cache.