Commit d5c1b275 authored by Timo Koch's avatar Timo Koch
Browse files

[disc] Remove flux stencil from base fluxvars. Use directly.

parent 8eccfda9
......@@ -26,6 +26,9 @@
#define DUMUX_CC_CONNECTIVITY_MAP_HH
#include <vector>
#include <utility>
#include <dumux/common/properties.hh>
#include <dumux/discretization/fluxstencil.hh>
namespace Dumux
{
......@@ -44,9 +47,9 @@ template<class TypeTag>
class CCSimpleConnectivityMap
{
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using IndexType = typename GridView::IndexSet::IndexType;
using FluxStencil = Dumux::FluxStencil<TypeTag>;
struct DataJ
{
......@@ -84,7 +87,7 @@ public:
// loop over sub control faces
for (auto&& scvf : scvfs(fvGeometry))
{
const auto& stencil = FluxVariables::computeStencil(element, fvGeometry, scvf);
const auto& stencil = FluxStencil::stencil(element, fvGeometry, scvf);
// insert our index in the neighbor stencils of the elements in the flux stencil
for (auto globalI : stencil)
......
......@@ -24,6 +24,7 @@
#ifndef DUMUX_CC_MPFA_CONNECTIVITY_MAP_HH
#define DUMUX_CC_MPFA_CONNECTIVITY_MAP_HH
#include <dumux/common/properties.hh>
#include <dumux/discretization/cellcentered/mpfa/methods.hh>
#include <dumux/discretization/cellcentered/connectivitymap.hh>
#include <dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh>
......
......@@ -24,6 +24,11 @@
#ifndef DUMUX_CC_MPFA_GENERAL_CONNECTIVITY_MAP_HH
#define DUMUX_CC_MPFA_GENERAL_CONNECTIVITY_MAP_HH
#include <vector>
#include <utility>
#include <dumux/common/properties.hh>
#include <dumux/discretization/fluxstencil.hh>
namespace Dumux
{
......@@ -40,9 +45,9 @@ class CCMpfaGeneralConnectivityMap
{
using MpfaHelper = typename GET_PROP_TYPE(TypeTag, MpfaHelper);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using IndexType = typename GridView::IndexSet::IndexType;
using FluxStencil = Dumux::FluxStencil<TypeTag>;
// To each cell "globalI" there will be a list of "globalJ", in which globalI is part
// of the stencil. We save the scvfs over which fluxes depend on globalI and a list of
......@@ -80,8 +85,7 @@ public:
// loop over sub control faces
for (auto&& scvf : scvfs(fvGeometry))
{
FluxVariables fluxVars;
const auto& stencil = fluxVars.computeStencil(element, fvGeometry, scvf);
const auto& stencil = FluxStencil::stencil(element, fvGeometry, scvf);
// insert our index in the neighbor stencils of the elements in the flux stencil
for (auto globalI : stencil)
......@@ -192,6 +196,6 @@ public:
private:
Map map_;
};
}
} // end namespace Dumux
#endif
......@@ -45,33 +45,10 @@ class FluxStencilImplementation;
template<class TypeTag>
using FluxStencil = FluxStencilImplementation<TypeTag, GET_PROP_VALUE(TypeTag, DiscretizationMethod)>;
//! Flux stencil for the box method
template<class TypeTag>
class FluxStencilImplementation<TypeTag, DiscretizationMethods::Box>
{
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using Element = typename GridView::template Codim<0>::Entity;
using IndexType = typename GridView::IndexSet::IndexType;
using Stencil = std::vector<IndexType>;
public:
// This is for compatibility with the cc methods. The flux stencil info is obsolete for the box method.
static Stencil stencil(const Element& element,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
return Stencil();
}
};
//! Flux stencil for the cell-centered TPFA scheme
template<class TypeTag>
class FluxStencilImplementation<TypeTag, DiscretizationMethods::CCTpfa>
{
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
......@@ -102,7 +79,6 @@ public:
template<class TypeTag>
class FluxStencilImplementation<TypeTag, DiscretizationMethods::CCMpfa>
{
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
......
......@@ -23,14 +23,12 @@
#ifndef DUMUX_DISCRETIZATION_FLUXVARIABLESBASE_HH
#define DUMUX_DISCRETIZATION_FLUXVARIABLESBASE_HH
#include <dumux/discretization/methods.hh>
#include <dumux/discretization/fluxstencil.hh>
#include <dumux/discretization/upwindscheme.hh>
namespace Dumux
{
template<class TypeTag, class UpwindScheme, class FluxStencil>
template<class TypeTag, class UpwindScheme>
class FluxVariablesBaseImplementation;
/*!
......@@ -39,7 +37,7 @@ class FluxVariablesBaseImplementation;
* The upwind scheme is chosen depending on the discretization method
*/
template<class TypeTag>
using FluxVariablesBase = FluxVariablesBaseImplementation<TypeTag, UpwindScheme<TypeTag>, FluxStencil<TypeTag>>;
using FluxVariablesBase = FluxVariablesBaseImplementation<TypeTag, UpwindScheme<TypeTag>>;
/*!
* \ingroup Discretization
......@@ -48,7 +46,7 @@ using FluxVariablesBase = FluxVariablesBaseImplementation<TypeTag, UpwindScheme<
* \param TypeTag The type tag
* \param UpwindScheme The type used for the upwinding of the advective fluxes
*/
template<class TypeTag, class UpwindScheme, class FluxStencil>
template<class TypeTag, class UpwindScheme>
class FluxVariablesBaseImplementation
{
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
......@@ -105,14 +103,6 @@ public:
return UpwindScheme::apply(*this, upwindTerm, flux, phaseIdx);
}
static Stencil computeStencil(const Element& element,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
//! Forward to the discretization specific implementation
return FluxStencil::stencil(element, fvGeometry, scvf);
}
private:
const Problem* problemPtr_; //! Pointer to the problem
const Element* elementPtr_; //! Pointer to the element at hand
......
......@@ -34,26 +34,12 @@
#include <dumux/common/properties.hh>
#include <dumux/discretization/cellcentered/tpfa/properties.hh>
//! Dummy flux variables class so that we can update the connectivity map
class MockFluxVariables
{
public:
template<class Element, class FvGeometry, class Scvf>
static std::vector<std::size_t> computeStencil(const Element& element,
const FvGeometry& fvGeometry,
const Scvf& scvf)
{
return std::vector<std::size_t>();
}
};
namespace Dumux {
namespace Properties {
NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(CCTpfaModel));
SET_TYPE_PROP(TestFVGeometry, Grid, Dune::YaspGrid<2>);
SET_TYPE_PROP(TestFVGeometry, FluxVariables, MockFluxVariables);
}
}
namespace Properties {
NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(CCTpfaModel));
SET_TYPE_PROP(TestFVGeometry, Grid, Dune::YaspGrid<2>);
} // end namespace Properties
} // end namespace Dumux
template<class T>
class NoopFunctor {
......
......@@ -36,33 +36,18 @@
#include <dumux/common/properties.hh>
#include <dumux/discretization/cellcentered/tpfa/properties.hh>
//! Dummy flux variables class so that we can update the connectivity map
class MockFluxVariables
{
public:
template<class Element, class FvGeometry, class Scvf>
static std::vector<std::size_t> computeStencil(const Element& element,
const FvGeometry& fvGeometry,
const Scvf& scvf)
{
return std::vector<std::size_t>();
}
};
namespace Dumux {
namespace Properties{
//! Test without using global caching of the geometries
NEW_TYPE_TAG(TestFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel));
SET_TYPE_PROP(TestFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>);
SET_TYPE_PROP(TestFVGeometryNonConforming, FluxVariables, MockFluxVariables);
//! Test using global geometry caching
NEW_TYPE_TAG(TestCachedFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel));
SET_TYPE_PROP(TestCachedFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>);
SET_BOOL_PROP(TestCachedFVGeometryNonConforming, EnableFVGridGeometryCache, true);
SET_TYPE_PROP(TestCachedFVGeometryNonConforming, FluxVariables, MockFluxVariables);
}
}
namespace Properties{
//! Test without using global caching of the geometries
NEW_TYPE_TAG(TestFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel));
SET_TYPE_PROP(TestFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>);
//! Test using global geometry caching
NEW_TYPE_TAG(TestCachedFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel));
SET_TYPE_PROP(TestCachedFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>);
SET_BOOL_PROP(TestCachedFVGeometryNonConforming, EnableFVGridGeometryCache, true);
} // end namespace Properties
} // end namespace Dumux
//! epsilon for checking direction of scvf normals
constexpr double eps = 1e-6;
......
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