PISM, A Parallel Ice Sheet Model stable 0.4.1779
Public Member Functions | Static Public Attributes | Protected Attributes

FEQuadrature Class Reference

Numerical integration of finite element functions. More...

#include <FETools.hh>

List of all members.

Public Member Functions

 FEQuadrature ()
void init (const IceGrid &g, PetscScalar L=1.)
 Obtain the weights $w_q$ for quadrature.
const FEFunctionGerm(* testFunctionValues ())[Nq]
 Return the values at all quadrature points of all shape functions.
const FEFunctionGermtestFunctionValues (PetscInt q)
 Return the values of all shape functions at quadrature point q.
const FEFunctionGermtestFunctionValues (PetscInt q, PetscInt k)
 Return the values at quadrature point q of shape function k.
void computeTrialFunctionValues (const PetscReal *x, PetscReal *vals)
 Compute the values at the quadrature ponits of a scalar-valued finite-element function with element-local degrees of freedom x.
void computeTrialFunctionValues (const PetscReal *x, PetscReal *vals, PetscReal *dx, PetscReal *dy)
 Compute the values and first derivatives at the quadrature points of a scalar-valued finite-element function with element-local degrees of freedom x.
void computeTrialFunctionValues (PetscInt i, PetscInt j, const FEDOFMap &dof, PetscReal const *const *xg, PetscReal *vals)
 Compute the values at the quadrature points on element (i,j) of a scalar-valued finite-element function with global degrees of freedom x.
void computeTrialFunctionValues (PetscInt i, PetscInt j, const FEDOFMap &dof, PetscReal const *const *xg, PetscReal *vals, PetscReal *dx, PetscReal *dy)
 Compute the values and first derivatives at the quadrature points on element (i,j) of a scalar-valued finite-element function with global degrees of freedom x.
void computeTrialFunctionValues (const PISMVector2 *x, PISMVector2 *vals)
 Compute the values at the quadrature points of a vector-valued finite-element function with element-local degrees of freedom x.
void computeTrialFunctionValues (const PISMVector2 *x, PISMVector2 *vals, PetscReal(*Dv)[3])
 Compute the values and symmetric gradient at the quadrature points of a vector-valued finite-element function with element-local degrees of freedom x.
void computeTrialFunctionValues (const PISMVector2 *x, PISMVector2 *vals, PISMVector2 *dx, PISMVector2 *dy)
 Compute the values and symmetric gradient at the quadrature points of a vector-valued finite-element function with element-local degrees of freedom x.
void computeTrialFunctionValues (PetscInt i, PetscInt j, const FEDOFMap &dof, PISMVector2 const *const *xg, PISMVector2 *vals)
 Compute the values at the quadrature points of a vector-valued finite-element function on element (i,j) with global degrees of freedom xg.
void computeTrialFunctionValues (PetscInt i, PetscInt j, const FEDOFMap &dof, PISMVector2 const *const *xg, PISMVector2 *vals, PetscReal(*Dv)[3])
 Compute the values and symmetric gradient at the quadrature points of a vector-valued finite-element function on element (i,j) with global degrees of freedom xg.
void getWeightedJacobian (PetscReal *jxw)
 Obtain the weights $w_q$ for quadrature.

Static Public Attributes

static const PetscInt Nq = 4
 Number of quadrature points.
static const PetscInt Nk = 4
 Number of test functions on the element.
static const PetscReal quadPoints [Nq][2]
 The coordinates of the quadrature points on the reference element.
static const PetscReal quadWeights [Nq] = {1,1,1,1}
 The weights for quadrature on the reference element.

Protected Attributes

PetscReal m_jacobianDet
 The Jacobian determinant of the map from the reference element to the physical element.
FEFunctionGerm m_germs [Nq][Nk]
 Shape function values (for each of Nq quadrature points, and each of Nk shape function )
PetscReal m_tmpScalar [Nk]
PISMVector2 m_tmpVector [Nk]

Detailed Description

Numerical integration of finite element functions.

The core of the finite element method is the computation of integrals over elements. For nonlinear problems, or problems with non-constant coefficients (i.e. any real problem) the integration has to be done approximately:

\[ \int_E f(x)\; dx \approx \sum_q f(x_q) w_q \]

for certain quadrature points $x_q$ and weights $w_q$. An FEQuadrature is used to evaluate finite element functions at quadrature points, and to compute weights $w_q$ for a given element.

