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

[doc] Improve documentation of cc tpfa discretization scheme

parent fe4b32c5
......@@ -18,7 +18,8 @@
*****************************************************************************/
/*!
* \file
* \brief This file contains free functions to evaluate the transmissibilities
* \ingroup CCTpfaDiscretization
* \brief Free functions to evaluate the transmissibilities
* associated with flux evaluations across sub-control volume faces
* in the context of the cell-centered TPFA scheme.
*/
......@@ -32,10 +33,9 @@ namespace Dumux
{
/*!
* \ingroup Tpfa
*
* \brief Free function to evaluate the Tpfa transmissibility associated
* with the flux (in the form of flux = T*gradU) across a
* \ingroup CCTpfaDiscretization
* \brief Free function to evaluate the Tpfa transmissibility
* associated with the flux (in the form of flux = T*gradU) across a
* sub-control volume face stemming from a given sub-control
* volume with corresponding tensor T.
*
......@@ -62,9 +62,11 @@ typename Tensor::field_type computeTpfaTransmissibility(const SubControlVolumeFa
}
/*!
* \ingroup Tpfa
*
* \brief Specialization of the above function for scalar T.
* \ingroup CCTpfaDiscretization
* \brief Free function to evaluate the Tpfa transmissibility
* associated with the flux (in the form of flux = T*gradU) across a
* sub-control volume face stemming from a given sub-control
* volume for the case where T is just a scalar
*
* \param scvf The sub-control volume face
* \param scv The neighboring sub-control volume
......
......@@ -18,9 +18,8 @@
*****************************************************************************/
/*!
* \file
* \brief This file contains the data which is required to calculate
* volume and mass fluxes of fluid phases over a face of a finite volume by means
* of the Darcy approximation. Specializations are provided for the different discretization methods.
* \ingroup CCTpfaDiscretization
* \brief Darcy's law for cell-centered finite volume schemes with two-point flux approximation
*/
#ifndef DUMUX_DISCRETIZATION_CC_TPFA_DARCYS_LAW_HH
#define DUMUX_DISCRETIZATION_CC_TPFA_DARCYS_LAW_HH
......@@ -42,15 +41,19 @@ template<class TypeTag, bool isNetwork>
class CCTpfaDarcysLaw;
/*!
* \ingroup DarcysLaw
* \brief Specialization of Darcy's Law for the CCTpfa method.
* \ingroup CCTpfaDiscretization
* \brief Darcy's law for cell-centered finite volume schemes with two-point flux approximation
* \note Darcy's law is speialized for network and surface grids (i.e. if grid dim < dimWorld)
*/
template <class TypeTag>
class DarcysLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>
: public CCTpfaDarcysLaw<TypeTag, (GET_PROP_TYPE(TypeTag, Grid)::dimension < GET_PROP_TYPE(TypeTag, Grid)::dimensionworld) >
: public CCTpfaDarcysLaw<TypeTag, (GET_PROP_TYPE(TypeTag, Grid)::dimension < GET_PROP_TYPE(TypeTag, Grid)::dimensionworld) >
{};
//! Class that fills the cache corresponding to tpfa Darcy's Law
/*!
* \ingroup CCTpfaDiscretization
* \brief Class that fills the cache corresponding to tpfa Darcy's Law
*/
template<class TypeTag>
class TpfaDarcysLawCacheFiller
{
......@@ -77,7 +80,10 @@ public:
}
};
//! the cache corresponding to tpfa Darcy's Law
/*!
* \ingroup CCTpfaDiscretization
* \brief The cache corresponding to tpfa Darcy's Law
*/
template<class TypeTag>
class TpfaDarcysLawCache
{
......@@ -108,7 +114,10 @@ private:
Scalar tij_;
};
//! Specialization of the CCTpfaDarcysLaw grids where dim=dimWorld
/*!
* \ingroup CCTpfaDiscretization
* \brief Specialization of the CCTpfaDarcysLaw grids where dim=dimWorld
*/
template<class TypeTag>
class CCTpfaDarcysLaw<TypeTag, /*isNetwork*/ false>
{
......@@ -133,12 +142,13 @@ class CCTpfaDarcysLaw<TypeTag, /*isNetwork*/ false>
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
public:
// state the discretization method this implementation belongs to
//! state the discretization method this implementation belongs to
static const DiscretizationMethods myDiscretizationMethod = DiscretizationMethods::CCTpfa;
// state the type for the corresponding cache
//! state the type for the corresponding cache
using Cache = TpfaDarcysLawCache<TypeTag>;
//! Compute the advective flux
static Scalar flux(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
......@@ -260,7 +270,10 @@ class CCTpfaDarcysLaw<TypeTag, /*isNetwork*/ false>
}
};
//! Specialization of the CCTpfaDarcysLaw for network/surface grids
/*!
* \ingroup CCTpfaDiscretization
* \brief Specialization of the CCTpfaDarcysLaw grids where dim < dimWorld (network/surface grids)
*/
template<class TypeTag>
class CCTpfaDarcysLaw<TypeTag, /*isNetwork*/ true>
{
......@@ -285,12 +298,13 @@ class CCTpfaDarcysLaw<TypeTag, /*isNetwork*/ true>
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
public:
// state the discretization method this implementation belongs to
//! state the discretization method this implementation belongs to
static const DiscretizationMethods myDiscretizationMethod = DiscretizationMethods::CCTpfa;
// state the type for the corresponding cache
//! state the type for the corresponding cache
using Cache = TpfaDarcysLawCache<TypeTag>;
//! Compute the advective flux
static Scalar flux(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
......
......@@ -18,7 +18,8 @@
*****************************************************************************/
/*!
* \file
* \brief The global object of flux var caches
* \ingroup CCTpfaDiscretization
* \brief The flux variables caches for an element
*/
#ifndef DUMUX_DISCRETIZATION_CCTPFA_ELEMENT_FLUXVARSCACHE_HH
#define DUMUX_DISCRETIZATION_CCTPFA_ELEMENT_FLUXVARSCACHE_HH
......@@ -31,15 +32,19 @@ namespace Dumux
{
/*!
* \ingroup ImplicitModel
* \brief Base class for the stencil local flux variables cache
* \ingroup CCTpfaDiscretization
* \brief The flux variables caches for an element
* \note The class is specialized for a version with and without caching
* If grid caching is enabled the flux caches are stored for the whole gridview in the corresponding
* GridFluxVariablesCache which is memory intensive but faster. For caching disabled the
* flux caches are locally computed for each element whenever needed.
*/
template<class TypeTag, bool EnableGridFluxVariablesCache>
class CCTpfaElementFluxVariablesCache;
/*!
* \ingroup ImplicitModel
* \brief Spezialization when caching globally
* \ingroup CCTpfaDiscretization
* \brief The flux variables caches for an element with caching enabled
*/
template<class TypeTag>
class CCTpfaElementFluxVariablesCache<TypeTag, true>
......@@ -58,23 +63,23 @@ public:
CCTpfaElementFluxVariablesCache(const GridFluxVariablesCache& global)
: gridFluxVarsCachePtr_(&global) {}
// Specialization for the global caching being enabled - do nothing here
//! Specialization for the global caching being enabled - do nothing here
void bindElement(const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars) {}
// Specialization for the global caching being enabled - do nothing here
//! Specialization for the global caching being enabled - do nothing here
void bind(const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars) {}
// Specialization for the global caching being enabled - do nothing here
//! Specialization for the global caching being enabled - do nothing here
void bindScvf(const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars,
const SubControlVolumeFace& scvf) {}
// Specialization for the global caching being enabled - do nothing here
//! Specialization for the global caching being enabled - do nothing here
void update(const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars)
......@@ -82,7 +87,7 @@ public:
DUNE_THROW(Dune::InvalidStateException, "In case of enabled caching, the grid flux variables cache has to be updated");
}
// access operators in the case of caching
//! access operators in the case of caching
const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const
{ return gridFluxVarsCache()[scvf]; }
......@@ -95,8 +100,8 @@ private:
};
/*!
* \ingroup ImplicitModel
* \brief Spezialization when not using global caching
* \ingroup CCTpfaDiscretization
* \brief The flux variables caches for an element with caching disabled
*/
template<class TypeTag>
class CCTpfaElementFluxVariablesCache<TypeTag, false>
......@@ -116,8 +121,11 @@ public:
CCTpfaElementFluxVariablesCache(const GridFluxVariablesCache& global)
: gridFluxVarsCachePtr_(&global) {}
// This function has to be called prior to flux calculations on the element.
// Prepares the transmissibilities of the scv faces in an element. The FvGeometry is assumed to be bound.
/*!
* \brief Prepares the transmissibilities of the scv faces in an element
* \note the fvGeometry is assumed to be bound to the same element
* \note this function has to be called prior to flux calculations on the element.
*/
void bindElement(const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars)
......@@ -140,8 +148,11 @@ public:
}
}
// This function is called by the CCLocalResidual before flux calculations during assembly.
// Prepares the transmissibilities of the scv faces in the stencil. The FvGeometries are assumed to be bound.
/*!
* \brief Prepares the transmissibilities of the scv faces in the stencil of an element
* \note the fvGeometry is assumed to be bound to the same element
* \note this function has to be called prior to flux calculations on the element.
*/
void bind(const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars)
......@@ -185,6 +196,11 @@ public:
}
}
/*!
* \brief Prepares the transmissibilities of a single scv face
* \note the fvGeometry is assumed to be bound to the same element
* \note this function has to be called prior to flux calculations on the element.
*/
void bindScvf(const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars,
......@@ -200,8 +216,10 @@ public:
globalScvfIndices_[0] = scvf.index();
}
// This function is used to update the transmissibilities if the volume variables have changed
// Results in undefined behaviour if called before bind() or with a different element
/*!
* \brief Update the transmissibilities if the volume variables have changed
* \note Results in undefined behaviour if called before bind() or with a different element
*/
void update(const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars)
......@@ -229,10 +247,11 @@ public:
}
}
// access operators in the case of no caching
//! access operators in the case of no caching
const FluxVariablesCache& operator [](const SubControlVolumeFace& scvf) const
{ return fluxVarsCache_[getLocalScvfIdx_(scvf.index())]; }
//! access operators in the case of no caching
FluxVariablesCache& operator [](const SubControlVolumeFace& scvf)
{ return fluxVarsCache_[getLocalScvfIdx_(scvf.index())]; }
......@@ -243,7 +262,7 @@ public:
private:
const GridFluxVariablesCache* gridFluxVarsCachePtr_;
// get index of scvf in the local container
//! get index of scvf in the local container
int getLocalScvfIdx_(const int scvfIdx) const
{
auto it = std::find(globalScvfIndices_.begin(), globalScvfIndices_.end(), scvfIdx);
......@@ -255,6 +274,6 @@ private:
std::vector<IndexType> globalScvfIndices_;
};
} // end namespace
} // end namespace Dumux
#endif
......@@ -18,7 +18,8 @@
*****************************************************************************/
/*!
* \file
* \brief The local (stencil) volume variables class for cell centered models
* \ingroup CCTpfaDiscretization
* \brief The local (stencil) volume variables class for cell centered tpfa models
*/
#ifndef DUMUX_DISCRETIZATION_CCTPFA_ELEMENT_VOLUMEVARIABLES_HH
#define DUMUX_DISCRETIZATION_CCTPFA_ELEMENT_VOLUMEVARIABLES_HH
......@@ -29,14 +30,19 @@ namespace Dumux
{
/*!
* \ingroup ImplicitModel
* \brief Base class for the volume variables vector
* \ingroup CCTpfaDiscretization
* \brief The local (stencil) volume variables class for cell centered tpfa models
* \note The class is specilized for versions with and without caching
*/
template<class TypeTag, bool enableGridVolVarsCache>
class CCTpfaElementVolumeVariables
{};
// specialization in case of storing the volume variables globally
/*!
* \ingroup CCTpfaDiscretization
* \brief The local (stencil) volume variables class for cell centered tpfa models with caching
* \note the volume variables are stored for the whole grid view in the corresponding GridVolumeVariables class
*/
template<class TypeTag>
class CCTpfaElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/true>
{
......@@ -58,22 +64,21 @@ public:
CCTpfaElementVolumeVariables(const GridVolumeVariables& gridVolVars)
: gridVolVarsPtr_(&gridVolVars) {}
//! operator for the access with an index
const VolumeVariables& operator [](const SubControlVolume& scv) const
{ return gridVolVars().volVars(scv.dofIndex()); }
// operator for the access with an index
// needed for cc methods for the access to the boundary volume variables
//! operator for the access with an index
const VolumeVariables& operator [](const IndexType scvIdx) const
{ return gridVolVars().volVars(scvIdx); }
// For compatibility reasons with the case of not storing the vol vars.
// function to be called before assembling an element, preparing the vol vars within the stencil
//! precompute all volume variables in a stencil of an element - do nothing volVars: are cached
void bind(const Element& element,
const FVElementGeometry& fvGeometry,
const SolutionVector& sol)
{}
// function to prepare the vol vars within the element
//! precompute the volume variables of an element - do nothing: volVars are cached
void bindElement(const Element& element,
const FVElementGeometry& fvGeometry,
const SolutionVector& sol)
......@@ -87,8 +92,10 @@ private:
const GridVolumeVariables* gridVolVarsPtr_;
};
// Specialization when the current volume variables are not stored
/*!
* \ingroup CCTpfaDiscretization
* \brief The local (stencil) volume variables class for cell centered tpfa models with caching
*/
template<class TypeTag>
class CCTpfaElementVolumeVariables<TypeTag, /*enableGridVolVarsCache*/false>
{
......@@ -111,8 +118,7 @@ public:
CCTpfaElementVolumeVariables(const GridVolumeVariables& gridVolVars)
: gridVolVarsPtr_(&gridVolVars) {}
// Binding of an element, prepares the volume variables within the element stencil
// called by the local jacobian to prepare element assembly
//! Prepares the volume variables within the element stencil
void bind(const Element& element,
const FVElementGeometry& fvGeometry,
const SolutionVector& sol)
......@@ -198,8 +204,7 @@ public:
// }
}
// Binding of an element, prepares only the volume variables of the element
// specialization for cc models
//! Prepares the volume variables of an element
void bindElement(const Element& element,
const FVElementGeometry& fvGeometry,
const SolutionVector& sol)
......@@ -219,15 +224,19 @@ public:
volVarIndices_[0] = scv.dofIndex();
}
//! access operator with scv
const VolumeVariables& operator [](const SubControlVolume& scv) const
{ return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
//! access operator with scv
VolumeVariables& operator [](const SubControlVolume& scv)
{ return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
//! access operator with scv index
const VolumeVariables& operator [](IndexType scvIdx) const
{ return volumeVariables_[getLocalIdx_(scvIdx)]; }
//! access operator with scv index
VolumeVariables& operator [](IndexType scvIdx)
{ return volumeVariables_[getLocalIdx_(scvIdx)]; }
......@@ -244,6 +253,7 @@ public:
private:
const GridVolumeVariables* gridVolVarsPtr_;
//! map a global scv index to the local storage index
int getLocalIdx_(const int volVarIdx) const
{
auto it = std::find(volVarIndices_.begin(), volVarIndices_.end(), volVarIdx);
......@@ -255,6 +265,6 @@ private:
std::vector<VolumeVariables> volumeVariables_;
};
} // end namespace
} // end namespace Dumux
#endif
......@@ -18,8 +18,8 @@
*****************************************************************************/
/*!
* \file
* \brief This file contains the data which is required to calculate
* diffusive mass fluxes due to molecular diffusion with Fick's law.
* \ingroup CCTpfaDiscretization
* \brief Fick's law for cell-centered finite volume schemes with two-point flux approximation
*/
#ifndef DUMUX_DISCRETIZATION_CC_TPFA_FICKS_LAW_HH
#define DUMUX_DISCRETIZATION_CC_TPFA_FICKS_LAW_HH
......@@ -37,8 +37,8 @@ template<class TypeTag, DiscretizationMethods discMethod>
class FicksLawImplementation;
/*!
* \ingroup CCTpfaFicksLaw
* \brief Specialization of Fick's Law for the CCTpfa method.
* \ingroup CCTpfaDiscretization
* \brief Fick's law for cell-centered finite volume schemes with two-point flux approximation
*/
template <class TypeTag>
class FicksLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>
......@@ -114,12 +114,13 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>
};
public:
// state the discretization method this implementation belongs to
//! state the discretization method this implementation belongs to
static const DiscretizationMethods myDiscretizationMethod = DiscretizationMethods::CCTpfa;
//! state the type for the corresponding cache and its filler
using Cache = TpfaFicksLawCache;
//! return diffusive fluxes for all components in a phase
static ComponentFluxVector flux(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
......@@ -159,6 +160,7 @@ public:
return componentFlux;
}
//! compute diffusive transmissibilities
static Scalar calculateTransmissibility(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
......@@ -257,6 +259,7 @@ private:
return rho/(scvf.numOutsideScvs()+1);
}
};
} // end namespace
} // end namespace Dumux
#endif
......@@ -16,9 +16,10 @@
* 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 The flux variables cache filler class for the cell-centered TPFA scheme
* \ingroup CCTpfaDiscretization
* \brief A helper class to fill the flux variable caches used in the flux constitutive laws
*/
#ifndef DUMUX_DISCRETIZATION_CCTPFA_FLUXVARSCACHE_FILLER_HH
#define DUMUX_DISCRETIZATION_CCTPFA_FLUXVARSCACHE_FILLER_HH
......@@ -30,9 +31,9 @@ namespace Dumux
{
/*!
* \ingroup ImplicitModel
* \brief Helper class to fill the flux var caches
*/
* \ingroup CCTpfaDiscretization
* \brief A helper class to fill the flux variable caches used in the flux constitutive laws
*/
template<class TypeTag>
class CCTpfaFluxVariablesCacheFiller
{
......@@ -193,6 +194,6 @@ private:
const Problem* problemPtr_;
};
} // end namespace
} // end namespace Dumux
#endif
......@@ -17,10 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief This file contains the data which is required to calculate
* heat conduction fluxes with Fourier's law.
*/
* \file
* \ingroup CCTpfaDiscretization
* \brief Fourier's law for cell-centered finite volume schemes with two-point flux approximation
*/
#ifndef DUMUX_DISCRETIZATION_CC_TPFA_FOURIERS_LAW_HH
#define DUMUX_DISCRETIZATION_CC_TPFA_FOURIERS_LAW_HH
......@@ -37,9 +37,9 @@ template<class TypeTag, DiscretizationMethods discMethod>
class FouriersLawImplementation;
/*!
* \ingroup FouriersLaw
* \brief Specialization of Fourier's Law for the CCTpfa method.
*/
* \ingroup CCTpfaDiscretization
* \brief Fourier's law for cell-centered finite volume schemes with two-point flux approximation
*/
template <class TypeTag>
class FouriersLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>
{
......@@ -106,12 +106,13 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::CCTpfa>
};
public:
// state the discretization method this implementation belongs to
//! state the discretization method this implementation belongs to
static const DiscretizationMethods myDiscretizationMethod = DiscretizationMethods::CCTpfa;
//! export the type for the corresponding cache
using Cache = TpfaFouriersLawCache;
//! Compute the heat condution flux assuming thermal equilibrium
static Scalar flux(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
......@@ -130,6 +131,7 @@ public:
return tij*(tInside - tOutside);
}
//! Compute transmissibilities
static Scalar calculateTransmissibility(const Problem& problem,
const Element& element,
const FVElementGeometry& fvGeometry,
......
......@@ -18,7 +18,8 @@
*****************************************************************************/
/*!
* \file
* \brief Base class for a local finite volume geometry for cell-centered TPFA models
* \ingroup CCTpfaDiscretization
* \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered TPFA models
* This builds up the sub control volumes and sub control volume faces
* for each element in the local scope we are restricting to, e.g. stencil or element.
*/
......@@ -38,17 +39,22 @@ template<class TypeTag, bool EnableFVGridGeometryCache>
class CCTpfaFVGridGeometry;
/*!
* \ingroup ImplicitModel
* \brief Base class for the finite volume geometry vector for cell-centered TPFA models
* \ingroup CCTpfaDiscretization
* \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered TPFA models
* This builds up the sub control volumes and sub control volume faces
* for each element.
* for each element in the local scope we are restricting to, e.g. stencil or element.
* \note This class is specialized for versions with and without caching the fv geometries on the grid view
*/
template<class TypeTag, bool EnableFVGridGeometryCache>
class CCTpfaFVElementGeometry
{};
//! specialization in case the FVElementGeometries are stored globally
//! In this case we just forward internally to the global object
/*!
* \ingroup CCTpfaDiscretization
* \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered TPFA models
* Specialization for grid caching enabled
* \note The finite volume geometries are stored in the corresponding FVGridGeometry
*/
template<class TypeTag>
class CCTpfaFVElementGeometry<TypeTag, true>
{
......@@ -151,7 +157,11 @@ private:
const FVGridGeometry* fvGridGeometryPtr_;
};
//! specialization in case the FVElementGeometries are not stored
/*!
* \ingroup CCTpfaDiscretization
* \brief Stencil-local finite volume geometry (scvs and scvfs) for cell-centered TPFA models
* Specialization for grid caching disabled
*/
template<class TypeTag>
class CCTpfaFVElementGeometry<TypeTag, false>
{
......@@ -526,7 +536,7 @@ private: