12#ifndef DUMUX_DISCRETIZATION_STAGGERED_GRID_FLUXVARSCACHE_HH
13#define DUMUX_DISCRETIZATION_STAGGERED_GRID_FLUXVARSCACHE_HH
29template<
class P,
class FVC,
class FVCF,
int upwOrder>
36 template<
class Gr
idFluxVariablesCache,
bool cachingEnabled>
45template<
class Problem,
46 class FluxVariablesCache,
47 class FluxVariablesCacheFiller,
48 bool EnableGridFluxVariablesCache =
false,
49 int upwindSchemeOrder = 1,
58template<
class P,
class FVC,
class FVCF,
int upwindSchemeOrder,
class TheTraits>
61 using Problem =
typename TheTraits::Problem;
65 using FluxVariablesCacheFiller =
typename TheTraits::FluxVariablesCacheFiller;
72 using Scalar =
typename FluxVariablesCache::Scalar;
74 static constexpr bool useHigherOrder = upwindSchemeOrder > 1;
80 static constexpr bool cachingEnabled =
true;
86 : problemPtr_(&problem)
87 , staggeredUpwindMethods_(problem.paramGroup())
91 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
92 void update(
const GridGeometry& gridGeometry,
93 const GridVolumeVariables& gridVolVars,
94 const SolutionVector& sol,
95 bool forceUpdate =
false)
98 if (FluxVariablesCacheFiller::isSolDependent || forceUpdate)
102 FluxVariablesCacheFiller filler(problem());
104 fluxVarsCache_.resize(gridGeometry.numScvf());
105 auto fvGeometry =
localView(gridGeometry);
106 auto elemVolVars =
localView(gridVolVars);
107 for (
const auto& element : elements(gridGeometry.gridView()))
110 fvGeometry.bind(element);
111 elemVolVars.bind(element, fvGeometry, sol);
113 for (
auto&& scvf : scvfs(fvGeometry))
115 filler.fill(*
this, fluxVarsCache_[scvf.index()], element, fvGeometry, elemVolVars, scvf, forceUpdate);
124 return staggeredUpwindMethods_;
128 {
return *problemPtr_; }
132 {
return fluxVarsCache_[scvfIdx]; }
135 {
return fluxVarsCache_[scvfIdx]; }
138 const Problem* problemPtr_;
141 std::vector<FluxVariablesCache> fluxVarsCache_;
142 std::vector<std::size_t> globalScvfIndices_;
150template<
class P,
class FVC,
class FVCF,
int upwindSchemeOrder,
class TheTraits>
153 using Problem =
typename TheTraits::Problem;
157 using FluxVariablesCacheFiller =
typename TheTraits::FluxVariablesCacheFiller;
166 using Scalar =
typename FluxVariablesCache::Scalar;
169 static constexpr bool cachingEnabled =
false;
178 : problemPtr_(&problem)
179 , staggeredUpwindMethods_(problem.paramGroup())
183 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
184 void update(
const GridGeometry& gridGeometry,
185 const GridVolumeVariables& gridVolVars,
186 const SolutionVector& sol,
187 bool forceUpdate =
false) {}
190 {
return *problemPtr_; }
195 return staggeredUpwindMethods_;
199 const Problem* problemPtr_;
Base class for the stencil local flux variables cache for the staggered model.
Definition: discretization/staggered/elementfluxvariablescache.hh:30
Flux variables cache class for staggered models. Specialization in case of not storing the flux cache...
Definition: discretization/staggered/gridfluxvariablescache.hh:152
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: discretization/staggered/gridfluxvariablescache.hh:163
StaggeredGridFluxVariablesCache(const Problem &problem)
Definition: discretization/staggered/gridfluxvariablescache.hh:177
TheTraits Traits
the flux var cache traits
Definition: discretization/staggered/gridfluxvariablescache.hh:160
const Problem & problem() const
Definition: discretization/staggered/gridfluxvariablescache.hh:189
typename FluxVariablesCache::Scalar Scalar
the scalar type
Definition: discretization/staggered/gridfluxvariablescache.hh:166
const UpwindScheme & staggeredUpwindMethods() const
Return the UpwindingMethods.
Definition: discretization/staggered/gridfluxvariablescache.hh:193
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: discretization/staggered/gridfluxvariablescache.hh:172
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: discretization/staggered/gridfluxvariablescache.hh:184
Flux variables cache class for staggered models. Specialization in case of storing the flux cache.
Definition: discretization/staggered/gridfluxvariablescache.hh:60
typename FluxVariablesCache::Scalar Scalar
Definition: discretization/staggered/gridfluxvariablescache.hh:72
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition: discretization/staggered/gridfluxvariablescache.hh:92
TheTraits Traits
the flux var cache traits
Definition: discretization/staggered/gridfluxvariablescache.hh:68
StaggeredGridFluxVariablesCache(const Problem &problem)
Definition: discretization/staggered/gridfluxvariablescache.hh:85
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition: discretization/staggered/gridfluxvariablescache.hh:83
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition: discretization/staggered/gridfluxvariablescache.hh:71
const UpwindScheme & staggeredUpwindMethods() const
Return the StaggeredUpwindMethods.
Definition: discretization/staggered/gridfluxvariablescache.hh:122
const Problem & problem() const
Definition: discretization/staggered/gridfluxvariablescache.hh:127
Flux variables cache class for staggered models.
Definition: discretization/staggered/gridfluxvariablescache.hh:51
This file contains different higher order methods for approximating the velocity.
Definition: staggeredupwindmethods.hh:50
Forward declaration of the upwind scheme implementation.
Definition: flux/upwindscheme.hh:22
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:26
Free function to get the local view of a grid cache object.
This file contains different higher order methods for approximating the velocity.
Traits class to be used for the StaggeredGridVFluxVariablesCache.
Definition: discretization/staggered/gridfluxvariablescache.hh:31
static constexpr int upwindSchemeOrder
Definition: discretization/staggered/gridfluxvariablescache.hh:38
P Problem
Definition: discretization/staggered/gridfluxvariablescache.hh:32
FVCF FluxVariablesCacheFiller
Definition: discretization/staggered/gridfluxvariablescache.hh:34
FVC FluxVariablesCache
Definition: discretization/staggered/gridfluxvariablescache.hh:33