Quadrature

Ferrite.QuadratureRuleType
QuadratureRule{shape}([::Type{T},] [quad_rule_type::Symbol,] order::Int)
QuadratureRule{shape}(weights::AbstractVector{T}, points::AbstractVector{Vec{rdim, T}})

Create a QuadratureRule used for integration on the refshape shape (of type AbstractRefShape). order is the order of the quadrature rule. quad_rule_type is an optional argument determining the type of quadrature rule, currently the :legendre and :lobatto rules are implemented for hypercubes. For triangles up to order 8 the default rule is the one by :dunavant (see [6]) and for tetrahedra the default rule is keast_minimal (see [7]). Wedges and pyramids default to :polyquad (see [8]). Furthermore we have implemented

  • :gaussjacobi for triangles (order 9-15)
  • :keast_minimal (see [7]) for tetrahedra (order 1-5), containing negative weights
  • :keast_positive (see [7]) for tetrahedra (order 1-5), containing only positive weights

A QuadratureRule is used to approximate an integral on a domain by a weighted sum of function values at specific points:

$\int\limits_\Omega f(\mathbf{x}) \text{d} \Omega \approx \sum\limits_{q = 1}^{n_q} f(\mathbf{x}_q) w_q$

The quadrature rule consists of $n_q$ points in space $\mathbf{x}_q$ with corresponding weights $w_q$.

In Ferrite, the QuadratureRule type is mostly used as one of the components to create CellValues.

Common methods:

Example:

julia> qr = QuadratureRule{RefTriangle}(1)
QuadratureRule{RefTriangle, Float64, 2}([0.5], Vec{2, Float64}[[0.33333333333333, 0.33333333333333]])

julia> getpoints(qr)
1-element Vector{Vec{2, Float64}}:
 [0.33333333333333, 0.33333333333333]
source
Ferrite.FacetQuadratureRuleType
FacetQuadratureRule{shape}([::Type{T},] [quad_rule_type::Symbol,] order::Int)
FacetQuadratureRule{shape}(face_rules::NTuple{<:Any, <:QuadratureRule{shape}})
FacetQuadratureRule{shape}(face_rules::AbstractVector{<:QuadratureRule{shape}})

Create a FacetQuadratureRule used for integration of the faces of the refshape shape (of type AbstractRefShape). order is the order of the quadrature rule. If no symbol is provided, the default quad_rule_type for each facet's reference shape is used (see QuadratureRule). For non-default quad_rule_types on cells with mixed facet types (e.g. RefPrism and RefPyramid), the face_rules must be provided explicitly.

FacetQuadratureRule is used as one of the components to create FacetValues.

source
Ferrite.getnquadpointsMethod
getnquadpoints(qr::FacetQuadratureRule, face::Int)

Return the number of quadrature points in qr for local face index face.

source
Ferrite.getpointsFunction
getpoints(qr::QuadratureRule)
getpoints(qr::FacetQuadratureRule, face::Int)

Return the points of the quadrature rule.

Examples

julia> qr = QuadratureRule{RefTriangle}(:legendre, 2);

julia> getpoints(qr)
3-element Vector{Vec{2, Float64}}:
 [0.16666666666667, 0.16666666666667]
 [0.16666666666667, 0.66666666666667]
 [0.66666666666667, 0.16666666666667]
source
Ferrite.getweightsFunction
getweights(qr::QuadratureRule)
getweights(qr::FacetQuadratureRule, face::Int)

Return the weights of the quadrature rule.

Examples

julia> qr = QuadratureRule{RefTriangle}(:legendre, 2);

julia> getweights(qr)
3-element Array{Float64,1}:
 0.166667
 0.166667
 0.166667
source