Use package AbaqusReader.jl (#127)

Source code related to read and parse ABAQUS .inp files is now living in
it's own repository `AbaqusReader.jl` and in this commit we cleanup the
same files from this repository.

- add AbaqusReader to .travis.yml because it's not registered package yet
- initialize Mesh from AbaqusReader.jl dict
- remove ABAQUS tests and files moved to AbaqusReader.jl
- remove references to old module Abaqus
- move ABAQUS code to preprocess.jl (what is left)
- close issue #122
- close issue #55
This commit is contained in:
Jukka Aho
2017-07-21 00:40:52 +03:00
committed by GitHub
parent 9ad66be08b
commit a666bb4bd8
13 changed files with 76 additions and 1296 deletions
-95
View File
@@ -1,95 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using JuliaFEM
using JuliaFEM.Preprocess
using JuliaFEM.Postprocess
using JuliaFEM.Abaqus
using JuliaFEM.Testing
using DataFrames
# to turn on automatic file download, set
# ENV["ABAQUS_DOWNLOAD_URL"] = "http://<domain>:2080/v2016/books/eif"
# if don't want to download all stuff to current directory, set also
# ENV["ABAQUS_DOWNLOAD_DIR"] = "/tmp"
""" Run test, return true if simulation is succesfull, i.e. no errors raise
during parsing .inp file or execution of model. This doesn't mean that results
are meaningful; they must be checked in separately. Running model only verifies
that no catastrophic failures happen during file parsing. """
function abaqus_run_test(name)
return_code = abaqus_run_model(name; fetch=true, verbose=true)
return_code == 0 && return true
return false
end
@testset "JuliaFEM-ABAQUS interface" begin
@testset "1 Element Verification" begin
@testset "1.2 Eigenvalue tests" begin
@testset "1.2.1 Eigenvalue extraction for single unconstrained elements" begin
@testset "Acoustic elements" begin
@testset "AC1D2 elements." begin
# abaqus_run_test("ec12afe1") || return
end
end
@testset "Three-dimensional continuum elements" begin
@testset "C3D10 elements." begin
# abaqus_run_test("ec3asfe1") || return
end
end
end
end
@testset "1.3 Simple load tests" begin
@testset "1.3.1 Membrane loading of plane stress, plane strain, membrane, and shell elements" begin
@testset "CPS4 elements." begin
# abaqus_run_test("ecs4sfs1") || return
end
end
@testset "1.3.3 Three-dimensional solid elements" begin
@testset "C3D8 elements." begin
abaqus_run_test("ec38sfs2") || return
#res = abaqus_open_results("ec38sfs2")
node_output1 = wsv"""
NODE U1 U2 U3 COOR1 COOR2 COOR3
1 -2.0000E-33 -2.0000E-33 -2.0000E-33 0.000 0.000 0.000
2 -2.6667E-05 -1.0000E-33 -1.7333E-04 2.000 0.000 0.000
3 -2.0000E-04 -2.6667E-05 -1.7333E-04 2.000 2.000 0.000
4 -1.7333E-04 -2.6667E-05 -1.0000E-33 0.000 2.000 0.000
5 -3.6777E-48 -8.6667E-05 -1.3333E-05 0.000 0.000 1.000
6 -2.6667E-05 -8.6667E-05 -1.8667E-04 2.000 0.000 1.000
7 -2.0000E-04 -1.1333E-04 -1.8667E-04 2.000 2.000 1.000
8 -1.7333E-04 -1.1333E-04 -1.3333E-05 0.000 2.000 1.000
"""
node_output_2 = wsv"""
NODE RF1 RF2 RF3 CF1 CF2 CF3
1 1500.000 1500.000 1000.000 0.000 0.000 0.000
2 0.000 500.000 0.000 1500.000 0.000 0.000
3 0.000 0.000 0.000 500.000 500.000 -1000.000
4 0.000 0.000 0.000 500.000 1500.000 0.000
5 -500.000 0.000 0.000 0.000 -500.000 1000.000
6 0.000 0.000 0.000 -500.000 -1500.000 0.000
7 0.000 0.000 0.000 -1500.000 -1500.000 -1000.000
8 0.000 0.000 0.000 -1500.000 -500.000 0.000
"""
#= to check also results:
side, opts = read_result(xdmf, "SECTION/side")
@test isapprox(side["SOFM"], 3464.0)
@test isapprox(side["SOF1"], 2000.0)
@test isapprox(side["SOF2"], 2000.0)
@test isapprox(side["SOF3"], 2000.0)
@test isapprox(side["SOMM"], 2828.0)
@test isapprox(side["SOM1"], 0.0)
@test isapprox(side["SOM2"], 2000.0)
@test isapprox(side["SOM3"], -2000.0)
@test isapprox(side["SOAREA"], 2.000)
@test isapprox(side["SOCF1"], 2/3)
@test isapprox(side["SOCF2"], 2/3)
@test isapprox(side["SOCF3"], 1/6)
=#
end
end
end
end
end
-110
View File
@@ -1,110 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using JuliaFEM
using JuliaFEM.Preprocess
using JuliaFEM.Abaqus
using JuliaFEM.Testing
using JuliaFEM.Preprocess: element_has_nodes, element_has_type
@testset "read inp file" begin
model = open(parse_abaqus, joinpath(Pkg.dir("JuliaFEM"),"geometry","3d_beam","palkki.inp"))
@test length(model["nodes"]) == 298
@test length(model["elements"]) == 120
@test length(model["elsets"]["Body1"]) == 120
@test length(model["nsets"]["SUPPORT"]) == 9
@test length(model["nsets"]["LOAD"]) == 9
@test length(model["nsets"]["TOP"]) == 83
end
@testset "test read element section" begin
data = """*ELEMENT, TYPE=C3D10, ELSET=BEAM
1, 243, 240, 191, 117, 245, 242, 244,
1, 2, 196
2, 204, 199, 175, 130, 207, 208, 209,
3, 4, 176
"""
data = split(data, "\n")
model = Dict{AbstractString, Any}()
model["nsets"] = Dict{AbstractString, Vector{Int}}()
model["elsets"] = Dict{AbstractString, Vector{Int}}()
model["elements"] = Dict{Integer, Any}()
parse_section(model, data, :ELEMENT, 1, 5, Val{:ELEMENT})
@test length(model["elements"]) == 2
@test model["elements"][1]["connectivity"] == [243, 240, 191, 117, 245, 242, 244, 1, 2, 196]
@test model["elements"][2]["connectivity"] == [204, 199, 175, 130, 207, 208, 209, 3, 4, 176]
@test model["elsets"]["BEAM"] == [1, 2]
end
@testset "parse nodes from abaqus .inp file to Mesh" begin
fn = joinpath(Pkg.dir("JuliaFEM"), "test", "testdata","cube_tet4.inp")
mesh = abaqus_read_mesh(fn)
info(mesh.surface_sets)
@test length(mesh.nodes) == 10
@test length(mesh.elements) == 17
@test haskey(mesh.elements, 1)
@test mesh.elements[1] == [8, 10, 1, 2]
@test mesh.element_types[1] == :Tet4
@test haskey(mesh.node_sets, :SYM12)
@test haskey(mesh.element_sets, :CUBE)
@test haskey(mesh.surface_sets, :LOAD)
@test haskey(mesh.surface_sets, :ORDER)
@test length(mesh.surface_sets[:LOAD]) == 2
@test mesh.surface_sets[:LOAD][1] == (16, :S1)
@test mesh.surface_types[:LOAD] == :ELEMENT
@test length(Set(map(size, values(mesh.nodes)))) == 1
elements = create_surface_elements(mesh,:LOAD)
@test get_connectivity(elements[1]) == [8,10,9]
end
@testset "parse nodes from abaqus .inp file to Mesh (NX export)" begin
fn = joinpath(Pkg.dir("JuliaFEM"), "test", "testdata","nx_export_problem.inp")
mesh = abaqus_read_mesh(fn)
@test length(mesh.nodes) == 3
end
@testset "parse abaqus .inp created using hypermesh" begin
data = """
**
** ABAQUS Input Deck Generated by HyperMesh Version : 14.0.120.28
** Generated using HyperMesh-Abaqus Template Version : 14.0.120
**
** Template: ABAQUS/STANDARD 3D
**
*NODE , Nset = nset_csys0
1, 2.649428 , -21.93735 , 217.2934
2, 27.54531 , 1.108443 , 228.8077
"""
fn = tempname() * ".inp"
open(fn, "w") do fid write(fid, data) end
mesh = abaqus_read_mesh(fn)
@test length(mesh.nodes) == 2
end
@testset "Elemement types and nodes" begin
@test element_has_nodes(Val{:C3D4}) == 4
@test element_has_type(Val{:C3D4}) == :Tet4
@test element_has_nodes(Val{:C3D8}) == 8
@test element_has_type(Val{:C3D8}) == :Hex8
@test element_has_nodes(Val{:C3D10}) == 10
@test element_has_type(Val{:C3D10}) == :Tet10
@test element_has_nodes(Val{:C3D20}) == 20
@test element_has_nodes(Val{:C3D20E}) == 20
@test element_has_nodes(Val{:S3}) == 3
@test element_has_type(Val{:S3}) == :Tri3
@test element_has_nodes(Val{:STRI65}) == 6
@test element_has_type(Val{:STRI65}) == :Tri6
@test element_has_nodes(Val{:CPS4}) == 4
@test element_has_type(Val{:CPS4}) == :Quad4
end
@testset "GENERATE keyword" begin
data = """
*NSET, NSET=testgen, GENERATE
7,13,2
"""
fn = tempname() * ".inp"
open(fn, "w") do fid write(fid, data) end
mesh = abaqus_read_mesh(fn)
@test mesh.node_sets[:testgen] == Set([7,9,13,11])
end
-1
View File
@@ -5,7 +5,6 @@ using JuliaFEM
using JuliaFEM.Preprocess
using JuliaFEM.Postprocess
using JuliaFEM.Testing
using JuliaFEM.Abaqus: create_surface_elements
tet4_meshfile = "test_problems_contact_3d/tet4.inp"
tet10_meshfile = "test_problems_contact_3d/tet10.inp"
-1
View File
@@ -5,7 +5,6 @@ using JuliaFEM
using JuliaFEM.Preprocess
using JuliaFEM.Postprocess
using JuliaFEM.Testing
using JuliaFEM.Abaqus: create_surface_elements
### temperature patch tests, sl tet4, dl tet4, sl tet10, dl tet 10
-1
View File
@@ -5,7 +5,6 @@ using JuliaFEM
using JuliaFEM.Preprocess
using JuliaFEM.Postprocess
using JuliaFEM.Testing
using JuliaFEM.Abaqus: create_surface_elements
@testset "forget to add elements to problem" begin
X = Dict(
-48
View File
@@ -1,48 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using JuliaFEM
using JuliaFEM.Preprocess
using JuliaFEM.Postprocess
using JuliaFEM.Abaqus
using JuliaFEM.Testing
@testset "parse abaqus inp file to AbaqusModel" begin
fn = Pkg.dir("JuliaFEM") * "/test/testdata/cube_tet4.inp"
model = abaqus_read_model(fn)
@test length(model.properties) == 1
section = first(model.properties)
@test section.element_set == :CUBE
@test section.material_name == :MAT
@test haskey(model.materials, :MAT)
material = model.materials[:MAT]
@test isapprox(first(material.properties).E, 208.0e3)
@test length(model.steps) == 1
step = first(model.steps)
@test length(step.boundary_conditions) == 2
bc = step.boundary_conditions[1]
@test bc.data[1] == [:SYM12, 3]
@test bc.data[2] == [:SYM23, 1]
@test bc.data[3] == [:SYM13, 2]
load = step.boundary_conditions[2]
@test load.data[1] == [:LOAD, :P, 1.00000]
end
#=
@testset "given abaqus model solve field" begin
fn = Pkg.dir("JuliaFEM") * "/test/testdata/cube_tet4.inp"
model = abaqus_read_model(fn)
problems = model()
body = first(problems)
info(body("displacement", 0.0))
result = XDMF()
xdmf_new_result!(result, body, 0.0)
xdmf_save_field!(result, body, 0.0, "displacement"; field_type="Vector")
xdmf_save!(result, "/tmp/cube_tet4.xmf")
end
=#
-1
View File
@@ -5,7 +5,6 @@ using JuliaFEM
using JuliaFEM.Preprocess
using JuliaFEM.Postprocess
using JuliaFEM.Testing
using JuliaFEM.Abaqus: create_surface_elements
datadir = first(splitext(basename(@__FILE__)))