mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-24 11:16:47 +00:00
Bug/mortar discretization (#88)
* new mortar segmentation tests which are failing * test_problems_mortar_3d.jl: first test (Tet4) pass * solvers.jl: diagonal of A is now properly filled, if that option is used. Another option is to remove zero rows from matrix system, which is on by default * problems_mortar.jl: added new function diagnose_interface to calculate quantities from interface hopefully revealing bugs in calculation * problems_mortar_3d.jl: added docstring for check_orientation! and removed flooding debug messages not helping to debug anything * solvers.jl: Another way to solve Ax = b * Refactored code to make implementation of Tri6 assemble! easier * Patch test with linear Tet4 elements and quadratic Tet10 elements pass When using quadratic elements, in polygon clipping algorithm element is divided to linear sub-elements as proposed in [Puso2008]. Interpolation of Lagrange multiplier space is done using quadratic shape functions. References ---------- [Puso2008] Puso, Michael A., T. A. Laursen, and Jerome Solberg. "A segment-to-segment mortar contact method for quadratic elements and large deformations." Computer Methods in Applied Mechanics and Engineering 197.6 (2008): 555-566. * increased coverage by adding diagnose_interface * test using dual basis, failing for unknown reason * Fixed dual basis construction for Mortar/Tet4 The coefficient matrix Ae for one particular slave element e is the result performing numerical integration on *all* integration cells associated with this element [Popp2013]. Ae cannot be calculated "cell-wise" like it was done before. Now patch test will pass also using `interface.properties.dual_basis = true` option. Partially integrated slave elements are supported as well. References ---------- [Popp2013] Popp, Alexander, et al. "Improved robustness and consistency of 3D contact algorithms based on a dual mortar approach." Computer Methods in Applied Mechanics and Engineering 264 (2013): 67-80. * Minor modifications to preprocess.jl - removed two functions which are unimplemented (but maybe planned in future) - added function create_node_set_from_element_set!, which can be used, like name suggests, to create a node set from nodes belonging to some set of elements. * solvers.jl: now prints a list of overconstrained nodes which can be easily copy-pasted to problem.assembly.removed_dofs list to solver overconstrained situation manually * Increase code coverage Added a new test which tests dual basis 3d mortar + adjust option when using Tet4 in elasticity problem. * Tet10 + Dual basis still failing, others are working * mortar 3d low level tests * linear surface element projection tests pass * Introduced basis transform constant alpha Tet10 + dual basis patch test still failing, but single element low level routine tests gives expected results with alpha=0.2 * added new integration rule FPG12 for triangular elements * added drop_tolerance option to remove very small values from constraint matrices * Introduced a basis transform matrix T Constructing bi-orthogonal basis for quadratic surfaces is ill-conditioned. By doing a basis transform N' = N*T for slave side displacement vector it's possible to construct a bi-orthogonal basis in a same way than with linear elements. Setting alpha=0.2 ensures that quadratic basis functions are strictly positive in practical cases. * fix 3d clipping test routine, accepts only 3d vertices * dropped number of integration poitns from 12 to 7 in quadratic mortar surfaces intrestingly gives more accurate results, maybe something numerical error in FPG12 integration rule..? * added two displacement patch tests + output writing for all cases * %s/Int64/Int/g * Changed test data location * Fine tuning of logging levels
This commit is contained in:
committed by
Tero Frondelius
parent
a5c093c1d6
commit
f275ce3767
+27
-31
@@ -17,13 +17,13 @@ import Base: copy
|
||||
using JuliaFEM
|
||||
|
||||
type Mesh
|
||||
nodes :: Dict{Int64, Vector{Float64}}
|
||||
node_sets :: Dict{Symbol, Set{Int64}}
|
||||
elements :: Dict{Int64, Vector{Int64}}
|
||||
element_types :: Dict{Int64, Symbol}
|
||||
element_codes :: Dict{Int64, Symbol}
|
||||
element_sets :: Dict{Symbol, Set{Int64}}
|
||||
surface_sets :: Dict{Symbol, Vector{Tuple{Int64, Symbol}}}
|
||||
nodes :: Dict{Int, Vector{Float64}}
|
||||
node_sets :: Dict{Symbol, Set{Int}}
|
||||
elements :: Dict{Int, Vector{Int}}
|
||||
element_types :: Dict{Int, Symbol}
|
||||
element_codes :: Dict{Int, Symbol}
|
||||
element_sets :: Dict{Symbol, Set{Int}}
|
||||
surface_sets :: Dict{Symbol, Vector{Tuple{Int, Symbol}}}
|
||||
surface_types :: Dict{Symbol, Symbol}
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ function add_node!(mesh::Mesh, nid::Int, ncoords::Vector{Float64})
|
||||
mesh.nodes[nid] = ncoords
|
||||
end
|
||||
|
||||
function add_nodes!(mesh::Mesh, nodes::Dict{Int64, Vector{Float64}})
|
||||
function add_nodes!(mesh::Mesh, nodes::Dict{Int, Vector{Float64}})
|
||||
for (nid, ncoords) in nodes
|
||||
add_node!(mesh, nid, ncoords)
|
||||
end
|
||||
@@ -43,17 +43,28 @@ end
|
||||
|
||||
function add_node_to_node_set!(mesh::Mesh, set_name, nids...)
|
||||
if !haskey(mesh.node_sets, set_name)
|
||||
mesh.node_sets[set_name] = Set{Int64}()
|
||||
mesh.node_sets[set_name] = Set{Int}()
|
||||
end
|
||||
push!(mesh.node_sets[set_name], nids...)
|
||||
return
|
||||
end
|
||||
|
||||
function add_element!(mesh::Mesh, elid::Int, eltype::Symbol, connectivity::Vector{Int64})
|
||||
""" Create a new node set from nodes in element set. """
|
||||
function create_node_set_from_element_set!(mesh::Mesh, set_name)
|
||||
node_ids = Set{Int}()
|
||||
for elid in mesh.element_sets[set_name]
|
||||
push!(node_ids, mesh.elements[elid]...)
|
||||
end
|
||||
mesh.node_sets[set_name] = node_ids
|
||||
return
|
||||
end
|
||||
|
||||
function add_element!(mesh::Mesh, elid::Int, eltype::Symbol, connectivity::Vector{Int})
|
||||
mesh.elements[elid] = connectivity
|
||||
mesh.element_types[elid] = eltype
|
||||
end
|
||||
|
||||
function add_elements!(mesh::Mesh, elements::Dict{Int64, Tuple{Symbol, Vector{Int64}}})
|
||||
function add_elements!(mesh::Mesh, elements::Dict{Int, Tuple{Symbol, Vector{Int}}})
|
||||
for (elid, (eltype, elcon)) in elements
|
||||
add_element!(mesh, elid, eltype, elcon)
|
||||
end
|
||||
@@ -61,7 +72,7 @@ end
|
||||
|
||||
function add_element_to_element_set!(mesh::Mesh, set_name, elids...)
|
||||
if !haskey(mesh.element_sets, set_name)
|
||||
mesh.element_sets[set_name] = Set{Int64}()
|
||||
mesh.element_sets[set_name] = Set{Int}()
|
||||
end
|
||||
push!(mesh.element_sets[set_name], elids...)
|
||||
end
|
||||
@@ -76,7 +87,7 @@ function copy(mesh::Mesh)
|
||||
return mesh2
|
||||
end
|
||||
|
||||
function filter_by_element_id(mesh::Mesh, element_ids::Vector{Int64})
|
||||
function filter_by_element_id(mesh::Mesh, element_ids::Vector{Int})
|
||||
mesh2 = copy(mesh)
|
||||
mesh2.elements = Dict()
|
||||
for elid in element_ids
|
||||
@@ -113,7 +124,7 @@ function create_elements(mesh::Mesh, element_sets::Symbol...; element_type=nothi
|
||||
if isempty(element_sets)
|
||||
element_ids = collect(keys(mesh.elements))
|
||||
else
|
||||
element_ids = Set{Int64}()
|
||||
element_ids = Set{Int}()
|
||||
for set_name in element_sets
|
||||
element_ids = union(element_ids, mesh.element_sets[set_name])
|
||||
end
|
||||
@@ -135,7 +146,7 @@ end
|
||||
|
||||
""" find npts nearest nodes from mesh and return id numbers as list. """
|
||||
function find_nearest_nodes(mesh::Mesh, coords::Vector, npts=1)
|
||||
dist = Dict{Int64, Float64}()
|
||||
dist = Dict{Int, Float64}()
|
||||
for (nid, c) in mesh.nodes
|
||||
dist[nid] = norm(coords-c)
|
||||
end
|
||||
@@ -166,7 +177,7 @@ function reorder_element_connectivity!(mesh::Mesh, mapping::Dict{Symbol, Vector{
|
||||
end
|
||||
end
|
||||
|
||||
function JuliaFEM.Problem{P<:FieldProblem}(mesh::Mesh, ::Type{P}, name::AbstractString, dimension::Int64)
|
||||
function JuliaFEM.Problem{P<:FieldProblem}(mesh::Mesh, ::Type{P}, name::AbstractString, dimension::Int)
|
||||
problem = Problem(P, name, dimension)
|
||||
problem.elements = create_elements(mesh, name)
|
||||
return problem
|
||||
@@ -177,18 +188,3 @@ function JuliaFEM.Problem{P<:BoundaryProblem}(mesh::Mesh, ::Type{P}, name, dimen
|
||||
problem.elements = create_elements(mesh, name)
|
||||
return problem
|
||||
end
|
||||
|
||||
"""
|
||||
Swap surface element connectivity s.t. normals point outward
|
||||
"""
|
||||
function check_orientation!
|
||||
# TODO
|
||||
end
|
||||
|
||||
"""
|
||||
Partition model using METIS
|
||||
"""
|
||||
function partition_model!
|
||||
# TODO
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user