In this concrete implementation, the reference element $R$ is the square $[-1,1]\times[-1,1]$. On a given element, nodes (o) and quadrature points (*) are ordered as follows:

         3 o------------------o  2
           |  3             2 |
           |    *        *    |
           |                  |
           |                  |
           |    *        *    |
           |  0            1  |
        0  o------------------o  1

So there are four quad points per element, which occur at $x,y=\pm 1/\sqrt{3}$. This corresponds to the tensor product of Gaussian integration on an interval that is exact for cubic functions on the interval.

Integration on a physical element can be thought of as being done by change of variables. The quadrature weights need to be modified, and the FEQuadrature takes care of this for you. Because all elements in an IceGrid are congruent, the quadrature weights are the same for each element, and are computed upon initialization with an IceGrid.

See also: FiniteElement/IceGrid background material.

Definition at line 380 of file FETools.hh.


Constructor & Destructor Documentation

Definition at line 202 of file FETools.cc.


Member Function Documentation

void computeTrialFunctionValues ( const PetscReal x,
PetscReal vals 
)

Compute the values at the quadrature ponits of a scalar-valued finite-element function with element-local degrees of freedom x.

There should be room for FEQuadrature::Nq values in the output vector vals.

Definition at line 258 of file FETools.cc.

References m_germs, Nk, Nq, and FEFunctionGerm::val.

Referenced by SSAFEM_Forward::assemble_T_rhs(), SSAFEM_Forward::assemble_TStarA_rhs(), SSAFEM_Forward::assemble_TStarB_rhs(), SSAFEM::compute_local_function(), SSAFEM::compute_local_jacobian(), computeTrialFunctionValues(), SSAFEM_Forward::domainIP_core(), SSAFEM_Forward::rangeIP_core(), SSAFEM_Forward::set_tauc(), and SSAFEM::setup().

void computeTrialFunctionValues ( PetscInt  i,
PetscInt  j,
const FEDOFMap dof,
PetscReal const *const *  xg,
PetscReal vals,
PetscReal dx,
PetscReal dy 
)

Compute the values and first derivatives at the quadrature points on element (i,j) of a scalar-valued finite-element function with global degrees of freedom x.

There should be room for FEQuadrature::Nq values in the output vectors vals, dx, and dy.

Definition at line 300 of file FETools.cc.

References computeTrialFunctionValues(), FEDOFMap::extractLocalDOFs(), and m_tmpScalar.

void computeTrialFunctionValues ( PetscInt  i,
PetscInt  j,
const FEDOFMap dof,
PISMVector2 const *const *  xg,
PISMVector2 *  vals,
PetscReal(*)  Dv[3] 
)

Compute the values and symmetric gradient at the quadrature points of a vector-valued finite-element function on element (i,j) with global degrees of freedom xg.

There should be room for FEQuadrature::Nq values in the output vectors vals and Dv. Each entry of Dv is an array of three numbers:

\[\left[\frac{du}{dx},\frac{dv}{dy},\frac{1}{2}\left(\frac{du}{dy}+\frac{dv}{dx}\right)\right]\]

.

Definition at line 387 of file FETools.cc.

References computeTrialFunctionValues(), FEDOFMap::extractLocalDOFs(), and m_tmpVector.

void computeTrialFunctionValues ( const PISMVector2 *  x,
PISMVector2 *  vals 
)

Compute the values at the quadrature points of a vector-valued finite-element function with element-local degrees of freedom x.

There should be room for FEQuadrature::Nq values in the output vector vals.

Definition at line 310 of file FETools.cc.

References m_germs, Nk, Nq, and FEFunctionGerm::val.

void computeTrialFunctionValues ( const PISMVector2 *  x,
PISMVector2 *  vals,
PetscReal(*)  Dv[3] 
)

Compute the values and symmetric gradient at the quadrature points of a vector-valued finite-element function with element-local degrees of freedom x.

There should be room for FEQuadrature::Nq values in the output vectors vals and Dv. Each entry of Dv is an array of three numbers:

\[\left[\frac{du}{dx},\frac{dv}{dy},\frac{1}{2}\left(\frac{du}{dy}+\frac{dv}{dx}\right)\right]\]

.

Definition at line 329 of file FETools.cc.

References FEFunctionGerm::dx, FEFunctionGerm::dy, m_germs, Nk, Nq, and FEFunctionGerm::val.

void computeTrialFunctionValues ( const PISMVector2 *  x,
PISMVector2 *  vals,
PISMVector2 *  dx,
PISMVector2 *  dy 
)

Compute the values and symmetric gradient at the quadrature points of a vector-valued finite-element function with element-local degrees of freedom x.

