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;
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 auto fvGeometry =
localView(gridGeometry);
118 auto elemVolVars =
localView(gridVolVars);
119 for (
const auto& element : elements(gridGeometry.gridView()))
122 fvGeometry.bind(element);
123 elemVolVars.bind(element, fvGeometry, sol);
125 for (
auto&& scvf : scvfs(fvGeometry))
127 filler.fill(*
this, fluxVarsCache_[scvf.index()], element, fvGeometry, elemVolVars, scvf, forceUpdate);
136 return staggeredUpwindMethods_;
140 {
return *problemPtr_; }
144 {
return fluxVarsCache_[scvfIdx]; }
147 {
return fluxVarsCache_[scvfIdx]; }
150 const Problem* problemPtr_;
153 std::vector<FluxVariablesCache> fluxVarsCache_;
154 std::vector<std::size_t> globalScvfIndices_;
162template<
class P,
class FVC,
class FVCF,
int upwindSchemeOrder,
class TheTraits>
165 using Problem =
typename TheTraits::Problem;
169 using FluxVariablesCacheFiller =
typename TheTraits::FluxVariablesCacheFiller;
178 using Scalar =
typename FluxVariablesCache::Scalar;
191 , staggeredUpwindMethods_(
problem.paramGroup())
195 template<
class Gr
idGeometry,
class Gr
idVolumeVariables,
class SolutionVector>
196 void update(
const GridGeometry& gridGeometry,
197 const GridVolumeVariables& gridVolVars,
198 const SolutionVector& sol,
199 bool forceUpdate =
false) {}
202 {
return *problemPtr_; }
207 return staggeredUpwindMethods_;
211 const Problem* problemPtr_;
This file contains different higher order methods for approximating the velocity.
Free function to get the local view of a grid cache object.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition localview.hh:38
UpwindSchemeImpl< GridGeometry, typename GridGeometry::DiscretizationMethod > UpwindScheme
The upwind scheme used for the advective fluxes. This depends on the chosen discretization method.
Definition flux/upwindscheme.hh:42
Base class for the stencil local flux variables cache for the staggered model.
Definition discretization/staggered/elementfluxvariablescache.hh:42
Traits class to be used for the StaggeredGridVFluxVariablesCache.
Definition discretization/staggered/gridfluxvariablescache.hh:43
StaggeredElementFluxVariablesCache< GridFluxVariablesCache, cachingEnabled > LocalView
Definition discretization/staggered/gridfluxvariablescache.hh:49
static constexpr int upwindSchemeOrder
Definition discretization/staggered/gridfluxvariablescache.hh:50
P Problem
Definition discretization/staggered/gridfluxvariablescache.hh:44
FVCF FluxVariablesCacheFiller
Definition discretization/staggered/gridfluxvariablescache.hh:46
FVC FluxVariablesCache
Definition discretization/staggered/gridfluxvariablescache.hh:45
Flux variables cache class for staggered models.
Definition discretization/staggered/gridfluxvariablescache.hh:63
typename FluxVariablesCache::Scalar Scalar
Definition discretization/staggered/gridfluxvariablescache.hh:84
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition discretization/staggered/gridfluxvariablescache.hh:104
TheTraits Traits
the flux var cache traits
Definition discretization/staggered/gridfluxvariablescache.hh:80
StaggeredGridFluxVariablesCache(const Problem &problem)
Definition discretization/staggered/gridfluxvariablescache.hh:97
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition discretization/staggered/gridfluxvariablescache.hh:95
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition discretization/staggered/gridfluxvariablescache.hh:83
static constexpr bool cachingEnabled
make it possible to query if caching is enabled
Definition discretization/staggered/gridfluxvariablescache.hh:92
static constexpr bool useHigherOrder
Definition discretization/staggered/gridfluxvariablescache.hh:86
const UpwindScheme & staggeredUpwindMethods() const
Return the StaggeredUpwindMethods.
Definition discretization/staggered/gridfluxvariablescache.hh:134
const Problem & problem() const
Definition discretization/staggered/gridfluxvariablescache.hh:139
StaggeredUpwindMethods< Scalar, upwindSchemeOrder > UpwindScheme
export upwind scheme
Definition discretization/staggered/gridfluxvariablescache.hh:89
static constexpr bool cachingEnabled
make it possible to query if caching is enabled
Definition discretization/staggered/gridfluxvariablescache.hh:181
typename Traits::FluxVariablesCache FluxVariablesCache
export the flux variable cache type
Definition discretization/staggered/gridfluxvariablescache.hh:175
StaggeredGridFluxVariablesCache(const Problem &problem)
Definition discretization/staggered/gridfluxvariablescache.hh:189
TheTraits Traits
the flux var cache traits
Definition discretization/staggered/gridfluxvariablescache.hh:172
StaggeredUpwindMethods< Scalar, upwindSchemeOrder > UpwindScheme
export upwind scheme
Definition discretization/staggered/gridfluxvariablescache.hh:187
const Problem & problem() const
Definition discretization/staggered/gridfluxvariablescache.hh:201
typename FluxVariablesCache::Scalar Scalar
the scalar type
Definition discretization/staggered/gridfluxvariablescache.hh:178
const UpwindScheme & staggeredUpwindMethods() const
Return the UpwindingMethods.
Definition discretization/staggered/gridfluxvariablescache.hh:205
typename Traits::template LocalView< ThisType, cachingEnabled > LocalView
export the type of the local view
Definition discretization/staggered/gridfluxvariablescache.hh:184
void update(const GridGeometry &gridGeometry, const GridVolumeVariables &gridVolVars, const SolutionVector &sol, bool forceUpdate=false)
Definition discretization/staggered/gridfluxvariablescache.hh:196
This file contains different higher order methods for approximating the velocity.
Definition staggeredupwindmethods.hh:62
Base class for the stencil local flux variables cache for the staggered model.