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;
86 static constexpr bool useHigherOrder = upwindSchemeOrder > 1;
92 static constexpr bool cachingEnabled =
true;
98 : problemPtr_(&problem)
99 , staggeredUpwindMethods_(problem.paramGroup())
103 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
104 void update(
const GridGeometry& gridGeometry,
105 const GridVolumeVariables& gridVolVars,
106 const SolutionVector& sol,
107 bool forceUpdate =
false)
110 if (FluxVariablesCacheFiller::isSolDependent || forceUpdate)
114 FluxVariablesCacheFiller filler(problem());
116 fluxVarsCache_.resize(gridGeometry.numScvf());
117 for (
const auto& element : elements(gridGeometry.gridView()))
120 auto fvGeometry =
localView(gridGeometry);
121 fvGeometry.bind(element);
123 auto elemVolVars =
localView(gridVolVars);
124 elemVolVars.bind(element, fvGeometry, sol);
126 for (
auto&& scvf : scvfs(fvGeometry))
128 filler.fill(*
this, fluxVarsCache_[scvf.index()], element, fvGeometry, elemVolVars, scvf, forceUpdate);
137 return staggeredUpwindMethods_;
141 {
return *problemPtr_; }
145 {
return fluxVarsCache_[scvfIdx]; }
148 {
return fluxVarsCache_[scvfIdx]; }
151 const Problem* problemPtr_;
154 std::vector<FluxVariablesCache> fluxVarsCache_;
155 std::vector<std::size_t> globalScvfIndices_;
163template<
class P,
class FVC,
class FVCF,
int upwindSchemeOrder,
class TheTraits>
166 using Problem =
typename TheTraits::Problem;
170 using FluxVariablesCacheFiller =
typename TheTraits::FluxVariablesCacheFiller;
179 using Scalar =
typename FluxVariablesCache::Scalar;
182 static constexpr bool cachingEnabled =
false;
191 : problemPtr_(&problem)
192 , staggeredUpwindMethods_(problem.paramGroup())
196 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
197 void update(
const GridGeometry& gridGeometry,
198 const GridVolumeVariables& gridVolVars,
199 const SolutionVector& sol,
200 bool forceUpdate =
false) {}
203 {
return *problemPtr_; }
208 return staggeredUpwindMethods_;
212 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
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
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
Flux variables cache class for staggered models. Specialization in case of storing the flux cache.
Definition: staggered/gridfluxvariablescache.hh:72
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:104
TheTraits Traits
the flux var cache traits
Definition: staggered/gridfluxvariablescache.hh:80
StaggeredGridFluxVariablesCache(const Problem &problem)
Definition: staggered/gridfluxvariablescache.hh:97
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: staggered/gridfluxvariablescache.hh:95
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: staggered/gridfluxvariablescache.hh:83
const UpwindScheme & staggeredUpwindMethods() const
Return the StaggeredUpwindMethods.
Definition: staggered/gridfluxvariablescache.hh:135
const Problem & problem() const
Definition: staggered/gridfluxvariablescache.hh:140
Flux variables cache class for staggered models. Specialization in case of not storing the flux cache...
Definition: staggered/gridfluxvariablescache.hh:165
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: staggered/gridfluxvariablescache.hh:176
StaggeredGridFluxVariablesCache(const Problem &problem)
Definition: staggered/gridfluxvariablescache.hh:190
TheTraits Traits
the flux var cache traits
Definition: staggered/gridfluxvariablescache.hh:173
const Problem & problem() const
Definition: staggered/gridfluxvariablescache.hh:202
typename FluxVariablesCache::Scalar Scalar
the scalar type
Definition: staggered/gridfluxvariablescache.hh:179
const UpwindScheme & staggeredUpwindMethods() const
Return the UpwindingMethods.
Definition: staggered/gridfluxvariablescache.hh:206
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: staggered/gridfluxvariablescache.hh:185
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: staggered/gridfluxvariablescache.hh:197
Forward declaration of the upwind scheme implementation.
Definition: flux/upwindscheme.hh:34
This file contains different higher order methods for approximating the velocity.
Definition: staggeredupwindmethods.hh:62