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

Merge branch 'feature/remove-stencils-from-staggered-fluxvars' into 'next'

Feature/remove stencils from staggered fluxvars

See merge request !700
parents 8f68697f f1197439
......@@ -22,8 +22,8 @@
* that contribute to the derivative calculation. This is used for
* finite-volume schemes with symmetric sparsity pattern in the global matrix.
*/
#ifndef DUMUX_STAGGERED_CONNECTIVITY_MAP_HH
#define DUMUX_STAGGERED_CONNECTIVITY_MAP_HH
#ifndef DUMUX_STAGGERED_FREEFLOW_CONNECTIVITY_MAP_HH
#define DUMUX_STAGGERED_FREEFLOW_CONNECTIVITY_MAP_HH
#include <vector>
#include <dumux/common/properties.hh>
......@@ -32,12 +32,14 @@ namespace Dumux
{
template<class TypeTag>
class StaggeredConnectivityMap
class StaggeredFreeFlowConnectivityMap
{
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
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 DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices);
......@@ -76,7 +78,6 @@ public:
std::vector<Stencil> fullfaceToFaceStencils;
fullfaceToFaceStencils.resize(numDofsFace);
FluxVariables fluxVars;
for(auto&& element: elements(fvGridGeometry.gridView()))
{
// restrict the FvGeometry locally and bind to the element
......@@ -87,12 +88,12 @@ public:
for (auto&& scvf : scvfs(fvGeometry))
{
const auto dofIdxCellCenter = fvGridGeometry.elementMapper().index(element);
fluxVars.computeCellCenterToCellCenterStencil(cellCenterToCellCenterMap_[dofIdxCellCenter], element, fvGeometry, scvf);
fluxVars.computeCellCenterToFaceStencil(cellCenterToFaceMap_[dofIdxCellCenter], element, fvGeometry, scvf);
computeCellCenterToCellCenterStencil_(cellCenterToCellCenterMap_[dofIdxCellCenter], element, fvGeometry, scvf);
computeCellCenterToFaceStencil_(cellCenterToFaceMap_[dofIdxCellCenter], element, fvGeometry, scvf);
const auto scvfIdx = scvf.index();
fluxVars.computeFaceToCellCenterStencil(faceToCellCenterMap_[scvfIdx], fvGeometry, scvf);
fluxVars.computeFaceToFaceStencil(faceToFaceMap_[scvfIdx], fvGeometry, scvf);
computeFaceToCellCenterStencil_(faceToCellCenterMap_[scvfIdx], fvGeometry, scvf);
computeFaceToFaceStencil_(faceToFaceMap_[scvfIdx], fvGeometry, scvf);
}
}
}
......@@ -119,6 +120,83 @@ public:
private:
/*
* \brief Computes the stencil for cell center dofs w.r.t to other cell center dofs.
* Basically, these are the dof indices of the neighboring elements plus the dof index of the element itself.
*/
void computeCellCenterToCellCenterStencil_(Stencil& stencil,
const Element& element,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
// the first entry is always the cc dofIdx itself
if(stencil.empty())
stencil.push_back(scvf.insideScvIdx());
if(!scvf.boundary())
stencil.push_back(scvf.outsideScvIdx());
}
/*
* \brief Computes the stencil for cell center dofs w.r.t to face dofs.
* Basically, these are the dof indices of the element's faces.
*/
void computeCellCenterToFaceStencil_(Stencil& stencil,
const Element& element,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
stencil.push_back(scvf.dofIndex());
}
/*
* \brief Computes the stencil for face dofs w.r.t to cell center dofs.
* Basically, these are the dof indices of the elements adjacent to the face and those of
* the elements adjacent to the faces parallel to the own face.
*/
void computeFaceToCellCenterStencil_(Stencil& stencil,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
const auto eIdx = scvf.insideScvIdx();
stencil.push_back(scvf.insideScvIdx());
for(const auto& data : scvf.pairData())
{
auto& normalFace = fvGeometry.scvf(eIdx, data.localNormalFaceIdx);
if(!normalFace.boundary())
{
const auto outerParallelElementDofIdx = normalFace.outsideScvIdx();
stencil.push_back(outerParallelElementDofIdx);
}
}
}
/*
* \brief Computes the stencil for face dofs w.r.t to face dofs.
* For a full description of the stencil, please see the document under dumux/doc/docextra/staggered
*/
void computeFaceToFaceStencil_(Stencil& stencil,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
// the first entries are always the face dofIdx itself and the one of the opposing face
if(stencil.empty())
{
stencil.push_back(scvf.dofIndex());
stencil.push_back(scvf.dofIndexOpposingFace());
}
for(const auto& data : scvf.pairData())
{
stencil.push_back(data.normalPair.first);
const auto outerParallelFaceDofIdx = data.outerParallelFaceDofIdx;
if(outerParallelFaceDofIdx >= 0)
stencil.push_back(outerParallelFaceDofIdx);
if(!scvf.boundary())
stencil.push_back(data.normalPair.second);
}
}
CellCenterToCellCenterMap cellCenterToCellCenterMap_;
CellCenterToFaceMap cellCenterToFaceMap_;
FaceToCellCenterMap faceToCellCenterMap_;
......@@ -127,4 +205,4 @@ private:
} // end namespace Dumux
#endif
#endif // DUMUX_STAGGERED_FREEFLOW_CONNECTIVITY_MAP_HH
......@@ -31,6 +31,7 @@
#include <dumux/freeflow/properties.hh>
#include "subcontrolvolumeface.hh"
#include "connectivitymap.hh"
#include "facevariables.hh"
#include "boundarytypes.hh"
#include "velocityoutput.hh"
......@@ -110,6 +111,9 @@ public:
SET_TYPE_PROP(StaggeredFreeFlowModel, VelocityOutput, StaggeredFreeFlowVelocityOutput<TypeTag>);
SET_TYPE_PROP(StaggeredFreeFlowModel, AssemblyMap, StaggeredFreeFlowConnectivityMap<TypeTag>);
} // namespace Properties
} // namespace Dumux
......
......@@ -27,7 +27,6 @@
#include <dumux/common/properties.hh>
#include <dumux/discretization/basefvgridgeometry.hh>
#include <dumux/discretization/staggered/connectivitymap.hh>
namespace Dumux
{
......@@ -65,7 +64,7 @@ class StaggeredFVGridGeometry<TypeTag, true> : public BaseFVGridGeometry<TypeTag
};
using GeometryHelper = typename GET_PROP_TYPE(TypeTag, StaggeredGeometryHelper);
using ConnectivityMap = StaggeredConnectivityMap<TypeTag>;
using ConnectivityMap = typename GET_PROP_TYPE(TypeTag, AssemblyMap);
public:
//! Constructor
......
......@@ -23,8 +23,8 @@
* \brief Defines a type tag and some properties for models using the staggered scheme.
*/
#ifndef DUMUX_STAGGERDs_PROPERTIES_HH
#define DUMUX_STAGGERDs_PROPERTIES_HH
#ifndef DUMUX_STAGGERD_PROPERTIES_HH
#define DUMUX_STAGGERD_PROPERTIES_HH
#include <dumux/common/properties.hh>
......@@ -51,7 +51,6 @@
#include <dune/istl/multitypeblockvector.hh>
#include <dune/istl/multitypeblockmatrix.hh>
namespace Dumux
{
......
......@@ -139,64 +139,6 @@ public:
return result;
}
void computeCellCenterToCellCenterStencil(Stencil& stencil,
const Element& element,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
// the first entry is always the cc dofIdx itself
if(stencil.empty())
stencil.push_back(scvf.insideScvIdx());
if(!scvf.boundary())
stencil.push_back(scvf.outsideScvIdx());
}
void computeCellCenterToFaceStencil(Stencil& stencil,
const Element& element,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
stencil.push_back(scvf.dofIndex());
}
void computeFaceToCellCenterStencil(Stencil& stencil,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
const int eIdx = scvf.insideScvIdx();
stencil.push_back(scvf.insideScvIdx());
for(const auto& data : scvf.pairData())
{
auto& normalFace = fvGeometry.scvf(eIdx, data.localNormalFaceIdx);
const auto outerParallelElementDofIdx = normalFace.outsideScvIdx();
if(!normalFace.boundary())
stencil.push_back(outerParallelElementDofIdx);
}
}
void computeFaceToFaceStencil(Stencil& stencil,
const FVElementGeometry& fvGeometry,
const SubControlVolumeFace& scvf)
{
// the first entries are always the face dofIdx itself and the one of the opposing face
if(stencil.empty())
{
stencil.push_back(scvf.dofIndex());
stencil.push_back(scvf.dofIndexOpposingFace());
}
for(const auto& data : scvf.pairData())
{
stencil.push_back(data.normalPair.first);
const auto outerParallelFaceDofIdx = data.outerParallelFaceDofIdx;
if(outerParallelFaceDofIdx >= 0)
stencil.push_back(outerParallelFaceDofIdx);
if(!scvf.boundary())
stencil.push_back(data.normalPair.second);
}
}
/*!
* \brief Returns the normal part of the momentum flux
*/
......
......@@ -37,37 +37,13 @@
namespace Dumux
{
//! Dummy flux variables class so that we can update the connectivity map
class MockFluxVariables
//! Dummy connectivity map, required by FVGridGeometry
class MockConnectivityMap
{
public:
template<class Map, class Element, class FvGeometry, class Scvf>
void computeCellCenterToCellCenterStencil(Map& map,
const Element& element,
const FvGeometry& fvGeometry,
const Scvf& scvf)
{}
template<class Map, class Element, class FvGeometry, class Scvf>
void computeCellCenterToFaceStencil(Map& map,
const Element& element,
const FvGeometry& fvGeometry,
const Scvf& scvf)
{}
template<class Map, class FvGeometry, class Scvf>
void computeFaceToCellCenterStencil(Map& map,
const FvGeometry& fvGeometry,
const Scvf& scvf)
{}
template<class Map, class FvGeometry, class Scvf>
void computeFaceToFaceStencil(Map& map,
const FvGeometry& fvGeometry,
const Scvf& scvf)
{}
template<class FVGridGeometry>
void update(const FVGridGeometry& fvGridGeometry)
{}
};
namespace Properties
......@@ -76,7 +52,7 @@ NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(StaggeredModel));
SET_TYPE_PROP(TestFVGeometry, Grid, Dune::YaspGrid<2>);
SET_TYPE_PROP(TestFVGeometry, FluxVariables, MockFluxVariables);
SET_TYPE_PROP(TestFVGeometry, AssemblyMap, MockConnectivityMap);
SET_BOOL_PROP(TestFVGeometry, EnableFVGridGeometryCache, true);
}
......
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