There should be room for FEQuadrature::Nq values in the output vectors vals, \ dx, and dy. Each element of dx is the derivative of the vector-valued finite-element function in the x direction, and similarly for dy.

Definition at line 352 of file FETools.cc.

References FEFunctionGerm::dx, FEFunctionGerm::dy, m_germs, Nk, Nq, and FEFunctionGerm::val.

void computeTrialFunctionValues ( const PetscReal x,
PetscReal vals,
PetscReal dx,
PetscReal dy 
)

Compute the values and first derivatives at the quadrature points of a scalar-valued finite-element function with element-local degrees of freedom x.

There should be room for FEQuadrature::Nq values in the output vectors vals, dx, and dy.

Definition at line 274 of file FETools.cc.

References FEFunctionGerm::dx, FEFunctionGerm::dy, m_germs, Nk, Nq, and FEFunctionGerm::val.

void computeTrialFunctionValues ( PetscInt  i,
PetscInt  j,
const FEDOFMap dof,
PISMVector2 const *const *  xg,
PISMVector2 *  vals 
)

Compute the values at the quadrature points of a vector-valued finite-element function on element (i,j) with global degrees of freedom xg.

There should be room for FEQuadrature::Nq values in the output vectors vals.

Definition at line 374 of file FETools.cc.

References computeTrialFunctionValues(), FEDOFMap::extractLocalDOFs(), and m_tmpVector.

void computeTrialFunctionValues ( PetscInt  i,
PetscInt  j,
const FEDOFMap dof,
PetscReal const *const *  xg,
PetscReal vals 
)

Compute the values at the quadrature points on element (i,j) of a scalar-valued finite-element function with global degrees of freedom x.

There should be room for FEQuadrature::Nq values in the output vector vals.

Definition at line 290 of file FETools.cc.

References computeTrialFunctionValues(), FEDOFMap::extractLocalDOFs(), and m_tmpScalar.

void getWeightedJacobian ( PetscReal jxw)
void init ( const IceGrid &  g,
PetscScalar  L = 1. 
)

Obtain the weights $w_q$ for quadrature.

ref.Length();

ref.Length();

Definition at line 216 of file FETools.cc.

References FEFunctionGerm::dx, FEFunctionGerm::dy, FEShapeQ1::eval(), L, m_germs, m_jacobianDet, Nk, Nq, and quadPoints.

Referenced by SSAFEM::SSAFEM().

const FEFunctionGerm(* testFunctionValues ( ) )[Nq]
const FEFunctionGerm * testFunctionValues ( PetscInt  q,
PetscInt  k 
)

Return the values at quadrature point q of shape function k.

Definition at line 249 of file FETools.cc.

References m_germs.

const FEFunctionGerm * testFunctionValues ( PetscInt  q)

Return the values of all shape functions at quadrature point q.

Definition at line 243 of file FETools.cc.

References m_germs.


Member Data Documentation

FEFunctionGerm m_germs[Nq][Nk] [protected]

Shape function values (for each of Nq quadrature points, and each of Nk shape function )

Definition at line 422 of file FETools.hh.

Referenced by computeTrialFunctionValues(), init(), and testFunctionValues().

PetscReal m_jacobianDet [protected]

The Jacobian determinant of the map from the reference element to the physical element.

Definition at line 420 of file FETools.hh.

Referenced by getWeightedJacobian(), and init().

PetscReal m_tmpScalar[Nk] [protected]

Definition at line 424 of file FETools.hh.

Referenced by computeTrialFunctionValues().

PISMVector2 m_tmpVector[Nk] [protected]

Definition at line 425 of file FETools.hh.

Referenced by computeTrialFunctionValues().

const PetscInt Nk = 4 [static]
const PetscInt Nq = 4 [static]
const PetscReal quadPoints [static]
Initial value:
 
                                          {{ -0.57735026918962573, -0.57735026918962573 },
                                           {  0.57735026918962573, -0.57735026918962573 },
                                           {  0.57735026918962573,  0.57735026918962573 },
                                           { -0.57735026918962573,  0.57735026918962573 }}

The coordinates of the quadrature points on the reference element.

The quadrature points on the reference square $x,y=\pm 1/\sqrt{3}$.

Definition at line 413 of file FETools.hh.

Referenced by init().

const PetscReal quadWeights = {1,1,1,1} [static]

The weights for quadrature on the reference element.

The weights w_i for gaussian quadrature on the reference element with these quadrature points.

Definition at line 415 of file FETools.hh.

Referenced by getWeightedJacobian().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines