Assembly
Ferrite.start_assemble — Functionstart_assemble([N=0]) -> AssemblerCreate an Assembler object which can be used to assemble element contributions to the global sparse matrix. Use assemble! for each element, and end_assemble, to finalize the assembly and return the sparse matrix.
Note that giving a sparse matrix as input can be more efficient. See below and as described in the manual.
When the same matrix pattern is used multiple times (for e.g. multiple time steps or Newton iterations) it is more efficient to create the sparse matrix once and reuse the same pattern. See the manual section on assembly.
start_assemble(K::SparseMatrixCSC; fillzero::Bool=true) -> AssemblerSparsityPattern
start_assemble(K::SparseMatrixCSC, f::Vector; fillzero::Bool=true) -> AssemblerSparsityPatternCreate a AssemblerSparsityPattern from the matrix K and optional vector f.
start_assemble(K::Symmetric{SparseMatrixCSC}; fillzero::Bool=true) -> AssemblerSymmetricSparsityPattern
start_assemble(K::Symmetric{SparseMatrixCSC}, f::Vector=Td[]; fillzero::Bool=true) -> AssemblerSymmetricSparsityPatternCreate a AssemblerSymmetricSparsityPattern from the matrix K and optional vector f.
AssemblerSparsityPattern and AssemblerSymmetricSparsityPattern allocate workspace necessary for efficient matrix assembly. To assemble the contribution from an element, use assemble!.
The keyword argument fillzero can be set to false if K and f should not be zeroed out, but instead keep their current values.
Ferrite.assemble! — Functionassemble!(a::Assembler, dofs, Ke)Assembles the element matrix Ke into a.
assemble!(a::Assembler, rowdofs, coldofs, Ke)Assembles the matrix Ke into a according to the dofs specified by rowdofs and coldofs.
assemble!(g, dofs, ge)Assembles the element residual ge into the global residual vector g.
assemble!(A::AbstractSparseAssembler, dofs::AbstractVector{Int}, Ke::AbstractMatrix)
assemble!(A::AbstractSparseAssembler, dofs::AbstractVector{Int}, Ke::AbstractMatrix, fe::AbstractVector)Assemble the element stiffness matrix Ke (and optional force vector fe) into the global stiffness (and force) in A, given the element degrees of freedom dofs.
This is equivalent to K[dofs, dofs] += Ke and f[dofs] += fe, where K is the global stiffness matrix and f the global force/residual vector, but more efficient.
Ferrite.end_assemble — Functionend_assemble(a::Assembler) -> KFinalizes an assembly. Returns a sparse matrix with the assembled values. Note that this step is not necessary for AbstractSparseAssemblers.
Ferrite.create_sparsity_pattern — Functioncreate_sparsity_pattern(dh::DofHandler; coupling)Create the sparsity pattern corresponding to the degree of freedom numbering in the DofHandler. Return a SparseMatrixCSC with stored values in the correct places.
The keyword argument coupling can be used to specify how fields (or components) in the dof handler couple to each other. coupling should be a square matrix of booleans with number of rows/columns equal to the total number of fields, or total number of components, in the DofHandler with true if fields are coupled and false if not. By default full coupling is assumed.
See the Sparsity Pattern section of the manual.
create_sparsity_pattern(dh::AbstractDofHandler, ch::ConstraintHandler; coupling)Create a sparsity pattern accounting for affine constraints in ch. See the Affine Constraints section of the manual for further details.
Ferrite.create_symmetric_sparsity_pattern — Functioncreate_symmetric_sparsity_pattern(dh::DofHandler; coupling)Create the symmetric sparsity pattern corresponding to the degree of freedom numbering in the DofHandler by only considering the upper triangle of the matrix. Return a Symmetric{SparseMatrixCSC}.
See the Sparsity Pattern section of the manual.
create_symmetric_sparsity_pattern(dh::AbstractDofHandler, ch::ConstraintHandler, coupling)Create a symmetric sparsity pattern accounting for affine constraints in ch. See the Affine Constraints section of the manual for further details.