ug4
ug::IConvectionShapes< dim > Class Template Reference

Interface class for upwind methods. More...

#include <conv_shape_interface.h>

Public Types

typedef IConvectionShapes< dimthis_type
 Abbreviation for own type. More...
 
typedef bool(this_type::* UpdateFunc) (const FVGeometryBase *geo, const MathVector< dim > *Velocity, const MathMatrix< dim, dim > *Diffusion, bool computeDeriv)
 type of update function More...
 

Public Member Functions

const MathMatrix< dim, dim > & D_diffusion (size_t scvf, size_t sh) const
 upwind shapes for ip vel More...
 
const MathVector< dim > & D_vel (size_t scvf, size_t sh) const
 upwind shape for corner vel More...
 
 IConvectionShapes ()
 constructor More...
 
bool non_zero_deriv_diffusion () const
 returns if upwind shape w.r.t. ip vel is non-zero More...
 
size_t num_scvf () const
 returns number of sub control volume faces More...
 
size_t num_sh () const
 returns number of shapes More...
 
number operator() (size_t scvf, size_t sh) const
 shape value More...
 
template<typename TFVGeom , typename TAssFunc >
void register_update_func (TAssFunc func)
 register a update function for a Geometry More...
 
template<typename TFVGeom >
bool set_geometry_type (const TFVGeom &geo)
 set the Geometry type to use for next updates More...
 
bool update (const FVGeometryBase *geo, const MathVector< dim > *Velocity, const MathMatrix< dim, dim > *DiffDisp, bool computeDeriv)
 
virtual ~IConvectionShapes ()
 destructor More...
 

Protected Member Functions

numberconv_shape (size_t scvf, size_t sh)
 non-const access to ip velocity (i.e. interpolated velocity at ip) More...
 
MathMatrix< dim, dim > & conv_shape_diffusion (size_t scvf, size_t sh)
 non-const access to upwind shapes for ip vel More...
 
MathVector< dim > & D_vel (size_t scvf, size_t sh)
 non-const access to upwind shapes for corner vel More...
 
void set_non_zero_deriv_diffusion_flag (bool flag)
 sets the shape ip flag More...
 
void set_sizes (size_t numScvf, size_t numSh)
 resize the data arrays More...
 

Protected Attributes

bool m_bNonZeroDerivDiffusion
 flag if ip shapes are non-zero More...
 
int m_id
 id of current geometry type More...
 
size_t m_numScvf
 number of current scvf More...
 
size_t m_numSh
 number of current shape functions (usually in corners) More...
 
std::vector< std::vector< number > > m_vConvShape
 upwind shapes for corners shape functions More...
 
std::vector< std::vector< MathMatrix< dim, dim > > > m_vConvShapeDiffusion
 upwind shapes for corners shape functions More...
 
std::vector< std::vector< MathVector< dim > > > m_vConvShapeVel
 upwind shapes for corners shape functions More...
 
std::vector< UpdateFuncm_vUpdateFunc
 Vector holding all update functions. More...
 

Detailed Description

template<int dim>
class ug::IConvectionShapes< dim >

Interface class for upwind methods.

Upwind is a way of stabilization of discretizations of convection(-diffusion) PDEs. For a detailed description of the idea, cf.

  • P. Frolkovic, H. De Schepper, Numerical Modelling of Convection Dominated Transport Coupled with Density Driven Flow in Porous Media. Advances in Water Resources 24 (1): 63–72, 2000, DOI: 10.1016/S0309-1708(00)00025-7
  • K. W. Morton, D. Mayers, Numerical Solution of Partial Differential Equations: An Introduction (2nd ed.), Cambridge: Cambridge University Press, 2005, DOI: 10.1017/CBO9780511812248
  • R. J. LeVeque, Numerical Methods for Conservation Laws (2nd ed.), Springer Basel AG, 1992, DOI: 10.1007/978-3-0348-8629-1

