mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-30 13:29:22 +00:00
2d mortar
This commit is contained in:
+28
-20
@@ -15,7 +15,7 @@ type DirichletProblem <: BoundaryProblem
|
||||
unknown_field_name :: ASCIIString
|
||||
unknown_field_dimension :: Int
|
||||
equations :: Vector{DirichletEquation}
|
||||
element_mapping :: Dict{Element, Equation}
|
||||
# element_mapping :: Dict{DataType, DataType}
|
||||
field_value :: Function
|
||||
end
|
||||
|
||||
@@ -36,14 +36,15 @@ Create u(X) = 0.0 boundary condition for three-dimensional elasticity problem:
|
||||
>>> u(X) = [0.0, 0.0, 0.0]
|
||||
>>> bc = DirichletProblem(3, u)
|
||||
"""
|
||||
function DirichletProblem(dimension::Int=1, field_value::Function=(X)->[0.0,0.0,0.0])
|
||||
element_mapping = nothing
|
||||
if dimension == 1
|
||||
element_mapping = Dict(
|
||||
Seg2 => DBC2D2
|
||||
)
|
||||
end
|
||||
DirichletProblem("reaction force", dimension, [], element_mapping, field_value)
|
||||
function DirichletProblem(dimension::Int=1, field_value::Function=(X)->[0.0,0.0,0.0], equations=[])
|
||||
# element_mapping = nothing
|
||||
# if dimension == 1
|
||||
# element_mapping = Dict(
|
||||
# Seg2 => DBC2D2
|
||||
# )
|
||||
# end
|
||||
DirichletProblem("reaction force", dimension, equations, field_value)
|
||||
# DirichletProblem("reaction force", dimension, [], element_mapping, field_value)
|
||||
end
|
||||
|
||||
""" Dirichlet boundary condition element for 2 node line segment """
|
||||
@@ -51,17 +52,22 @@ type DBC2D2 <: DirichletEquation
|
||||
element :: Seg2
|
||||
integration_points :: Vector{IntegrationPoint}
|
||||
end
|
||||
function DBC2D2(element::Seg2)
|
||||
integration_points = default_integration_points(element)
|
||||
if !haskey(element, "reaction force")
|
||||
element["reaction force"] = zeros(1, 2)
|
||||
end
|
||||
|
||||
function Base.size(equation::DBC2D2)
|
||||
return (1, 2)
|
||||
end
|
||||
|
||||
#function DBC2D2(element::Seg2)
|
||||
function Base.convert(::Type{DirichletEquation}, element::Seg2)
|
||||
integration_points = line3()
|
||||
haskey(element, "reaction force") || (element["reaction force"] = zeros(1, 2))
|
||||
DBC2D2(element, integration_points)
|
||||
end
|
||||
Base.size(equation::DBC2D2) = (1, 2)
|
||||
|
||||
|
||||
function assemble!(assembly::Assembly, equation::DirichletEquation, time::Number=0.0, problem=nothing)
|
||||
gdofs = get_gdofs(equation)
|
||||
# info("gdofs = $gdofs")
|
||||
element = get_element(equation)
|
||||
basis = get_basis(element)
|
||||
detJ = det(basis)
|
||||
@@ -69,11 +75,13 @@ function assemble!(assembly::Assembly, equation::DirichletEquation, time::Number
|
||||
w = ip.weight * detJ(ip)
|
||||
N = basis(ip, time)
|
||||
add!(assembly.stiffness_matrix, gdofs, gdofs, w*N'*N)
|
||||
if !isa(problem, Void)
|
||||
X = basis("geometry", ip, time)
|
||||
u = problem.field_value(X)
|
||||
add!(assembly.force_vector, gdofs, w*N'*u)
|
||||
end
|
||||
# info("added $(w*N'*N)")
|
||||
# if !isa(problem, Void)
|
||||
# X = basis("geometry", ip, time)
|
||||
# u = problem.field_value(X)[1:length(gdofs)]
|
||||
# add!(assembly.force_vector, gdofs, w*N'*u)
|
||||
# end
|
||||
end
|
||||
# info("assembly done")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user