Utilities

Plotting

eldraw2(ex, ey, [plotpar=[1,1,0], elnum=zeros(0)])

Draws the 2D mesh defined by ex, ey.

eldisp2(ex, ey, ed, [plotpar=[1,1,0], sfac=1.0])

Draws the displaced 2D mesh defined by ex, ey and the displacements given in ed.

Export to VTK

vtk_grid(Edof, Coord, Dof, nen, filename::AbstractString) → vtkgrid

Creates an unstructured VTK grid. nen is the number of nodes per element

To add cell data and point data and write the file see https://github.com/jipolanco/WriteVTK.jl#generating-an-unstructured-vtk-file

Solving system of equations

solveq(K, f, bc[, symmetric=false]) → a, fb

Solves the equation system Ka = f taking into account the Dirichlet boundary conditions in the matrix bc. Returns the solution vector a and reaction forces fb If symmetric is set to true, the matrix will be factorized with Cholesky factorization.

Coordinate extraction

extract(edof, a)

Extracts the element displacements from the global solution vector a given an edof matrix. This assumes all elements to have the same number of dofs.

coordxtr(Edof, Coord, Dof, nen) → Ex, Ey, Ez

Extracts the coordinates of the nodes of the elements.

This function can be slow for large number of elements.

topologyxtr(Edof, Coord, Dof, nen) → topology

Extracts the connectivity matrix.

This function can be slow for large number of elements.

Static condensation

statcon(K, f, cd) → K_cond, f_cond

Condenses out the dofs given in cd from K and f.

Assembler

start_assemble([N=0]) → Assembler

Call before starting an assembly.

Returns an Assembler type that is used to hold the intermediate data before an assembly is finished.

assemble(edof, a, Ke)

Assembles the element matrix Ke into a.

end_assemble(a::Assembler) → K

Finalizes an assembly. Returns a sparse matrix with the assembled values.