3d mortar assembly tests + fixes detecting unique with tol.

This commit is contained in:
Jukka Aho
2015-12-10 23:00:05 +02:00
parent a3c84680a3
commit d960ec5824
9 changed files with 184 additions and 27 deletions
+3 -1
View File
@@ -51,6 +51,8 @@ function test_solver_multiple_dirichlet_bc()
push!(problem3, dy)
solver = DirectSolver()
solver.dump_matrices = true
solver.name = "test_solver_multiple_dirichlet_bc"
push!(solver, problem)
push!(solver, problem2)
push!(solver, problem3)
@@ -63,7 +65,7 @@ function test_solver_multiple_dirichlet_bc()
@test isapprox(disp, [3.17431158889468E-02, -1.38591518927826E-01])
end
#test_solver_multiple_dirichlet_bc()
test_solver_multiple_dirichlet_bc()
function test_direct_cholesky_with_non_homogeneous_dirichlet_conditions()
+12 -1
View File
@@ -4,7 +4,7 @@
module TestDirichletBoundaryCondition
using JuliaFEM.Test
using JuliaFEM.Core: Seg2, DirichletProblem, Assembly, assemble
using JuliaFEM.Core: Tri3, Seg2, DirichletProblem, Assembly, assemble
function test_dirichlet_problem_1_dim()
element = Seg2([1, 2])
@@ -53,4 +53,15 @@ function test_dirichlet_problem_2_dim_single_dof_fixed()
@test isapprox(b, [0.0, 0.0, 0.0, 0.0])
end
function test_dirichlet_surface_tri3()
elem = Tri3([1, 2, 3])
elem["geometry"] = Vector{Float64}[[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]]
elem["temperature"] = 0.0
prob = DirichletProblem("temperature", 1)
push!(prob, elem)
ass = assemble(prob, 0.0)
k = full(ass.stiffness_matrix)
@test isapprox(k, 1/24*[2 1 1; 1 2 1; 1 1 2])
end
end
+2
View File
@@ -36,6 +36,8 @@ function test_one_element() # always start test function with name test_
A = full(assembly.stiffness_matrix)
b = full(assembly.force_vector)
info("stiffness matrix = \n$(round(A, 3))")
@test isapprox(A, [
4.0 -1.0 -2.0 -1.0
-1.0 4.0 -1.0 -2.0
+37 -2
View File
@@ -15,7 +15,8 @@ using JuliaFEM.Core: project_from_slave_to_master, project_from_master_to_slave
using JuliaFEM.Core: create_auxiliary_plane, project_point_to_auxiliary_plane,
get_edge_intersections, get_points_inside_triangle,
clip_polygon, calculate_polygon_centerpoint,
project_point_from_plane_to_surface
project_point_from_plane_to_surface, assemble
function get_test_2d_model()
# this is hand calculated and given as an example in my thesis
@@ -68,6 +69,7 @@ function test_calc_flat_2d_projection_slave_to_master()
@test X2 == [3/4, 1.0]
end
function test_calc_flat_2d_projection_master_to_slave()
slaves, masters = get_test_2d_model()
slave1, slave2 = slaves
@@ -80,6 +82,7 @@ function test_calc_flat_2d_projection_master_to_slave()
end
#test_calc_flat_2d_projection_master_to_slave()
function test_calc_flat_2d_projection_rotated()
master1 = Seg2([3, 4])
master1["geometry"] = Vector{Float64}[[0.0, 1.0], [0.0, 0.0]]
@@ -102,6 +105,7 @@ function test_calc_flat_2d_projection_rotated()
end
function test_create_flat_2d_assembly()
slaves, masters = get_test_2d_model()
slave1, slave2 = slaves
@@ -149,6 +153,7 @@ function test_create_flat_2d_assembly()
end
#test_create_flat_2d_assembly()
function test_2d_mortar_multiple_bodies_multiple_dirichlet_bc()
N = Vector[
[0.0, 0.0], [1.0, 0.0],
@@ -351,6 +356,7 @@ function test_2d_mortar_three_bodies_shared_nodes()
end
#test_2d_mortar_three_bodies_shared_nodes()
function test_auxiliary_plane_transforms()
nodes = Vector{Float64}[
[0.0, 0.0, 0.0],
@@ -380,7 +386,7 @@ function test_auxiliary_plane_transforms()
info("projected point = $X")
@test isapprox(X, Float64[1.0/3.0+0.1, 1.0/3.0+0.1, 0.0])
end
test_auxiliary_plane_transforms()
#test_auxiliary_plane_transforms()
function test_get_edge_intersections()
@@ -460,4 +466,33 @@ end
#test_calculate_polygon_centerpoint()
function test_assemble_3d_problem()
nodes = Vector{Float64}[
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 0.1],
[1.0, 0.0, 0.1],
[0.0, 1.0, 0.1]]
mel = Tri3([4, 5, 6])
mel["geometry"] = Vector{Float64}[nodes[4], nodes[5], nodes[6]]
sel = Tri3([1, 2, 3])
sel["geometry"] = Vector{Float64}[nodes[1], nodes[2], nodes[3]]
R = [0.0 1.0 0.0
0.0 0.0 1.0
1.0 0.0 0.0]
sel["nodal ntsys"] = Matrix{Float64}[R, R, R]
sel["master elements"] = Element[mel]
prob = MortarProblem("temperature", 1)
push!(prob, sel)
stiffness_matrix = full(assemble(prob, 0.0).stiffness_matrix)
info("stiffness matrix for this problem:\n$stiffness_matrix")
M = D = 1/24*[2 1 1; 1 2 1; 1 1 2]
B = [D -M] # slave dofs are first in this.
info("expected matrix for this problem:\n$B")
@test isapprox(stiffness_matrix, B)
end
#test_assemble_3d_problem()
end