Convection shapes is one of possible implementations of upwind methods, in which the upwind is considered as a special kind of interpolation of degrees of freedom of the unknown function (for ex., concentration at the corners of the element) into integration points inside the grid element. E.g. the so-called 'full upwind' method for the vertex-centered FV discretizations sets the concentration in the whole grid element be equal to the concentration at a certain specially selected 'upwind corner' chosen according to the direction of the convection velocity. Like every interpolation, this one can be introduced by a set of shape functions associated with the degrees of freedom of the grid function. These shape functions for an upwind method are said to be its convection shapes.

But in terms of this interface, the convection shapes are the values of the convection shape functions at the integration points premultiplied by the norm of the projection of the velocity to the normal to the corresponding subcontrol volume faces and by the area of these faces. Thus, for a convective term of the form

\[ \nabla \cdot (\mathbf{v} c) \]

(with \(\mathbf{v}\) being the convective velocity) the convective flux through a subcontrol volume face with the integration point \(ip\) is

\[ \sum_{s=1}^{n_s} \phi_s (ip) \, c_s, \]

where \(\phi_s (ip)\) are the values of the \(n_s\) `‘convection shapes’' at \(ip\), whereas \(c_s\) are the degrees of freedom of \(c\) corresponding to the shapes.

Although the convection shapes for every upwind method are based on the same idea, they depend on the geometry of the secondary grid (i.e., on the finite volume geometry). For this, for every FV geometry, an own object of the convection shapes class is registered.

Note furthermore that the convection shapes may depend not only on the velocity but also on the diffusion. Such methods raise up the asymptotic convergence of the discretization of convection-diffusion problems. As the diffusion tensor may also depend on the unknowns (via its dispersion part), the derivatives of the shapes w.r.t. the components of the diffusion tensor are taken into account.

Template Parameters
dimthe world dimension (in which the velocity is given)

Member Typedef Documentation

◆ this_type

template<int dim>
typedef IConvectionShapes<dim> ug::IConvectionShapes< dim >::this_type

Abbreviation for own type.

◆ UpdateFunc

template<int dim>
typedef bool(this_type::* ug::IConvectionShapes< dim >::UpdateFunc) (const FVGeometryBase *geo, const MathVector< dim > *Velocity, const MathMatrix< dim, dim > *Diffusion, bool computeDeriv)

type of update function

Constructor & Destructor Documentation

◆ IConvectionShapes()

◆ ~IConvectionShapes()

template<int dim>
virtual ug::IConvectionShapes< dim >::~IConvectionShapes ( )
inlinevirtual

destructor

Member Function Documentation

◆ conv_shape()

template<int dim>
number& ug::IConvectionShapes< dim >::conv_shape ( size_t  scvf,
size_t  sh 
)
inlineprotected

non-const access to ip velocity (i.e. interpolated velocity at ip)

References ug::IConvectionShapes< dim >::m_vConvShape, and UG_ASSERT.

◆ conv_shape_diffusion()

template<int dim>
MathMatrix<dim,dim>& ug::IConvectionShapes< dim >::conv_shape_diffusion ( size_t  scvf,
size_t  sh 
)
inlineprotected

non-const access to upwind shapes for ip vel

References ug::IConvectionShapes< dim >::m_vConvShapeDiffusion, and UG_ASSERT.

◆ D_diffusion()

template<int dim>
const MathMatrix<dim,dim>& ug::IConvectionShapes< dim >::D_diffusion ( size_t  scvf,
size_t  sh 
) const
inline

upwind shapes for ip vel

References ug::IConvectionShapes< dim >::m_vConvShapeDiffusion, and UG_ASSERT.

◆ D_vel() [1/2]

template<int dim>
MathVector<dim>& ug::IConvectionShapes< dim >::D_vel ( size_t  scvf,
size_t  sh 
)
inlineprotected

non-const access to upwind shapes for corner vel

References ug::IConvectionShapes< dim >::m_vConvShapeVel, and UG_ASSERT.

◆ D_vel() [2/2]

template<int dim>
const MathVector<dim>& ug::IConvectionShapes< dim >::D_vel ( size_t  scvf,
size_t  sh 
) const
inline

upwind shape for corner vel

References ug::IConvectionShapes< dim >::m_vConvShapeVel, and UG_ASSERT.

◆ non_zero_deriv_diffusion()

template<int dim>
bool ug::IConvectionShapes< dim >::non_zero_deriv_diffusion ( ) const
inline

returns if upwind shape w.r.t. ip vel is non-zero

References ug::IConvectionShapes< dim >::m_bNonZeroDerivDiffusion.

◆ num_scvf()

template<int dim>
size_t ug::IConvectionShapes< dim >::num_scvf ( ) const
inline

returns number of sub control volume faces

References ug::IConvectionShapes< dim >::m_numScvf.

◆ num_sh()

template<int dim>
size_t ug::IConvectionShapes< dim >::num_sh ( ) const
inline

returns number of shapes

References ug::IConvectionShapes< dim >::m_numSh.

◆ operator()()

template<int dim>
number ug::IConvectionShapes< dim >::operator() ( size_t  scvf,
size_t  sh 
) const
inline

◆ register_update_func()

template<int dim>
template<typename TFVGeom , typename TAssFunc >
void ug::IConvectionShapes< dim >::register_update_func ( TAssFunc  func)

register a update function for a Geometry

References func().

◆ set_geometry_type()

template<int dim>
template<typename TFVGeom >
bool ug::IConvectionShapes< dim >::set_geometry_type ( const TFVGeom &  geo)

set the Geometry type to use for next updates

References UG_LOG.

◆ set_non_zero_deriv_diffusion_flag()

template<int dim>
void ug::IConvectionShapes< dim >::set_non_zero_deriv_diffusion_flag ( bool  flag)
inlineprotected

sets the shape ip flag

References ug::IConvectionShapes< dim >::m_bNonZeroDerivDiffusion.

◆ set_sizes()

template<int dim>
void ug::IConvectionShapes< dim >::set_sizes ( size_t  numScvf,
size_t  numSh 
)
protected

resize the data arrays

◆ update()

template<int dim>
bool ug::IConvectionShapes< dim >::update ( const FVGeometryBase geo,
const MathVector< dim > *  Velocity,
const MathMatrix< dim, dim > *  DiffDisp,
bool  computeDeriv 
)
inline

Member Data Documentation

◆ m_bNonZeroDerivDiffusion

template<int dim>
bool ug::IConvectionShapes< dim >::m_bNonZeroDerivDiffusion
protected

◆ m_id

template<int dim>
int ug::IConvectionShapes< dim >::m_id
protected

id of current geometry type

Referenced by ug::IConvectionShapes< dim >::update().

◆ m_numScvf

template<int dim>
size_t ug::IConvectionShapes< dim >::m_numScvf
protected

number of current scvf

Referenced by ug::IConvectionShapes< dim >::num_scvf().

◆ m_numSh

template<int dim>
size_t ug::IConvectionShapes< dim >::m_numSh
protected

number of current shape functions (usually in corners)

Referenced by ug::IConvectionShapes< dim >::num_sh().

◆ m_vConvShape

template<int dim>
std::vector<std::vector<number> > ug::IConvectionShapes< dim >::m_vConvShape
protected

◆ m_vConvShapeDiffusion

template<int dim>
std::vector<std::vector<MathMatrix<dim,dim> > > ug::IConvectionShapes< dim >::m_vConvShapeDiffusion
protected

◆ m_vConvShapeVel

template<int dim>
std::vector<std::vector<MathVector<dim> > > ug::IConvectionShapes< dim >::m_vConvShapeVel
protected

upwind shapes for corners shape functions

Referenced by ug::IConvectionShapes< dim >::D_vel(), and ug::IConvectionShapes< dim >::IConvectionShapes().

◆ m_vUpdateFunc

template<int dim>
std::vector<UpdateFunc> ug::IConvectionShapes< dim >::m_vUpdateFunc
protected

The documentation for this class was generated from the following file: