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.
Contents
SymFEl.jl
SymFEL.x
— Constantx = SymPy.symbols("x")
Symbolic variable x.
This variable is exported.
SymFEL.y
— Constanty = SymPy.symbols("y")
Symbolic variable y.
This variable is exported.
SymFEL.z
— Constantz = SymPy.symbols("z")
Symbolic variable z.
This variable is exported.
SymFEL.h
— Constanth = SymPy.symbols("h")
Symbolic variable h.
This variable is exported.
SymFEL.hx
— Constanthx = SymPy.symbols("hx")
Symbolic variable h.
This variable is exported.
SymFEL.hy
— Constanthy = SymPy.symbols("hy")
Symbolic variable hy.
This variable is exported.
SymFEL.hz
— Constanthz = SymPy.symbols("hz")
Symbolic variable hz.
This variable is exported.
SymFEL.get_em
— Functionget_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
.
SymFEL.get_square_em
— Methodget_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 variablenc
: order of nodes for columnnr
: order of nodes for row
SymFEL.get_cube_em
— Methodget_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 variableMz
: elementary matrix for the z variablenc
: order of nodes for columnnr
: order of nodes for row
Lagrange finite elements
SymFEL.get_lagrange_basis
— Functionget_lagrange_basis(n = 1, varcoeff = false)
Get Lagrange basis function of order n
.
SymFEL.get_lagrange_em
— Functionget_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.
SymFEL.get_lagrange_em_varcoeff
— Functionget_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.
SymFEL.get_square_lagrange_em
— Functionget_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}
Hermite finite elements
SymFEL.get_hermite_basis
— Functionget_hermite_basis(n = 3, varcoeff = false)
Get Hermite basis function of order n
.
SymFEL.get_hermite_em
— Functionget_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.
SymFEL.get_hermite_em_varcoeff
— Functionget_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.
SymFEL.get_square_hermite_em((px, py) = (3, 3), (mx, my) = (0, 0), (nx, ny) = (0, 0))
SymFEL.interpolate
— Methodinterpolate(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 whichfd
is known.ti
: values in whichfd
is interpolated.
Assembling functions – 1d
SymFEL.Mesh1d
— TypeMesh1d
A type describing a mesh for a one dimensional domain.
SymFEL.assemble_1d_FE_matrix
— Methodassemble_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 matrixnbNodes
: number of nodes in the meshintNodes1
: number of interior nodes in the interior of each element for lhsintNodes2
: number of interior nodes in the interior of each element for rhsdof1
: number of degrees of freedom for each node for lhsdof2
: number of degrees of freedom for each node for rhs
SymFEL.assemble_1d_nu_FE_matrix
— Methodassemble_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-meshintNodes1
: number of interior nodes in the interior of each element for lhsintNodes2
: number of interior nodes in the interior of each element for rhsdof1
: number of degrees of freedom for each node for lhsdof2
: number of degrees of freedom for each node for rhs
Assembling functions – 2d
SymFEL.assemble_squaremesh_FE_matrix
— Methodassemble_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 matrixelements
: list of elementsorder1
: order for lhsorder2
: order for rhsdof1
: number of degrees of freedom for each node for lhsdof2
: number of degrees of freedom for each node for rhs
SymFEL.assemble_squaremesh_FE_matrix
— Methodassemble_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 matrixelements
: list of elementsel_labels
: list of element numbers on which we integrateorder1
: order for lhsorder2
: order for rhsdof1
: number of degrees of freedom for each node for lhsdof2
: number of degrees of freedom for each node for rhs
SymFEL.assemble1d_squaremesh_FE_matrix
— Methodassemble1d_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 matrixelements
: list of elementselements1s
: list of 1d elementsorder1
: order for lhsorder2
: order for rhsdof1
: number of degrees of freedom for each node for lhsdof2
: number of degrees of freedom for each node for rhs
Assembling functions – 3d
SymFEL.assemble_cubemesh_FE_matrix
— Methodassemble_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 matrixelements
: list of elementsorder1
: order for lhsorder2
: order for rhsdof1
: number of degrees of freedom for each node for lhsdof2
: number of degrees of freedom for each node for rhs
SymFEL.assemble_cubemesh_FE_matrix
— Methodassemble_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 matrixelements
: list of elementsel_labels
: list of element numbers on which we integrateorder1
: order for lhsorder2
: order for rhsdof1
: number of degrees of freedom for each node for lhsdof2
: number of degrees of freedom for each node for rhs
SymFEL.assemble2d_cubemesh_FE_matrix
— Methodassemble2d_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 matrixelements
: list of elementselements1s
: list of 1d elementsorder1
: order for lhsorder2
: order for rhsdof1
: number of degrees of freedom for each node for lhsdof2
: number of degrees of freedom for each node for rhs