Meshes

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:

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

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

source

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.

source

fem_squaremesh(square,h)

Returns the grid in the iFEM form of the two arrays (node,elem)

source

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")
source

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)
source

Example Meshes

meshExample_bunny() : Returns a 3D SimpleMesh.

source

meshExample_flowpastcylindermesh() : Returns a 2D SimpleMesh.

source

meshExample_lakemesh() : Returns a 2D SimpleMesh.

source

meshExample_Lshapemesh() : Returns a 2D SimpleMesh.

source

meshExample_Lshapeunstructure() : Returns a 2D SimpleMesh.

source

meshExample_oilpump() : Returns a 3D SimpleMesh.

source

meshExample_wavymesh() : Returns a 2D SimpleMesh.

source

meshExample_wavyperturbmesh() : Returns a 3D SimpleMesh.

source

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.