diff --git a/src/Physics/Material/Material_Models/Correspondence_UMAT.jl b/src/Physics/Material/Material_Models/Correspondence_UMAT.jl index 87bccb34b..7272313a3 100644 --- a/src/Physics/Material/Material_Models/Correspondence_UMAT.jl +++ b/src/Physics/Material/Material_Models/Correspondence_UMAT.jl @@ -59,13 +59,14 @@ function init_material_model(datamanager::Module, nodes::Union{SubArray,Vector{I end # properties include the material properties, etc. num_props = material_parameter["Number of Properties"] - properties = datamanager.create_constant_free_size_field("Properties", Float64, num_props, 1) + properties = datamanager.create_constant_free_size_field("Properties", Float64, (num_props, 1)) + for iID in 1:num_props if !haskey(material_parameter, "Property_$iID") @error "Property_$iID is missing. Number of properties is $num_props and properties have to be in order without a missing number." return nothing end - props[iID] = material_parameter["Property_$iID"] + properties[iID] = material_parameter["Property_$iID"] end if !haskey(material_parameter, "UMAT Material Name") diff --git a/test/runtests.jl b/test/runtests.jl index 4e3d9a00e..621d16365 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -118,7 +118,6 @@ MPI.Init() @includetests["unit_tests/Physics/Additive/ut_Additive_Factory"] end end - @testset "Corrosion" begin @testset "ut_Corrosion_Factory" begin @includetests["unit_tests/Physics/Corrosion/ut_Corrosion_Factory"] @@ -158,6 +157,7 @@ MPI.Init() end @testset "ut_correspondence" begin @includetests["unit_tests/Physics/Material/Material_Models/ut_Correspondence"] + @includetests["unit_tests/Physics/Material/Material_Models/ut_Correspondence_UMAT"] end @testset "ut_ordinary" begin @includetests["unit_tests/Physics/Material/Material_Models/Ordinary/ut_ordinary"] diff --git a/test/unit_tests/Physics/Material/Material_Models/ut_Correspondence_UMAT.jl b/test/unit_tests/Physics/Material/Material_Models/ut_Correspondence_UMAT.jl new file mode 100644 index 000000000..cc5cdd4b7 --- /dev/null +++ b/test/unit_tests/Physics/Material/Material_Models/ut_Correspondence_UMAT.jl @@ -0,0 +1,38 @@ +# SPDX-FileCopyrightText: 2023 Christian Willberg , Jan-Timo Hesse +# +# SPDX-License-Identifier: BSD-3-Clause +using Test +include("../../../../../src/Physics/Material/Material_Models/Correspondence_UMAT.jl") +include("../../../../../src/Support/data_manager.jl") +include("../../../../../src/Support/data_manager.jl") +@testset "get_name&fe_support" begin + @test Correspondence_UMAT.correspondence_name() == "Correspondence UMAT" + @test Correspondence_UMAT.fe_support() +end +@testset "init exceptions" begin + nodes = 2 + test_Data_manager = Data_manager + test_Data_manager.set_num_controller(nodes) + dof = 3 + test_Data_manager.set_dof(dof) + + @test isnothing(Correspondence_UMAT.init_material_model(test_Data_manager, Vector{Int64}(1:nodes), Dict())) + @test isnothing(Correspondence_UMAT.init_material_model(test_Data_manager, Vector{Int64}(1:nodes), Dict("Number of Properties" => 3, "Property_1" => 2, "Property_3" => 2))) + @test isnothing(Correspondence_UMAT.init_material_model(test_Data_manager, Vector{Int64}(1:nodes), Dict("Number of Properties" => 3, "Property_1" => 2, "Property_3" => 2, "Property_4" => 2))) + + + @test isnothing(Correspondence_UMAT.init_material_model(test_Data_manager, Vector{Int64}(1:nodes), Dict("Number of Properties" => 3, "Property_1" => 2, "Property_2" => 2, "Property_3" => 2.4, "UMAT Material Name" => "a"^81))) + @test !isnothing(Correspondence_UMAT.init_material_model(test_Data_manager, Vector{Int64}(1:nodes), Dict("Number of Properties" => 3, "Property_1" => 2, "Property_2" => 2, "Property_3" => 2.4, "UMAT Material Name" => "a"^80))) + + @test isnothing(Correspondence_UMAT.init_material_model(test_Data_manager, Vector{Int64}(1:nodes), Dict("Number of Properties" => 3, "Property_1" => 2, "Property_2" => 2, "Property_3" => 2.4, "Property_4" => 2.4, "Predefined Field Names" => "s"))) + + properties = test_Data_manager.get_field("Properties") + @test length(properties) == 3 + @test properties[1] == 2 + @test properties[2] == 2 + @test properties[3] == 2.4 + + test_Data_manager.create_constant_node_field("test_field", Float64, 2) + Correspondence_UMAT.init_material_model(test_Data_manager, Vector{Int64}(1:nodes), Dict("Number of Properties" => 3, "Property_1" => 2, "Property_2" => 2, "Property_3" => 2.4, "Predefined Field Names" => "test_field")) + @test ("test_field" in test_Data_manager.get_all_field_keys()) +end \ No newline at end of file