FE Values¶
To assist with creating new finite elements JuAFEM has the concept of an object called
FEValues. The idea for this was taken from deal.ii_.
An FEValues object facilitates with evaluating shape functions, gradient of shape functions and evaluating values on operators of finite element discretized functions.
Initializing an FEValues object is done with two other objects. One FunctionSpace object and one QuadratureRule.
Function spaces¶
A function space is described by its name, for example Lagrange, an order of the base functions and a shape which the space is defined on.
The following function spaces are currently available:
Lagrange{1, JuaFEM.Line}Lagrange{2, JuaFEM.Line}Lagrange{1, JuaFEM.RefCube}Lagrange{1, JuaFEM.RefTetrahedron}Lagrange{1, JuaFEM.RefTetrahedron}Lagrange{2, JuaFEM.RefTetrahedron}Lagrange{1, JuaFEM.Cube}Serendipity{2, JuaFEM.RefCube}
Quadrature¶
Currently only Gauss quadrature is implemented. A QuadratureRule is created from get_gaussrule(shape, order) where shape is an instance of one of the shapes shown in the function space list above and order is the order of the quadrature rule.
Using FE Values¶
An example of creating a FEValues object is shown below.
Upon creation, FEValues caches the values of the shape functions and derivatives in the quadrature points.
The points of FEValues is that for each element you call reinit!(fev, x) where x is a Vector of `Tensor{1}`s. This will update the global shape function derivatives, jacobians, weights etc.
Different queries can now be performed.
Shape function queries¶
-
shape_value(fe_v, q_point::Int) → value¶ Gets the value of the shape function for a given quadrature point
-
shape_value(fe_v, q_point::Int, base_func::Int) → value Gets the value of the shape function at a given quadrature point and given base function
-
shape_gradient(fe_v, q_point::Int) → gradients::Vector{Tensor{2}}¶ Get the gradients of the shape functions for a given quadrature point
-
shape_gradient(fe_v, q_point::Int, base_func::Int) → gradient::Tensor{2} Get the gradient of the shape functions for a given quadrature point and base function
Discretized function queries¶
We can also compute different operatiors on a finite element discretized function:
-
function_scalar_value(fe_v, q_point::Int, u::Vector) → value¶ Computes the value in a quadrature point for a scalar valued function
-
function_vector_value(fe_v, q_point::Int, u::Vector{Tensor{1}}) → value::Tensor{1}¶ Computes the value in a quadrature point for a vector valued function.
-
function_scalar_gradient(fe_v, q_point::Int, u::Vector) → grad::Tensor{1}¶ Computes the gradient in a quadrature point for a scalar valued function.
-
function_vector_symmetric_gradient(fe_v, q_point::Int, u::Vector{Tensor{1}}) → sym_grad::SymmetricTensor{2}¶ Computes the symmetric gradient (jacobian) in a quadrature point for a vector valued function. Result is stored in
grad.
-
function_vector_divergence(fe_v, q_point::Int, u::Vector{Tensor{1}}) → divergence¶ Computes the divergence in a quadrature point for a vector valued function.