25#ifndef DUMUX_MIXEDDIMENSION_FACET_CC_UPWINDSCHEME_HH
26#define DUMUX_MIXEDDIMENSION_FACET_CC_UPWINDSCHEME_HH
40template<
class Gr
idGeometry>
43 using GridView =
typename GridGeometry::GridView;
44 static constexpr int dim = GridView::dimension;
45 static constexpr int dimWorld = GridView::dimensionworld;
49 template<
class FluxVariables,
class UpwindTermFunction,
class Scalar,
int d = dim,
int dw = dimWorld>
50 static typename std::enable_if<(d < dw), Scalar>::type
51 apply(
const FluxVariables& fluxVars,
52 const UpwindTermFunction& upwindTerm,
53 Scalar flux,
int phaseIdx)
55 static const Scalar upwindWeight = getParam<Scalar>(
"Flux.UpwindWeight");
58 const auto& scvf = fluxVars.scvFace();
59 const auto& elemVolVars = fluxVars.elemVolVars();
60 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
63 const auto& cm = fluxVars.problem().couplingManager();
64 if (cm.isOnInteriorBoundary(fluxVars.element(), scvf))
66 const auto& outsideVolVars = cm.getLowDimVolVars(fluxVars.element(), scvf);
67 if (std::signbit(flux))
68 return flux*(upwindWeight*upwindTerm(outsideVolVars)
69 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
71 return flux*(upwindWeight*upwindTerm(insideVolVars)
72 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
77 if (scvf.numOutsideScvs() > 1)
81 Scalar branchingPointUpwindTerm = 0.0;
82 Scalar sumUpwindFluxes = 0.0;
85 if (!std::signbit(flux))
86 return upwindTerm(insideVolVars)*flux;
88 sumUpwindFluxes += flux;
90 for (
unsigned int i = 0; i < scvf.numOutsideScvs(); ++i)
93 const auto& fvGeometry = fluxVars.fvGeometry();
94 const auto outsideScvIdx = scvf.outsideScvIdx(i);
95 const auto outsideElement = fvGeometry.gridGeometry().element(outsideScvIdx);
96 const auto& flippedScvf = fvGeometry.flipScvf(scvf.index(), i);
98 using AdvectionType =
typename FluxVariables::AdvectionType;
99 const auto outsideFlux = AdvectionType::flux(fluxVars.problem(),
105 fluxVars.elemFluxVarsCache());
107 if (!std::signbit(outsideFlux))
108 branchingPointUpwindTerm += upwindTerm(elemVolVars[outsideScvIdx])*outsideFlux;
110 sumUpwindFluxes += outsideFlux;
114 if (sumUpwindFluxes != 0.0)
115 branchingPointUpwindTerm /= -sumUpwindFluxes;
117 branchingPointUpwindTerm = 0.0;
122 if (std::signbit(flux))
123 return flux*branchingPointUpwindTerm;
125 return flux*upwindTerm(insideVolVars);
130 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
131 if (std::signbit(flux))
132 return flux*(upwindWeight*upwindTerm(outsideVolVars)
133 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
135 return flux*(upwindWeight*upwindTerm(insideVolVars)
136 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
142 template<
class FluxVariables,
class UpwindTermFunction,
class Scalar,
int d = dim,
int dw = dimWorld>
143 static typename std::enable_if<(d == dw), Scalar>::type
144 apply(
const FluxVariables& fluxVars,
145 const UpwindTermFunction& upwindTerm,
146 Scalar flux,
int phaseIdx)
148 static const Scalar upwindWeight = getParam<Scalar>(
"Flux.UpwindWeight");
150 const auto& scvf = fluxVars.scvFace();
151 const auto& elemVolVars = fluxVars.elemVolVars();
152 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
155 const auto& cm = fluxVars.problem().couplingManager();
156 if (cm.isOnInteriorBoundary(fluxVars.element(), scvf))
159 const auto& outsideVolVars = cm.getLowDimVolVars(fluxVars.element(), scvf);
160 if (std::signbit(flux))
161 return flux*(upwindWeight*upwindTerm(outsideVolVars)
162 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
164 return flux*(upwindWeight*upwindTerm(insideVolVars)
165 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
169 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
171 if (std::signbit(flux))
172 return flux*(upwindWeight*upwindTerm(outsideVolVars)
173 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
175 return flux*(upwindWeight*upwindTerm(insideVolVars)
176 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
The available discretization methods in Dumux.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
The upwind scheme used for the advective fluxes. This is a modified scheme for models involving coupl...
Definition: multidomain/facet/cellcentered/upwindscheme.hh:42
static std::enable_if<(d< dw), Scalar >::type apply(const FluxVariables &fluxVars, const UpwindTermFunction &upwindTerm, Scalar flux, int phaseIdx)
Definition: multidomain/facet/cellcentered/upwindscheme.hh:51
static std::enable_if<(d==dw), Scalar >::type apply(const FluxVariables &fluxVars, const UpwindTermFunction &upwindTerm, Scalar flux, int phaseIdx)
Definition: multidomain/facet/cellcentered/upwindscheme.hh:144
Declares all properties used in Dumux.