Meshes
Mesh Specification
Finite element meshes are specified in the (node,elem) structure due to Long Chen. For the standard elements used in this package, we describe a geometric figure by a triangulation. The nodes are the vertices of the triangle and the elements are the triangles themselves. These are encoded as follows:
Row $i$ of node is an $(x,y)$ (or $(x,y,z)$) pair which specifies the coordinates of the $i$th node.
Row $j$ of elem are the indices of the nodes which make the triangle. Thus in 2D each row has three numbers.
For example, to know the $(x,y)$ locations of the vertices of triangle $j$, we would see that node[elem[j,i],:]
are the $(x,y)$ locations of the $i$th vertex for $i=1,2,3$.
For more information, please see Programming of Finite Element Methods by Long Chen.
Mesh Generation Functions
DiffEqPDEBase.findboundary
— Function.findboundary(elem,bdflag=[])
`
findboundary(fem_mesh::FEMMesh,bdflag=[])
Finds elements which are on the boundary of the domain. If bdflag is given, then those indices are added as nodes for a dirichlet boundary condition (useful for creating cracks and other cutouts of domains).
Returns
bdnode
= Vector of indices for bdnode. Using node[:,bdnode] returns boundary nodes.
bdedge
= Vector of indices for boundary edges.
is_bdnode
= Vector of booleans size N which donotes which are on the boundary
is_bdelem
= Vector of booleans size NT which denotes which are on the boundary
DiffEqPDEBase.setboundary
— Function.setboundary(node::AbstractArray,elem::AbstractArray,bdtype)
setboundary(fem_mesh::FEMMesh,bdtype)
Takes in the fem_mesh and creates an array bdflag which denotes the boundary types. 1 stands for dirichlet, 2 for neumann, 3 for robin.
DiffEqPDEBase.fem_squaremesh
— Function.fem_squaremesh(square,h)
Returns the grid in the iFEM form of the two arrays (node,elem)
DiffEqPDEBase.notime_squaremesh
— Function.notime_squaremesh(square,dx,bdtype)
Computes the (node,elem) square mesh for the square with the chosen dx
and boundary settings.
###Example
square=[0 1 0 1] #Unit Square
dx=.25
notime_squaremesh(square,dx,"dirichlet")
DiffEqPDEBase.parabolic_squaremesh
— Function.parabolic_squaremesh(square,dx,dt,T,bdtype)
Computes the (node,elem) x [0,T]
parabolic square mesh for the square with the chosen dx
and boundary settings and with the constant time intervals dt
.
###Example
square=[0 1 0 1] #Unit Square
dx=.25; dt=.25;T=2
parabolic_squaremesh(square,dx,dt,T,:dirichlet)
Example Meshes
DiffEqProblemLibrary.meshExample_bunny
— Function.meshExample_bunny()
: Returns a 3D SimpleMesh.
meshExample_flowpastcylindermesh()
: Returns a 2D SimpleMesh.
DiffEqProblemLibrary.meshExample_lakemesh
— Function.meshExample_lakemesh()
: Returns a 2D SimpleMesh.
DiffEqProblemLibrary.meshExample_Lshapemesh
— Function.meshExample_Lshapemesh()
: Returns a 2D SimpleMesh.
meshExample_Lshapeunstructure()
: Returns a 2D SimpleMesh.
DiffEqProblemLibrary.meshExample_oilpump
— Function.meshExample_oilpump()
: Returns a 3D SimpleMesh.
DiffEqProblemLibrary.meshExample_wavymesh
— Function.meshExample_wavymesh()
: Returns a 2D SimpleMesh.
DiffEqProblemLibrary.meshExample_wavyperturbmesh
— Function.meshExample_wavyperturbmesh()
: Returns a 3D SimpleMesh.
Plot Functions
The plot functionality is provided by a Plots.jl recipe. What is plotted is a "trisurf" of the mesh. To plot a mesh, simply use:
plot(mesh::Mesh)
All of the functionality (keyword arguments) provided by Plots.jl are able to be used in this command. Please see the Plots.jl documentation for more information.