# SymFEL.jl Documentation

Testing

This package contains several functions usefull for the implementation of the finite elements method (FEM). We use the package SymPy for the computation of the basis finite element functions for both Lagrange and Hermite finite elements. We also compute the elementary matrices in 1d and for quadragular elements in 2d. For the two dimensional meshes we employ Gmsh. The Gmsh SDK should be installed in your path following the instruction on the Gmsh site.

The utilisation of the package is illustrated by several examples in 1d and 2d.

A documentation website is available at http://lmbp.uca.fr/~cindea/software/SymFEL.jl/.

Here are some features to develop in the next versions:

• 3d finite elements on quadragular meshes
• 2d triangular finite elements
• 3d tetrahedral finite elements
• combine the symbolic integration to numerical integration to speed-up the execution.

## SymFEl.jl

SymFEL.get_emFunction
get_em(deg1=1, deg2=1, der1=0, der2=0; fe1="Lagrange", fe2="Lagrange")

Gives 1d elementary matrices for Lagrange and Hermite elements.

The elementary matrices are computed for elements of length h.

source
SymFEL.get_square_emMethod
get_square_em(Mx::Array{SymPy.Sym, 2},
My::Array{SymPy.Sym, 2},
nc::Tuple{Array{Int64,1},Array{Int64,1}},
nr::Tuple{Array{Int64,1},Array{Int64,1}})

Get elementary matrices for a squared or a rectangular element.

Arguments

• Mx : elementary matrix for the x variable.
• My : elementary matrix for the y variable
• nc : order of nodes for column
• nr : order of nodes for row
source
SymFEL.get_cube_emMethod
get_cube_em(Mx::Array{SymPy.Sym, 2},
My::Array{SymPy.Sym, 2},
Mz::Array{SymPy.Sym, 2},
nc::Tuple{Array{Int64,1},Array{Int64,1},Array{Int64,1}},
nr::Tuple{Array{Int64,1},Array{Int64,1}},Array{Int64,1})

Get elementary matrices for a cube or a rectangular hexahedron element.

Arguments

• Mx : elementary matrix for the x variable.
• My : elementary matrix for the y variable
• Mz : elementary matrix for the z variable
• nc : order of nodes for column
• nr : order of nodes for row
source

## Lagrange finite elements

SymFEL.get_lagrange_emFunction
get_lagrange_em(p = 1, m = 0, n = 0)

Get Lagrange finite elements elementary matrices.

Arguments

• p: degree of polynomials in the basis.
• m: number of derivatives on the first function.
• n: number of derivatives on the second function.
source
SymFEL.get_lagrange_em_varcoeffFunction
get_lagrange_em_varcoeff(p = 1, m = 0, n = 0, f = 1)

Get Hermite finite elements elementary matrices for variable coefficients.

Arguments

• p: degree of polynomials in the basis.
• m: number of derivatives on the first function.
• n: number of derivatives on the second function.
• f: the variable coefficient.
source
SymFEL.get_square_lagrange_emFunction
get_square_lagrange_em((px, py) = (1, 1), (mx, my) = (0, 0), (nx, ny) = (0, 0))

Get Lagrange finite elements elementary matrices for a squared element.

Arguments

• (px, py) : degree of polynomials in the basis.
• (mx, my) : number of derivatives on the first function wrt x and y
• (nx, ny) : number of derivatives on the second function wrt x and y

Remarks

The current version works only for px, py in {1, 2}

source

## Hermite finite elements

SymFEL.get_hermite_emFunction
get_hermite_em(p = 3, m = 0, n = 0)

Get Hermite finite elements elementary matrices.

Arguments

• p: degree of polynomials in the basis.
• m: number of derivatives on the first function.
• n: number of derivatives on the second function.
source
SymFEL.get_hermite_em_varcoeffFunction
get_hermite_em_varcoeff(p = 3, m = 0, n = 0, f = 1)
Get Hermite finite elements elementary matrices for variable coefficients.

Arguments

• p: degree of polynomials in the basis.
• m: number of derivatives on the first function.
• n: number of derivatives on the second function.
• f: the variable coefficient.
source
SymFEL.get_square_hermite_em((px, py) = (3, 3), (mx, my) = (0, 0), (nx, ny) = (0, 0))
SymFEL.interpolateMethod
interpolate(fd::Matrix{Float64}, t::Vector{Float64}, ti::Vector{Float64})

Interpolates fd from t to ti.

Arguments:

• fd: values and derivatives of function to interpolate.
• t: values in which fd is known.
• ti: values in which fd is interpolated.
source

## Assembling functions – 1d

SymFEL.assemble_1d_FE_matrixMethod
assemble_1d_FE_matrix(elem::Array{Float64, 2}, nbNodes::Int64;
intNodes = 0, dof1 = 1, dof2 = 1)

Assemble a finite elements matrix corresponding to a 1 dimensional uniform mesh.

Arguments

