24#ifndef DUMUX_DISCRETIZATION_FACECENTERED_DIAMOND_ELEMENT_SOLUTION_HH
25#define DUMUX_DISCRETIZATION_FACECENTERED_DIAMOND_ELEMENT_SOLUTION_HH
30#include <dune/common/reservedvector.hh>
40template<
class FVElementGeometry,
class PV>
43 using GridGeometry =
typename FVElementGeometry::GridGeometry;
44 using GridView =
typename GridGeometry::GridView;
45 using Element =
typename GridView::template Codim<0>::Entity;
47 static constexpr int dim = GridView::dimension;
48 static constexpr int numCubeFaces = 2*dim;
57 template<
class SolutionVector>
59 const GridGeometry& gridGeometry)
61 update(element, sol, gridGeometry);
65 template<
class ElementVolumeVariables>
67 const FVElementGeometry& fvGeometry)
69 priVars_.resize(fvGeometry.numScv());
70 for (
const auto& scv : scvs(fvGeometry))
71 priVars_[scv.localDofIndex()] = elemVolVars[scv].priVars();
75 template<
class SolutionVector>
76 void update(
const Element& element,
const SolutionVector& sol,
77 const GridGeometry& gridGeometry)
79 const auto numFaces = element.subEntities(1);
80 priVars_.resize(numFaces);
81 for (
int fIdx = 0; fIdx < numFaces; ++fIdx)
82 priVars_[fIdx] = sol[gridGeometry.dofMapper().subIndex(element, fIdx, 1)];
86 template<
class SolutionVector>
87 void update(
const Element& element,
const SolutionVector& sol,
88 const FVElementGeometry& fvGeometry)
90 priVars_.resize(fvGeometry.numScv());
91 for (
const auto& scv : scvs(fvGeometry))
92 priVars_[scv.localDofIndex()] = sol[scv.dofIndex()];
96 template<
typename IndexType>
98 {
return priVars_[localScvIdx]; }
101 template<
typename IndexType>
103 {
return priVars_[localScvIdx]; }
107 {
return priVars_.size(); }
110 Dune::ReservedVector<PrimaryVariables, numCubeFaces> priVars_;
117template<
class Element,
class SolutionVector,
class Gr
idGeometry>
118auto elementSolution(
const Element& element,
const SolutionVector& sol,
const GridGeometry& gg)
120 FaceCenteredDiamondElementSolution<
typename GridGeometry::LocalView,
121 std::decay_t<decltype(std::declval<SolutionVector>()[0])>>
124 using PrimaryVariables = std::decay_t<decltype(std::declval<SolutionVector>()[0])>;
125 return FaceCenteredDiamondElementSolution<typename GridGeometry::LocalView, PrimaryVariables>(element, sol, gg);
132template<
class Element,
class ElementVolumeVariables,
class FVElementGeometry>
133auto elementSolution(
const Element& element,
const ElementVolumeVariables& elemVolVars,
const FVElementGeometry& gg)
135 FaceCenteredDiamondElementSolution<FVElementGeometry, typename ElementVolumeVariables::VolumeVariables::PrimaryVariables>>
137 using PrimaryVariables =
typename ElementVolumeVariables::VolumeVariables::PrimaryVariables;
138 return FaceCenteredDiamondElementSolution<FVElementGeometry, PrimaryVariables>(element, elemVolVars, gg);
Defines the index types used for grid and local indices.
The available discretization methods in Dumux.
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethods::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:118
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
constexpr FCDiamond fcdiamond
Definition: method.hh:141
The global face variables class for face-centered diamond models.
Definition: facecentered/diamond/elementsolution.hh:42
std::size_t size() const
return the size of the element solution
Definition: facecentered/diamond/elementsolution.hh:106
PV PrimaryVariables
export the primary variables type
Definition: facecentered/diamond/elementsolution.hh:52
FaceCenteredDiamondElementSolution(const Element &element, const ElementVolumeVariables &elemVolVars, const FVElementGeometry &fvGeometry)
Constructor with element, element volume variables and fv element geometry.
Definition: facecentered/diamond/elementsolution.hh:66
const PrimaryVariables & operator[](IndexType localScvIdx) const
bracket operator const access
Definition: facecentered/diamond/elementsolution.hh:97
void update(const Element &element, const SolutionVector &sol, const GridGeometry &gridGeometry)
extract the element solution from the solution vector using a mapper
Definition: facecentered/diamond/elementsolution.hh:76
FaceCenteredDiamondElementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gridGeometry)
Constructor with element, solution vector and grid geometry.
Definition: facecentered/diamond/elementsolution.hh:58
FaceCenteredDiamondElementSolution()=default
void update(const Element &element, const SolutionVector &sol, const FVElementGeometry &fvGeometry)
extract the element solution from the solution vector using a mapper
Definition: facecentered/diamond/elementsolution.hh:87