Commit 505e89b1 authored by Dennis Gläser's avatar Dennis Gläser Committed by Timo Koch
Browse files

[mpfa] make scv face method-specific

We introduce method-specific implementations that should inherit from a
mpfa-specific base class (which inherits from the scvf base class). We define
an interface for the constructor that has to be met by all the implementations.
We do this so that the classes instantiating scv faces do not have to be
method-specific. We add a local index to the constructor which corresponds
to the local vertex index an scvf is connected to for the mpfa-o-fps scheme.
parent 994fd5bc
......@@ -329,6 +329,7 @@ private:
geomHelper.getScvfCorners(isGeometry, faceScvfIdx),
is.centerUnitOuterNormal(),
vIdxGlobal,
vIdxLocal,
scvFaceIndices[scvfCounter],
std::array<IndexType, 2>({{eIdx, neighborVolVarIndices[scvfCounter]}}),
q,
......@@ -413,6 +414,7 @@ private:
geomHelper.getScvfCorners(isGeometry, faceScvfIdx),
is.centerUnitOuterNormal(),
vIdxGlobal,
vIdxLocal,
scvFaceIndices[scvfCounter],
std::array<IndexType, 2>({{eIdxGlobal, neighborVolVarIndices[scvfCounter]}}),
q,
......
......@@ -275,6 +275,7 @@ public:
geomHelper.getScvfCorners(isGeometry, faceScvfIdx),
intersection.centerUnitOuterNormal(),
vIdxGlobal,
vIdxLocal,
scvfIdx,
std::array<IndexType, 2>({{eIdx, nIdx}}),
q,
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief Class for an mpfa-o sub control volume face
*/
#ifndef DUMUX_DISCRETIZATION_CC_MPFA_O_SUBCONTROLVOLUMEFACE_HH
#define DUMUX_DISCRETIZATION_CC_MPFA_O_SUBCONTROLVOLUMEFACE_HH
#include <dumux/discretization/cellcentered/mpfa/methods.hh>
#include <dumux/discretization/cellcentered/mpfa/subcontrolvolumefacebase.hh>
namespace Dumux
{
/*!
* \ingroup Discretization
* \brief Class for a sub control volume face in the mpfa-o method. We simply inherit from the base class here.
*/
template<class G, typename I>
class CCMpfaSubControlVolumeFace<MpfaMethods::oMethod, G, I> : public CCMpfaSubControlVolumeFaceBase<G, I>
{
using ParentType = CCMpfaSubControlVolumeFaceBase<G, I>;
using Geometry = G;
using IndexType = I;
using Scalar = typename Geometry::ctype;
static const int dim = Geometry::mydimension;
static const int dimworld = Geometry::coorddimension;
using GlobalPosition = Dune::FieldVector<Scalar, dimworld>;
public:
//! We do not use the vertexIndexInElement variable.
//! It is here to satisfy the general mpfa scvf interface.
template<class MpfaGeometryHelper>
CCMpfaSubControlVolumeFace(const MpfaGeometryHelper& geomHelper,
std::vector<GlobalPosition>&& corners,
GlobalPosition&& unitOuterNormal,
IndexType vertexIndex,
unsigned int localIndex,
IndexType scvfIndex,
std::array<IndexType, 2>&& scvIndices,
Scalar q,
bool boundary)
: ParentType(geomHelper,
std::move(corners),
std::move(unitOuterNormal),
vertexIndex,
localIndex,
scvfIndex,
std::move(scvIndices),
q,
boundary)
{}
};
} // end namespace
#endif
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief Class for an mpfao-fps sub control volume face
*/
#ifndef DUMUX_DISCRETIZATION_CC_MPFA_O_FPS_SUBCONTROLVOLUMEFACE_HH
#define DUMUX_DISCRETIZATION_CC_MPFA_O_FPS_SUBCONTROLVOLUMEFACE_HH
#include <dumux/discretization/cellcentered/mpfa/methods.hh>
#include <dumux/discretization/cellcentered/mpfa/omethod/subcontrolvolumeface.hh>
namespace Dumux
{
/*!
* \ingroup Discretization
* \brief Class for a sub control volume face in the mpfao-fps method.
*/
template<class G, typename I>
class CCMpfaSubControlVolumeFace<MpfaMethods::oMethodFps, G, I> : public CCMpfaSubControlVolumeFace<MpfaMethods::oMethod, G, I>
{
using ParentType = CCMpfaSubControlVolumeFace<MpfaMethods::oMethod, G, I>;
using Geometry = G;
using IndexType = I;
using Scalar = typename Geometry::ctype;
static const int dim = Geometry::mydimension;
static const int dimworld = Geometry::coorddimension;
using GlobalPosition = Dune::FieldVector<Scalar, dimworld>;
public:
template<class MpfaGeometryHelper>
CCMpfaSubControlVolumeFace(const MpfaGeometryHelper& geomHelper,
std::vector<GlobalPosition>&& corners,
GlobalPosition&& unitOuterNormal,
IndexType vIdxGlobal,
unsigned int vIdxLocal,
IndexType scvfIndex,
std::array<IndexType, 2>&& scvIndices,
Scalar q,
bool boundary)
: ParentType(geomHelper,
std::move(corners),
std::move(unitOuterNormal),
vIdxGlobal,
vIdxLocal,
scvfIndex,
std::move(scvIndices),
q,
boundary),
vIdxInElement_(vIdxLocal)
{}
//! Returns the local index inside the element of the vertex the scvf is connected to
IndexType vertexIndexInElement() const
{ return vIdxInElement_; }
private:
unsigned int vIdxInElement_;
};
} // end namespace
#endif
......@@ -23,22 +23,25 @@
#ifndef DUMUX_DISCRETIZATION_CC_MPFA_SUBCONTROLVOLUMEFACE_HH
#define DUMUX_DISCRETIZATION_CC_MPFA_SUBCONTROLVOLUMEFACE_HH
#include <utility>
#include <dune/common/fvector.hh>
#include <dumux/discretization/subcontrolvolumefacebase.hh>
#include "methods.hh"
namespace Dumux
{
//! Forward declaration of the method specific implementations
//! Available implementations have to be included at the end of this file.
template<MpfaMethods M, class G, typename I>
class CCMpfaSubControlVolumeFaceImplementation;
/*!
* \ingroup Discretization
* \brief Class for a sub control volume face in the box method, i.e a part of the boundary
* of a sub control volume we compute fluxes on. We simply use the base class here.
* \brief Class for a sub control volume face in mpfa methods, i.e a part of the boundary
* of a control volume we compute fluxes on. This class inherits from the actual implementations
* and defines the constructor interface.
*/
template<class G, typename I>
class CCMpfaSubControlVolumeFace : public SubControlVolumeFaceBase<CCMpfaSubControlVolumeFace<G, I>, G, I>
template<MpfaMethods M, class G, typename I>
class CCMpfaSubControlVolumeFace : public CCMpfaSubControlVolumeFaceImplementation<M, G, I>
{
using ParentType = SubControlVolumeFaceBase<CCMpfaSubControlVolumeFace<G, I>, G, I>;
using ParentType = CCMpfaSubControlVolumeFaceImplementation<M, G, I>;
using Geometry = G;
using IndexType = I;
......@@ -47,105 +50,42 @@ class CCMpfaSubControlVolumeFace : public SubControlVolumeFaceBase<CCMpfaSubCont
static const int dimworld = Geometry::coorddimension;
using GlobalPosition = Dune::FieldVector<Scalar, dimworld>;
using LocalPosition = Dune::FieldVector<Scalar, dim>;
public:
/*!
* \brief Constructor interface of an mpfa sub control volume face
*
* We define a general constructor for scv faces in mpfa methods.
* This is necessary so that the class instantiating scv faces can work
* method-independent.
*
* \param geomHelper The mpfa geometry helper
* \param corners The corners of the scv face
* \param unitOuterNormal The unit outer normal vector of the scvf
* \param vIdxGlobal The global vertex index the scvf is connected to
* \param localIndex Some element local index (the local vertex index in mpfao-fps)
* \param scvfIndex The global index of this scv face
* \param scvIndices The inside and outside scv indices connected to this face
* \param q The parameterization of the quadrature point on the scvf for flux calculation
* \param boundary Boolean to specify whether or not the scvf is on a boundary
*/
template<class MpfaGeometryHelper>
CCMpfaSubControlVolumeFace(const MpfaGeometryHelper& geomHelper,
std::vector<GlobalPosition>&& corners,
GlobalPosition&& unitOuterNormal,
IndexType vertexIndex,
IndexType vIdxGlobal,
unsigned int localIndex,
IndexType scvfIndex,
std::array<IndexType, 2>&& scvIndices,
Scalar q,
bool boundary)
: ParentType(),
boundary_(boundary),
vertexIndex_(vertexIndex),
scvfIndex_(scvfIndex),
scvIndices_(std::move(scvIndices)),
corners_(std::move(corners)),
center_(0.0),
unitOuterNormal_(std::move(unitOuterNormal))
{
for (const auto& corner : corners_)
center_ += corner;
center_ /= corners_.size();
ipGlobal_ = geomHelper.getScvfIntegrationPoint(corners_, q);
area_ = geomHelper.getScvfArea(corners_);
}
//! The center of the sub control volume face
GlobalPosition center() const
{ return center_; }
//! The integration point for flux evaluations in global coordinates
GlobalPosition ipGlobal() const
{ return ipGlobal_; }
//! The area of the sub control volume face
Scalar area() const
{ return area_; }
//! returns bolean if the sub control volume face is on the domain boundary
bool boundary() const
{ return boundary_; }
GlobalPosition unitOuterNormal() const
{ return unitOuterNormal_; }
//! index of the inside sub control volume for spatial param evaluation
IndexType insideScvIdx() const
{ return scvIndices_[0]; }
//! index of the outside sub control volume for spatial param evaluation
IndexType outsideScvIdx() const
{ return scvIndices_[1]; }
//! The global index of this sub control volume face
IndexType index() const
{ return scvfIndex_; }
//! Returns the number of corners
std::size_t corners() const
{ return corners_.size(); }
//! Returns the corner for a given local index
GlobalPosition corner(unsigned int localIdx) const
{
assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
return corners_[localIdx];
}
//! The geometry of the sub control volume face
const Geometry geometry() const
{ return Geometry(Dune::GeometryType(Dune::GeometryType::cube, dim), corners_); }
//! Returns the global position of the vertex the scvf is connected to
GlobalPosition vertexCorner() const
{ return corners_.back(); }
//! Returns the global position of the center of the element facet this scvf is embedded in
GlobalPosition facetCorner() const
{ return corner(0); }
//! Returns the index of the vertex the scvf is connected to
IndexType vertexIndex() const
{ return vertexIndex_; }
private:
bool boundary_;
IndexType vertexIndex_;
IndexType scvfIndex_;
std::array<IndexType, 2> scvIndices_;
std::vector<GlobalPosition> corners_;
GlobalPosition center_;
GlobalPosition ipGlobal_;
GlobalPosition unitOuterNormal_;
Scalar area_;
: ParentType(geomHelper, corners, unitOuterNormal, vIdxGlobal, localIndex, scvfIndex, scvIndices, q, boundary)
{}
};
} // end namespace
//! The available implementations should be included here
#include <dumux/discretization/cellcentered/mpfa/omethod/subcontrolvolumeface.hh>
#include <dumux/discretization/cellcentered/mpfa/omethodfps/subcontrolvolumeface.hh>
#endif
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief Class for an mpfa-o sub control volume face
*/
#ifndef DUMUX_DISCRETIZATION_CC_MPFA_SUBCONTROLVOLUMEFACEBASE_HH
#define DUMUX_DISCRETIZATION_CC_MPFA_SUBCONTROLVOLUMEFACEBASE_HH
#include <utility>
#include <dune/common/fvector.hh>
#include <dumux/discretization/subcontrolvolumefacebase.hh>
namespace Dumux
{
/*!
* \ingroup Discretization
* \brief Base class for a sub-control volume face in mpfa methods. All mpfa method-specific implementations should inherit from this class
*/
template<class G, typename I>
class CCMpfaSubControlVolumeFaceBase : public SubControlVolumeFaceBase<CCMpfaSubControlVolumeFaceBase<G, I>, G, I>
{
using ParentType = SubControlVolumeFaceBase<CCMpfaSubControlVolumeFaceBase<G, I>, G, I>;
using Geometry = G;
using IndexType = I;
using Scalar = typename Geometry::ctype;
static const int dim = Geometry::mydimension;
static const int dimworld = Geometry::coorddimension;
using GlobalPosition = Dune::FieldVector<Scalar, dimworld>;
public:
/*!
* \brief Constructor
*
* We do not use the localIndex here. Its meaning can vary depending on the
* implementation (i.e. mpfa method) and is handled by the implementation itself.
*
* \param geomHelper The mpfa geometry helper
* \param corners The corners of the scv face
* \param unitOuterNormal The unit outer normal vector of the scvf
* \param vIdxGlobal The global vertex index the scvf is connected to
* \param localIndex Some element local index (the local vertex index in mpfao-fps)
* \param scvfIndex The global index of this scv face
* \param scvIndices The inside and outside scv indices connected to this face
* \param q The parameterization of the quadrature point on the scvf for flux calculation
* \param boundary Boolean to specify whether or not the scvf is on a boundary
*/
template<class MpfaGeometryHelper>
CCMpfaSubControlVolumeFaceBase(const MpfaGeometryHelper& geomHelper,
std::vector<GlobalPosition>&& corners,
GlobalPosition&& unitOuterNormal,
IndexType vertexIndex,
unsigned int localIndex,
IndexType scvfIndex,
std::array<IndexType, 2>&& scvIndices,
Scalar q,
bool boundary)
: ParentType(),
boundary_(boundary),
vertexIndex_(vertexIndex),
scvfIndex_(scvfIndex),
scvIndices_(std::move(scvIndices)),
corners_(std::move(corners)),
center_(0.0),
unitOuterNormal_(std::move(unitOuterNormal))
{
for (const auto& corner : corners_)
center_ += corner;
center_ /= corners_.size();
ipGlobal_ = geomHelper.getScvfIntegrationPoint(corners_, q);
area_ = geomHelper.getScvfArea(corners_);
}
//! The center of the sub control volume face
GlobalPosition center() const
{ return center_; }
//! The integration point for flux evaluations in global coordinates
GlobalPosition ipGlobal() const
{ return ipGlobal_; }
//! The area of the sub control volume face
Scalar area() const
{ return area_; }
//! returns bolean if the sub control volume face is on the domain boundary
bool boundary() const
{ return boundary_; }
GlobalPosition unitOuterNormal() const
{ return unitOuterNormal_; }
//! index of the inside sub control volume for spatial param evaluation
IndexType insideScvIdx() const
{ return scvIndices_[0]; }
//! index of the outside sub control volume for spatial param evaluation
IndexType outsideScvIdx() const
{ return scvIndices_[1]; }
//! The global index of this sub control volume face
IndexType index() const
{ return scvfIndex_; }
//! Returns the number of corners
std::size_t corners() const
{ return corners_.size(); }
//! Returns the corner for a given local index
GlobalPosition corner(unsigned int localIdx) const
{
assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
return corners_[localIdx];
}
//! The geometry of the sub control volume face
const Geometry geometry() const
{ return Geometry(Dune::GeometryType(Dune::GeometryType::cube, dim), corners_); }
//! Returns the global position of the vertex the scvf is connected to
GlobalPosition vertexCorner() const
{ return corners_.back(); }
//! Returns the global position of the center of the element facet this scvf is embedded in
GlobalPosition facetCorner() const
{ return corner(0); }
//! Returns the index of the vertex the scvf is connected to
IndexType vertexIndex() const
{ return vertexIndex_; }
private:
bool boundary_;
IndexType vertexIndex_;
IndexType scvfIndex_;
std::array<IndexType, 2> scvIndices_;
std::vector<GlobalPosition> corners_;
GlobalPosition center_;
GlobalPosition ipGlobal_;
GlobalPosition unitOuterNormal_;
Scalar area_;
};
} // end namespace
#endif
......@@ -105,7 +105,7 @@ private:
using ScvfGeometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld>;
using IndexType = typename GridView::IndexSet::IndexType;
public:
typedef Dumux::CCMpfaSubControlVolumeFace<ScvfGeometry, IndexType> type;
typedef Dumux::CCMpfaSubControlVolumeFace<GET_PROP_VALUE(TypeTag, MpfaMethod), ScvfGeometry, IndexType> type;
};
// By default, we use tpfa on the boundaries
......
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