2015-10-28 04:29:14 +02:00
|
|
|
# This file is a part of JuliaFEM.
|
|
|
|
|
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
|
|
|
|
|
|
|
|
|
# Functions to handle global assembly of problem
|
|
|
|
|
|
2015-11-27 10:10:00 +02:00
|
|
|
function assemble!(assembly::Assembly, problem::AllProblems, time::Float64, empty_assembly::Bool=true)
|
2015-11-24 03:06:56 +02:00
|
|
|
if empty_assembly
|
|
|
|
|
empty!(assembly)
|
|
|
|
|
end
|
2015-11-27 10:10:00 +02:00
|
|
|
for element in get_elements(problem)
|
|
|
|
|
assemble!(assembly, problem, element, time)
|
2015-11-24 03:06:56 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2015-11-27 10:10:00 +02:00
|
|
|
function assemble(problem::AllProblems, time::Float64)
|
2015-11-24 03:06:56 +02:00
|
|
|
assembly = Assembly()
|
2015-11-27 10:10:00 +02:00
|
|
|
for element in get_elements(problem)
|
|
|
|
|
assemble!(assembly, problem, element, time)
|
2015-10-28 04:29:14 +02:00
|
|
|
end
|
2015-11-24 03:06:56 +02:00
|
|
|
return assembly
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function Base.(:+)(ass1::Assembly, ass2::Assembly)
|
|
|
|
|
mass_matrix = ass1.mass_matrix + ass2.mass_matrix
|
|
|
|
|
stiffness_matrix = ass1.stiffness_matrix + ass2.stiffness_matrix
|
|
|
|
|
force_vector = ass1.force_vector + ass2.force_vector
|
|
|
|
|
return Assembly(mass_matrix, stiffness_matrix, force_vector)
|
2015-10-28 04:29:14 +02:00
|
|
|
end
|