diff --git a/dumux/discretization/staggered/freeflow/facevariables.hh b/dumux/discretization/staggered/freeflow/facevariables.hh index 89cdfa2e6fc00462b263d0d9cdba5d417c13a449..6eebd6e3c2441838a40ed4aa0b718bed0784d50c 100644 --- a/dumux/discretization/staggered/freeflow/facevariables.hh +++ b/dumux/discretization/staggered/freeflow/facevariables.hh @@ -26,6 +26,7 @@ #include <array> #include <vector> +#include <type_traits> namespace Dumux { @@ -88,14 +89,17 @@ public: * \param fvGeometry The finite-volume geometry * \param scvf The sub-control volume face of interest */ - template<class SolVector, class Problem, class Element, + template<class FaceSolution, class Problem, class Element, class FVElementGeometry, class SubControlVolumeFace> - void update(const SolVector& faceSol, + void update(const FaceSolution& faceSol, const Problem& problem, const Element& element, const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) { + static_assert(std::decay_t<decltype(faceSol[0])>::dimension == 1, + "\n\n\nVelocity primary variable must be a scalar value. \n\n Make sure to use\n\n ffSol = partial(sol, ffFaceIdx, ffCellCenterIdx);\n\n"); + inAxisVelocities_.self = faceSol[scvf.dofIndex()]; inAxisVelocities_.opposite = faceSol[scvf.dofIndexOpposingFace()]; diff --git a/dumux/discretization/staggered/gridfacevariables.hh b/dumux/discretization/staggered/gridfacevariables.hh index f6c5eb63155dd862f2bdd9ff8e8390011917f4b8..ccc8859b48176b79a1e84de90a0547fec5257763 100644 --- a/dumux/discretization/staggered/gridfacevariables.hh +++ b/dumux/discretization/staggered/gridfacevariables.hh @@ -27,6 +27,7 @@ //! make the local view function available whenever we use this class #include <dumux/discretization/localview.hh> #include <dumux/discretization/staggered/elementfacevariables.hh> +#include <dumux/discretization/staggered/facesolution.hh> namespace Dumux { @@ -82,18 +83,18 @@ public: //! Update all face variables template<class GridGeometry, class SolutionVector> - void update(const GridGeometry& gridGeometry, const SolutionVector& faceSol) + void update(const GridGeometry& gridGeometry, const SolutionVector& sol) { - faceVariables_.resize(gridGeometry.numScvf()); - for(auto&& element : elements(gridGeometry.gridView())) + for (auto&& element : elements(gridGeometry.gridView())) { auto fvGeometry = localView(gridGeometry); fvGeometry.bindElement(element); - for(auto&& scvf : scvfs(fvGeometry)) + for (auto&& scvf : scvfs(fvGeometry)) { + const auto faceSol = StaggeredFaceSolution(scvf, sol, gridGeometry); faceVariables_[scvf.index()].update(faceSol, problem(), element, fvGeometry, scvf); } }