• elem : elementary finite elements matrix
• nbNodes : number of nodes in the mesh
• intNodes1 : number of interior nodes in the interior of each element for lhs
• intNodes2 : number of interior nodes in the interior of each element for rhs
• dof1 : number of degrees of freedom for each node for lhs
• dof2 : number of degrees of freedom for each node for rhs
source
SymFEL.assemble_1d_nu_FE_matrixMethod
assemble_1d_nu_FE_matrix(elem::Matrix{SymPy.Sym}, nodes::Array{Float64, 1};
intNodes = 0, dof1 = 1, dof2 = 1)

Assemble a finite elements matrix corresponding to a 1 dimensional non-uniform mesh.

Arguments

• elem : elementary finite elements matrix (with elements of type SymPy.Sym)
• nodes : vector of nodes composing the non uniform-mesh
• intNodes1 : number of interior nodes in the interior of each element for lhs
• intNodes2 : number of interior nodes in the interior of each element for rhs
• dof1 : number of degrees of freedom for each node for lhs
• dof2 : number of degrees of freedom for each node for rhs
source

## Assembling functions – 2d

SymFEL.assemble_squaremesh_FE_matrixMethod
assemble_squaremesh_FE_matrix(el_mat::Array{Float64, 2},
elements::Array{Int64, 2};
order1 = 1, order2 = 1,
dof1 = 1, dof2 = 1)

Assemble a finite elements matrix corresponding to a 2 dimensional square mesh.

Arguments

• el_mat : elementary finite elements matrix
• elements : list of elements
• order1 : order for lhs
• order2 : order for rhs
• dof1 : number of degrees of freedom for each node for lhs
• dof2 : number of degrees of freedom for each node for rhs
source
SymFEL.assemble_squaremesh_FE_matrixMethod
assemble_squaremesh_FE_matrix(el_mat::Array{Float64, 2},
elements::Array{Int64, 2},
el_labels::Array{Int64, 1};
order1 = 1,
order2 = 1,
dof1 = 1,
dof2 = 1)

Assemble a finite elements matrix corresponding to a 2 dimensional square mesh.

Arguments

• el_mat : elementary finite elements matrix
• elements : list of elements
• el_labels: list of element numbers on which we integrate
• order1 : order for lhs
• order2 : order for rhs
• dof1 : number of degrees of freedom for each node for lhs
• dof2 : number of degrees of freedom for each node for rhs
source
SymFEL.assemble1d_squaremesh_FE_matrixMethod
assemble1d_squaremesh_FE_matrix(el_mat::Array{Float64, 2},
elements::Array{Int64, 2},
el_labels::Array{Int64, 1};
order1 = 1,
order2 = 1,
dof1 = 1,
dof2 = 1)

Assemble a finite elements matrix corresponding to a 2 dimensional square mesh.

Arguments

• el_mat : elementary finite elements matrix
• elements : list of elements
• elements1s: list of 1d elements
• order1 : order for lhs
• order2 : order for rhs
• dof1 : number of degrees of freedom for each node for lhs
• dof2 : number of degrees of freedom for each node for rhs
source

## Assembling functions – 3d

SymFEL.assemble_cubemesh_FE_matrixMethod
assemble_cubemesh_FE_matrix(el_mat::Array{Float64, 2},
elements::Array{UInt64, 2};
order1 = 1, order2 = 1,
dof1 = 1, dof2 = 1)

Assemble a finite elements matrix corresponding to a 3 dimensional cube mesh.

Arguments

• el_mat : elementary finite elements matrix
• elements : list of elements
• order1 : order for lhs
• order2 : order for rhs
• dof1 : number of degrees of freedom for each node for lhs
• dof2 : number of degrees of freedom for each node for rhs
source
SymFEL.assemble_cubemesh_FE_matrixMethod
assemble_cubemesh_FE_matrix(el_mat::Array{Float64, 2},
elements::Array{UInt64, 2},
el_labels::Array{UInt64, 1};
order1 = 1,
order2 = 1,
dof1 = 1,
dof2 = 1)

Assemble a finite elements matrix corresponding to a 3 dimensional cube mesh.

Arguments

• el_mat : elementary finite elements matrix
• elements : list of elements
• el_labels: list of element numbers on which we integrate
• order1 : order for lhs
• order2 : order for rhs
• dof1 : number of degrees of freedom for each node for lhs
• dof2 : number of degrees of freedom for each node for rhs
source
SymFEL.assemble2d_cubemesh_FE_matrixMethod
assemble2d_cubemesh_FE_matrix(el_mat::Array{Float64, 2},
elements::Array{UInt64, 2},
el_labels::Array{UInt64, 1};
order1 = 1,
order2 = 1,
dof1 = 1,
dof2 = 1)

Assemble a finite elements matrix corresponding to a 3 dimensional cube mesh.

Arguments

• el_mat : elementary finite elements matrix
• elements : list of elements
• elements1s: list of 1d elements
• order1 : order for lhs
• order2 : order for rhs
• dof1 : number of degrees of freedom for each node for lhs
• dof2 : number of degrees of freedom for each node for rhs
source