24#ifndef DUMUX_DISCRETIZATION_STAGGERED_GRID_FLUXVARSCACHE_HH
25#define DUMUX_DISCRETIZATION_STAGGERED_GRID_FLUXVARSCACHE_HH
41template<
class P,
class FVC,
class FVCF,
int upwOrder>
48 template<
class Gr
idFluxVariablesCache,
bool cachingEnabled>
57template<
class Problem,
58 class FluxVariablesCache,
59 class FluxVariablesCacheFiller,
60 bool EnableGridFluxVariablesCache =
false,
61 int upwindSchemeOrder = 1,
70template<
class P,
class FVC,
class FVCF,
int upwindSchemeOrder,
class TheTraits>
73 using Problem =
typename TheTraits::Problem;
77 using FluxVariablesCacheFiller =
typename TheTraits::FluxVariablesCacheFiller;
84 using Scalar =
typename FluxVariablesCache::Scalar;
96 , staggeredUpwindMethods_(paramGroup)
100 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
101 void update(
const GridGeometry& gridGeometry,
102 const GridVolumeVariables& gridVolVars,
103 const SolutionVector& sol,
104 bool forceUpdate =
false)
107 if (FluxVariablesCacheFiller::isSolDependent || forceUpdate)
111 FluxVariablesCacheFiller filler(
problem());
113 fluxVarsCache_.resize(gridGeometry.numScvf());
114 for (
const auto& element : elements(gridGeometry.gridView()))
117 auto fvGeometry =
localView(gridGeometry);
118 fvGeometry.bind(element);
120 auto elemVolVars =
localView(gridVolVars);
121 elemVolVars.bind(element, fvGeometry, sol);
123 for (
auto&& scvf : scvfs(fvGeometry))
125 filler.fill(*
this, fluxVarsCache_[scvf.index()], element, fvGeometry, elemVolVars, scvf, forceUpdate);
134 return staggeredUpwindMethods_;
138 {
return *problemPtr_; }
142 {
return fluxVarsCache_[scvfIdx]; }
145 {
return fluxVarsCache_[scvfIdx]; }
148 const Problem* problemPtr_;
151 std::vector<FluxVariablesCache> fluxVarsCache_;
152 std::vector<std::size_t> globalScvfIndices_;
160template<
class P,
class FVC,
class FVCF,
int upwindSchemeOrder,
class TheTraits>
163 using Problem =
typename TheTraits::Problem;
167 using FluxVariablesCacheFiller =
typename TheTraits::FluxVariablesCacheFiller;
176 using Scalar =
typename FluxVariablesCache::Scalar;
186 , staggeredUpwindMethods_(paramGroup)
190 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
191 void update(
const GridGeometry& gridGeometry,
192 const GridVolumeVariables& gridVolVars,
193 const SolutionVector& sol,
194 bool forceUpdate =
false) {}
197 {
return *problemPtr_; }
202 return staggeredUpwindMethods_;
206 const Problem* problemPtr_;
Free function to get the local view of a grid cache object.
This file contains different higher order methods for approximating the velocity.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition localview.hh:38
make the local view function available whenever we use the grid geometry
Definition adapt.hh:29
Base class for the stencil local flux variables cache for the staggered model.
Definition staggered/elementfluxvariablescache.hh:41
Traits class to be used for the StaggeredGridVFluxVariablesCache.
Definition staggered/gridfluxvariablescache.hh:43
StaggeredElementFluxVariablesCache< GridFluxVariablesCache, cachingEnabled > LocalView
Definition staggered/gridfluxvariablescache.hh:49
static constexpr int upwindSchemeOrder
Definition staggered/gridfluxvariablescache.hh:50
P Problem
Definition staggered/gridfluxvariablescache.hh:44
FVCF FluxVariablesCacheFiller
Definition staggered/gridfluxvariablescache.hh:46
FVC FluxVariablesCache
Definition staggered/gridfluxvariablescache.hh:45
Flux variables cache class for staggered models.
Definition staggered/gridfluxvariablescache.hh:63
typename FluxVariablesCache::Scalar Scalar
Definition staggered/gridfluxvariablescache.hh:84
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition staggered/gridfluxvariablescache.hh:101
TheTraits Traits
the flux var cache traits
Definition staggered/gridfluxvariablescache.hh:80
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition staggered/gridfluxvariablescache.hh:92
StaggeredGridFluxVariablesCache(const Problem &problem, const std::string ¶mGroup="")
Definition staggered/gridfluxvariablescache.hh:94
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition staggered/gridfluxvariablescache.hh:83
static constexpr bool cachingEnabled
make it possible to query if caching is enabled
Definition staggered/gridfluxvariablescache.hh:89
static constexpr bool useHigherOrder
Definition staggered/gridfluxvariablescache.hh:86
const StaggeredUpwindMethods< Scalar, upwindSchemeOrder > & staggeredUpwindMethods() const
Return the StaggeredUpwindMethods.
Definition staggered/gridfluxvariablescache.hh:132
const Problem & problem() const
Definition staggered/gridfluxvariablescache.hh:137
static constexpr bool cachingEnabled
make it possible to query if caching is enabled
Definition staggered/gridfluxvariablescache.hh:179
StaggeredGridFluxVariablesCache(const Problem &problem, const std::string ¶mGroup="")
Definition staggered/gridfluxvariablescache.hh:184
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition staggered/gridfluxvariablescache.hh:173
TheTraits Traits
the flux var cache traits
Definition staggered/gridfluxvariablescache.hh:170
const Problem & problem() const
Definition staggered/gridfluxvariablescache.hh:196
typename FluxVariablesCache::Scalar Scalar
the scalar type
Definition staggered/gridfluxvariablescache.hh:176
const StaggeredUpwindMethods< Scalar, upwindSchemeOrder > & staggeredUpwindMethods() const
Return the UpwindingMethods.
Definition staggered/gridfluxvariablescache.hh:200
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition staggered/gridfluxvariablescache.hh:182
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition staggered/gridfluxvariablescache.hh:191
This file contains different higher order methods for approximating the velocity.
Definition staggeredupwindmethods.hh:53
Base class for the stencil local flux variables cache for the staggered model.