Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
85 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ using Logging | |
|
||
include("parse_mesh.jl") | ||
#include("parse_model.jl") | ||
include("create_surface_elements.jl") | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# This file is a part of JuliaFEM. | ||
# License is MIT: see https://github.com/JuliaFEM/AbaqusReader.jl/blob/master/LICENSE | ||
|
||
""" | ||
element_mapping | ||
This mapping table contains information what node ids locally match | ||
each side of element. | ||
""" | ||
const element_mapping = Dict( | ||
:Tet4 => Dict( | ||
:S1 => (:Tri3, [1, 3, 2]), | ||
:S2 => (:Tri3, [1, 2, 4]), | ||
:S3 => (:Tri3, [2, 3, 4]), | ||
:S4 => (:Tri3, [1, 4, 3])), | ||
:Tet10 => Dict( | ||
:S1 => (:Tri6, [1, 3, 2, 7, 6, 5]), | ||
:S2 => (:Tri6, [1, 2, 4, 5, 9, 8]), | ||
:S3 => (:Tri6, [2, 3, 4, 6, 10, 9]), | ||
:S4 => (:Tri6, [1, 4, 3, 8, 10, 7])), | ||
:Hex8 => Dict( | ||
:S1 => (:Quad4, [1, 2, 3, 4]), | ||
:S2 => (:Quad4, [5, 8, 7, 6]), | ||
:S3 => (:Quad4, [1, 5, 6, 2]), | ||
:S4 => (:Quad4, [2, 6, 7, 3]), | ||
:S5 => (:Quad4, [3, 7, 8, 4]), | ||
:S6 => (:Quad4, [4, 8, 5, 1]))) | ||
|
||
""" Given element code, element side and global connectivity, determine boundary | ||
element. E.g. for Tet4 we have 4 sides S1..S4 and boundary element is of type Tri3. | ||
""" | ||
function create_surface_element(element_type::Symbol, element_side::Symbol, | ||
element_connectivity::Vector{Int64}) | ||
|
||
if !haskey(element_mapping, element_type) | ||
error("Unable to find surface element for element of type ", | ||
"$element_type for side $element_side, update element ", | ||
"mapping table.") | ||
end | ||
|
||
if !haskey(element_mapping[element_type], element_side) | ||
error("Unable to find child element side mapping for element ", | ||
"of type $element_type for side $element_side, update ", | ||
"element mapping table.") | ||
end | ||
|
||
surfel, surfel_lconn = element_mapping[element_type][element_side] | ||
surfel_gconn = element_connectivity[surfel_lconn] | ||
return surfel, surfel_gconn | ||
end | ||
|
||
function create_surface_elements(mesh::Dict, surface_name::String) | ||
surface = mesh["surface_sets"][surface_name] | ||
elements = mesh["elements"] | ||
eltypes = mesh["element_types"] | ||
result = Tuple{Symbol, Vector{Integer}}[] | ||
for (elid, side) in surface | ||
surface_element = create_surface_element(eltypes[elid], side, elements[elid]) | ||
push!(result, surface_element) | ||
end | ||
return result | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# This file is a part of JuliaFEM. | ||
# License is MIT: see https://github.com/JuliaFEM/AbaqusReader.jl/blob/master/LICENSE | ||
|
||
using Base.Test | ||
|
||
using AbaqusReader: create_surface_element, create_surface_elements | ||
|
||
@testset "create surface element from voluminal element surface" begin | ||
element = create_surface_element(:Tet4, :S1, [8, 9, 10, 2]) | ||
@test element == (:Tri3, [8, 10, 9]) | ||
end | ||
|
||
@testset "create surface elements from voluminal element surface" begin | ||
mesh = Dict( | ||
"elements" => Dict(16 => [8, 9, 10, 2]), | ||
"element_types" => Dict(16 => :Tet4), | ||
"surface_sets" => Dict("LOAD" => [(16, :S1)])) | ||
elements = create_surface_elements(mesh, "LOAD") | ||
@test elements[1] == (:Tri3, [8,10,9]) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters