Examples
smearFEM.apply_boundary_conditions
— MethodApply the Neumann slip boundary conditions to the global stiffness matrix
Arguments:
K: {[ndof,ndof] SparseMatrixCSC{Float64,Int64}} : sparse stiffness matrix ID: {[nNodes,nDof] Matrix{Int}} : matrix that maps the global degrees of freedom to the local degrees of freedom qd: {[ndof] Vector{Float64}} : Dirichlet boundary conditions qn: {[ndof] Vector{Float64}} : Neumann boundary conditions
Returns:
K: {[ndof,ndof] SparseMatrixCSC{Float64,Int64}} : sparse stiffness matrix with the boundary conditions applied F: {[ndof] Vector{Float64}} : force vector
smearFEM.assemble_system
— Methodassemble_system(ne, NodeList, IEN, ndim, FunctionClass="Q1", nDof=1, ID=nothing, Young=1, ν=0.3)
Assembles the finite element system. # Returns the global stiffness matrix
Arguments:
ne::Interger
: number of elements in each directionNodeList::Matrix{Float64}{ndim,nNodes}
: coordinates of the nodesIEN::Matrix{Int}{nElements,nLocalNodes}
: connectivity matrixndim::Interger
: number of dimensionsnDof::Interger
: number of degree of freedom per nodeFunctionClass::String
: type of basis functions to be considered (Q1:quadratic or Q2:Lagrange)ID::Matrix{Int}{nNodes,nDof}
: matrix that maps the global degrees of freedom to the local degrees of freedomYoung::Float64
: Young's modulusν::Float64
: Poisson's ratio
Returns:
K::SparseMatrixCSC{Float64,Int64}{ndof,ndof}
: sparse stiffness matrix
smearFEM.get_cMat
— Functionget_cMat(type; λ=nothing, μ=nothing, Young=nothing, ν=nothing)
Returns the stiffness matrix for a given type of material
Arguments:
type::String
: type of constitutive matrix to be considered (lame or standard)λ::Float64
: Lame's first parameterμ::Float64
: Sheer modulusYoung::Float64
: Young's modulusν::Float64
: Poisson's ratio
Returns:
cMat::Matrix{Float64}
: constitutive matrix
smearFEM.initialize_mesh_test
— Functionfunction initialize_mesh_test(x0, x1, y0, y1, z0, z1, ne, ndim, FunctionClass, CameraMatrix, filepath=nothing)
Initialize the mesh and write the data to a file
Arguments:
x0::Float64
: x-coordinate of the lower left corner of the domainx1::Float64
: x-coordinate of the upper right corner of the domainy0::Float64
: y-coordinate of the lower left corner of the domainy1::Float64
: y-coordinate of the upper right corner of the domainz0::Float64
: z-coordinate of the lower left corner of the domainz1::Float64
: z-coordinate of the upper right corner of the domainne::Int
: number of elementsndim::Int
: number of dimensionsFunctionClass::String
: type of basis functionCameraMatrix::Matrix{Float64}
: camera matrixfilepath::String
: path to the file
smearFEM.set_file
— Methodset_file(filepath)
Create the directories to store the data
Arguments:
filepath::String
: path to the file
smearFEM.setboundaryCond
— FunctionSet the Dirichlet boundary conditions for the problem
Arguments:
NodeList::Matrix{Float64}{nNodes,ndim}
: array of nodesne::Int
: number of elementsndim::Int
: number of dimensionsFunctionClass::String
: type of basis function
Returns:
q_upper::Vector{Float64}
: vector of the Dirichlet boundary conditions (for ndof = 1) / Dirichlet boundary conditions upper surface (for ndof > 1)q_lower::Vector{Float64}
: vector of the Neumann boundary conditions (for ndof = 1) / Dirichlet boundary conditions lower surface (for ndof > 1)C_uc::SparseMatrixCSC{Float64,Int64}
: onstraint matrix
smearFEM.simulate
— Methodsimulate(x0, x1, y0, y1, z0, z1, ne, Young, ν, ndim, FunctionClass, nDof, β, CameraMatrix, endTime, tSteps, Control, cParam, cMat; writeData=false, filepath=nothing)
Simulate the deformation of a cylindrical under compression
Arguments:
x0::Float64
: x-coordinate of the lower left corner of the domainx1::Float64
: x-coordinate of the upper right corner of the domainy0::Float64
: y-coordinate of the lower left corner of the domainy1::Float64
: y-coordinate of the upper right corner of the domainz0::Float64
: z-coordinate of the lower left corner of the domainz1::Float64
: z-coordinate of the upper right corner of the domainne::Int
: number of elementsYoung::Float64
: Young's modulusν::Float64
: Poisson's rationdim::Int
: number of dimensionsFunctionClass::String
: type of basis functionnDof::Int
: number of degree of freedom per nodeβ::Float64
: friction parameterCameraMatrix::Matrix{Float64}
: camera matrixendTime::Float64
: end timetSteps::Int
: number of time steps to be takenControl::String
: type of control (force or displacement)cParam::Vector{Float64}
: control parameter (force or displacement prescribed at the top surface per time step)cMat::Matrix{Float64}
: control matrixwriteData::Bool
: write the data to a filefilepath::String
: path to the file
smearFEM.test
— Methodtest(x0, x1, y0, y1, z0, z1, ne, Young, ν, ndim, FunctionClass, nDof, β, CameraMatrix, endTime, tSteps, Control; writeData=false, filepath=nothing, mode = "standard")
Test the simulation
Arguments:
x0::Float64
: x-coordinate of the lower left corner of the domainx1::Float64
: x-coordinate of the upper right corner of the domainy0::Float64
: y-coordinate of the lower left corner of the domainy1::Float64
: y-coordinate of the upper right corner of the domainz0::Float64
: z-coordinate of the lower left corner of the domainz1::Float64
: z-coordinate of the upper right corner of the domainne::Int
: number of elementsYoung::Float64
: Young's modulusν::Float64
: Poisson's rationdim::Int
: number of dimensionsFunctionClass::String
: type of basis functionnDof::Int
: number of degree of freedom per nodeβ::Float64
: friction parameterCameraMatrix::Matrix{Float64}
: camera matrixendTime::Float64
: end timetSteps::Int
: number of time steps to be takenControl::String
: type of control (force or displacement)writeData::Bool
: write the data to a filefilepath::String
: path to the filemode::String
: type of constitutive matrix
smearFEM.write_sim_data
— Methodwrite_sim_data(x0, x1, y0, y1, z0, z1, ne, Young, ν, ndim, FunctionClass, nDof, β, CameraMatrix, endTime, tSteps, Control, filename; mode = "standard")
Initialize the simulation and write the data to a file
Arguments:
x0::Float64
: x-coordinate of the lower left corner of the domainx1::Float64
: x-coordinate of the upper right corner of the domainy0::Float64
: y-coordinate of the lower left corner of the domainy1::Float64
: y-coordinate of the upper right corner of the domainz0::Float64
: z-coordinate of the lower left corner of the domainz1::Float64
: z-coordinate of the upper right corner of the domainne::Int
: number of elementsYoung::Float64
: Young's modulusν::Float64
: Poisson's rationdim::Int
: number of dimensionsFunctionClass::String
: type of basis functionnDof::Int
: number of degree of freedom per nodeβ::Float64
: friction parameterCameraMatrix::Matrix{Float64}
: camera matrixendTime::Float64
: end timetSteps::Int
: number of time steps to be takenControl::String
: type of control (force or displacement)filename::String
: path to the file
smearFEM.apply_boundary_conditions_stokes
— MethodApply the Neumann slip boundary conditions to the global stiffness matrix
Arguments:
K: {[ndof,ndof] SparseMatrixCSC{Float64,Int64}} : sparse stiffness matrix ID: {[nNodes,nDof] Matrix{Int}} : matrix that maps the global degrees of freedom to the local degrees of freedom qd: {[ndof] Vector{Float64}} : Dirichlet boundary conditions qn: {[ndof] Vector{Float64}} : Neumann boundary conditions
Returns:
K: {[ndof,ndof] SparseMatrixCSC{Float64,Int64}} : sparse stiffness matrix with the boundary conditions applied F: {[ndof] Vector{Float64}} : force vector
smearFEM.assemble_system_A
— Methodassemble_system(ne, NodeList, IEN, ndim, FunctionClass="Q1", nDof=1, ID=nothing, Young=1, ν=0.3)
Assembles the finite element system. # Returns the global stiffness matrix
Arguments:
ne::Interger
: number of elements in each directionNodeList::Matrix{Float64}{ndim,nNodes}
: coordinates of the nodesIEN::Matrix{Int}{nElements,nLocalNodes}
: connectivity matrixndim::Interger
: number of dimensionsnDof::Interger
: number of degree of freedom per nodeFunctionClass::String
: type of basis functions to be considered (Q1:quadratic or Q2:Lagrange)ID::Matrix{Int}{nNodes,nDof}
: matrix that maps the global degrees of freedom to the local degrees of freedomYoung::Float64
: Young's modulusν::Float64
: Poisson's ratio
Returns:
K::SparseMatrixCSC{Float64,Int64}{ndof,ndof}
: sparse stiffness matrix
smearFEM.set_boundary_cond_stokes
— FunctionSet the Dirichlet boundary conditions for the problem
Arguments:
NodeList::Matrix{Float64}{nNodes,ndim}
: array of nodesne::Int
: number of elementsndim::Int
: number of dimensionsFunctionClass::String
: type of basis function
Returns:
q_upper::Vector{Float64}
: vector of the Dirichlet boundary conditions (for ndof = 1) / Dirichlet boundary conditions upper surface (for ndof > 1)q_lower::Vector{Float64}
: vector of the Neumann boundary conditions (for ndof = 1) / Dirichlet boundary conditions lower surface (for ndof > 1)C_uc::SparseMatrixCSC{Float64,Int64}
: onstraint matrix