Commit 951d6ab5 authored by Martin Schneider's avatar Martin Schneider
Browse files

[md][stokesdarcy][box] Introduce volVars wrapper class which mimic elemVolVars

parent 2d684fe1
......@@ -152,6 +152,7 @@ private:
template<std::size_t id> using GridView = typename GridGeometry<id>::GridView;
template<std::size_t id> using Element = typename GridView<id>::template Codim<0>::Entity;
template<std::size_t id> using PrimaryVariables = typename MDTraits::template SubDomain<id>::PrimaryVariables;
template<std::size_t id> using SubControlVolume = typename FVElementGeometry<id>::SubControlVolume;
template<std::size_t id> using SubControlVolumeFace = typename FVElementGeometry<id>::SubControlVolumeFace;
using CellCenterSolutionVector = GetPropType<StokesTypeTag, Properties::CellCenterSolutionVector>;
......@@ -704,9 +705,16 @@ public:
}
}
const auto sol() const
//! Return the volume variables of domain i for a given element and scv
template<std::size_t i>
VolumeVariables<i> volVars(Dune::index_constant<i> domainI,
const Element<i>& element,
const SubControlVolume<i>& scv) const
{
return this->curSol();
VolumeVariables<i> volVars;
const auto elemSol = elementSolution(element, this->curSol()[domainI], this->problem(domainI).gridGeometry());
volVars.update(elemSol, this->problem(domainI), element, scv);
return volVars;
}
const auto& couplingMapper() const
......
......@@ -55,6 +55,27 @@ namespace Detail {
}
}
template<class CouplingManager, class Element, std::size_t id>
struct VolVarsWrapper
{
using Index = Dune::index_constant<id>;
VolVarsWrapper(const CouplingManager& cm, const Element& element)
: cm_(cm), element_(element), domainI_()
{}
template<class SubControlVolume>
auto operator[](const SubControlVolume& scv) const
{
return cm_.volVars(domainI_, element_, scv);
}
private:
const CouplingManager& cm_;
const Element& element_;
Index domainI_;
};
template<class MDTraits, class CouplingManager>
class Projection
{
......@@ -88,7 +109,6 @@ public:
Scalar projection = 0.0;
auto domainI = Dune::index_constant<freeFlowIdx>();
auto fvGeometry = localView(couplingManager.problem(porousMediumIdx).gridGeometry());
auto elemVolVars = localView(darcyElemVolVars.gridVolVars());
// integrate darcy pressure over each coupling facet and average
for(const auto& couplingFacet : couplingFacets(domainI, couplingManager.couplingMapper(), stokesScvf.insideScvIdx(), stokesScvf.localFaceIdx()))
......@@ -105,7 +125,7 @@ public:
}
else
{
elemVolVars.bind(element, fvGeometry, couplingManager.sol()[porousMediumIdx]);
VolVarsWrapper<CouplingManager, Element<porousMediumIdx>, porousMediumIdx> elemVolVars(couplingManager, element);
projection += calculateFacetIntegral(element, fvGeometry, fvGeometry.scvf(couplingFacet.pmScvfIdx), elemVolVars, couplingFacet.geometry, evalPriVar);
}
......@@ -143,11 +163,11 @@ public:
return projection;
}
template<class CouplingFacetGeometry, class Function>
template<class CouplingFacetGeometry, class ElementVolumeVariables, class Function>
static Scalar calculateFacetIntegral(const Element<porousMediumIdx>& element,
const FVElementGeometry<porousMediumIdx>& fvGeometry,
const SubControlVolumeFace<porousMediumIdx>& scvf,
const ElementVolumeVariables<porousMediumIdx>& elemVolVars,
const ElementVolumeVariables& elemVolVars,
const CouplingFacetGeometry& facetGeometry,
Function evalPriVar)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment