13#ifndef DUMUX_MIXEDDIMENSION_FACET_CC_UPWINDSCHEME_HH
14#define DUMUX_MIXEDDIMENSION_FACET_CC_UPWINDSCHEME_HH
28template<
class Gr
idGeometry>
31 using GridView =
typename GridGeometry::GridView;
32 static constexpr int dim = GridView::dimension;
33 static constexpr int dimWorld = GridView::dimensionworld;
37 template<
class FluxVariables,
class UpwindTermFunction,
class Scalar,
int d = dim,
int dw = dimWorld>
38 static typename std::enable_if<(d < dw), Scalar>::type
39 apply(
const FluxVariables& fluxVars,
40 const UpwindTermFunction& upwindTerm,
41 Scalar flux,
int phaseIdx)
43 static const Scalar upwindWeight = getParam<Scalar>(
"Flux.UpwindWeight");
46 const auto& scvf = fluxVars.scvFace();
47 const auto& elemVolVars = fluxVars.elemVolVars();
48 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
51 const auto& cm = fluxVars.problem().couplingManager();
52 if (cm.isOnInteriorBoundary(fluxVars.element(), scvf))
54 const auto& outsideVolVars = cm.getLowDimVolVars(fluxVars.element(), scvf);
55 if (std::signbit(flux))
56 return flux*(upwindWeight*upwindTerm(outsideVolVars)
57 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
59 return flux*(upwindWeight*upwindTerm(insideVolVars)
60 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
65 if (scvf.numOutsideScvs() > 1)
69 Scalar branchingPointUpwindTerm = 0.0;
70 Scalar sumUpwindFluxes = 0.0;
73 if (!std::signbit(flux))
74 return upwindTerm(insideVolVars)*flux;
76 sumUpwindFluxes += flux;
78 for (
unsigned int i = 0; i < scvf.numOutsideScvs(); ++i)
81 const auto& fvGeometry = fluxVars.fvGeometry();
82 const auto outsideScvIdx = scvf.outsideScvIdx(i);
83 const auto outsideElement = fvGeometry.gridGeometry().element(outsideScvIdx);
84 const auto& flippedScvf = fvGeometry.flipScvf(scvf.index(), i);
86 using AdvectionType =
typename FluxVariables::AdvectionType;
87 const auto outsideFlux = AdvectionType::flux(fluxVars.problem(),
93 fluxVars.elemFluxVarsCache());
95 if (!std::signbit(outsideFlux))
96 branchingPointUpwindTerm += upwindTerm(elemVolVars[outsideScvIdx])*outsideFlux;
98 sumUpwindFluxes += outsideFlux;
102 if (sumUpwindFluxes != 0.0)
103 branchingPointUpwindTerm /= -sumUpwindFluxes;
105 branchingPointUpwindTerm = 0.0;
110 if (std::signbit(flux))
111 return flux*branchingPointUpwindTerm;
113 return flux*upwindTerm(insideVolVars);
118 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
119 if (std::signbit(flux))
120 return flux*(upwindWeight*upwindTerm(outsideVolVars)
121 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
123 return flux*(upwindWeight*upwindTerm(insideVolVars)
124 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
130 template<
class FluxVariables,
class UpwindTermFunction,
class Scalar,
int d = dim,
int dw = dimWorld>
131 static typename std::enable_if<(d == dw), Scalar>::type
132 apply(
const FluxVariables& fluxVars,
133 const UpwindTermFunction& upwindTerm,
134 Scalar flux,
int phaseIdx)
136 static const Scalar upwindWeight = getParam<Scalar>(
"Flux.UpwindWeight");
138 const auto& scvf = fluxVars.scvFace();
139 const auto& elemVolVars = fluxVars.elemVolVars();
140 const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
143 const auto& cm = fluxVars.problem().couplingManager();
144 if (cm.isOnInteriorBoundary(fluxVars.element(), scvf))
147 const auto& outsideVolVars = cm.getLowDimVolVars(fluxVars.element(), scvf);
148 if (std::signbit(flux))
149 return flux*(upwindWeight*upwindTerm(outsideVolVars)
150 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
152 return flux*(upwindWeight*upwindTerm(insideVolVars)
153 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
157 const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
159 if (std::signbit(flux))
160 return flux*(upwindWeight*upwindTerm(outsideVolVars)
161 + (1.0 - upwindWeight)*upwindTerm(insideVolVars));
163 return flux*(upwindWeight*upwindTerm(insideVolVars)
164 + (1.0 - upwindWeight)*upwindTerm(outsideVolVars));
The upwind scheme used for the advective fluxes. This is a modified scheme for models involving coupl...
Definition: multidomain/facet/cellcentered/upwindscheme.hh:30
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:39
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:132
Defines all properties used in Dumux.
The available discretization methods in Dumux.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.