diff --git a/Project.toml b/Project.toml index 16ca646be..ac7a3b03b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PeriLab" uuid = "2ecefcea-59f0-46dd-9cfd-1d2b8cc5f112" authors = ["Christian Willberg ", "Jan-Timo Hesse "] -version = "1.4.11" +version = "1.5.0" [deps] AbaqusReader = "bc6b9049-e460-56d6-94b4-a597b2c0390d" diff --git a/src/Compute/compute_field_values.jl b/src/Compute/compute_field_values.jl index 9ec40732b..ea9fbae92 100644 --- a/src/Compute/compute_field_values.jl +++ b/src/Compute/compute_field_values.jl @@ -2,13 +2,11 @@ # # SPDX-License-Identifier: BSD-3-Clause -using .Helpers: find_active_nodes, get_active_update_nodes, add_in_place! +using ...Helpers: find_active_nodes, get_active_update_nodes, add_in_place!, invert using StaticArrays: MMatrix, SMatrix -using .Helpers: invert -include("../Models/Material/Material_Basis.jl") -using .Material_Basis: - get_strain, get_Hooke_matrix, - compute_deviatoric_and_spherical_stresses +using ..Material_Basis: + get_strain, get_Hooke_matrix, + compute_deviatoric_and_spherical_stresses """ get_forces_from_force_density(datamanager::Module) diff --git a/src/Core/BC_manager.jl b/src/Core/BC_manager.jl index aa497181a..0d4daccf1 100644 --- a/src/Core/BC_manager.jl +++ b/src/Core/BC_manager.jl @@ -7,9 +7,8 @@ export init_BCs export apply_bc_dirichlet export apply_bc_neumann export find_bc_free_dof -include("../Support/Parameters/parameter_handling.jl") -using .Parameter_Handling: get_bc_definitions +using ...Parameter_Handling: get_bc_definitions """ find_bc_free_dof(datamanager::Module, bcs::Dict{String,Any}) diff --git a/src/Core/Data_manager.jl b/src/Core/Data_manager.jl index 5350e4535..1a1f78354 100644 --- a/src/Core/Data_manager.jl +++ b/src/Core/Data_manager.jl @@ -5,8 +5,7 @@ module Data_manager using MPI using DataStructures: OrderedDict -include("../Support/Helpers.jl") -using .Helpers: fill_in_place! +using ..Helpers: fill_in_place! ########################## # Variables diff --git a/src/Core/Module_inclusion/set_Modules.jl b/src/Core/Module_inclusion/set_Modules.jl index 58f2817a2..19fceef1b 100644 --- a/src/Core/Module_inclusion/set_Modules.jl +++ b/src/Core/Module_inclusion/set_Modules.jl @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause -module Set_modules +# module Set_modules export include_files export find_module_files @@ -191,4 +191,4 @@ function create_module_specifics(name::Union{String,SubString}, return nothing end -end +# end diff --git a/src/Core/Solver/Solver_control.jl b/src/Core/Solver/Solver_control.jl index ab970828e..372ce615c 100644 --- a/src/Core/Solver/Solver_control.jl +++ b/src/Core/Solver/Solver_control.jl @@ -3,31 +3,28 @@ # SPDX-License-Identifier: BSD-3-Clause module Solver_control - -include("../../Support/Parameters/parameter_handling.jl") -include("../../Support/Helpers.jl") -using .Parameter_Handling: - get_density, - get_horizon, - get_solver_name, - get_model_options, - get_fem_block, - get_calculation_options, - get_angles, - get_block_names_and_ids, - get_solver_params -using .Helpers: fastdot, check_inf_or_nan, get_block_nodes +using ..Parameter_Handling: + get_density, + get_horizon, + get_solver_name, + get_model_options, + get_fem_block, + get_calculation_options, + get_angles, + get_block_names_and_ids, + get_solver_params +using ..Helpers +include("../../Models/Material/Material_Basis.jl") +include("../../FEM/FEM_Factory.jl") include("../../Models/Model_Factory.jl") +include("../BC_manager.jl") include("Verlet.jl") include("Static_solver.jl") -include("../BC_manager.jl") -include("../../MPI_communication/MPI_communication.jl") -using .MPI_communication: synch_responder_to_controller, - synch_controller_to_responder, - synch_controller_bonds_to_responder, - synch_controller_bonds_to_responder_flattened +using ..MPI_communication: synch_responder_to_controller, + synch_controller_to_responder, + synch_controller_bonds_to_responder, + synch_controller_bonds_to_responder_flattened -include("../../FEM/FEM_Factory.jl") include("../Influence_function.jl") using .Model_Factory: init_models, read_properties diff --git a/src/Core/Solver/Static_solver.jl b/src/Core/Solver/Static_solver.jl index 83b68a1bf..c00518404 100644 --- a/src/Core/Solver/Static_solver.jl +++ b/src/Core/Solver/Static_solver.jl @@ -12,27 +12,18 @@ using LoopVectorization using PrettyTables using Logging -include("../../Support/Helpers.jl") -using .Helpers: check_inf_or_nan, find_active_nodes, progress_bar -include("../../Support/Parameters/parameter_handling.jl") -using .Parameter_Handling: - get_initial_time, - get_fixed_dt, - get_final_time, - get_numerical_damping, - get_safety_factor, - get_max_damage - -include("../../MPI_communication/MPI_communication.jl") -using .MPI_communication: barrier -include("../BC_manager.jl") -include("../../Models/Model_Factory.jl") -include("../../IO/logging.jl") -include("../../Compute/compute_field_values.jl") -using .Model_Factory -using .Boundary_conditions: apply_bc_dirichlet, apply_bc_neumann, find_bc_free_dof -using .Helpers: matrix_style -using .Logging_module: print_table +using ...Helpers: check_inf_or_nan, find_active_nodes, progress_bar, matrix_style +using ...Parameter_Handling: + get_initial_time, + get_fixed_dt, + get_final_time, + get_numerical_damping, + get_safety_factor, + get_max_damage +using ...MPI_communication: barrier +using ..Model_Factory +using ..Boundary_conditions: apply_bc_dirichlet, apply_bc_neumann, find_bc_free_dof +using ...Logging_module: print_table export init_solver export run_solver @@ -157,7 +148,7 @@ function init_solver(solver_options::Dict{Any,Any}, start_u = datamanager.get_field("Start_Values") end check_inf_or_nan(start_u, "Start_Values") - Boundary_conditions.find_bc_free_dof(datamanager, bcs) + find_bc_free_dof(datamanager, bcs) if datamanager.get_rank() == 0 data = ["Static Solver" "" "" "" @@ -384,7 +375,7 @@ function residual!(residual, datamanager.synch_manager(synchronise_field, "download_from_cores") # synch - # @timeit to "apply_bc_neumann" datamanager = Boundary_conditions.apply_bc_neumann(bcs, datamanager, time) #-> von neumann + # @timeit to "apply_bc_neumann" datamanager = apply_bc_neumann(bcs, datamanager, time) #-> von neumann #active_nodes = datamanager.get_field("Active Nodes") #active_nodes = find_active_nodes(active_list, active_nodes, 1:datamanager.get_nnodes()) diff --git a/src/Core/Solver/Verlet.jl b/src/Core/Solver/Verlet.jl index 8767d6140..a0f8ed4c4 100644 --- a/src/Core/Solver/Verlet.jl +++ b/src/Core/Solver/Verlet.jl @@ -11,27 +11,20 @@ using LoopVectorization using PrettyTables using Logging -include("../../Support/Helpers.jl") -using .Helpers: check_inf_or_nan, find_active_nodes, progress_bar -include("../../Support/Parameters/parameter_handling.jl") -using .Parameter_Handling: - get_initial_time, - get_fixed_dt, - get_final_time, - get_numerical_damping, - get_safety_factor, - get_max_damage - -include("../../MPI_communication/MPI_communication.jl") -using .MPI_communication: find_and_set_core_value_min, find_and_set_core_value_max, barrier -include("../BC_manager.jl") -include("../../Models/Model_Factory.jl") -include("../../IO/logging.jl") +using ...Helpers#: check_inf_or_nan, find_active_nodes, progress_bar, matrix_style +using ...Parameter_Handling: + get_initial_time, + get_fixed_dt, + get_final_time, + get_numerical_damping, + get_safety_factor, + get_max_damage +using ...MPI_communication: find_and_set_core_value_min, find_and_set_core_value_max, + barrier +using ..Model_Factory: compute_models +using ..Boundary_conditions: apply_bc_dirichlet, apply_bc_neumann +using ...Logging_module: print_table include("../../Compute/compute_field_values.jl") -using .Model_Factory -using .Boundary_conditions: apply_bc_dirichlet, apply_bc_neumann -using .Helpers: matrix_style -using .Logging_module: print_table export init_solver export run_solver @@ -507,13 +500,13 @@ function run_solver(solver_options::Dict{Any,Any}, "upload_to_cores") # synch - @timeit to "compute_models" datamanager=Model_Factory.compute_models(datamanager, - block_nodes, - dt, - time, - solver_options["Models"], - synchronise_field, - to) + @timeit to "compute_models" datamanager=compute_models(datamanager, + block_nodes, + dt, + time, + solver_options["Models"], + synchronise_field, + to) # update the current active nodes; might have been changed by the additive models if "Material" in solver_options["Models"] diff --git a/src/FEM/Coupling/Arlequin_coupling.jl b/src/FEM/Coupling/Arlequin_coupling.jl index 245b042fd..80a6dd5cf 100644 --- a/src/FEM/Coupling/Arlequin_coupling.jl +++ b/src/FEM/Coupling/Arlequin_coupling.jl @@ -4,21 +4,19 @@ module Arlequin_coupling include("../Element_formulation/Lagrange_element.jl") -include("../FEM_routines.jl") using .Lagrange_element: define_lagrangian_grid_space, get_recursive_lagrange_shape_functions -using .FEM_routines: get_polynomial_degree -include("../../Support/Helpers.jl") -using .Helpers: - find_active_nodes, - find_point_in_polygon, - find_point_in_hexagon, - get_ring, - get_hexagon, - create_centroid_and_search_radius, - get_nearest_neighbors, - find_point_in_element +using ...FEM_routines: get_polynomial_degree +using ......Helpers: + find_active_nodes, + find_point_in_polygon, + find_point_in_hexagon, + get_ring, + get_hexagon, + create_centroid_and_search_radius, + get_nearest_neighbors, + find_point_in_element using LinearAlgebra export coupling_name diff --git a/src/FEM/Coupling/Coupling_Factory.jl b/src/FEM/Coupling/Coupling_Factory.jl index 66a66a9b7..46b496784 100644 --- a/src/FEM/Coupling/Coupling_Factory.jl +++ b/src/FEM/Coupling/Coupling_Factory.jl @@ -4,9 +4,9 @@ module Coupling_PD_FEM include("../../Core/Module_inclusion/set_Modules.jl") -using .Set_modules -global module_list = Set_modules.find_module_files(@__DIR__, "coupling_name") -Set_modules.include_files(module_list) +# using .Set_modules +global module_list = find_module_files(@__DIR__, "coupling_name") +include_files(module_list) export init_coupling export compute_coupling @@ -22,7 +22,7 @@ function init_coupling(datamanager::Module, nodes, complete_params::Dict) end coupling_model = complete_params["FEM"]["Coupling"]["Coupling Type"] - mod = Set_modules.create_module_specifics(coupling_model, module_list, "coupling_name") + mod = create_module_specifics(coupling_model, module_list, "coupling_name") if isnothing(mod) @error "No material of name " * material_model * " exists." end diff --git a/src/FEM/FEM_Factory.jl b/src/FEM/FEM_Factory.jl index 43cbd9189..d2c5cc64c 100644 --- a/src/FEM/FEM_Factory.jl +++ b/src/FEM/FEM_Factory.jl @@ -17,15 +17,16 @@ include("./Coupling/Coupling_Factory.jl") # in future using set modules for material # test case is correspondence material -include("./../Models/Material/Material_Models/Correspondence/Correspondence_Elastic.jl") -using .Correspondence_Elastic +using ...Helpers: fast_mul!, get_mapping +using ..Material_Basis: get_Hooke_matrix +# using .Correspondence_Elastic using .Coupling_PD_FEM -using .Set_modules +# using .Set_modules export init_FEM export eval_FEM -global module_list = Set_modules.find_module_files(@__DIR__, "element_name") -Set_modules.include_files(module_list) +global module_list = find_module_files(@__DIR__, "element_name") +include_files(module_list) function init_FEM(complete_params::Dict, datamanager::Module) if !haskey(complete_params, "FEM") @@ -93,18 +94,18 @@ function init_FEM(complete_params::Dict, datamanager::Module) N[:], B_elem = create_element_matrices(dof, p, - Set_modules.create_module_specifics(params["Element Type"], - module_list, - specifics)) + create_module_specifics(params["Element Type"], + module_list, + specifics)) if isnothing(N) || isnothing(B_matrix) return nothing end specifics = Dict{String,String}("Call Function" => "init_element", "Name" => "element_name") - datamanager = Set_modules.create_module_specifics(params["Element Type"], - module_list, - specifics, - (datamanager, elements, params, p)) + datamanager = create_module_specifics(params["Element Type"], + module_list, + specifics, + (datamanager, elements, params, p)) elements = Vector{Int64}(1:nelements) topology = datamanager.get_field("FE Topology") @@ -153,16 +154,32 @@ function valid_models(params::Dict) if !haskey(params, "Material Model") @error "No material model has been defined for FEM in the block." return nothing - else - # in future -> FE support -> check with set modules - if !Correspondence_Elastic.fe_support() - @error "No FEM support for " * params["Material Model"] - return nothing - end + # else + # # in future -> FE support -> check with set modules + # if !Correspondence_Elastic.fe_support() + # @error "No FEM support for " * params["Material Model"] + # return nothing + # end end return true end +function compute_stresses(datamanager::Module, + dof::Int64, + material_parameter::Dict, + time::Float64, + dt::Float64, + strain_increment::Vector{Float64}, + stress_N::Vector{Float64}, + stress_NP1::Vector{Float64}) + hookeMatrix = get_Hooke_matrix(datamanager, + material_parameter, + material_parameter["Symmetry"], + dof) + + return hookeMatrix * strain_increment + stress_N, datamanager +end + function eval_FEM(datamanager::Module, elements::AbstractVector{Int64}, params::Dict{String,Any}, @@ -171,7 +188,7 @@ function eval_FEM(datamanager::Module, return compute_FEM(datamanager, elements, params, - Correspondence_Elastic.compute_stresses, + compute_stresses, time, dt) end diff --git a/src/FEM/FEM_routines.jl b/src/FEM/FEM_routines.jl index ce1677681..52a96b6f9 100644 --- a/src/FEM/FEM_routines.jl +++ b/src/FEM/FEM_routines.jl @@ -6,10 +6,7 @@ using LinearAlgebra using StaticArrays using FastGaussQuadrature using Statistics -include("../Models/Material/Material_Basis.jl") -using .Material_Basis: voigt_to_matrix -include("../Support/Helpers.jl") -using .Helpers: invert, determinant +using ....Helpers: invert, determinant, voigt_to_matrix function get_FE_material_model(params::Dict{String,Any}, name::String) if !haskey(params["Material Models"], params["FEM"][name]["Material Model"]) @error "Material model " * diff --git a/src/IO/IO.jl b/src/IO/IO.jl index 7a8c477f8..eb32da5e0 100644 --- a/src/IO/IO.jl +++ b/src/IO/IO.jl @@ -9,29 +9,27 @@ using DataFrames using PrettyTables using Logging -include("../Support/Geometry.jl") - -using .Geometry - include("read_inputdeck.jl") include("mesh_data.jl") include("exodus_export.jl") include("csv_export.jl") include("../Compute/compute_global_values.jl") -include("../Support/Parameters/parameter_handling.jl") -include("../MPI_communication/MPI_communication.jl") -using .MPI_communication: send_single_value_from_vector, synch_responder_to_controller, - synch_controller_to_responder, - synch_controller_bonds_to_responder, - split_vector, synch_controller_bonds_to_responder_flattened, - send_vector_from_root_to_core_i, broadcast_value, - find_and_set_core_value_min, find_and_set_core_value_sum, - find_and_set_core_value_max, - find_and_set_core_value_avg, gather_values, barrier - -using .Helpers: progress_bar - -using .Parameter_Handling +using ..MPI_communication: send_single_value_from_vector, synch_responder_to_controller, + synch_controller_to_responder, + synch_controller_bonds_to_responder, + split_vector, synch_controller_bonds_to_responder_flattened, + send_vector_from_root_to_core_i, broadcast_value, + find_and_set_core_value_min, find_and_set_core_value_sum, + find_and_set_core_value_max, + find_and_set_core_value_avg, gather_values, barrier + +using ..Helpers: progress_bar +using ..Logging_module: get_log_stream +using ..Parameter_Handling: get_solver_steps, get_flush_file, get_write_after_damage, + get_start_time, get_end_time, get_outputs, get_output_frequency, + get_output_filenames, get_computes_names, get_computes, get_fem_block +using ..Geometry: rotation_tensor + using OrderedCollections using NearestNeighbors: KDTree, nn export initialize_data @@ -414,7 +412,8 @@ function initialize_data(filename::String, params=init_data(read_input_file(filename), filedirectory, datamanager, comm, to) - return datamanager, params + steps = get_solver_steps(params) + return datamanager, params, steps end """ @@ -435,18 +434,19 @@ function init_orientations(datamanager::Module) dof = datamanager.get_dof() nnodes = datamanager.get_nnodes() orientations = datamanager.create_constant_node_field("Orientations", Float64, 3) - rotation_tensor = datamanager.create_constant_node_field("Rotation Tensor", - Float64, - dof, VectorOrMatrix = "Matrix") + rotation_tensor_field = datamanager.create_constant_node_field("Rotation Tensor", + Float64, + dof, + VectorOrMatrix = "Matrix") angles = datamanager.get_field("Angles") for iID in 1:nnodes - rotation_tensor[iID, :, :] = Geometry.rotation_tensor(angles[iID, :], dof) + rotation_tensor_field[iID, :, :] = rotation_tensor(angles[iID, :], dof) if dof == 2 - orientations[iID, :] = vcat(rotation_tensor[iID, :, 1], 0) + orientations[iID, :] = vcat(rotation_tensor_field[iID, :, 1], 0) elseif dof == 3 - orientations[iID, :] = rotation_tensor[iID, :, 1] + orientations[iID, :] = rotation_tensor_field[iID, :, 1] end end return datamanager @@ -935,12 +935,12 @@ function show_block_summary(solver_options::Dict, end if !silent pretty_table(full_df; show_subheader = false) - stream = Logging_module.get_log_stream(2) + stream = get_log_stream(2) if !isnothing(stream) pretty_table(stream, full_df; show_subheader = false) end else - stream = Logging_module.get_log_stream(1) + stream = get_log_stream(1) if !isnothing(stream) pretty_table(stream, full_df; show_subheader = false) end @@ -949,12 +949,12 @@ function show_block_summary(solver_options::Dict, if log_file != "" if !silent pretty_table(df; show_subheader = false) - stream = Logging_module.get_log_stream(2) + stream = get_log_stream(2) if !isnothing(stream) pretty_table(stream, df; show_subheader = false) end else - stream = Logging_module.get_log_stream(1) + stream = get_log_stream(1) if !isnothing(stream) pretty_table(stream, df; show_subheader = false) end @@ -1029,12 +1029,12 @@ function show_mpi_summary(log_file::String, merged_df = vcat(all_dfs...) if !silent pretty_table(merged_df; show_subheader = false) - stream = Logging_module.get_log_stream(2) + stream = get_log_stream(2) if !isnothing(stream) pretty_table(stream, merged_df; show_subheader = false) end else - stream = Logging_module.get_log_stream(1) + stream = get_log_stream(1) if !isnothing(stream) pretty_table(stream, merged_df; show_subheader = false) end @@ -1043,12 +1043,12 @@ function show_mpi_summary(log_file::String, if log_file != "" if !silent pretty_table(df; show_subheader = false) - stream = Logging_module.get_log_stream(2) + stream = get_log_stream(2) if !isnothing(stream) pretty_table(stream, df; show_subheader = false) end else - stream = Logging_module.get_log_stream(1) + stream = get_log_stream(1) if !isnothing(stream) pretty_table(stream, df; show_subheader = false) end diff --git a/src/IO/bond_filters.jl b/src/IO/bond_filters.jl index d125b6ead..db68df859 100644 --- a/src/IO/bond_filters.jl +++ b/src/IO/bond_filters.jl @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: BSD-3-Clause +using ..Parameter_Handling: get_bond_filters + """ bond_intersects_disc(p0::Vector{Float64}, p1::Vector{Float64}, center::Vector{Float64}, normal::Vector{Float64}, radius::Float64) diff --git a/src/IO/gcode.jl b/src/IO/gcode.jl index e700a1ba9..bd6322fea 100644 --- a/src/IO/gcode.jl +++ b/src/IO/gcode.jl @@ -9,8 +9,7 @@ using Rotations using CSV, DataFrames using ProgressBars using NearestNeighbors -include("../Support/Helpers.jl") -using .Helpers: sub_in_place!, normalize_in_place! +using ..Helpers: sub_in_place!, normalize_in_place! function distance_along_line(dir::Vector{Float64}, point_diff::Vector{Float64}) diff --git a/src/IO/mesh_data.jl b/src/IO/mesh_data.jl index 8dce338a3..9295202b4 100644 --- a/src/IO/mesh_data.jl +++ b/src/IO/mesh_data.jl @@ -10,10 +10,11 @@ using PrettyTables include("bond_filters.jl") include("gcode.jl") include("volume.jl") -# include("../Support/Helpers.jl") -using .Helpers: fastdot, get_nearest_neighbors -include("./logging.jl") -using .Logging_module: print_table +using ..Helpers: fastdot, get_nearest_neighbors +using ..Logging_module: print_table +using ..Parameter_Handling: get_mesh_name, get_header, get_node_sets, + get_external_topology_name, get_horizon +using ..Geometry: bond_geometry! #export read_mesh #export load_mesh_and_distribute @@ -378,11 +379,11 @@ function get_bond_geometry(datamanager::Module) undeformed_bond = datamanager.create_constant_bond_field("Bond Geometry", Float64, dof) undeformed_bond_length = datamanager.create_constant_bond_field("Bond Length", Float64, 1) - Geometry.bond_geometry!(undeformed_bond, - undeformed_bond_length, - Vector{Int64}(1:nnodes), - nlist, - coor) + bond_geometry!(undeformed_bond, + undeformed_bond_length, + Vector{Int64}(1:nnodes), + nlist, + coor) return datamanager end @@ -846,7 +847,7 @@ function load_and_evaluate_mesh(params::Dict, ranksize::Int64, to::TimerOutput, silent::Bool) - filename = joinpath(path, Parameter_Handling.get_mesh_name(params)) + filename = joinpath(path, get_mesh_name(params)) if params["Discretization"]["Type"] == "Abaqus" @timeit to "read_mesh" mesh, nsets=read_mesh(filename, params) elseif params["Discretization"]["Type"] == "Gcode" diff --git a/src/IO/read_inputdeck.jl b/src/IO/read_inputdeck.jl index 56a564fed..20bf2745b 100644 --- a/src/IO/read_inputdeck.jl +++ b/src/IO/read_inputdeck.jl @@ -3,6 +3,7 @@ # SPDX-License-Identifier: BSD-3-Clause using YAML: load_file +using ...Parameter_Handling: validate_yaml export read_input_file diff --git a/src/Models/Additive/Additive_Factory.jl b/src/Models/Additive/Additive_Factory.jl index e819d5be0..6497eff22 100644 --- a/src/Models/Additive/Additive_Factory.jl +++ b/src/Models/Additive/Additive_Factory.jl @@ -4,12 +4,10 @@ module Additive include("../../Core/Module_inclusion/set_Modules.jl") -using .Set_modules -global module_list = Set_modules.find_module_files(@__DIR__, "additive_name") -Set_modules.include_files(module_list) -include("../../Support/Helpers.jl") +global module_list = find_module_files(@__DIR__, "additive_name") +include_files(module_list) using TimerOutputs -using .Helpers: find_inverse_bond_id +using .....Helpers: find_inverse_bond_id export compute_model export init_model export init_fields @@ -96,9 +94,9 @@ datamanager = init_model(my_data_manager, [1, 2, 3], 1) function init_model(datamanager::Module, nodes::AbstractVector{Int64}, block::Int64) model_param = datamanager.get_properties(block, "Additive Model") - mod = Set_modules.create_module_specifics(model_param["Additive Model"], - module_list, - "additive_name") + mod = create_module_specifics(model_param["Additive Model"], + module_list, + "additive_name") if isnothing(mod) @error "No additive model of name " * model_param["Additive Model"] * " exists." return nothing diff --git a/src/Models/Contact/Contact_Factory.jl b/src/Models/Contact/Contact_Factory.jl index f4845148c..f48934d86 100644 --- a/src/Models/Contact/Contact_Factory.jl +++ b/src/Models/Contact/Contact_Factory.jl @@ -5,17 +5,13 @@ module Contact_Factory using TimerOutputs using LinearAlgebra -include("../../MPI_communication/MPI_communication.jl") -using .MPI_communication: find_and_set_core_value_sum +using .....MPI_communication: find_and_set_core_value_sum include("Contact_search.jl") using .Contact_search: init_contact_search, compute_geometry, get_surface_information, compute_contact_pairs -include("Penalty_model.jl") -using .Penalty_model -include("../../Support/Helpers.jl") -using .Helpers: remove_ids, get_block_nodes, compute_free_surface_nodes, find_indices +using .....Helpers: remove_ids, get_block_nodes, compute_free_surface_nodes, find_indices include("../../Core/Module_inclusion/set_Modules.jl") -using .Set_modules: find_module_files, include_files +# using .Set_modules: find_module_files, include_files global module_list = find_module_files(@__DIR__, "contact_model_name") include_files(module_list) export init_contact_model @@ -121,9 +117,9 @@ function init_contact_model(datamanager::Module, params) end init_contact_search(datamanager, contact_params, cm) - mod = Set_modules.create_module_specifics(contact_params["Type"], - module_list, - "contact_model_name") + mod = create_module_specifics(contact_params["Type"], + module_list, + "contact_model_name") if isnothing(mod) @error "No contact model of type " * contact_params["Type"] * " exists." diff --git a/src/Models/Contact/Contact_search.jl b/src/Models/Contact/Contact_search.jl index 13c337d14..5fd7bef23 100644 --- a/src/Models/Contact/Contact_search.jl +++ b/src/Models/Contact/Contact_search.jl @@ -3,9 +3,9 @@ # SPDX-License-Identifier: BSD-3-Clause module Contact_search -include("../../Support/Helpers.jl") -using .Helpers: get_nearest_neighbors, nearest_point_id, get_block_nodes, compute_geometry, - point_is_inside, get_surface_information, compute_distance_and_normals +using ....Helpers: get_nearest_neighbors, nearest_point_id, get_block_nodes, + compute_geometry, + point_is_inside, get_surface_information, compute_distance_and_normals export init_contact_search export compute_contact_pairs diff --git a/src/Models/Contact/Penalty_model.jl b/src/Models/Contact/Penalty_model.jl index 60a746fe3..c819aef40 100644 --- a/src/Models/Contact/Penalty_model.jl +++ b/src/Models/Contact/Penalty_model.jl @@ -4,8 +4,7 @@ module Penalty_model -include("../../Support/Helpers.jl") -import .Helpers: get_shared_horizon, dot, norm +import .....Helpers: get_shared_horizon, dot, norm export contact_model_name export init_contact_model diff --git a/src/Models/Damage/Critical_Stretch.jl b/src/Models/Damage/Critical_Stretch.jl index 786ba22ec..674c40f88 100644 --- a/src/Models/Damage/Critical_Stretch.jl +++ b/src/Models/Damage/Critical_Stretch.jl @@ -3,8 +3,7 @@ # SPDX-License-Identifier: BSD-3-Clause module Critical_stretch -include("../../Support/Helpers.jl") -using .Helpers: sub_in_place!, div_in_place! +using .....Helpers: sub_in_place!, div_in_place! export compute_model export damage_name export init_model diff --git a/src/Models/Damage/Damage_Factory.jl b/src/Models/Damage/Damage_Factory.jl index c47a91760..8ebc19642 100644 --- a/src/Models/Damage/Damage_Factory.jl +++ b/src/Models/Damage/Damage_Factory.jl @@ -4,13 +4,11 @@ module Damage include("../../Core/Module_inclusion/set_Modules.jl") -using .Set_modules -global module_list = Set_modules.find_module_files(@__DIR__, "damage_name") -Set_modules.include_files(module_list) -include("../../Support/Helpers.jl") +global module_list = find_module_files(@__DIR__, "damage_name") +include_files(module_list) using TimerOutputs using LoopVectorization -using .Helpers: find_inverse_bond_id +using .....Helpers: find_inverse_bond_id export fields_for_local_synchronization export compute_model export init_interface_crit_values @@ -253,9 +251,9 @@ function init_model(datamanager::Module, nodes::AbstractVector{Int64}, # if haskey(model_param, "Anisotropic Damage") # datamanager.create_bond_field("Bond Damage Anisotropic", Float64, datamanager.get_dof(), 1) # end - mod = Set_modules.create_module_specifics(model_param["Damage Model"], - module_list, - "damage_name") + mod = create_module_specifics(model_param["Damage Model"], + module_list, + "damage_name") if isnothing(mod) @error "No damage model of name " * model_param["Damage Model"] * " exists." diff --git a/src/Models/Damage/Energy_release.jl b/src/Models/Damage/Energy_release.jl index 614719e2c..7000f4139 100644 --- a/src/Models/Damage/Energy_release.jl +++ b/src/Models/Damage/Energy_release.jl @@ -3,19 +3,14 @@ # SPDX-License-Identifier: BSD-3-Clause module Critical_Energy_Model -include("../Material/Material_Factory.jl") -include("../../Support/Geometry.jl") -include("../../Support/Helpers.jl") -using .Material -using .Geometry -using .Helpers: - rotate, - fastdot, - sub_in_place!, - div_in_place!, - mul_in_place!, - interpol_data, - is_dependent +using ......Helpers: + rotate, + fastdot, + sub_in_place!, + div_in_place!, + mul_in_place!, + interpol_data, + is_dependent using LinearAlgebra using StaticArrays export compute_model diff --git a/src/Models/Damage/Energy_release_aniso.jl b/src/Models/Damage/Energy_release_aniso.jl index f7a4bda71..fc01e0010 100644 --- a/src/Models/Damage/Energy_release_aniso.jl +++ b/src/Models/Damage/Energy_release_aniso.jl @@ -3,19 +3,14 @@ # SPDX-License-Identifier: BSD-3-Clause module Critical_Energy_Aniso_Model -include("../Material/Material_Factory.jl") -include("../../Support/Geometry.jl") -include("../../Support/Helpers.jl") -using .Material -using .Geometry -using .Helpers: - rotate, - fastdot, - sub_in_place!, - div_in_place!, - mul_in_place!, - interpol_data, - is_dependent +using ......Helpers: + rotate, + fastdot, + sub_in_place!, + div_in_place!, + mul_in_place!, + interpol_data, + is_dependent using LinearAlgebra using StaticArrays export compute_model @@ -185,9 +180,9 @@ function compute_model(datamanager::Module, end # Compute bond_norm for all components at once div_in_place!(bond_norm_all, - rotated_bond, - deformed_bond_length[iID][jID], - true) + rotated_bond, + deformed_bond_length[iID][jID], + true) mul!(temp, bond_energy, bond_norm_all) # Compute the condition for all components at once diff --git a/src/Models/Degradation/Degradation_Factory.jl b/src/Models/Degradation/Degradation_Factory.jl index a8792f80e..5836805b7 100644 --- a/src/Models/Degradation/Degradation_Factory.jl +++ b/src/Models/Degradation/Degradation_Factory.jl @@ -4,12 +4,11 @@ module Degradation include("../../Core/Module_inclusion/set_Modules.jl") -using .Set_modules -global module_list = Set_modules.find_module_files(@__DIR__, "degradation_name") -Set_modules.include_files(module_list) -include("../../Support/Helpers.jl") +# using .Set_modules +global module_list = find_module_files(@__DIR__, "degradation_name") +include_files(module_list) using TimerOutputs -using .Helpers: find_inverse_bond_id +using ....Helpers: find_inverse_bond_id export compute_model export init_model export init_fields @@ -79,9 +78,9 @@ datamanager = init_model(my_data_manager, [1, 2, 3], 1) function init_model(datamanager::Module, nodes::AbstractVector{Int64}, block::Int64) model_param = datamanager.get_properties(block, "Degradation Model") - mod = Set_modules.create_module_specifics(model_param["Degradation Model"], - module_list, - "degradation_name") + mod = create_module_specifics(model_param["Degradation Model"], + module_list, + "degradation_name") if isnothing(mod) @error "No degradation model of name " * model_param["Degradation Model"] * " exists." diff --git a/src/Models/Material/Material_Basis.jl b/src/Models/Material/Material_Basis.jl index 6903f998e..8fe1f03c4 100644 --- a/src/Models/Material/Material_Basis.jl +++ b/src/Models/Material/Material_Basis.jl @@ -6,19 +6,15 @@ module Material_Basis using LinearAlgebra using LoopVectorization using StaticArrays -include("../../Support/Helpers.jl") -using .Helpers: get_MMatrix, determinant, invert, smat, interpol_data, get_dependent_value, - mat_mul! +using ......Helpers: get_MMatrix, determinant, invert, smat, interpol_data, + get_dependent_value, + mat_mul!, matrix_to_voigt, voigt_to_matrix export get_value export get_all_elastic_moduli export get_Hooke_matrix export distribute_forces! export local_damping_due_to_damage export flaw_function -export matrix_to_voigt -export voigt_to_matrix -export matrix_to_vector -export vector_to_matrix export check_symmetry export get_symmetry export get_von_mises_yield_stress @@ -249,7 +245,7 @@ function get_all_elastic_moduli(datamanager::Module, if state_factor_defined && datamanager.has_key("State Variables") state_factor = datamanager.get_field("State Variables")[:, - parameter["State Factor ID"]] + parameter["State Factor ID"]] K .*= state_factor E .*= state_factor G .*= state_factor @@ -472,15 +468,15 @@ function distribute_forces!(force_densities::Matrix{Float64}, @views @inbounds @fastmath for m in axes(force_densities[iID, :], 1) #temp = bond_damage[iID][jID] * bond_force[iID][jID, m] force_densities[iID, - m] += bond_damage[iID][jID] * - bond_force[iID][jID][m] * - volume[nlist[iID][jID]] * - bond_mod[jID][m] + m] += bond_damage[iID][jID] * + bond_force[iID][jID][m] * + volume[nlist[iID][jID]] * + bond_mod[jID][m] force_densities[nlist[iID][jID], - m] -= bond_damage[iID][jID] * - bond_force[iID][jID][m] * - volume[iID] * - bond_mod[jID][m] + m] -= bond_damage[iID][jID] * + bond_force[iID][jID][m] * + volume[iID] * + bond_mod[jID][m] end end end @@ -522,6 +518,8 @@ function distribute_forces!(force_densities::Matrix{Float64}, @inbounds @fastmath for m in eachindex(forces_j) force_contribution = damage_factor * forces_j[m] + # @info damage_factor + # @info forces_j[m] force_densities[iID, m] += force_contribution * vol_j force_densities[jID, m] -= force_contribution * vol_i end @@ -530,109 +528,6 @@ function distribute_forces!(force_densities::Matrix{Float64}, return nothing end -""" - matrix_to_voigt(matrix) - -Convert a 2x2 or 3x3 matrix to Voigt notation (6x1 vector) - -# Arguments -- `matrix::Matrix{Float64}`: The matrix. -# Returns -- `voigt::Vector{Float64}`: The Voigt notation. -""" - -function matrix_to_voigt(matrix::AbstractMatrix{Float64}) - if length(matrix) == 4 - @inbounds return @SVector [matrix[1, 1], - matrix[2, 2], - 0.5 * (matrix[1, 2] + matrix[2, 1])] - - elseif length(matrix) == 9 - @inbounds return @SVector [matrix[1, 1], - matrix[2, 2], - matrix[3, 3], - 0.5 * (matrix[2, 3] + matrix[3, 2]), - 0.5 * (matrix[1, 3] + matrix[3, 1]), - 0.5 * (matrix[1, 2] + matrix[2, 1])] - else - @error "Unsupported matrix size for matrix_to_voigt" - return nothing - end -end - -""" - voigt_to_matrix(voigt::Union{Vector{Float64},Vector{Int64}}) - -Convert a Voigt notation (6x1 or 3x1 vector) to a 2x2 or 3x3 matrix - -# Arguments -- `voigt::Vector{Float64}`: The Voigt notation. -# Returns -- `matrix::Matrix{Float64}`: The matrix. -""" -function voigt_to_matrix(voigt::Union{MVector,SVector,Vector}) - if length(voigt) == 3 - return @SMatrix [voigt[1] voigt[3]; voigt[3] voigt[2]] - elseif length(voigt) == 6 - return @SMatrix [voigt[1] voigt[6] voigt[5] - voigt[6] voigt[2] voigt[4] - voigt[5] voigt[4] voigt[3]] - else - @error "Unsupported matrix size for voigt_to_matrix" - return nothing - end -end - -""" - matrix_to_vector(matrix::AbstractMatrix{Float64}) - -Convert a 3x3 matrix to a 6x1 vector - -# Arguments -- `matrix::Matrix{Float64}`: The matrix. -# Returns -- `vector::SVector{Float64}`: The Vorigt vector. -""" -function matrix_to_vector(matrix::AbstractMatrix{Float64}) - if length(matrix) == 4 - @inbounds return @SVector [ - matrix[1, 1], - matrix[2, 2], - 0.0, - matrix[1, 2], - matrix[2, 1] - ] - elseif length(matrix) == 9 - @inbounds return @SVector [matrix[1, 1], matrix[2, 2], matrix[3, 3], - matrix[1, 2], matrix[2, 3], matrix[3, 1], - matrix[2, 1], matrix[3, 2], matrix[1, 3]] - end -end - -""" - vector_to_matrix(matrix) - -Convert a 6x1 vector to a 3x3 matrix - -# Arguments -- `vector::Vector{Float64}`: The vector. -# Returns -- `matrix::Matrix{Float64}`: The matrix. -""" -function vector_to_matrix(vector) - if length(vector) == 5 - return @SMatrix [vector[1] vector[3] - vector[4] vector[2]] - elseif length(vector) == 9 - return @SMatrix [vector[1] vector[4] vector[9] - vector[7] vector[2] vector[5] - vector[6] vector[8] vector[3]] - else - @error "Unsupported vector size for vector_to_matrix" - return nothing - end -end - """ check_symmetry(prop::Dict, dof::Int64) diff --git a/src/Models/Material/Material_Factory.jl b/src/Models/Material/Material_Factory.jl index 6c2bb3a82..6c6666dd5 100644 --- a/src/Models/Material/Material_Factory.jl +++ b/src/Models/Material/Material_Factory.jl @@ -4,23 +4,21 @@ module Material include("../../Core/Module_inclusion/set_Modules.jl") -include("Material_Basis.jl") -using .Material_Basis: - get_all_elastic_moduli, - distribute_forces!, - check_symmetry, - get_all_elastic_moduli, - init_local_damping_due_to_damage, - local_damping_due_to_damage +include("Material_Models/Ordinary/Ordinary.jl") +using ...Material_Basis: + get_all_elastic_moduli, + distribute_forces!, + check_symmetry, + get_all_elastic_moduli, + init_local_damping_due_to_damage, + local_damping_due_to_damage using LinearAlgebra: dot -using .Set_modules +# using .Set_modules using TimerOutputs using StaticArrays -global module_list = Set_modules.find_module_files(@__DIR__, "material_name") -Set_modules.include_files(module_list) -include("./Material_Models/Correspondence/Correspondence.jl") -using .Correspondence +global module_list = find_module_files(@__DIR__, "material_name") +include_files(module_list) export init_model export compute_model export determine_isotropic_parameter @@ -108,9 +106,9 @@ function init_model(datamanager::Module, nodes::AbstractVector{Int64}, material_models = map(r -> strip(r), material_models) for material_model in material_models - mod = Set_modules.create_module_specifics(material_model, - module_list, - "material_name") + mod = create_module_specifics(material_model, + module_list, + "material_name") datamanager.set_analysis_model("Material Model", block, material_model) if isnothing(mod) @error "No material of name " * material_model * " exists." diff --git a/src/Models/Material/Material_Models/BondBased/1D_Bondbased_Elastic.jl b/src/Models/Material/Material_Models/BondBased/1D_Bondbased_Elastic.jl index 299782c78..2787beee1 100644 --- a/src/Models/Material/Material_Models/BondBased/1D_Bondbased_Elastic.jl +++ b/src/Models/Material/Material_Models/BondBased/1D_Bondbased_Elastic.jl @@ -3,10 +3,6 @@ # SPDX-License-Identifier: BSD-3-Clause module OneD_Bond_based_elastic -include("../../Material_Basis.jl") -include("../../../../Support/Helpers.jl") -using .Material_Basis: get_symmetry, apply_pointwise_E, compute_bond_based_constants -using .Helpers: is_dependent using LoopVectorization using TimerOutputs export init_model diff --git a/src/Models/Material/Material_Models/BondBased/Bondbased_Elastic.jl b/src/Models/Material/Material_Models/BondBased/Bondbased_Elastic.jl index a43a1cc22..b60d16ad9 100644 --- a/src/Models/Material/Material_Models/BondBased/Bondbased_Elastic.jl +++ b/src/Models/Material/Material_Models/BondBased/Bondbased_Elastic.jl @@ -3,10 +3,8 @@ # SPDX-License-Identifier: BSD-3-Clause module Bondbased_Elastic -include("../../Material_Basis.jl") -include("../../../../Support/Helpers.jl") -using .Material_Basis: get_symmetry, apply_pointwise_E, compute_bond_based_constants -using .Helpers: is_dependent +using ....Material_Basis: get_symmetry, apply_pointwise_E, compute_bond_based_constants +using .......Helpers: is_dependent using LoopVectorization using TimerOutputs export init_model diff --git a/src/Models/Material/Material_Models/BondBased/Unified_Bondbased_Elastic.jl b/src/Models/Material/Material_Models/BondBased/Unified_Bondbased_Elastic.jl index e9be75f35..dad172abb 100644 --- a/src/Models/Material/Material_Models/BondBased/Unified_Bondbased_Elastic.jl +++ b/src/Models/Material/Material_Models/BondBased/Unified_Bondbased_Elastic.jl @@ -11,8 +11,7 @@ It is simplified. Rigid body motion is not considered )omega_{ij} = 0 as well as """ # -include("../../Material_Basis.jl") -import .Material_Basis: get_symmetry, apply_pointwise_E +import ....Material_Basis: get_symmetry, apply_pointwise_E using LoopVectorization using TimerOutputs export init_model diff --git a/src/Models/Material/Material_Models/Correspondence/Bond_Associated_Correspondence.jl b/src/Models/Material/Material_Models/Correspondence/Bond_Associated_Correspondence.jl index 7a747d451..dca1b0722 100644 --- a/src/Models/Material/Material_Models/Correspondence/Bond_Associated_Correspondence.jl +++ b/src/Models/Material/Material_Models/Correspondence/Bond_Associated_Correspondence.jl @@ -6,19 +6,15 @@ module Bond_Associated_Correspondence using LinearAlgebra using StaticArrays using TimerOutputs -include("../../../../Support/Helpers.jl") -include("../../../../Support/Geometry.jl") -include("../../Material_Basis.jl") -using .Material_Basis: compute_Piola_Kirchhoff_stress! -using .Helpers: - find_local_neighbors, invert, rotate, fastdot, determinant, smat, - matrix_diff! -using .Geometry: - compute_strain, - compute_bond_level_rotation_tensor, - compute_bond_level_deformation_gradient -include("../../../Pre_calculation/pre_bond_associated_correspondence.jl") -using .Pre_Bond_Associated_Correspondence: compute_weighted_volume! +using .....Material_Basis: compute_Piola_Kirchhoff_stress! +using ........Helpers: + find_local_neighbors, invert, rotate, fastdot, determinant, smat, + matrix_diff! +using ........Geometry: + compute_strain, + compute_bond_level_rotation_tensor, + compute_bond_level_deformation_gradient +using ....Pre_Calculation.Pre_Bond_Associated_Correspondence: compute_weighted_volume! export fields_for_local_synchronization export init_model export compute_model diff --git a/src/Models/Material/Material_Models/Correspondence/Correspondence.jl b/src/Models/Material/Material_Models/Correspondence/Correspondence.jl index e1469074d..a77621195 100644 --- a/src/Models/Material/Material_Models/Correspondence/Correspondence.jl +++ b/src/Models/Material/Material_Models/Correspondence/Correspondence.jl @@ -12,17 +12,13 @@ include("../Zero_Energy_Control/global_control.jl") using .Global_zero_energy_control: compute_control include("./Bond_Associated_Correspondence.jl") using .Bond_Associated_Correspondence -include("../../Material_Basis.jl") -using .Material_Basis: compute_Piola_Kirchhoff_stress! -include("../../../../Support/Helpers.jl") -using .Helpers: invert, rotate, determinant, smat, matrix_diff!, fast_mul!, mat_mul! -include("../../../../Support/Geometry.jl") -using .Geometry: compute_strain +using ....Material_Basis: compute_Piola_Kirchhoff_stress! +using .......Helpers: invert, rotate, determinant, smat, matrix_diff!, fast_mul!, mat_mul! +using .......Geometry: compute_strain using .Global_zero_energy_control include("../../../../Core/Module_inclusion/set_Modules.jl") -using .Set_modules -global module_list = Set_modules.find_module_files(@__DIR__, "correspondence_name") -Set_modules.include_files(module_list) +global module_list = find_module_files(@__DIR__, "correspondence_name") +include_files(module_list) export init_model export material_name @@ -65,9 +61,9 @@ function init_model(datamanager::Module, #occursin("Correspondence", material_name) for material_model in material_models datamanager.set_analysis_model("Correspondence Model", block, material_model) - mod = Set_modules.create_module_specifics(material_model, - module_list, - "correspondence_name") + mod = create_module_specifics(material_model, + module_list, + "correspondence_name") if isnothing(mod) @error "No correspondence material of name " * material_model * " exists." return nothing diff --git a/src/Models/Material/Material_Models/Correspondence/Correspondence_Elastic.jl b/src/Models/Material/Material_Models/Correspondence/Correspondence_Elastic.jl index e1033373e..b5bf61d77 100644 --- a/src/Models/Material/Material_Models/Correspondence/Correspondence_Elastic.jl +++ b/src/Models/Material/Material_Models/Correspondence/Correspondence_Elastic.jl @@ -3,10 +3,8 @@ # SPDX-License-Identifier: BSD-3-Clause module Correspondence_Elastic -include("../../Material_Basis.jl") -include("../../../../Support/Helpers.jl") -using .Material_Basis: voigt_to_matrix, matrix_to_voigt, get_Hooke_matrix -using .Helpers: get_fourth_order, fast_mul!, get_mapping +using .....Material_Basis: get_Hooke_matrix +using .......Helpers: get_fourth_order, fast_mul!, get_mapping export compute_stresses export correspondence_name export fe_support diff --git a/src/Models/Material/Material_Models/Correspondence/Correspondence_Plastic.jl b/src/Models/Material/Material_Models/Correspondence/Correspondence_Plastic.jl index 3eca09b51..9df9d8b13 100644 --- a/src/Models/Material/Material_Models/Correspondence/Correspondence_Plastic.jl +++ b/src/Models/Material/Material_Models/Correspondence/Correspondence_Plastic.jl @@ -3,10 +3,9 @@ # SPDX-License-Identifier: BSD-3-Clause module Correspondence_Plastic -include("../../Material_Basis.jl") -using .Material_Basis: - flaw_function, get_von_mises_yield_stress, - compute_deviatoric_and_spherical_stresses +using .....Material_Basis: + flaw_function, get_von_mises_yield_stress, + compute_deviatoric_and_spherical_stresses using LinearAlgebra using StaticArrays export fe_support @@ -142,18 +141,18 @@ function compute_stresses(datamanager::Module, stress_NP1[iID, :, :], plastic_strain_NP1[iID], von_Mises_stress_yield[iID] = compute_plastic_model(stress_NP1[iID, - :, - :], + :, + :], stress_N[iID, - :, - :], + :, + :], spherical_stress_NP1, spherical_stress_N, deviatoric_stress_NP1, deviatoric_stress_N, strain_increment[iID, - :, - :], + :, + :], von_Mises_stress_yield[iID], plastic_strain_NP1[iID], plastic_strain_N[iID], @@ -199,16 +198,16 @@ function compute_stresses_ba(datamanager::Module, stress_NP1[iID][jID, :, :], plastic_strain_NP1[iID][jID], von_Mises_stress_yield[iID][jID] = compute_plastic_model(stress_NP1[iID][jID, :, - :], + :], stress_N[iID][jID, :, - :], + :], spherical_stress_NP1, spherical_stress_N, deviatoric_stress_NP1, deviatoric_stress_N, strain_increment[iID][jID, - :, - :], + :, + :], von_Mises_stress_yield[iID][jID], plastic_strain_NP1[iID][jID], plastic_strain_N[iID][jID], diff --git a/src/Models/Material/Material_Models/Correspondence/Correspondence_UMAT.jl b/src/Models/Material/Material_Models/Correspondence/Correspondence_UMAT.jl index 566bcf3fd..fe0acd7db 100644 --- a/src/Models/Material/Material_Models/Correspondence/Correspondence_UMAT.jl +++ b/src/Models/Material/Material_Models/Correspondence/Correspondence_UMAT.jl @@ -4,11 +4,9 @@ module Correspondence_UMAT using StaticArrays -include("../../Material_Basis.jl") -using .Material_Basis: voigt_to_matrix, matrix_to_voigt, get_Hooke_matrix -include("../../../../Support/Geometry.jl") -include("../Zero_Energy_Control/global_control.jl") -using .Global_zero_energy_control: global_zero_energy_mode_stiffness +using ......Helpers: voigt_to_matrix, matrix_to_voigt +using .....Material_Basis: get_Hooke_matrix +using ..Global_zero_energy_control: global_zero_energy_mode_stiffness export fe_support export init_model export correspondence_name diff --git a/src/Models/Material/Material_Models/Correspondence/Correspondence_VUMAT.jl b/src/Models/Material/Material_Models/Correspondence/Correspondence_VUMAT.jl index d383c22c3..eccb892c8 100644 --- a/src/Models/Material/Material_Models/Correspondence/Correspondence_VUMAT.jl +++ b/src/Models/Material/Material_Models/Correspondence/Correspondence_VUMAT.jl @@ -4,13 +4,10 @@ module Correspondence_VUMAT using StaticArrays -include("../../Material_Basis.jl") -using .Material_Basis: - voigt_to_matrix, matrix_to_voigt, get_Hooke_matrix, matrix_to_vector, - vector_to_matrix -include("../../../../Support/Geometry.jl") -include("../Zero_Energy_Control/global_control.jl") -using .Global_zero_energy_control: global_zero_energy_mode_stiffness +using ......Helpers: voigt_to_matrix, matrix_to_voigt, matrix_to_vector, + vector_to_matrix +using .....Material_Basis: get_Hooke_matrix +using ..Global_zero_energy_control: global_zero_energy_mode_stiffness export fe_support export init_model export correspondence_name diff --git a/src/Models/Material/Material_Models/Ordinary/Ordinary.jl b/src/Models/Material/Material_Models/Ordinary/Ordinary.jl index 9be197180..3a80e6734 100644 --- a/src/Models/Material/Material_Models/Ordinary/Ordinary.jl +++ b/src/Models/Material/Material_Models/Ordinary/Ordinary.jl @@ -4,8 +4,7 @@ module Ordinary -include("../../../../Support/Helpers.jl") -using .Helpers: div_in_place!, mul_in_place! +using .....Helpers: div_in_place!, mul_in_place! using LinearAlgebra using LoopVectorization export compute_dilatation! diff --git a/src/Models/Material/Material_Models/Ordinary/PD_Solid_Elastic.jl b/src/Models/Material/Material_Models/Ordinary/PD_Solid_Elastic.jl index 16d38fd0d..5e2124f81 100644 --- a/src/Models/Material/Material_Models/Ordinary/PD_Solid_Elastic.jl +++ b/src/Models/Material/Material_Models/Ordinary/PD_Solid_Elastic.jl @@ -3,16 +3,13 @@ # SPDX-License-Identifier: BSD-3-Clause module PD_Solid_Elastic -include("../../Material_Basis.jl") -using .Material_Basis: get_symmetry -include("./Ordinary.jl") -include("../../../../Support/Helpers.jl") -using .Helpers: add_in_place! +using ....Material_Basis: get_symmetry +using ......Helpers: add_in_place! using TimerOutputs using StaticArrays -using .Ordinary: - compute_weighted_volume!, compute_dilatation!, calculate_symmetry_params, - get_bond_forces +using ..Ordinary: + compute_weighted_volume!, compute_dilatation!, calculate_symmetry_params, + get_bond_forces export fe_support export init_model export material_name @@ -211,8 +208,8 @@ function elastic!(nodes::AbstractVector{Int64}, # alpha::Float64 = 0 if shear_modulus isa Float64 alpha, gamma, - kappa = Ordinary.calculate_symmetry_params(symmetry, shear_modulus, - bulk_modulus) + kappa = calculate_symmetry_params(symmetry, shear_modulus, + bulk_modulus) end for iID in nodes @@ -222,9 +219,9 @@ function elastic!(nodes::AbstractVector{Int64}, end if !(shear_modulus isa Float64) alpha, gamma, - kappa = Ordinary.calculate_symmetry_params(symmetry, - shear_modulus[iID], - bulk_modulus[iID]) + kappa = calculate_symmetry_params(symmetry, + shear_modulus[iID], + bulk_modulus[iID]) end deviatoric_deformation::Float64 = 0.0 diff --git a/src/Models/Material/Material_Models/Ordinary/PD_Solid_Plastic.jl b/src/Models/Material/Material_Models/Ordinary/PD_Solid_Plastic.jl index d0f39f4a3..947168fcd 100644 --- a/src/Models/Material/Material_Models/Ordinary/PD_Solid_Plastic.jl +++ b/src/Models/Material/Material_Models/Ordinary/PD_Solid_Plastic.jl @@ -5,12 +5,9 @@ module PD_Solid_Plastic using TimerOutputs -include("../../Material_Basis.jl") -using .Material_Basis: get_symmetry -include("./Ordinary.jl") -include("../../../../Support/Helpers.jl") -using .Helpers: add_in_place!, mul_in_place!, sub_in_place! -using .Ordinary: calculate_symmetry_params, get_bond_forces +using ....Material_Basis: get_symmetry +using ......Helpers: add_in_place!, mul_in_place!, sub_in_place! +using ..Ordinary: calculate_symmetry_params, get_bond_forces export fe_support export init_model @@ -159,9 +156,9 @@ function compute_model(datamanager::Module, lambdaNP1 = datamanager.get_field("Lambda Plastic", "NP1") @timeit to "calculate_symmetry_params" alpha, gamma, - kappa=Ordinary.calculate_symmetry_params(symmetry, - shear_modulus, - bulk_modulus) + kappa=calculate_symmetry_params(symmetry, + shear_modulus, + bulk_modulus) @timeit to "compute_deviatoric_force_state_norm" compute_deviatoric_force_state_norm!(td_norm, nodes, nlist, diff --git a/src/Models/Material/Material_Models/Zero_Energy_Control/global_control.jl b/src/Models/Material/Material_Models/Zero_Energy_Control/global_control.jl index 591724e9a..eef20c89d 100644 --- a/src/Models/Material/Material_Models/Zero_Energy_Control/global_control.jl +++ b/src/Models/Material/Material_Models/Zero_Energy_Control/global_control.jl @@ -3,14 +3,11 @@ # SPDX-License-Identifier: BSD-3-Clause module Global_zero_energy_control -include("../../../../Support/Helpers.jl") -using .Helpers: get_fourth_order, mul! +using ........Helpers: get_fourth_order, mul! using StaticArrays: MMatrix, MVector using LoopVectorization -include("../../../../Support/Geometry.jl") -include("../../Material_Basis.jl") -using .Material_Basis: get_Hooke_matrix -using .Geometry: rotation_tensor +using .....Material_Basis: get_Hooke_matrix +using ........Geometry: rotation_tensor export control_name export compute_control export global_zero_energy_mode_stiffness diff --git a/src/Models/Model_Factory.jl b/src/Models/Model_Factory.jl index 25f49aaeb..b16fe88e4 100644 --- a/src/Models/Model_Factory.jl +++ b/src/Models/Model_Factory.jl @@ -3,11 +3,11 @@ # SPDX-License-Identifier: BSD-3-Clause module Model_Factory -include("../Support/Helpers.jl") -using .Helpers: - check_inf_or_nan, find_active_nodes, get_active_update_nodes, invert, - determinant +using ....Helpers: + check_inf_or_nan, find_active_nodes, get_active_update_nodes, invert, + determinant +include("./Pre_calculation/Pre_Calculation_Factory.jl") include("./Surface_correction/Surface_correction.jl") include("./Contact/Contact_Factory.jl") include("./Additive/Additive_Factory.jl") @@ -15,11 +15,7 @@ include("./Degradation/Degradation_Factory.jl") include("./Damage/Damage_Factory.jl") include("./Material/Material_Factory.jl") include("./Thermal/Thermal_Factory.jl") -include("./Pre_calculation/Pre_Calculation_Factory.jl") -include("../Support/Parameters/parameter_handling.jl") -using .Parameter_Handling: get_model_parameter, get_heat_capacity -# in future FEM will be outside of the Model_Factory -include("../FEM/FEM_Factory.jl") +using ...Parameter_Handling: get_model_parameter, get_heat_capacity using .Additive using .Degradation using .Damage @@ -29,7 +25,7 @@ using .Surface_correction: init_surface_correction, compute_surface_correction using .Thermal using .Contact_Factory # in future FEM will be outside of the Model_Factory -using .FEM +using ..FEM using TimerOutputs export compute_models export init_models diff --git a/src/Models/Pre_calculation/Pre_Calculation_Factory.jl b/src/Models/Pre_calculation/Pre_Calculation_Factory.jl index f0be4f33c..b337ca071 100644 --- a/src/Models/Pre_calculation/Pre_Calculation_Factory.jl +++ b/src/Models/Pre_calculation/Pre_Calculation_Factory.jl @@ -5,9 +5,9 @@ module Pre_Calculation include("../../Core/Module_inclusion/set_Modules.jl") using DataStructures -using .Set_modules -global module_list = Set_modules.find_module_files(@__DIR__, "pre_calculation_name") -Set_modules.include_files(module_list) +# using .Set_modules +global module_list = find_module_files(@__DIR__, "pre_calculation_name") +include_files(module_list) using TimerOutputs @@ -60,9 +60,9 @@ function init_model(datamanager::Module, nodes::AbstractVector{Int64}, for (active_model_name, active_model) in pairs(datamanager.get_properties(block, "Pre Calculation Model")) if active_model - mod = Set_modules.create_module_specifics(active_model_name, - module_list, - "pre_calculation_name") + mod = create_module_specifics(active_model_name, + module_list, + "pre_calculation_name") datamanager.set_model_module(active_model_name, mod) # TODO right now no additional information is needed diff --git a/src/Models/Pre_calculation/bond_deformation.jl b/src/Models/Pre_calculation/bond_deformation.jl index b004d98ed..56cc77ca4 100644 --- a/src/Models/Pre_calculation/bond_deformation.jl +++ b/src/Models/Pre_calculation/bond_deformation.jl @@ -4,8 +4,7 @@ module Bond_Deformation using DataStructures: OrderedDict -include("../../Support/Geometry.jl") -using .Geometry +using .......Geometry: bond_geometry! export pre_calculation_name export init_model export compute @@ -75,11 +74,11 @@ function compute(datamanager::Module, deformed_coor = datamanager.get_field("Deformed Coordinates", "NP1") deformed_bond = datamanager.get_field("Deformed Bond Geometry", "NP1") deformed_bond_length = datamanager.get_field("Deformed Bond Length", "NP1") - Geometry.bond_geometry!(deformed_bond, - deformed_bond_length, - nodes, - nlist, - deformed_coor) + bond_geometry!(deformed_bond, + deformed_bond_length, + nodes, + nlist, + deformed_coor) return datamanager end diff --git a/src/Models/Pre_calculation/deformation_gradient.jl b/src/Models/Pre_calculation/deformation_gradient.jl index f335b2bac..d486dcd15 100644 --- a/src/Models/Pre_calculation/deformation_gradient.jl +++ b/src/Models/Pre_calculation/deformation_gradient.jl @@ -4,8 +4,7 @@ module Deformation_Gradient using DataStructures: OrderedDict -include("../../Support/Geometry.jl") -using .Geometry: compute_deformation_gradients! +using .......Geometry: compute_deformation_gradients! export pre_calculation_name export init_model export compute diff --git a/src/Models/Pre_calculation/pre_bond_associated_correspondence.jl b/src/Models/Pre_calculation/pre_bond_associated_correspondence.jl index 67a19ea1d..98c68d7b4 100644 --- a/src/Models/Pre_calculation/pre_bond_associated_correspondence.jl +++ b/src/Models/Pre_calculation/pre_bond_associated_correspondence.jl @@ -4,8 +4,7 @@ module Pre_Bond_Associated_Correspondence using DataStructures: OrderedDict -include("../../Support/Geometry.jl") -using .Geometry: compute_weighted_deformation_gradient +using .......Geometry: compute_weighted_deformation_gradient using LoopVectorization using StaticArrays: @MVector export fields_for_local_synchronization @@ -13,8 +12,7 @@ export pre_calculation_name export init_model export compute -include("../../Support/Helpers.jl") -using .Helpers: invert, qdim +using .......Helpers: invert, qdim """ pre_calculation_name() diff --git a/src/Models/Pre_calculation/shape_tensor.jl b/src/Models/Pre_calculation/shape_tensor.jl index 8593f0fa5..3bfb64378 100644 --- a/src/Models/Pre_calculation/shape_tensor.jl +++ b/src/Models/Pre_calculation/shape_tensor.jl @@ -4,10 +4,8 @@ module Shape_Tensor using DataStructures: OrderedDict -include("../../Support/Helpers.jl") -using .Helpers: find_active_nodes -include("../../Support/Geometry.jl") -using .Geometry: compute_shape_tensors! +using ......Helpers: find_active_nodes +using ......Geometry: compute_shape_tensors! export pre_calculation_name export init_model export compute diff --git a/src/Models/Thermal/Thermal_Factory.jl b/src/Models/Thermal/Thermal_Factory.jl index 1a462aaa9..e89151a29 100644 --- a/src/Models/Thermal/Thermal_Factory.jl +++ b/src/Models/Thermal/Thermal_Factory.jl @@ -5,9 +5,9 @@ module Thermal using TimerOutputs include("../../Core/Module_inclusion/set_Modules.jl") -using .Set_modules -global module_list = Set_modules.find_module_files(@__DIR__, "thermal_model_name") -Set_modules.include_files(module_list) +# using .Set_modules +global module_list = find_module_files(@__DIR__, "thermal_model_name") +include_files(module_list) using TimerOutputs export init_model export compute_model @@ -85,9 +85,9 @@ function init_model(datamanager::Module, nodes::AbstractVector{Int64}, thermal_models = split(model_param["Thermal Model"], "+") thermal_models = map(r -> strip(r), thermal_models) for thermal_model in thermal_models - mod = Set_modules.create_module_specifics(thermal_model, - module_list, - "thermal_model_name") + mod = create_module_specifics(thermal_model, + module_list, + "thermal_model_name") if isnothing(mod) @error "No thermal model of name " * thermal_model * " exists." return nothing diff --git a/src/Models/Thermal/heat_transfer.jl b/src/Models/Thermal/heat_transfer.jl index bf8c57109..ddf981bda 100644 --- a/src/Models/Thermal/heat_transfer.jl +++ b/src/Models/Thermal/heat_transfer.jl @@ -7,8 +7,7 @@ using LinearAlgebra: dot export compute_model export thermal_model_name export init_model -include("../../Support/Helpers.jl") -using .Helpers: normalize_in_place! +using .....Helpers: normalize_in_place! """ thermal_model_name() diff --git a/src/Models/Thermal/thermal_expansion.jl b/src/Models/Thermal/thermal_expansion.jl index 5eae95fa4..8630fc8c3 100644 --- a/src/Models/Thermal/thermal_expansion.jl +++ b/src/Models/Thermal/thermal_expansion.jl @@ -9,8 +9,7 @@ module Thermal_expansion using LinearAlgebra using StaticArrays -include("../Pre_calculation/deformation_gradient.jl") -using .Deformation_Gradient +using ...Pre_Calculation.Deformation_Gradient export fields_for_local_synchronization export compute_model export thermal_model_name diff --git a/src/Models/Thermal/thermal_flow.jl b/src/Models/Thermal/thermal_flow.jl index a72d245f1..3049febdb 100644 --- a/src/Models/Thermal/thermal_flow.jl +++ b/src/Models/Thermal/thermal_flow.jl @@ -5,8 +5,7 @@ module Thermal_Flow using LinearAlgebra using StaticArrays -include("../../Support/Helpers.jl") -using .Helpers: rotate_second_order_tensor, fastdot +using .....Helpers: rotate_second_order_tensor, fastdot export compute_model export thermal_model_name export init_model diff --git a/src/PeriLab.jl b/src/PeriLab.jl index fa5a31e6a..a6bd0099a 100644 --- a/src/PeriLab.jl +++ b/src/PeriLab.jl @@ -35,12 +35,14 @@ main("examples/Dogbone/Dogbone.yaml"; output_dir="", dry_run=false, verbose=fals """ module PeriLab +include("./Support/Helpers.jl") +include("./Support/Geometry.jl") include("./Core/Data_manager.jl") include("./IO/logging.jl") +include("./MPI_communication/MPI_communication.jl") +include("./Support/Parameters/parameter_handling.jl") include("./IO/IO.jl") include("./Core/Solver/Solver_control.jl") -include("./Support/Parameters/parameter_handling.jl") -using .Parameter_Handling: get_solver_steps using MPI using TimerOutputs @@ -55,9 +57,9 @@ using .Data_manager import .Logging_module import .IO -import .Solver_control +using .Solver_control -PERILAB_VERSION = "1.4.11" +PERILAB_VERSION = "1.5.0" export main @@ -293,12 +295,11 @@ function main(filename::String; Data_manager.set_silent(silent) Data_manager.set_verbose(verbose) @timeit to "IO.initialize_data" datamanager, - params=IO.initialize_data(filename, - filedirectory, - Data_manager, - comm, to) - - steps = get_solver_steps(params) + params, + steps=IO.initialize_data(filename, + filedirectory, + Data_manager, + comm, to) datamanager.set_max_step(steps[end]) for step_id in steps if !isnothing(step_id) diff --git a/src/Support/Geometry.jl b/src/Support/Geometry.jl index ec6eba126..e4b0c1334 100644 --- a/src/Support/Geometry.jl +++ b/src/Support/Geometry.jl @@ -7,8 +7,7 @@ using LinearAlgebra using Combinatorics: levicivita using StaticArrays using Rotations -include("Helpers.jl") -using .Helpers: invert, smat, mat_mul_transpose_mat! +using ...Helpers: invert, smat, mat_mul_transpose_mat! export bond_geometry! export compute_shape_tensors! export compute_deformation_gradients! diff --git a/src/Support/Helpers.jl b/src/Support/Helpers.jl index d1c771116..d0058dea5 100644 --- a/src/Support/Helpers.jl +++ b/src/Support/Helpers.jl @@ -46,6 +46,11 @@ export get_ring export get_hexagon export nearest_point_id export get_shared_horizon +export matrix_style +export matrix_to_voigt +export voigt_to_matrix +export matrix_to_vector +export vector_to_matrix const MAPPING_2D = @SMatrix [1 1; 2 2; 2 1] const MAPPING_3D = @SMatrix [1 1; 2 2; 3 3; 2 3; 1 3; 1 2] @@ -1086,4 +1091,107 @@ function rotation(R::Union{Adjoint{Float64,Matrix{Float64}},Matrix{Float64}}, end end +""" + matrix_to_voigt(matrix) + +Convert a 2x2 or 3x3 matrix to Voigt notation (6x1 vector) + +# Arguments +- `matrix::Matrix{Float64}`: The matrix. +# Returns +- `voigt::Vector{Float64}`: The Voigt notation. +""" + +function matrix_to_voigt(matrix::AbstractMatrix{Float64}) + if length(matrix) == 4 + @inbounds return @SVector [matrix[1, 1], + matrix[2, 2], + 0.5 * (matrix[1, 2] + matrix[2, 1])] + + elseif length(matrix) == 9 + @inbounds return @SVector [matrix[1, 1], + matrix[2, 2], + matrix[3, 3], + 0.5 * (matrix[2, 3] + matrix[3, 2]), + 0.5 * (matrix[1, 3] + matrix[3, 1]), + 0.5 * (matrix[1, 2] + matrix[2, 1])] + else + @error "Unsupported matrix size for matrix_to_voigt" + return nothing + end +end + +""" + voigt_to_matrix(voigt::Union{Vector{Float64},Vector{Int64}}) + +Convert a Voigt notation (6x1 or 3x1 vector) to a 2x2 or 3x3 matrix + +# Arguments +- `voigt::Vector{Float64}`: The Voigt notation. +# Returns +- `matrix::Matrix{Float64}`: The matrix. +""" +function voigt_to_matrix(voigt::Union{MVector,SVector,Vector}) + if length(voigt) == 3 + return @SMatrix [voigt[1] voigt[3]; voigt[3] voigt[2]] + elseif length(voigt) == 6 + return @SMatrix [voigt[1] voigt[6] voigt[5] + voigt[6] voigt[2] voigt[4] + voigt[5] voigt[4] voigt[3]] + else + @error "Unsupported matrix size for voigt_to_matrix" + return nothing + end +end + +""" + matrix_to_vector(matrix::AbstractMatrix{Float64}) + +Convert a 3x3 matrix to a 6x1 vector + +# Arguments +- `matrix::Matrix{Float64}`: The matrix. +# Returns +- `vector::SVector{Float64}`: The Vorigt vector. +""" +function matrix_to_vector(matrix::AbstractMatrix{Float64}) + if length(matrix) == 4 + @inbounds return @SVector [ + matrix[1, 1], + matrix[2, 2], + 0.0, + matrix[1, 2], + matrix[2, 1] + ] + elseif length(matrix) == 9 + @inbounds return @SVector [matrix[1, 1], matrix[2, 2], matrix[3, 3], + matrix[1, 2], matrix[2, 3], matrix[3, 1], + matrix[2, 1], matrix[3, 2], matrix[1, 3]] + end +end + +""" + vector_to_matrix(matrix) + +Convert a 6x1 vector to a 3x3 matrix + +# Arguments +- `vector::Vector{Float64}`: The vector. +# Returns +- `matrix::Matrix{Float64}`: The matrix. +""" +function vector_to_matrix(vector) + if length(vector) == 5 + return @SMatrix [vector[1] vector[3] + vector[4] vector[2]] + elseif length(vector) == 9 + return @SMatrix [vector[1] vector[4] vector[9] + vector[7] vector[2] vector[5] + vector[6] vector[8] vector[3]] + else + @error "Unsupported vector size for vector_to_matrix" + return nothing + end +end + end diff --git a/src/Support/Parameters/parameter_handling_models.jl b/src/Support/Parameters/parameter_handling_models.jl index cebe0283c..b34d8cee5 100644 --- a/src/Support/Parameters/parameter_handling_models.jl +++ b/src/Support/Parameters/parameter_handling_models.jl @@ -1,8 +1,7 @@ # SPDX-FileCopyrightText: 2023 Christian Willberg , Jan-Timo Hesse # # SPDX-License-Identifier: BSD-3-Clause -include("../Helpers.jl") -using .Helpers: interpolation, interpol_data +using ...Helpers: interpolation, interpol_data export get_model_parameter export find_data_files diff --git a/src/main.jl b/src/main.jl index 1d3bf8a8a..6e9e47e5f 100644 --- a/src/main.jl +++ b/src/main.jl @@ -8,7 +8,6 @@ if isfile("Project.toml") && isfile("Manifest.toml") Pkg.activate(".") Pkg.instantiate() end -using Revise using MPI MPI.Init() import PeriLab diff --git a/test/unit_tests/Compute/ut_compute_field_values.jl b/test/unit_tests/Compute/ut_compute_field_values.jl index 9c6d9e7d3..f0ba30e9b 100644 --- a/test/unit_tests/Compute/ut_compute_field_values.jl +++ b/test/unit_tests/Compute/ut_compute_field_values.jl @@ -3,9 +3,7 @@ # SPDX-License-Identifier: BSD-3-Clause using Test -# include("../../../src/Core/Data_manager.jl") -include("../../../src/Support/Helpers.jl") -include("../../../src/Compute/compute_field_values.jl") + @testset "ut_get_forces_from_force_density" begin test_data_manager = PeriLab.Data_manager test_data_manager.initialize_data() @@ -21,7 +19,7 @@ include("../../../src/Compute/compute_field_values.jl") volume[1:5] = 1:5 force_densityNP1 = rand(5, 3) - test_data_manager = get_forces_from_force_density(test_data_manager) + test_data_manager = PeriLab.Solver_control.Verlet.get_forces_from_force_density(test_data_manager) forces = test_data_manager.get_field("Forces", "NP1") for i in 1:5 for j in 1:3 @@ -62,7 +60,7 @@ end nodes = [1, 2, 3, 4, 5] - test_data_manager = get_partial_stresses(test_data_manager, nodes) + test_data_manager = PeriLab.Solver_control.Verlet.get_partial_stresses(test_data_manager, nodes) stresses = test_data_manager.get_field("Cauchy Stress", "NP1") testval = zeros(5, 3, 3) diff --git a/test/unit_tests/Core/Module_inclusion/ut_set_Modules.jl b/test/unit_tests/Core/Module_inclusion/ut_set_Modules.jl index d55a96bcd..087bcdd1f 100644 --- a/test/unit_tests/Core/Module_inclusion/ut_set_Modules.jl +++ b/test/unit_tests/Core/Module_inclusion/ut_set_Modules.jl @@ -2,17 +2,16 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../src/Core/Module_inclusion/set_Modules.jl") using Test using Random -# using .Set_modules +include("../../../../src/Core/Module_inclusion/set_Modules.jl") @testset "ut_find_jl_files" begin Random.seed!(rand(1:100000)) base = "test_tmp_Set_modules" - @test isnothing(Set_modules.find_jl_files(base)) + @test isnothing(find_jl_files(base)) if isdir(base) rm(base, recursive = true) @@ -46,7 +45,7 @@ using Random io = open(folder * "/" * filename4 * ".dat", "w") close(io) - list = PeriLab.Solver_control.FEM.Set_modules.find_jl_files(base) + list = find_jl_files(base) folder * "/" * filename1 * ".jl" in list @test subfolder1 * "/" * filename2 * ".jl" in list @test subfolder1 * "/" * filename3 * ".jl" in list diff --git a/test/unit_tests/Core/Solver/ut_Verlet.jl b/test/unit_tests/Core/Solver/ut_Verlet.jl index 419d08123..d498b127c 100644 --- a/test/unit_tests/Core/Solver/ut_Verlet.jl +++ b/test/unit_tests/Core/Solver/ut_Verlet.jl @@ -74,11 +74,11 @@ volume = [0.5, 0.5, 0.5, 0.5, 0.5] density = [1e-6, 1e-6, 3e-6, 3e-6, 1e-6] horizon = [3.1, 3.1, 3.1, 3.1, 3.1] -PeriLab.IO.Geometry.bond_geometry!(undeformed_bond, - undeformed_bond_length, - Vector(1:nnodes), - nlist, - coor) +PeriLab.Geometry.bond_geometry!(undeformed_bond, + undeformed_bond_length, + Vector(1:nnodes), + nlist, + coor) blocks = ["1", "2"] blocks = test_data_manager.set_block_name_list(blocks) diff --git a/test/unit_tests/FEM/Coupling/ut_Arlequin.jl b/test/unit_tests/FEM/Coupling/ut_Arlequin.jl index a0a765b39..ed73a14b2 100644 --- a/test/unit_tests/FEM/Coupling/ut_Arlequin.jl +++ b/test/unit_tests/FEM/Coupling/ut_Arlequin.jl @@ -4,10 +4,8 @@ using Test #include("../../../src/PeriLab.jl") - -include("../../../../src/FEM/Coupling/Arlequin_coupling.jl") @testset "ut_coupling_name" begin - @test Arlequin_coupling.coupling_name() == "Arlequin" + @test PeriLab.Solver_control.FEM.Coupling_PD_FEM.Arlequin_coupling.coupling_name() == "Arlequin" end @testset "ut_find_point_in_elements" begin dof = 2 @@ -32,7 +30,7 @@ end coordinates[9, :] = [0.5, 1.5] coordinates[10, :] = [1.5, 1.5] #PD - test_dict = Arlequin_coupling.find_point_in_elements(coordinates, + test_dict = PeriLab.Solver_control.FEM.Coupling_PD_FEM.Arlequin_coupling.find_point_in_elements(coordinates, topology, nodesPD, 2) @@ -69,7 +67,7 @@ end p = [1, 1] dof = 2 - test_mat = Arlequin_coupling.compute_coupling_matrix(coordinates, + test_mat = PeriLab.Solver_control.FEM.Coupling_PD_FEM.Arlequin_coupling.compute_coupling_matrix(coordinates, topology, 7, 2, @@ -82,7 +80,7 @@ end -0.25 0.0625 0.0625 0.0625 0.0625 -0.25 0.0625 0.0625 0.0625 0.0625 -0.25 0.0625 0.0625 0.0625 0.0625] - test_mat = Arlequin_coupling.compute_coupling_matrix(coordinates, + test_mat = PeriLab.Solver_control.FEM.Coupling_PD_FEM.Arlequin_coupling.compute_coupling_matrix(coordinates, topology, 8, 1, diff --git a/test/unit_tests/FEM/Element_formulation/ut_lagrange_element.jl b/test/unit_tests/FEM/Element_formulation/ut_lagrange_element.jl index 0f5b04517..cdc85603b 100644 --- a/test/unit_tests/FEM/Element_formulation/ut_lagrange_element.jl +++ b/test/unit_tests/FEM/Element_formulation/ut_lagrange_element.jl @@ -30,7 +30,7 @@ end p = 1 dof = 2 - weights, integration_points = get_weights_and_integration_points(dof, [2, 2]) + weights, integration_points = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(dof, [2, 2]) @test isnothing(Lagrange_element.create_element_matrices(1, [9, 2], [5, 1], @@ -55,7 +55,7 @@ end p) == [0.21132486540518708, 0.7886751345948129] p = 2 - weights, integration_points = get_weights_and_integration_points(2, [3, 3]) + weights, integration_points = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(2, [3, 3]) xi = Lagrange_element.define_lagrangian_grid_space(2, [p, p]) @test Lagrange_element.get_recursive_lagrange_shape_functions(xi[1, :], @@ -70,7 +70,7 @@ end p) == [-0.08729833462074169, 0.39999999999999997, 0.6872983346207417] p = 3 - weights, integration_points = get_weights_and_integration_points(2, [4, 4]) + weights, integration_points = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(2, [4, 4]) xi = Lagrange_element.define_lagrangian_grid_space(2, [p, p]) @test Lagrange_element.get_recursive_lagrange_shape_functions(xi[1, :], integration_points[1, 1], @@ -113,7 +113,7 @@ end 0.0, p) == [-0.5, 0.5] - weights, integration_points = get_weights_and_integration_points(2, [2, 2]) + weights, integration_points = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(2, [2, 2]) @test Lagrange_element.get_recursive_lagrange_shape_functions_derivative(xi[1, :], integration_points[1, 1], @@ -125,7 +125,7 @@ end p) == [-0.5, 0.5] p = 2 - weights, integration_points = get_weights_and_integration_points(2, [3, 3]) + weights, integration_points = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(2, [3, 3]) xi = Lagrange_element.define_lagrangian_grid_space(2, [p, p]) @test Lagrange_element.get_recursive_lagrange_shape_functions_derivative(xi[1, :], integration_points[1, @@ -143,7 +143,7 @@ end p) == [0.2745966692414834, -1.5491933384829668, 1.2745966692414834] p = 3 - weights, integration_points = get_weights_and_integration_points(2, [4, 4]) + weights, integration_points = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(2, [4, 4]) xi = Lagrange_element.define_lagrangian_grid_space(2, [p, p]) @test Lagrange_element.get_recursive_lagrange_shape_functions_derivative(xi[1, :], integration_points[1, diff --git a/test/unit_tests/FEM/ut_FEM_Factory.jl b/test/unit_tests/FEM/ut_FEM_Factory.jl index b0d80d5c2..44f8e6c41 100644 --- a/test/unit_tests/FEM/ut_FEM_Factory.jl +++ b/test/unit_tests/FEM/ut_FEM_Factory.jl @@ -4,7 +4,6 @@ using Test #include("../../../src/PeriLab.jl") - #using .PeriLab PeriLab.Data_manager.initialize_data() diff --git a/test/unit_tests/FEM/ut_FEM_routines.jl b/test/unit_tests/FEM/ut_FEM_routines.jl index 45e143f9b..0ee428b89 100644 --- a/test/unit_tests/FEM/ut_FEM_routines.jl +++ b/test/unit_tests/FEM/ut_FEM_routines.jl @@ -1,20 +1,8 @@ # SPDX-FileCopyrightText: 2023 Christian Willberg , Jan-Timo Hesse # # SPDX-License-Identifier: BSD-3-Clause -include("../../../src/FEM/FEM_routines.jl") include("../../../src/FEM/Element_formulation/Lagrange_element.jl") -#using .Lagrange_element #include("../../../src/PeriLab.jl") -using .FEM_routines: - create_element_matrices, - get_Jacobian, - get_polynomial_degree, - get_number_of_integration_points, - create_element_matrices, - get_lumped_mass, - get_weights_and_integration_points, - get_multi_dimensional_integration_point_data, - get_FE_material_model # using .PeriLab using Test @@ -45,8 +33,8 @@ using Test topology[1, 3] = 3 topology[1, 4] = 4 elements = Vector{Int64}(1:nelements) - p = get_polynomial_degree(params["FEM"]["FE_1"], dof) - num_int = get_number_of_integration_points(p, dof) + p = PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params["FEM"]["FE_1"], dof) + num_int = PeriLab.Solver_control.FEM.FEM_routines.get_number_of_integration_points(p, dof) N = test_data_manager.create_constant_free_size_field("N Matrix", Float64, @@ -57,7 +45,7 @@ using Test (prod(num_int), prod(p .+ 1) * dof, 3 * dof - 3)) - N, B = create_element_matrices(dof, p, Lagrange_element.create_element_matrices) + N, B = PeriLab.Solver_control.FEM.FEM_routines.create_element_matrices(dof, p, Lagrange_element.create_element_matrices) jacobian = test_data_manager.create_constant_free_size_field("Element Jacobi Matrix", Float64, @@ -68,7 +56,7 @@ using Test (nelements, prod(num_int))) test_jacobian, - test_determinant_jacobian = get_Jacobian(elements, + test_determinant_jacobian = PeriLab.Solver_control.FEM.FEM_routines.get_Jacobian(elements, dof, topology, coordinates, @@ -87,7 +75,7 @@ using Test coordinates[4, 2] = 1 jacobian, - determinant_jacobian = get_Jacobian(elements, + determinant_jacobian = PeriLab.Solver_control.FEM.FEM_routines.get_Jacobian(elements, dof, topology, coordinates, @@ -109,7 +97,7 @@ using Test coordinates[4, 1] = 2 coordinates[4, 2] = 0.5 jacobian, - determinant_jacobian = get_Jacobian(elements, + determinant_jacobian = PeriLab.Solver_control.FEM.FEM_routines.get_Jacobian(elements, dof, topology, coordinates, @@ -132,7 +120,7 @@ using Test coordinates[4, 2] = 1.0 jacobian, - determinant_jacobian = get_Jacobian(elements, + determinant_jacobian = PeriLab.Solver_control.FEM.FEM_routines.get_Jacobian(elements, dof, topology, coordinates, @@ -158,7 +146,7 @@ using Test coordinates[4, 2] = 1.5 jacobian, - determinant_jacobian = get_Jacobian(elements, + determinant_jacobian = PeriLab.Solver_control.FEM.FEM_routines.get_Jacobian(elements, dof, topology, coordinates, @@ -200,8 +188,8 @@ end topology[1, 3] = 3 topology[1, 4] = 4 elements = Vector{Int64}(1:nelements) - p = get_polynomial_degree(params["FEM"]["FE_1"], dof) - num_int = get_number_of_integration_points(p, dof) + p = PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params["FEM"]["FE_1"], dof) + num_int = PeriLab.Solver_control.FEM.FEM_routines.get_number_of_integration_points(p, dof) N = test_data_manager.create_constant_free_size_field("N Matrix", Float64, @@ -212,7 +200,7 @@ end (prod(num_int), prod(p .+ 1) * dof, 3 * dof - 3)) - N[:], B[:] = create_element_matrices(dof, p, Lagrange_element.create_element_matrices) + N[:], B[:] = PeriLab.Solver_control.FEM.FEM_routines.create_element_matrices(dof, p, Lagrange_element.create_element_matrices) lumped_mass = test_data_manager.create_constant_node_field("Lumped Mass Matrix", Float64, 1) @@ -347,7 +335,7 @@ end (nelements, prod(num_int))) jacobian, - determinant_jacobian = get_Jacobian(elements, + determinant_jacobian = PeriLab.Solver_control.FEM.FEM_routines.get_Jacobian(elements, dof, topology, coordinates, @@ -358,7 +346,7 @@ end rho = test_data_manager.create_constant_node_field("Density", Float64, 1) rho[:] .= 1.0 - lumped_mass = get_lumped_mass(elements, dof, topology, N, determinant_jacobian, rho, + lumped_mass = PeriLab.Solver_control.FEM.FEM_routines.get_lumped_mass(elements, dof, topology, N, determinant_jacobian, rho, lumped_mass) for i in 1:4 @test isapprox(lumped_mass[i], 1.0) @@ -366,7 +354,7 @@ end lumped_mass[:] .= 0 rho[:] .= 2.0 - lumped_mass = get_lumped_mass(elements, dof, topology, N, determinant_jacobian, rho, + lumped_mass = PeriLab.Solver_control.FEM.FEM_routines.get_lumped_mass(elements, dof, topology, N, determinant_jacobian, rho, lumped_mass) for i in 1:4 @test isapprox(lumped_mass[i], 2.0) @@ -374,7 +362,7 @@ end lumped_mass[:] .= 0 rho[:] .= 1.2 - lumped_mass = get_lumped_mass(elements, dof, topology, N, determinant_jacobian, rho, + lumped_mass = PeriLab.Solver_control.FEM.FEM_routines.get_lumped_mass(elements, dof, topology, N, determinant_jacobian, rho, lumped_mass) # specific lumped mass @test lumped_mass == [1.2; 1.2; 1.2; 1.2] @@ -389,7 +377,7 @@ end "Bulk Modulus" => 2.5e+3, "Shear Modulus" => 1.15e3))) - @test isnothing(get_FE_material_model(params, "FE_1")) + @test isnothing(PeriLab.Solver_control.FEM.FEM_routines.get_FE_material_model(params, "FE_1")) params = Dict{String,Any}("FEM" => Dict("FE_1" => Dict("Degree" => 1, "Element Type" => "Lagrange", @@ -399,7 +387,7 @@ end "Bulk Modulus" => 2.5e+3, "Shear Modulus" => 1.15e3))) - @test get_FE_material_model(params, "FE_1") == + @test PeriLab.Solver_control.FEM.FEM_routines.get_FE_material_model(params, "FE_1") == Dict("Material Model" => "Correspondence Elastic", "Symmetry" => "isotropic plane strain", "Bulk Modulus" => 2.5e+3, @@ -407,51 +395,51 @@ end end @testset "ut_get_polynomial_degree" begin - @test isnothing(get_polynomial_degree(Dict{String,Any}(), 1)) - @test isnothing(get_polynomial_degree(Dict{String,Any}(), 2)) - @test isnothing(get_polynomial_degree(Dict{String,Any}(), 3)) + @test isnothing(PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(Dict{String,Any}(), 1)) + @test isnothing(PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(Dict{String,Any}(), 2)) + @test isnothing(PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(Dict{String,Any}(), 3)) params = Dict{String,Any}("Degree" => 1) - @test get_polynomial_degree(params, 2) == [1, 1] - @test get_polynomial_degree(params, 3) == [1, 1, 1] + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 2) == [1, 1] + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 3) == [1, 1, 1] params = Dict{String,Any}("Degree" => 2) - @test get_polynomial_degree(params, 2) == [2, 2] - @test get_polynomial_degree(params, 3) == [2, 2, 2] + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 2) == [2, 2] + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 3) == [2, 2, 2] params = Dict{String,Any}("Degree" => 2.1) - @test get_polynomial_degree(params, 2) == [2, 2] - @test get_polynomial_degree(params, 3) == [2, 2, 2] + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 2) == [2, 2] + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 3) == [2, 2, 2] params = Dict{String,Any}("Degree" => [2 3 1]) - @test isnothing(get_polynomial_degree(params, 2)) - @test get_polynomial_degree(params, 3) == [2, 3, 1] + @test isnothing(PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 2)) + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 3) == [2, 3, 1] params = Dict{String,Any}("Degree" => [2.1 2]) - @test get_polynomial_degree(params, 2) == [2, 2] - @test isnothing(get_polynomial_degree(params, 3)) + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 2) == [2, 2] + @test isnothing(PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 3)) params = Dict{String,Any}("Degree" => "2") - @test get_polynomial_degree(params, 3) == [2, 2, 2] + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 3) == [2, 2, 2] params = Dict{String,Any}("Degree" => "2 2") - @test get_polynomial_degree(params, 2) == [2, 2] + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 2) == [2, 2] params = Dict{String,Any}("Degree" => "2 1") - @test get_polynomial_degree(params, 2) == [2, 1] + @test PeriLab.Solver_control.FEM.FEM_routines.get_polynomial_degree(params, 2) == [2, 1] end @testset "ut_get_number_of_integration_points" begin - @test get_number_of_integration_points(Vector{Int64}([1, 1]), 2) == [2, 2] - @test get_number_of_integration_points(Vector{Int64}([1, 1, 1]), 3) == [2, 2, 2] - @test get_number_of_integration_points(Vector{Int64}([1, 2, 1]), 3) == [2, 3, 2] - @test get_number_of_integration_points(Vector{Int64}([1, 3, 8]), 3) == [2, 5, 15] - @test get_number_of_integration_points(Vector{Int64}([1, 3]), 2) == [2, 5] + @test PeriLab.Solver_control.FEM.FEM_routines.get_number_of_integration_points(Vector{Int64}([1, 1]), 2) == [2, 2] + @test PeriLab.Solver_control.FEM.FEM_routines.get_number_of_integration_points(Vector{Int64}([1, 1, 1]), 3) == [2, 2, 2] + @test PeriLab.Solver_control.FEM.FEM_routines.get_number_of_integration_points(Vector{Int64}([1, 2, 1]), 3) == [2, 3, 2] + @test PeriLab.Solver_control.FEM.FEM_routines.get_number_of_integration_points(Vector{Int64}([1, 3, 8]), 3) == [2, 5, 15] + @test PeriLab.Solver_control.FEM.FEM_routines.get_number_of_integration_points(Vector{Int64}([1, 3]), 2) == [2, 5] end @testset "ut_get_weights_and_integration_points" begin - @test get_weights_and_integration_points(2, [1, 1]) == ([2.0 2.0], [0.0 0.0]) - @test get_weights_and_integration_points(2, [2, 2]) == ([1.0 1.0; 1.0 1.0], + @test PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(2, [1, 1]) == ([2.0 2.0], [0.0 0.0]) + @test PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(2, [2, 2]) == ([1.0 1.0; 1.0 1.0], [-0.5773502691896258 -0.5773502691896258; 0.5773502691896258 0.5773502691896258]) - @test get_weights_and_integration_points(3, [2, 3, 4]) == + @test PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(3, [2, 3, 4]) == ([1.0 0.5555555555555556 0.34785484513745385 1.0 0.8888888888888888 0.6521451548625462 0.0 0.5555555555555556 0.6521451548625462 @@ -460,18 +448,18 @@ end 0.5773502691896258 0.0 -0.3399810435848563 0.0 0.7745966692414834 0.3399810435848563 0.0 0.0 0.8611363115940526]) - @test get_weights_and_integration_points(3, [2, 1, 1]) == ([1.0 2.0 2.0; 1.0 0.0 0.0], + @test PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(3, [2, 1, 1]) == ([1.0 2.0 2.0; 1.0 0.0 0.0], [-0.5773502691896258 0.0 0.0; 0.5773502691896258 0.0 0.0]) end @testset "ut_get_multi_dimensional_integration_points" begin - @test isnothing(get_multi_dimensional_integration_point_data(1, [1], zeros(2, 2))) - @test isnothing(get_multi_dimensional_integration_point_data(4, [1, 1, 1, 1], + @test isnothing(PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(1, [1], zeros(2, 2))) + @test isnothing(PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(4, [1, 1, 1, 1], zeros(2, 2))) dof = 2 num_int = 2 - weights, xi = get_weights_and_integration_points(dof, [num_int, num_int]) - integration_point_coordinates = get_multi_dimensional_integration_point_data(dof, + weights, xi = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(dof, [num_int, num_int]) + integration_point_coordinates = PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(dof, [ num_int, num_int @@ -481,11 +469,11 @@ end @test integration_point_coordinates[2, :] == [0.5773502691896258, -0.5773502691896258] @test integration_point_coordinates[3, :] == [-0.5773502691896258, 0.5773502691896258] @test integration_point_coordinates[4, :] == [0.5773502691896258, 0.5773502691896258] - @test get_multi_dimensional_integration_point_data(dof, [num_int, num_int], weights) == + @test PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(dof, [num_int, num_int], weights) == [1.0 1.0; 1.0 1.0; 1.0 1.0; 1.0 1.0] dof = 3 - weights, xi = get_weights_and_integration_points(dof, [num_int, num_int, num_int]) - integration_point_coordinates = get_multi_dimensional_integration_point_data(dof, + weights, xi = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(dof, [num_int, num_int, num_int]) + integration_point_coordinates = PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(dof, [ num_int, num_int, @@ -509,7 +497,7 @@ end [-0.5773502691896258, 0.5773502691896258, 0.5773502691896258] @test integration_point_coordinates[8, :] == [0.5773502691896258, 0.5773502691896258, 0.5773502691896258] - integration_point_weights = get_multi_dimensional_integration_point_data(dof, + integration_point_weights = PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(dof, [ num_int, num_int, @@ -522,14 +510,14 @@ end end dof = 2 - weights, xi = get_weights_and_integration_points(dof, [num_int, num_int + 1]) - integration_point_coordinates = get_multi_dimensional_integration_point_data(dof, + weights, xi = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(dof, [num_int, num_int + 1]) + integration_point_coordinates = PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(dof, [ num_int, num_int + 1 ], xi) - integration_point_weights = get_multi_dimensional_integration_point_data(dof, + integration_point_weights = PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(dof, [ num_int, num_int + @@ -553,14 +541,14 @@ end @test integration_point_weights[5, :] == [1.0, 0.5555555555555556] @test integration_point_weights[6, :] == [1.0, 0.5555555555555556] - weights, xi = get_weights_and_integration_points(dof, [num_int + 1, num_int]) - integration_point_coordinates = get_multi_dimensional_integration_point_data(dof, + weights, xi = PeriLab.Solver_control.FEM.FEM_routines.get_weights_and_integration_points(dof, [num_int + 1, num_int]) + integration_point_coordinates = PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(dof, [ num_int + 1, num_int ], xi) - integration_point_weights = get_multi_dimensional_integration_point_data(dof, + integration_point_weights = PeriLab.Solver_control.FEM.FEM_routines.get_multi_dimensional_integration_point_data(dof, [ num_int + 1, @@ -588,19 +576,19 @@ end dof::Int64 = 1 p::Vector{Int64} = [1, 1] - N, B = create_element_matrices(dof, p, Lagrange_element.create_element_matrices) + N, B = PeriLab.Solver_control.FEM.FEM_routines.create_element_matrices(dof, p, Lagrange_element.create_element_matrices) @test isnothing(N) @test isnothing(B) dof = 4 N, - B = create_element_matrices(dof, + B = PeriLab.Solver_control.FEM.FEM_routines.create_element_matrices(dof, Vector{Int64}([1, 1, 1, 1]), Lagrange_element.create_element_matrices) @test isnothing(N) @test isnothing(B) dof = 2 - N, B = create_element_matrices(dof, p, Lagrange_element.create_element_matrices) + N, B = PeriLab.Solver_control.FEM.FEM_routines.create_element_matrices(dof, p, Lagrange_element.create_element_matrices) @test size(N) == (4, 8, 2) @test size(B) == (4, 8, 3) @@ -654,7 +642,7 @@ end dof = 3 p = [1, 1, 1] - N, B = create_element_matrices(dof, p, Lagrange_element.create_element_matrices) + N, B = PeriLab.Solver_control.FEM.FEM_routines.create_element_matrices(dof, p, Lagrange_element.create_element_matrices) @test size(N) == (8, 24, 3) @test size(B) == (8, 24, 6) @@ -682,13 +670,13 @@ end dof = 2 p = [2, 1] - N, B = create_element_matrices(dof, p, Lagrange_element.create_element_matrices) + N, B = PeriLab.Solver_control.FEM.FEM_routines.create_element_matrices(dof, p, Lagrange_element.create_element_matrices) @test size(N) == (6, 12, 2) @test size(B) == (6, 12, 3) dof = 3 p = [5, 3, 1] - N, B = create_element_matrices(dof, p, Lagrange_element.create_element_matrices) + N, B = PeriLab.Solver_control.FEM.FEM_routines.create_element_matrices(dof, p, Lagrange_element.create_element_matrices) @test size(N) == (90, 144, 3) @test size(B) == (90, 144, 6) diff --git a/test/unit_tests/IO/ut_exodus_export.jl b/test/unit_tests/IO/ut_exodus_export.jl index 4104a9166..61ee60dcb 100644 --- a/test/unit_tests/IO/ut_exodus_export.jl +++ b/test/unit_tests/IO/ut_exodus_export.jl @@ -2,10 +2,6 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../src/IO/exodus_export.jl") -include("../../../src/IO/csv_export.jl") -include("../../../src/Core/Data_manager.jl") - using Test using TimerOutputs @@ -14,35 +10,35 @@ test_data_manager = PeriLab.Data_manager test_data_manager.initialize_data() @testset "ut_get_block_nodes" begin block_Id = [1, 1, 2, 2, 2, 3, 3, 3, 1, 3, 3, 4] - test = get_block_nodes(block_Id, 1) + test = PeriLab.IO.get_block_nodes(block_Id, 1) @test test == [1 2 9] - test = get_block_nodes(block_Id, 2) + test = PeriLab.IO.get_block_nodes(block_Id, 2) @test test == [3 4 5] - test = get_block_nodes(block_Id, 3) + test = PeriLab.IO.get_block_nodes(block_Id, 3) @test test == [6 7 8 10 11] - test = get_block_nodes(block_Id, 4) + test = PeriLab.IO.get_block_nodes(block_Id, 4) @test test[1] == 12 end @testset "ut_paraview_specifics" begin - @test paraview_specifics(1) == "x" - @test paraview_specifics(2) == "y" - @test paraview_specifics(3) == "z" + @test PeriLab.IO.paraview_specifics(1) == "x" + @test PeriLab.IO.paraview_specifics(2) == "y" + @test PeriLab.IO.paraview_specifics(3) == "z" end @testset "ut_get_paraview_coordinates" begin for i in 1:3 - @test get_paraview_coordinates(1, i) == "x" - @test get_paraview_coordinates(2, i) == "y" - @test get_paraview_coordinates(3, i) == "z" + @test PeriLab.IO.get_paraview_coordinates(1, i) == "x" + @test PeriLab.IO.get_paraview_coordinates(2, i) == "y" + @test PeriLab.IO.get_paraview_coordinates(3, i) == "z" end - @test isnothing(get_paraview_coordinates(3, 10)) + @test isnothing(PeriLab.IO.get_paraview_coordinates(3, 10)) for ref in 4:9 for i in 1:3 for j in 1:3 - @test get_paraview_coordinates((i - 1) * 3 + j, ref) == - paraview_specifics(i) * paraview_specifics(j) + @test PeriLab.IO.get_paraview_coordinates((i - 1) * 3 + j, ref) == + PeriLab.IO.paraview_specifics(i) * PeriLab.IO.paraview_specifics(j) end end end @@ -66,8 +62,8 @@ topology[2, 4] = 5 filename2 = "./tmp/" * "test2.e" nnodes = 4 dof = 3 - exo = create_result_file(filename1, 5, dof, 1, 0, 2, topology) - exo = create_result_file(filename2, nnodes, dof, 1, 0) + exo = PeriLab.IO.create_result_file(filename1, 5, dof, 1, 0, 2, topology) + exo = PeriLab.IO.create_result_file(filename2, nnodes, dof, 1, 0) @test isfile(filename2) @test exo["file"].file_name == filename2 # @test num_dim(exo["file"].init) == dof @@ -82,7 +78,7 @@ topology[2, 4] = 5 nnodes = 300 dof = 2 @test isfile(filename2) - exo = create_result_file(filename2, nnodes, dof, 3, 2) + exo = PeriLab.IO.create_result_file(filename2, nnodes, dof, 3, 2) @test isfile(filename2) @test exo["file"].file_name == filename2 # @test num_dim(exo["file"].init) == dof @@ -194,14 +190,14 @@ computes = Dict("Fields" => Dict("External_Displacements" => Dict("fieldname" => "Node Set" => 1, "Variable" => "DisplacementsNP1")))) -exo1 = create_result_file(filename2, +exo1 = PeriLab.IO.create_result_file(filename2, nnodes, dof, maximum(block_Id), length(nsets), 2, topology) -exo1["file"] = init_results_in_exodus(exo1["file"], +exo1["file"] = PeriLab.IO.init_results_in_exodus(exo1["file"], outputs, coords, block_Id[1:nnodes], @@ -213,8 +209,8 @@ exo1["file"] = init_results_in_exodus(exo1["file"], topology, [1, 2]) rm(filename2) -exo = create_result_file(filename, nnodes, dof, maximum(block_Id), length(nsets)) -exo["file"] = init_results_in_exodus(exo["file"], +exo = PeriLab.IO.create_result_file(filename, nnodes, dof, maximum(block_Id), length(nsets)) +exo["file"] = PeriLab.IO.init_results_in_exodus(exo["file"], outputs, coords, block_Id[1:nnodes], @@ -224,11 +220,11 @@ exo["file"] = init_results_in_exodus(exo["file"], "1.0.0") result_files = [] push!(result_files, exo) -result_files[1]["file"] = write_step_and_time(result_files[1]["file"], 2, 2.2) -result_files[1]["file"] = write_step_and_time(result_files[1]["file"], 3, 3.7) -result_files[1]["file"] = write_step_and_time(result_files[1]["file"], 4, 4.7) -result_files[1]["file"] = write_step_and_time(result_files[1]["file"], 5, 5.7) -result_files[1]["file"] = write_step_and_time(result_files[1]["file"], 6, 6.7) +result_files[1]["file"] = PeriLab.IO.write_step_and_time(result_files[1]["file"], 2, 2.2) +result_files[1]["file"] = PeriLab.IO.write_step_and_time(result_files[1]["file"], 3, 3.7) +result_files[1]["file"] = PeriLab.IO.write_step_and_time(result_files[1]["file"], 4, 4.7) +result_files[1]["file"] = PeriLab.IO.write_step_and_time(result_files[1]["file"], 5, 5.7) +result_files[1]["file"] = PeriLab.IO.write_step_and_time(result_files[1]["file"], 6, 6.7) @testset "ut_init_results_in_exodus" begin # @test exo["file"].init.num_dim == dof @@ -266,7 +262,7 @@ disp[5] = 0 nodal_outputs = Dict(key => value for (key, value) in outputs["Fields"] if (!value["global_var"])) -exo["file"] = write_nodal_results_in_exodus(exo["file"], 2, nodal_outputs, +exo["file"] = PeriLab.IO.write_nodal_results_in_exodus(exo["file"], 2, nodal_outputs, test_data_manager) test_disp_step_zero = read_values(exo["file"], NodalVariable, 1, 1, "Displacements") @@ -320,8 +316,8 @@ end csvfilename = "./tmp/" * "test_2.csv" csv_file = open(csvfilename, "w") println(csv_file, "Test") -csv_file = create_result_file(csvfilename, computes) -exo["file"] = write_global_results_in_exodus(exo["file"], 2, [0.1, 0.2]) +csv_file = PeriLab.IO.create_result_file(csvfilename, computes) +exo["file"] = PeriLab.IO.write_global_results_in_exodus(exo["file"], 2, [0.1, 0.2]) @testset "ut_write_global_results_in_exodus" begin global_vars = read_names(exo["file"], GlobalVariable) @@ -336,14 +332,14 @@ end @testset "ut_merge_exodus_file" begin merged = true try - merge_exodus_file(exo["filename"]) + PeriLab.IO.merge_exodus_file(exo["filename"]) catch merged = false end @test merged end -write_global_results_in_csv(csv_file["file"], 1.0, [0.1, 0.2]) +PeriLab.IO.write_global_results_in_csv(csv_file["file"], 1.0, [0.1, 0.2]) #TODO: check if the csv file is correct @testset "ut_write_global_results_in_csv" begin @test isfile(csv_file["filename"]) diff --git a/test/unit_tests/IO/ut_mesh_data.jl b/test/unit_tests/IO/ut_mesh_data.jl index 37fcabbd0..23d0d2acf 100644 --- a/test/unit_tests/IO/ut_mesh_data.jl +++ b/test/unit_tests/IO/ut_mesh_data.jl @@ -569,11 +569,11 @@ end dof) undeformed_bond_length = test_data_manager.create_constant_bond_field("Bond Length", Float64, 1) - PeriLab.IO.Geometry.bond_geometry!(undeformed_bond, - undeformed_bond_length, - Vector(1:nnodes), - nlist, - coor) + PeriLab.Geometry.bond_geometry!(undeformed_bond, + undeformed_bond_length, + Vector(1:nnodes), + nlist, + coor) @test undeformed_bond[1][1][1] == 1 @test undeformed_bond[1][1][2] == 0 diff --git a/test/unit_tests/MPI_communication/ut_MPI.jl b/test/unit_tests/MPI_communication/ut_MPI.jl index 172d6bee2..7dc017e59 100644 --- a/test/unit_tests/MPI_communication/ut_MPI.jl +++ b/test/unit_tests/MPI_communication/ut_MPI.jl @@ -6,18 +6,7 @@ import MPI using Test using JSON3 using TimerOutputs - -include("../../../src/MPI_communication/MPI_communication.jl") -using .MPI_communication: send_single_value_from_vector, synch_responder_to_controller, - synch_controller_to_responder, - synch_controller_bonds_to_responder, - split_vector, synch_controller_bonds_to_responder_flattened, - send_vector_from_root_to_core_i, broadcast_value, - find_and_set_core_value_min, find_and_set_core_value_max, - find_and_set_core_value_sum, find_and_set_core_value_max, - find_and_set_core_value_avg, gather_values, barrier - -include("../../../src/Models/Material/Material_Models/BondBased/Bondbased_Elastic.jl") +using PeriLab function push_test!(dict::Dict, test::Bool, file::String, line::Int) push!(dict["tests"], test) @@ -36,10 +25,10 @@ test_dict = Dict() test = test_dict["find_and_set_core_value_min and max"] = Dict("tests" => [], "line" => []) value = rank + 1 -value = find_and_set_core_value_min(comm, value) +value = PeriLab.MPI_communication.find_and_set_core_value_min(comm, value) push_test!(test, (value == 1), @__FILE__, @__LINE__) value = rank + 1 -value = find_and_set_core_value_max(comm, value) +value = PeriLab.MPI_communication.find_and_set_core_value_max(comm, value) push_test!(test, (ncores == value), @__FILE__, @__LINE__) test = test_dict["ut_broadcast_value"] = Dict("tests" => [], "line" => []) @@ -48,21 +37,21 @@ if rank == 0 else send_msg = nothing end -send_msg = broadcast_value(comm, send_msg) +send_msg = PeriLab.MPI_communication.broadcast_value(comm, send_msg) push_test!(test, (send_msg == 100), @__FILE__, @__LINE__) if rank == 0 send_msg = true else send_msg = nothing end -send_msg = broadcast_value(comm, send_msg) +send_msg = PeriLab.MPI_communication.broadcast_value(comm, send_msg) push_test!(test, (send_msg), @__FILE__, @__LINE__) if rank == 0 send_msg = 100.5 else send_msg = nothing end -send_msg = broadcast_value(comm, send_msg) +send_msg = PeriLab.MPI_communication.broadcast_value(comm, send_msg) push_test!(test, (send_msg == 100.5), @__FILE__, @__LINE__) test = test_dict["ut_send_vector_from_root_to_core_i"] = Dict("tests" => [], "line" => []) @@ -74,12 +63,12 @@ else end recv_msg = [0, 0, 0] -recv_msg = send_vector_from_root_to_core_i(comm, send_msg, recv_msg, distribution) +recv_msg = PeriLab.MPI_communication.send_vector_from_root_to_core_i(comm, send_msg, recv_msg, distribution) push_test!(test, (recv_msg[1] == 2), @__FILE__, @__LINE__) push_test!(test, (recv_msg[2] == 1), @__FILE__, @__LINE__) push_test!(test, (recv_msg[3] == 5), @__FILE__, @__LINE__) distribution = [[1, 2, 3], [3, 2, 1], [3, 2, 1]] -recv_msg = send_vector_from_root_to_core_i(comm, send_msg, recv_msg, distribution) +recv_msg = PeriLab.MPI_communication.send_vector_from_root_to_core_i(comm, send_msg, recv_msg, distribution) if rank != 0 push_test!(test, (recv_msg[1] == 5), @__FILE__, @__LINE__) push_test!(test, (recv_msg[2] == 1), @__FILE__, @__LINE__) @@ -87,23 +76,19 @@ if rank != 0 end push_test!(test, - (isnothing(send_single_value_from_vector(comm, 0, [1], String))), + (isnothing(PeriLab.MPI_communication.send_single_value_from_vector(comm, 0, [1], String))), @__FILE__, @__LINE__) if ncores == 3 - include("../../../src/Core/Data_manager.jl") - include("../../../src/IO/IO.jl") - import .IO - using .Data_manager distribution = [[1, 2, 3], [2, 3, 4], [4, 1, 3]] ncores = 3 dof = 2 ptc = [1, 2, 2, 3] - overlap_map = IO.create_overlap_map(distribution, ptc, ncores) + overlap_map = PeriLab.IO.create_overlap_map(distribution, ptc, ncores) - overlap_map = IO.get_local_overlap_map(overlap_map, distribution, ncores) + overlap_map = PeriLab.IO.get_local_overlap_map(overlap_map, distribution, ncores) - test_data_manager = Data_manager + test_data_manager = PeriLab.Data_manager test_data_manager.initialize_data() test_data_manager.set_comm(comm) test_data_manager.create_constant_node_field("Block_Id", Int64, 1) @@ -175,11 +160,11 @@ if ncores == 3 distribution = [[1, 2, 3], [2, 3, 4], [4, 1, 3]] # sammel ein und summiere -> zweite routine mit sende vom Controller an alle responder - A = synch_responder_to_controller(comm, overlap_map, A, 1) - B = synch_responder_to_controller(comm, overlap_map, B, 4) - C = synch_responder_to_controller(comm, overlap_map, C, 1) - D = synch_responder_to_controller(comm, overlap_map, D, 5) - E = synch_responder_to_controller(comm, overlap_map, E, 1) + A = PeriLab.MPI_communication.synch_responder_to_controller(comm, overlap_map, A, 1) + B = PeriLab.MPI_communication.synch_responder_to_controller(comm, overlap_map, B, 4) + C = PeriLab.MPI_communication.synch_responder_to_controller(comm, overlap_map, C, 1) + D = PeriLab.MPI_communication.synch_responder_to_controller(comm, overlap_map, D, 5) + E = PeriLab.MPI_communication.synch_responder_to_controller(comm, overlap_map, E, 1) if rank == 0 test = test_dict["synch_responder_to_controller_rank_0"] = Dict("tests" => [], @@ -238,13 +223,13 @@ if ncores == 3 push_test!(test, (E[2] == false), @__FILE__, @__LINE__) push_test!(test, (E[3] == false), @__FILE__, @__LINE__) end - barrier(comm) + PeriLab.MPI_communication.barrier(comm) - A = synch_controller_to_responder(comm, overlap_map, A, 1) - B = synch_controller_to_responder(comm, overlap_map, B, 4) - C = synch_controller_to_responder(comm, overlap_map, C, 1) - D = synch_controller_to_responder(comm, overlap_map, D, 5) - E = synch_controller_to_responder(comm, overlap_map, E, 1) + A = PeriLab.MPI_communication.synch_controller_to_responder(comm, overlap_map, A, 1) + B = PeriLab.MPI_communication.synch_controller_to_responder(comm, overlap_map, B, 4) + C = PeriLab.MPI_communication.synch_controller_to_responder(comm, overlap_map, C, 1) + D = PeriLab.MPI_communication.synch_controller_to_responder(comm, overlap_map, D, 5) + E = PeriLab.MPI_communication.synch_controller_to_responder(comm, overlap_map, E, 1) if rank == 0 test = test_dict["synch_controller_to_responder_rank_0"] = Dict("tests" => [], "line" => []) @@ -265,19 +250,19 @@ if ncores == 3 push_test!(test, (E[3] == true), @__FILE__, @__LINE__) test = test_dict["find_global_core_value!_0"] = Dict("tests" => [], "line" => []) push_test!(test, - (IO.find_global_core_value!(0, "Sum", 1, test_data_manager) == 3), + (PeriLab.IO.find_global_core_value!(0, "Sum", 1, test_data_manager) == 3), @__FILE__, @__LINE__) push_test!(test, - (IO.find_global_core_value!(0, "Maximum", 1, test_data_manager) == 2), + (PeriLab.IO.find_global_core_value!(0, "Maximum", 1, test_data_manager) == 2), @__FILE__, @__LINE__) push_test!(test, - (IO.find_global_core_value!(0, "Minimum", 1, test_data_manager) == 0), + (PeriLab.IO.find_global_core_value!(0, "Minimum", 1, test_data_manager) == 0), @__FILE__, @__LINE__) push_test!(test, - (IO.find_global_core_value!(0, "Average", 1, test_data_manager) == 1), + (PeriLab.IO.find_global_core_value!(0, "Average", 1, test_data_manager) == 1), @__FILE__, @__LINE__) end @@ -302,19 +287,19 @@ if ncores == 3 push_test!(test, (E[3] == false), @__FILE__, @__LINE__) test = test_dict["find_global_core_value!_1"] = Dict("tests" => [], "line" => []) push_test!(test, - (IO.find_global_core_value!(1, "Sum", 1, test_data_manager) == 3), + (PeriLab.IO.find_global_core_value!(1, "Sum", 1, test_data_manager) == 3), @__FILE__, @__LINE__) push_test!(test, - (IO.find_global_core_value!(1, "Maximum", 1, test_data_manager) == 2), + (PeriLab.IO.find_global_core_value!(1, "Maximum", 1, test_data_manager) == 2), @__FILE__, @__LINE__) push_test!(test, - (IO.find_global_core_value!(1, "Minimum", 1, test_data_manager) == 0), + (PeriLab.IO.find_global_core_value!(1, "Minimum", 1, test_data_manager) == 0), @__FILE__, @__LINE__) push_test!(test, - (IO.find_global_core_value!(1, "Average", 1, test_data_manager) == 1), + (PeriLab.IO.find_global_core_value!(1, "Average", 1, test_data_manager) == 1), @__FILE__, @__LINE__) end @@ -343,19 +328,19 @@ if ncores == 3 push_test!(test, (E[3] == true), @__FILE__, @__LINE__) test = test_dict["find_global_core_value!_2"] = Dict("tests" => [], "line" => []) push_test!(test, - (IO.find_global_core_value!(2, "Sum", 1, test_data_manager) == 3), + (PeriLab.IO.find_global_core_value!(2, "Sum", 1, test_data_manager) == 3), @__FILE__, @__LINE__) push_test!(test, - (IO.find_global_core_value!(2, "Maximum", 1, test_data_manager) == 2), + (PeriLab.IO.find_global_core_value!(2, "Maximum", 1, test_data_manager) == 2), @__FILE__, @__LINE__) push_test!(test, - (IO.find_global_core_value!(2, "Minimum", 1, test_data_manager) == 0), + (PeriLab.IO.find_global_core_value!(2, "Minimum", 1, test_data_manager) == 0), @__FILE__, @__LINE__) push_test!(test, - (IO.find_global_core_value!(2, "Average", 1, test_data_manager) == 1), + (PeriLab.IO.find_global_core_value!(2, "Average", 1, test_data_manager) == 1), @__FILE__, @__LINE__) end @@ -379,11 +364,11 @@ if ncores == 3 end end - test_data_manager = Bondbased_Elastic.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0)) - test_data_manager = Bondbased_Elastic.compute_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.compute_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0), @@ -394,7 +379,7 @@ if ncores == 3 bf = test_data_manager.get_field("Bond Forces") - synch_controller_bonds_to_responder(comm, overlap_map, bf, dof) + PeriLab.MPI_communication.synch_controller_bonds_to_responder(comm, overlap_map, bf, dof) if rank == 0 test = test_dict["synch_controller_bonds_to_responder_rank_0"] = Dict("tests" => [], @@ -402,7 +387,7 @@ if ncores == 3 # push_test!(test, (bf[1] == Float64(-0.9)), @__FILE__, @__LINE__) end - synch_controller_bonds_to_responder_flattened(comm, overlap_map, bf, dof) + PeriLab.MPI_communication.synch_controller_bonds_to_responder_flattened(comm, overlap_map, bf, dof) if rank == 0 test = test_dict["synch_controller_bonds_to_responder_flattened_rank_0"] = Dict("tests" => [], "line" => []) @@ -414,10 +399,10 @@ if ncores == 3 "Material Model" => "Test 1"), "block_2" => Dict("Block ID" => 2, "Material Model" => "Test 2"))) - IO.show_block_summary(solver_options, params, "", false, comm, test_data_manager) - IO.show_block_summary(solver_options, params, "", true, comm, test_data_manager) - IO.show_mpi_summary("", false, comm, test_data_manager) - IO.show_mpi_summary("", true, comm, test_data_manager) + PeriLab.IO.show_block_summary(solver_options, params, "", false, comm, test_data_manager) + PeriLab.IO.show_block_summary(solver_options, params, "", true, comm, test_data_manager) + PeriLab.IO.show_mpi_summary("", false, comm, test_data_manager) + PeriLab.IO.show_mpi_summary("", true, comm, test_data_manager) end open("test_results_$rank.json", "w") do f diff --git a/test/unit_tests/Models/Additive/ut_Additive_Factory.jl b/test/unit_tests/Models/Additive/ut_Additive_Factory.jl index c9027a80a..7f0cb609c 100644 --- a/test/unit_tests/Models/Additive/ut_Additive_Factory.jl +++ b/test/unit_tests/Models/Additive/ut_Additive_Factory.jl @@ -2,11 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../src/Models/Additive/Additive_Factory.jl") -# include("../../../../src/Core/Data_manager.jl") - using Test -using .Additive @testset "init_fields" begin test_data_manager = PeriLab.Data_manager @@ -24,7 +20,7 @@ using .Additive nlist[3] = [1] nlist[4] = [1, 3] test_data_manager.create_bond_field("Bond Damage", Float64, 1) - test_data_manager = Additive.init_fields(test_data_manager) + test_data_manager = PeriLab.Solver_control.Model_Factory.Additive.init_fields(test_data_manager) field_keys = test_data_manager.get_all_field_keys() @test "Active" in field_keys active = test_data_manager.get_field("Active") @@ -36,5 +32,5 @@ end @testset "init_additive" begin test_data_manager = PeriLab.Data_manager test_data_manager.data["properties"][23] = Dict("Additive Model" => Dict("Additive Model" => "does not exist")) - @test isnothing(Additive.init_model(test_data_manager, Vector{Int64}([1, 2, 3]), 23)) + @test isnothing(PeriLab.Solver_control.Model_Factory.Additive.init_model(test_data_manager, Vector{Int64}([1, 2, 3]), 23)) end diff --git a/test/unit_tests/Models/Contact/ut_Contact_Factory.jl b/test/unit_tests/Models/Contact/ut_Contact_Factory.jl index 9c35babdb..053d568c5 100644 --- a/test/unit_tests/Models/Contact/ut_Contact_Factory.jl +++ b/test/unit_tests/Models/Contact/ut_Contact_Factory.jl @@ -2,10 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../src/Models/Contact/Contact_Factory.jl") -# include("../../../../src/Core/Data_manager.jl") using Test -using .Contact_Factory: check_valid_contact_model, get_all_contact_blocks @testset "ut_check_valid_contact_model" begin test_data_manager = PeriLab.Data_manager @@ -15,30 +12,30 @@ using .Contact_Factory: check_valid_contact_model, get_all_contact_blocks block_id = test_data_manager.create_constant_node_field("Block_Id", Int64, 1) block_id .= 1 # contact_params = Dict("cm" => Dict("Contact Groups" => Dict())) - # @test !check_valid_contact_model(contact_params, block_id) + # @test !PeriLab.Solver_control.check_valid_contact_model(contact_params, block_id) contact_params = Dict("cm" => Dict("Contact Groups" => Dict("cg" => Dict("Master Block ID" => 1)))) - @test !check_valid_contact_model(contact_params, block_id) + @test !PeriLab.Solver_control.Model_Factory.Contact_Factory.check_valid_contact_model(contact_params, block_id) contact_params = Dict("cm" => Dict("Contact Groups" => Dict("cg" => Dict("Master Block ID" => 1, "Slave Block ID" => 1)))) - @test !check_valid_contact_model(contact_params, block_id) + @test !PeriLab.Solver_control.Model_Factory.Contact_Factory.check_valid_contact_model(contact_params, block_id) contact_params = Dict("cm" => Dict("Contact Groups" => Dict("cg" => Dict("Master Block ID" => 1, "Slave Block ID" => 2)))) - @test !check_valid_contact_model(contact_params, block_id) + @test !PeriLab.Solver_control.Model_Factory.Contact_Factory.check_valid_contact_model(contact_params, block_id) contact_params = Dict("cm" => Dict("Contact Groups" => Dict("cg" => Dict("Master Block ID" => 1, "Slave Block ID" => 2))), "cm2" => Dict("Contact Groups" => Dict("cg" => Dict("Master Block ID" => 2, "Slave Block ID" => 1)))) - @test !check_valid_contact_model(contact_params, block_id) + @test !PeriLab.Solver_control.Model_Factory.Contact_Factory.check_valid_contact_model(contact_params, block_id) block_id[2] = 2 - @test !check_valid_contact_model(contact_params, block_id) + @test !PeriLab.Solver_control.Model_Factory.Contact_Factory.check_valid_contact_model(contact_params, block_id) contact_params = Dict("cm" => Dict("Contact Groups" => Dict("cg" => Dict("Master Block ID" => 1, "Slave Block ID" => 2, "Search Radius" => 0.0)))) - @test !check_valid_contact_model(contact_params, block_id) + @test !PeriLab.Solver_control.Model_Factory.Contact_Factory.check_valid_contact_model(contact_params, block_id) contact_params = Dict("cm" => Dict("Contact Groups" => Dict("cg" => Dict("Master Block ID" => 1, "Slave Block ID" => 2, "Search Radius" => -20.0)))) - @test !check_valid_contact_model(contact_params, block_id) + @test !PeriLab.Solver_control.Model_Factory.Contact_Factory.check_valid_contact_model(contact_params, block_id) end @testset "ut_get_all_contact_blocks" begin @@ -50,7 +47,7 @@ end "Slave Block ID" => 5), "q" => Dict("Master Block ID" => 8, "Slave Block ID" => 5)))) - @test get_all_contact_blocks(params) == [1, 2, 3, 5, 8] + @test PeriLab.Solver_control.Model_Factory.Contact_Factory.get_all_contact_blocks(params) == [1, 2, 3, 5, 8] end @testset "ut_get_double_surfs" begin @warn "TBD implentation of double surfs test" diff --git a/test/unit_tests/Models/Contact/ut_Contact_search.jl b/test/unit_tests/Models/Contact/ut_Contact_search.jl index cd4e98d4f..ac5cec8c5 100644 --- a/test/unit_tests/Models/Contact/ut_Contact_search.jl +++ b/test/unit_tests/Models/Contact/ut_Contact_search.jl @@ -1,8 +1,6 @@ # SPDX-FileCopyrightText: 2023 Christian Willberg , Jan-Timo Hesse # -# SPDX-License-Identifier: BSD-3-Clause +# SPDX-License-Identifier: BSD-3-compute_global_values -include("../../../../src/Models/Contact/Contact_search.jl") -# include("../../../../src/Core/Data_manager.jl") using Test -using .Contact_search: init_contact_search +@testset "test_empty" begin end \ No newline at end of file diff --git a/test/unit_tests/Models/Contact/ut_Penalty_model.jl b/test/unit_tests/Models/Contact/ut_Penalty_model.jl index add9fb7c7..5be93b224 100644 --- a/test/unit_tests/Models/Contact/ut_Penalty_model.jl +++ b/test/unit_tests/Models/Contact/ut_Penalty_model.jl @@ -2,16 +2,14 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../src/Models/Contact/Penalty_model.jl") - using Test @testset "contact_initialize_data" begin test_data_manager = PeriLab.Data_manager test_data_manager.initialize_data() params = Dict() - Penalty_model.init_contact_model(test_data_manager, params) + PeriLab.Solver_control.Model_Factory.Contact_Factory.Penalty_model.init_contact_model(test_data_manager, params) @test params["Contact Stiffness"] == 1e8 params["Friction Coefficient"] = -3 - @test isnothing(Penalty_model.init_contact_model(test_data_manager, params)) + @test isnothing(PeriLab.Solver_control.Model_Factory.Contact_Factory.Penalty_model.init_contact_model(test_data_manager, params)) end diff --git a/test/unit_tests/Models/Damage/ut_Damage_Factory.jl b/test/unit_tests/Models/Damage/ut_Damage_Factory.jl index 9d89e596b..5c22cdad7 100644 --- a/test/unit_tests/Models/Damage/ut_Damage_Factory.jl +++ b/test/unit_tests/Models/Damage/ut_Damage_Factory.jl @@ -2,10 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../src/Models/Damage/Damage_Factory.jl") -# include("../../../../src/Core/Data_manager.jl") using Test -using .Damage @testset "init_fields" begin test_data_manager = PeriLab.Data_manager @@ -22,7 +19,7 @@ using .Damage nlist[2] = [1, 3] nlist[3] = [1] nlist[4] = [1, 3] - Damage.init_fields(test_data_manager) + PeriLab.Solver_control.Model_Factory.Damage.init_fields(test_data_manager) field_keys = test_data_manager.get_all_field_keys() @test "DamageN" in field_keys @test "DamageNP1" in field_keys @@ -50,34 +47,34 @@ end @test bdNP1[2][:] == [1.0, 1.0] @test bdNP1[3][:] == [1.0] nodes = view(Vector(1:3), eachindex(Vector(1:3))) - Damage.damage_index(test_data_manager, nodes) + PeriLab.Solver_control.Model_Factory.Damage.damage_index(test_data_manager, nodes) @test damageNP1_test[1] == 0 @test damageNP1_test[2] == 0 @test damageNP1_test[3] == 0 bdNP1[1][:] .= 0 - Damage.damage_index(test_data_manager, nodes) + PeriLab.Solver_control.Model_Factory.Damage.damage_index(test_data_manager, nodes) @test damageNP1_test[1] == 1 @test damageNP1_test[2] == 0 @test damageNP1_test[3] == 0 bdNP1[2][1] = 0 - Damage.damage_index(test_data_manager, nodes) + PeriLab.Solver_control.Model_Factory.Damage.damage_index(test_data_manager, nodes) @test damageNP1_test[1] == 1 @test damageNP1_test[2] == 0.25 @test damageNP1_test[3] == 0 bdNP1[2][1] = 1 bdNP1[2][2] = 0 - Damage.damage_index(test_data_manager, nodes) + PeriLab.Solver_control.Model_Factory.Damage.damage_index(test_data_manager, nodes) @test damageNP1_test[1] == 1 @test damageNP1_test[2] == 0.75 @test damageNP1_test[3] == 0 bdNP1[2][1] = 0 bdNP1[2][2] = 0 - Damage.damage_index(test_data_manager, nodes) + PeriLab.Solver_control.Model_Factory.Damage.damage_index(test_data_manager, nodes) @test damageNP1_test[1] == 1 @test damageNP1_test[2] == 1 @test damageNP1_test[3] == 0 bdNP1[3][:] .= 0 - Damage.damage_index(test_data_manager, nodes) + PeriLab.Solver_control.Model_Factory.Damage.damage_index(test_data_manager, nodes) @test damageNP1_test[1] == 1 @test damageNP1_test[2] == 1 @test damageNP1_test[3] == 1 @@ -85,7 +82,7 @@ end @testset "ut_Damage_factory_exceptions" begin test_data_manager = PeriLab.Data_manager test_data_manager.data["properties"][1] = Dict("Damage Model" => Dict("Damage Model" => "not there")) - @test isnothing(Damage.init_model(test_data_manager, Vector{Int64}(1:3), 1)) + @test isnothing(PeriLab.Solver_control.Model_Factory.Damage.init_model(test_data_manager, Vector{Int64}(1:3), 1)) end @testset "ut_init_interface_crit_values" begin @@ -97,7 +94,7 @@ end "Interblock Damage" => Dict("Interblock Critical Value 1_2" => 0.2, "Interblock Critical Value 2_3" => 0.3, "Interblock Critical Value 2_1" => 0.4)) - Damage.init_interface_crit_values(test_data_manager, damage_parameter, 1) + PeriLab.Solver_control.Model_Factory.Damage.init_interface_crit_values(test_data_manager, damage_parameter, 1) @test test_data_manager.get_crit_values_matrix()[1, 2, 1] == 0.2 @test test_data_manager.get_crit_values_matrix()[2, 3, 1] == 0.3 @test test_data_manager.get_crit_values_matrix()[2, 1, 1] == 0.4 diff --git a/test/unit_tests/Models/Damage/ut_Energy_release.jl b/test/unit_tests/Models/Damage/ut_Energy_release.jl index c34b8984a..508e75a4a 100644 --- a/test/unit_tests/Models/Damage/ut_Energy_release.jl +++ b/test/unit_tests/Models/Damage/ut_Energy_release.jl @@ -2,22 +2,19 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../src/Models/Damage/Energy_release.jl") -# include("../../../../src/Core/Data_manager.jl") using Test -using .Critical_Energy_Model @testset "get_quad_horizon" begin horizon::Float64 = 1.0 thickness::Float64 = 2.0 - @test Critical_Energy_Model.get_quad_horizon(horizon, 3, thickness) == + @test PeriLab.Solver_control.Model_Factory.Damage.Critical_Energy_Model.get_quad_horizon(horizon, 3, thickness) == Float64(4 / (pi * horizon^4)) - @test Critical_Energy_Model.get_quad_horizon(horizon, 2, thickness) == + @test PeriLab.Solver_control.Model_Factory.Damage.Critical_Energy_Model.get_quad_horizon(horizon, 2, thickness) == Float64(3 / (pi * horizon^3 * thickness)) horizon = 5.6 thickness = 3.0 - @test Critical_Energy_Model.get_quad_horizon(horizon, 3, thickness) == + @test PeriLab.Solver_control.Model_Factory.Damage.Critical_Energy_Model.get_quad_horizon(horizon, 3, thickness) == Float64(4 / (pi * horizon^4)) - @test Critical_Energy_Model.get_quad_horizon(horizon, 2, thickness) == + @test PeriLab.Solver_control.Model_Factory.Damage.Critical_Energy_Model.get_quad_horizon(horizon, 2, thickness) == Float64(3 / (pi * horizon^3 * thickness)) end diff --git a/test/unit_tests/Models/Degradation/ut_Degradation_Factory.jl b/test/unit_tests/Models/Degradation/ut_Degradation_Factory.jl index 4ce39266e..28069f207 100644 --- a/test/unit_tests/Models/Degradation/ut_Degradation_Factory.jl +++ b/test/unit_tests/Models/Degradation/ut_Degradation_Factory.jl @@ -2,8 +2,5 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../src/Models/Degradation/Degradation_Factory.jl") -# include("../../../../src/Core/Data_manager.jl") using Test -using .Degradation @testset "test_empty" begin end diff --git a/test/unit_tests/Models/Material/Material_Models/BondBased/ut_Bondbased_Elastic.jl b/test/unit_tests/Models/Material/Material_Models/BondBased/ut_Bondbased_Elastic.jl index a3ada0fee..95c3e283d 100644 --- a/test/unit_tests/Models/Material/Material_Models/BondBased/ut_Bondbased_Elastic.jl +++ b/test/unit_tests/Models/Material/Material_Models/BondBased/ut_Bondbased_Elastic.jl @@ -1,9 +1,7 @@ # SPDX-FileCopyrightText: 2023 Christian Willberg , Jan-Timo Hesse # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../../../src/Models/Material/Material_Models/BondBased/Bondbased_Elastic.jl") -using .Bondbased_Elastic using Test using TimerOutputs #include("../../../../../../src/PeriLab.jl") @@ -12,8 +10,8 @@ using TimerOutputs #const to = TimerOutput() @testset "material_name" begin - @test Bondbased_Elastic.material_name() == "Bond-based Elastic" - @test !(Bondbased_Elastic.fe_support()) + @test PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.material_name() == "Bond-based Elastic" + @test !(PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.fe_support()) end @testset "compute_model" begin nodes = 2 @@ -39,11 +37,11 @@ end for iID in 1:nodes dbdNP1[iID] .= 1 + (-1)^iID * 0.1 end - test_data_manager = Bondbased_Elastic.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0)) - test_data_manager = Bondbased_Elastic.compute_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.compute_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0), @@ -70,12 +68,12 @@ end bf[2][1] .= 0 bf[2][2] .= 0 bf[2][3] .= 0 - test_data_manager = Bondbased_Elastic.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0, "Symmetry" => "here is something")) - test_data_manager = Bondbased_Elastic.compute_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.compute_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0, @@ -104,13 +102,13 @@ end bf[2][1] .= 0 bf[2][2] .= 0 bf[2][3] .= 0 - test_data_manager = Bondbased_Elastic.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0, "Symmetry" => "plane strain")) - test_data_manager = Bondbased_Elastic.compute_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.compute_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0, @@ -139,12 +137,12 @@ end bf[2][1] .= 0 bf[2][2] .= 0 bf[2][3] .= 0 - test_data_manager = Bondbased_Elastic.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0, "Symmetry" => "plane stress")) - test_data_manager = Bondbased_Elastic.compute_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Bondbased_Elastic.compute_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Bulk Modulus" => 1.0, "Young's Modulus" => 1.0, diff --git a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Bond_Associated_Correspondence.jl b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Bond_Associated_Correspondence.jl index d50819c3f..a783e9f9d 100644 --- a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Bond_Associated_Correspondence.jl +++ b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Bond_Associated_Correspondence.jl @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../../../src/Models/Material/Material_Models/Correspondence/Bond_Associated_Correspondence.jl") using Test # include("../../../../../../src/PeriLab.jl") # using .PeriLab @@ -37,7 +36,7 @@ using Test strainN[1][1, :, :] = [-1 -1; -1 -1] strainN[2][1, :, :] = [0.5 0; 0 0.5] - Bond_Associated_Correspondence.compute_bond_strain(nodes, + PeriLab.Solver_control.Model_Factory.Material.Correspondence.Bond_Associated_Correspondence.compute_bond_strain(nodes, nlist, deformation_gradient, strain, @@ -57,7 +56,7 @@ end expected_strain = 0.5 .* dt .* (deformation_gradient * deformation_gradient_dot + (deformation_gradient * deformation_gradient_dot)') computed_strain = zeros(3, 3) - Bond_Associated_Correspondence.update_Green_Langrange_strain(dt, + PeriLab.Solver_control.Model_Factory.Material.Correspondence.Bond_Associated_Correspondence.update_Green_Langrange_strain(dt, deformation_gradient, deformation_gradient_dot, computed_strain) @@ -72,7 +71,7 @@ end deformation_gradient_dot = zeros(3, 3) expected_strain = zeros(3, 3) computed_strain = zeros(3, 3) - Bond_Associated_Correspondence.update_Green_Langrange_strain(dt, + PeriLab.Solver_control.Model_Factory.Material.Correspondence.Bond_Associated_Correspondence.update_Green_Langrange_strain(dt, deformation_gradient, deformation_gradient_dot, computed_strain) @@ -93,18 +92,18 @@ end test_data_manager.create_constant_bond_field("Influence Function", Float64, 1) test_data_manager.create_bond_field("Bond Damage", Float64, 1) - @test isnothing(Bond_Associated_Correspondence.init_model(test_data_manager, nodes, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Bond_Associated_Correspondence.init_model(test_data_manager, nodes, Dict())) material_parameter = Dict{String,Any}("Symmetry" => "isotropic") - test_data_manager = Bond_Associated_Correspondence.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Correspondence.Bond_Associated_Correspondence.init_model(test_data_manager, nodes, material_parameter) @test test_data_manager.get_accuracy_order() == 1 material_parameter = Dict("Symmetry" => "isotropic", "Accuracy Order" => 2) - test_data_manager = Bond_Associated_Correspondence.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Correspondence.Bond_Associated_Correspondence.init_model(test_data_manager, nodes, material_parameter) @@ -160,7 +159,7 @@ end Float64, dof, VectorOrMatrix = "Matrix") - stress_integral = Bond_Associated_Correspondence.compute_stress_integral(nodes, + stress_integral = PeriLab.Solver_control.Model_Factory.Material.Correspondence.Bond_Associated_Correspondence.compute_stress_integral(nodes, dof, nlist, omega, diff --git a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence.jl b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence.jl index f6d13d748..b36013dd5 100644 --- a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence.jl +++ b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence.jl @@ -2,10 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../../../src/Models/Material/Material_Models/Correspondence/Correspondence.jl") - using Test -using .Correspondence #include("../../../../../../src/PeriLab.jl") #using .PeriLab @testset "zero_energy_mode_compensation_exception" begin @@ -17,7 +14,7 @@ using .Correspondence nn[2] = 3 nodes = Vector{Int64}(1:2) - @test Correspondence.zero_energy_mode_compensation(test_data_manager, + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.zero_energy_mode_compensation(test_data_manager, nodes, Dict{String,Any}(), 0.0, @@ -27,11 +24,11 @@ end @testset "ut_init_model" begin test_data_manager = PeriLab.Data_manager material_parameter = Dict{String,Any}() - @test isnothing(Correspondence.init_model(test_data_manager, [1, 2], 1, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.init_model(test_data_manager, [1, 2], 1, material_parameter)) material_parameter = Dict{String,Any}("Material Model" => "Correspondence Non_Exist", "Symmetry" => "isotropic plane strain") - @test isnothing(Correspondence.init_model(test_data_manager, [1, 2], 1, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.init_model(test_data_manager, [1, 2], 1, material_parameter)) end diff --git a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_Plastic.jl b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_Plastic.jl index d55361aa3..6585b1ef6 100644 --- a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_Plastic.jl +++ b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_Plastic.jl @@ -1,14 +1,14 @@ # SPDX-FileCopyrightText: 2023 Christian Willberg , Jan-Timo Hesse # # SPDX-License-Identifier: BSD-3-Clause + using Test -include("../../../../../../src/Models/Material/Material_Models/Correspondence/Correspondence_Plastic.jl") # include("../../../../../../src/PeriLab.jl") # using .PeriLab @testset "get_name&fe_support" begin - @test Correspondence_Plastic.correspondence_name() == "Correspondence Plastic" - @test !(Correspondence_Plastic.fe_support()) + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_Plastic.correspondence_name() == "Correspondence Plastic" + @test !(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_Plastic.fe_support()) end @testset "ut_init_model" begin @@ -21,18 +21,18 @@ end test_data_manager.set_dof(dof) nn = test_data_manager.create_constant_node_field("Number of Neighbors", Int64, 1) nn .= 2 - @test isnothing(Correspondence_Plastic.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_Plastic.init_model(test_data_manager, Vector{Int64}(1:nodes), material_parameter)) material_parameter = Dict("Shear Modulus" => 10.5) - @test isnothing(Correspondence_Plastic.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_Plastic.init_model(test_data_manager, Vector{Int64}(1:nodes), material_parameter)) material_parameter = Dict("Shear Modulus" => 10.5, "Yield Stress" => 3.4) - test_data_manager = Correspondence_Plastic.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_Plastic.init_model(test_data_manager, Vector{Int64}(1:nodes), material_parameter) @@ -42,7 +42,7 @@ end material_parameter = Dict("Shear Modulus" => 10.5, "Yield Stress" => 3.4, "Bond Associated" => true) - test_data_manager = Correspondence_Plastic.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_Plastic.init_model(test_data_manager, Vector{Int64}(1:nodes), material_parameter) diff --git a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_UMAT.jl b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_UMAT.jl index 05a05efcd..a9d499357 100644 --- a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_UMAT.jl +++ b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_UMAT.jl @@ -3,12 +3,11 @@ # SPDX-License-Identifier: BSD-3-Clause using Test using LinearAlgebra -include("../../../../../../src/Models/Material/Material_Models/Correspondence/Correspondence_UMAT.jl") #include("../../../../../../src/PeriLab.jl") #using .PeriLab @testset "get_name&fe_support" begin - @test Correspondence_UMAT.correspondence_name() == "Correspondence UMAT" - @test Correspondence_UMAT.fe_support() + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.correspondence_name() == "Correspondence UMAT" + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.fe_support() end @testset "init exceptions" begin nodes = 2 @@ -22,7 +21,7 @@ end file = "../src/Models/Material/UMATs/libperuser.so" end - @test !isnothing(Correspondence_UMAT.init_model(test_data_manager, + @test !isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file, "Number of Properties" => 3, @@ -30,19 +29,19 @@ end "Property_2" => 2, "Property_3" => 2.4, "Property_4" => 2))) - @test isnothing(Correspondence_UMAT.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file * "_not_there"))) - @test isnothing(Correspondence_UMAT.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file))) - @test isnothing(Correspondence_UMAT.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}())) - @test isnothing(Correspondence_UMAT.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file, "Number of Properties" => 3, @@ -50,7 +49,7 @@ end "Property_2" => 2.4, "Property_3" => 2.4, "UMAT Material Name" => "a"^81))) - @test !isnothing(Correspondence_UMAT.init_model(test_data_manager, + @test !isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file, "Number of Properties" => 3, @@ -65,7 +64,7 @@ end @test properties[2] == 2 @test properties[3] == 2.4 - @test isnothing(Correspondence_UMAT.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file, "Number of Properties" => 3, @@ -85,7 +84,7 @@ end "Property_2" => 2, "Property_3" => 2.4, "Predefined Field Names" => "test_field_2 test_field_3") - Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), mat_dict) + PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), mat_dict) fields = test_data_manager.get_field("Predefined Fields") inc = test_data_manager.get_field("Predefined Fields Increment") @test size(fields) == (2, 2) @@ -102,12 +101,12 @@ end "Property_3" => 2.4, "Predefined Field Names" => "test_field_2 test_field_3") @test !haskey(mat_dict, "UMAT name") - Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), mat_dict) + PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), mat_dict) @test haskey(mat_dict, "UMAT name") @test mat_dict["UMAT name"] == "UMAT" end @testset "ut_malloc_cstring" begin - CMNAME = Correspondence_UMAT.malloc_cstring("UMAT_TEST") + CMNAME = PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.malloc_cstring("UMAT_TEST") @test typeof(CMNAME) == Cstring end @@ -138,7 +137,7 @@ end DTEMP::Float64 = 0.1 PREDEF::Vector{Float64} = zeros(Float64, 1) # Adjust as needed DPRED::Vector{Float64} = zeros(Float64, 1) # Adjust as needed - CMNAME::Cstring = Correspondence_UMAT.malloc_cstring("UMAT_TEST") # Adjust as needed + CMNAME::Cstring = PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.malloc_cstring("UMAT_TEST") # Adjust as needed NDI::Int64 = 3 NSHR::Int64 = 3 NTENS::Int64 = 6 @@ -163,8 +162,8 @@ end PROPS[1] = 4.2 STRAN[1] = 1 DSTRAN[1] = 3 - Correspondence_UMAT.umat_file_path = file - Correspondence_UMAT.UMAT_interface(STRESS, + PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.umat_file_path = file + PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_UMAT.UMAT_interface(STRESS, STATEV, DDSDDE, SSE, diff --git a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_VUMAT.jl b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_VUMAT.jl index f9ba4cf4e..01a208844 100644 --- a/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_VUMAT.jl +++ b/test/unit_tests/Models/Material/Material_Models/Correspondence/ut_Correspondence_VUMAT.jl @@ -1,14 +1,14 @@ # SPDX-FileCopyrightText: 2023 Christian Willberg , Jan-Timo Hesse # # SPDX-License-Identifier: BSD-3-Clause + using Test using LinearAlgebra -include("../../../../../../src/Models/Material/Material_Models/Correspondence/Correspondence_VUMAT.jl") # include("../../../../../../src/PeriLab.jl") # using .PeriLab @testset "get_name&fe_support" begin - @test Correspondence_VUMAT.correspondence_name() == "Correspondence VUMAT" - @test Correspondence_VUMAT.fe_support() + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.correspondence_name() == "Correspondence VUMAT" + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.fe_support() end @testset "init exceptions" begin nodes = 2 @@ -22,7 +22,7 @@ end file = "../src/Models/Material/UMATs/libperuser.so" end - @test !isnothing(Correspondence_VUMAT.init_model(test_data_manager, + @test !isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file, "Number of Properties" => 3, @@ -30,19 +30,19 @@ end "Property_2" => 2, "Property_3" => 2.4, "Property_4" => 2))) - @test isnothing(Correspondence_VUMAT.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file * "_not_there"))) - @test isnothing(Correspondence_VUMAT.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file))) - @test isnothing(Correspondence_VUMAT.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}())) - @test isnothing(Correspondence_VUMAT.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file, "Number of Properties" => 3, @@ -50,7 +50,7 @@ end "Property_2" => 2.4, "Property_3" => 2.4, "VUMAT Material Name" => "a"^81))) - @test !isnothing(Correspondence_VUMAT.init_model(test_data_manager, + @test !isnothing(PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict{String,Any}("File" => file, "Number of Properties" => 3, @@ -71,7 +71,7 @@ end "Property_1" => 2, "Property_2" => 2, "Property_3" => 2.4) - Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), mat_dict) + PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), mat_dict) @test mat_dict["VUMAT name"] == "test_sub" mat_dict = Dict{String,Any}("File" => file, "Number of Properties" => 3, @@ -79,7 +79,7 @@ end "Property_2" => 2, "Property_3" => 2.4) @test !haskey(mat_dict, "VUMAT name") - Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), mat_dict) + PeriLab.Solver_control.Model_Factory.Material.Correspondence.Correspondence_VUMAT.init_model(test_data_manager, Vector{Int64}(1:nodes), mat_dict) @test haskey(mat_dict, "VUMAT name") @test mat_dict["VUMAT name"] == "VUMAT" end diff --git a/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_PD_Solid_Elastic.jl b/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_PD_Solid_Elastic.jl index 595a09ae4..01fb74500 100644 --- a/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_PD_Solid_Elastic.jl +++ b/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_PD_Solid_Elastic.jl @@ -1,10 +1,9 @@ # SPDX-FileCopyrightText: 2023 Christian Willberg , Jan-Timo Hesse # # SPDX-License-Identifier: BSD-3-Clause -using Test -include("../../../../../../src/Models/Material/Material_Models/Ordinary/PD_Solid_Elastic.jl") +using Test @testset "get_name&fe_support" begin - @test PD_Solid_Elastic.material_name() == "PD Solid Elastic" - @test !(PD_Solid_Elastic.fe_support()) + @test PeriLab.Solver_control.Model_Factory.Material.PD_Solid_Elastic.material_name() == "PD Solid Elastic" + @test !(PeriLab.Solver_control.Model_Factory.Material.PD_Solid_Elastic.fe_support()) end diff --git a/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_PD_Solid_Plastic.jl b/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_PD_Solid_Plastic.jl index 31a06f8f4..53ed9e4b9 100644 --- a/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_PD_Solid_Plastic.jl +++ b/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_PD_Solid_Plastic.jl @@ -1,14 +1,14 @@ # SPDX-FileCopyrightText: 2023 Christian Willberg , Jan-Timo Hesse # # SPDX-License-Identifier: BSD-3-Clause + using Test -include("../../../../../../src/Models/Material/Material_Models/Ordinary/PD_Solid_Plastic.jl") #include("../../../../../../src/PeriLab.jl") #using .PeriLab @testset "get_name&fe_support" begin - @test PD_Solid_Plastic.material_name() == "PD Solid Plastic" - @test !(PD_Solid_Plastic.fe_support()) + @test PeriLab.Solver_control.Model_Factory.Material.PD_Solid_Plastic.material_name() == "PD Solid Plastic" + @test !(PeriLab.Solver_control.Model_Factory.Material.PD_Solid_Plastic.fe_support()) end @testset "ut_init_model" begin @@ -26,10 +26,10 @@ end nn = test_data_manager.create_constant_node_field("Number of Neighbors", Int64, 1) nn .= 1 - @test isnothing(PD_Solid_Plastic.init_model(test_data_manager, Vector{Int64}(1:nodes), + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.PD_Solid_Plastic.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict())) - test_data_manager = PD_Solid_Plastic.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.PD_Solid_Plastic.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Yield Stress" => 5.3)) yield = test_data_manager.get_field("Yield Value") @@ -37,7 +37,7 @@ end @test isapprox(yield[1], 25 * 5.3 * 5.3 / (8 * pi * 3^5)) @test isapprox(yield[2], 25 * 5.3 * 5.3 / (8 * pi * 2^5)) - test_data_manager = PD_Solid_Plastic.init_model(test_data_manager, + test_data_manager = PeriLab.Solver_control.Model_Factory.Material.PD_Solid_Plastic.init_model(test_data_manager, Vector{Int64}(1:nodes), Dict("Yield Stress" => 2.2, "Symmetry" => "plane stress")) @@ -58,7 +58,7 @@ end deviatoric_plastic_extension_state = [[0.0, 0.0], [0.0, 0.0]] bond_force_deviatoric = [[0.0, 0.0], [0.0, 0.0]] - (bond_force_deviatoric, deviatoric_plastic_extension_state) = PD_Solid_Plastic.plastic(nodes, + (bond_force_deviatoric, deviatoric_plastic_extension_state) = PeriLab.Solver_control.Model_Factory.Material.PD_Solid_Plastic.plastic(nodes, td_norm, yield_value, lambdaNP1, diff --git a/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_ordinary.jl b/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_ordinary.jl index 4e6ddf276..9953c32b0 100644 --- a/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_ordinary.jl +++ b/test/unit_tests/Models/Material/Material_Models/Ordinary/ut_ordinary.jl @@ -2,9 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../../../src/Models/Material/Material_Models/Ordinary/Ordinary.jl") using Test -using .Ordinary @testset "compute_weighted_volume!" begin weighted_volume = zeros(9) weightedTest = zeros(9) @@ -82,7 +80,7 @@ using .Ordinary 0.8615883, 0.8615883] vec = Vector{Int64}(1:nnodes) - Ordinary.compute_weighted_volume!(weighted_volume, + PeriLab.Solver_control.Model_Factory.Material.Ordinary.compute_weighted_volume!(weighted_volume, vec, nlist, undeformed_bond_length, @@ -120,7 +118,7 @@ nlist[2][1] = 2 @testset "compute_dilatation!" begin vec = Vector{Int64}(1:nnodes) theta = zeros(Float64, 2) - Ordinary.compute_dilatation!(vec, + PeriLab.Solver_control.Model_Factory.Material.Ordinary.compute_dilatation!(vec, nlist, undeformed_bond_length, deformed_bond_length, @@ -132,7 +130,7 @@ nlist[2][1] = 2 @test theta[1] == 3.0 @test theta[2] == 3.0 weighted_volume[1] = 0 - Ordinary.compute_dilatation!(vec, + PeriLab.Solver_control.Model_Factory.Material.Ordinary.compute_dilatation!(vec, nlist, undeformed_bond_length, deformed_bond_length, @@ -146,12 +144,12 @@ nlist[2][1] = 2 end @testset "calculate_symmetry_params" begin - @test Ordinary.calculate_symmetry_params("3D", 1.0, 1.0) == (15, 1, 3) - test_val = Ordinary.calculate_symmetry_params("plane stress", 1.0, 1.0) + @test PeriLab.Solver_control.Model_Factory.Material.Ordinary.calculate_symmetry_params("3D", 1.0, 1.0) == (15, 1, 3) + test_val = PeriLab.Solver_control.Model_Factory.Material.Ordinary.calculate_symmetry_params("plane stress", 1.0, 1.0) @test test_val[1] == 8 @test isapprox(test_val[2], 0.5714285714285714) @test isapprox(test_val[3], 0.5714285714285714) - @test Ordinary.calculate_symmetry_params("plane strain", 1.0, 1.0) == (8, 2 / 3, 8 / 9) + @test PeriLab.Solver_control.Model_Factory.Material.Ordinary.calculate_symmetry_params("plane strain", 1.0, 1.0) == (8, 2 / 3, 8 / 9) end @testset "ut_get_bond_forces" begin @@ -164,7 +162,7 @@ end deformed_bond[1][2][1] = 1 bond_force = [[fill(0.0, dof) for j in 1:n] for n in nBonds] temp = [fill(0.0, n) for n in nBonds] - bond_force = Ordinary.get_bond_forces(vec, + bond_force = PeriLab.Solver_control.Model_Factory.Material.Ordinary.get_bond_forces(vec, bond_force_length, deformed_bond, deformed_bond_length, @@ -173,7 +171,7 @@ end @test bond_force == [[[0.5, 0.0], [0.5, 0.0]], [[0.0, 0.0], [0.0, 0.0]]] # deformed_bond_length[2][1] = 0 # @test isnothing( - # Ordinary.get_bond_forces( + # PeriLab.Solver_control.Model_Factory.Material.Ordinary.get_bond_forces( # vec, # bond_force_length, # deformed_bond, diff --git a/test/unit_tests/Models/Material/Zero_Energy_Control/ut_global_control.jl b/test/unit_tests/Models/Material/Zero_Energy_Control/ut_global_control.jl index d5d0f3c45..2e58fabd8 100644 --- a/test/unit_tests/Models/Material/Zero_Energy_Control/ut_global_control.jl +++ b/test/unit_tests/Models/Material/Zero_Energy_Control/ut_global_control.jl @@ -2,38 +2,36 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../../src/Models/Material/Material_Models/Zero_Energy_Control/global_control.jl") using Test -using .Global_zero_energy_control @testset "control_name" begin - @test Global_zero_energy_control.control_name() == "Global" + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Global_zero_energy_control.control_name() == "Global" end @testset "rotate_fourth_order_tensor_interface test" begin testval = zeros(3, 3, 3, 3) - @test Global_zero_energy_control.rotate_fourth_order_tensor(zeros(3), + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Global_zero_energy_control.rotate_fourth_order_tensor(zeros(3), zeros(3, 3, 3, 3), 3, true) == testval - @test Global_zero_energy_control.rotate_fourth_order_tensor(zeros(3), + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Global_zero_energy_control.rotate_fourth_order_tensor(zeros(3), zeros(3, 3, 3, 3), 3, false) == testval testval = zeros(2, 2, 2, 2) - @test Global_zero_energy_control.rotate_fourth_order_tensor(zeros(1), + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Global_zero_energy_control.rotate_fourth_order_tensor(zeros(1), zeros(2, 2, 2, 2), 2, true) == testval - @test Global_zero_energy_control.rotate_fourth_order_tensor(zeros(1), + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Global_zero_energy_control.rotate_fourth_order_tensor(zeros(1), zeros(2, 2, 2, 2), 2, false) == testval - @test Global_zero_energy_control.rotate_fourth_order_tensor(zeros(3), + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Global_zero_energy_control.rotate_fourth_order_tensor(zeros(3), zeros(2, 2, 2, 2), 3, true) == testval - @test Global_zero_energy_control.rotate_fourth_order_tensor(zeros(3), + @test PeriLab.Solver_control.Model_Factory.Material.Correspondence.Global_zero_energy_control.rotate_fourth_order_tensor(zeros(3), zeros(2, 2, 2, 2), 3, false) == testval diff --git a/test/unit_tests/Models/Material/ut_Material_Factory.jl b/test/unit_tests/Models/Material/ut_Material_Factory.jl index dff51ba98..5d71163cd 100644 --- a/test/unit_tests/Models/Material/ut_Material_Factory.jl +++ b/test/unit_tests/Models/Material/ut_Material_Factory.jl @@ -2,11 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../../src/Models/Material/Material_Factory.jl") -# include("../../../../src/Core/Data_manager.jl") -# include("../../../../src/Support/Parameters/parameter_handling.jl") using Test -import .Material @testset "ut_init_model_fields" begin test_data_manager = PeriLab.Data_manager @@ -16,7 +12,7 @@ import .Material test_data_manager.create_constant_node_field("Coordinates", Float64, 3) nn = test_data_manager.create_constant_node_field("Number of Neighbors", Int64, 1) nn[1:4] = 1:4 - Material.init_fields(test_data_manager) + PeriLab.Solver_control.Model_Factory.Material.init_fields(test_data_manager) field_keys = test_data_manager.get_all_field_keys() @test "ForcesN" in field_keys @test "ForcesNP1" in field_keys @@ -31,6 +27,6 @@ end test_data_manager.set_block_id_list([2, 3, 1]) test_data_manager.init_properties() test_data_manager.set_property(1, "Material Model", "E", 1) - @test isnothing(Material.init_model(test_data_manager, Vector{Int64}(1:4), 1)) - @test isnothing(Material.init_model(test_data_manager, Vector{Int64}(1:4), 2)) + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.init_model(test_data_manager, Vector{Int64}(1:4), 1)) + @test isnothing(PeriLab.Solver_control.Model_Factory.Material.init_model(test_data_manager, Vector{Int64}(1:4), 2)) end diff --git a/test/unit_tests/Models/Material/ut_material_basis.jl b/test/unit_tests/Models/Material/ut_material_basis.jl index dc1627313..660c9ed46 100644 --- a/test/unit_tests/Models/Material/ut_material_basis.jl +++ b/test/unit_tests/Models/Material/ut_material_basis.jl @@ -3,22 +3,6 @@ # SPDX-License-Identifier: BSD-3-Clause using Test -include("../../../../src/Models/Material/Material_Basis.jl") -using .Material_Basis: - get_value, - get_all_elastic_moduli, - get_Hooke_matrix, - distribute_forces!, - flaw_function, - matrix_to_voigt, - voigt_to_matrix, - check_symmetry, - get_symmetry, - get_von_mises_yield_stress, - get_strain, - compute_Piola_Kirchhoff_stress!, - apply_pointwise_E, - init_local_damping_due_to_damage #include("../../../../src/PeriLab.jl") #using .PeriLab @@ -28,11 +12,11 @@ using .Material_Basis: test_data_manager.set_num_controller(3) nn = test_data_manager.create_constant_node_field("Number of Neighbors", Int64, 1) nn .= 2 - @test isnothing(init_local_damping_due_to_damage(test_data_manager, + @test isnothing(PeriLab.Solver_control.Material_Basis.init_local_damping_due_to_damage(test_data_manager, collect(1:2), Dict(), Dict("Local Damping" => Dict()))) - @test isnothing(init_local_damping_due_to_damage(test_data_manager, + @test isnothing(PeriLab.Solver_control.Material_Basis.init_local_damping_due_to_damage(test_data_manager, collect(1:2), Dict(), Dict("Local Damping" => Dict("Representative Young's modulus" => 0)))) @@ -44,7 +28,7 @@ end bond_force=[[ones(2), ones(2)], [ones(2), ones(2)], [ones(2), ones(2)]] E = 3.3 bond_force[3][2][2] = 3 - apply_pointwise_E(nodes, E, bond_force) + PeriLab.Solver_control.Material_Basis.apply_pointwise_E(nodes, E, bond_force) @test bond_force[1][1][1] == 1 @test bond_force[1][1][2] == 1 @test bond_force[1][2][1] == 1 @@ -60,7 +44,7 @@ end bond_force=[[ones(2), ones(2)], [ones(2), ones(2)], [ones(2), ones(2), ones(2)]] E = zeros(4) - apply_pointwise_E(nodes, E, bond_force) + PeriLab.Solver_control.Material_Basis.apply_pointwise_E(nodes, E, bond_force) @test bond_force[1][1][1] == 1 @test bond_force[1][1][2] == 1 @test bond_force[1][2][1] == 1 @@ -90,35 +74,35 @@ end expected_force_densities = copy(force_densities) for iID in nodes expected_force_densities[iID, - :] .+= transpose(sum(bond_damage[iID] .* - mapreduce(permutedims, vcat, - bond_force[iID]) .* - volume[nlist[iID]], - dims = 1)) + :] .+= transpose(sum(bond_damage[iID] .* + mapreduce(permutedims, vcat, + bond_force[iID]) .* + volume[nlist[iID]], + dims = 1)) expected_force_densities[nlist[iID], - :] .-= bond_damage[iID] .* - mapreduce(permutedims, vcat, - bond_force[iID]) .* - volume[iID] + :] .-= bond_damage[iID] .* + mapreduce(permutedims, vcat, + bond_force[iID]) .* + volume[iID] end - distribute_forces!(force_densities, nodes, nlist, bond_force, volume, bond_damage) + PeriLab.Solver_control.Material_Basis.distribute_forces!(force_densities, nodes, nlist, bond_force, volume, bond_damage) @test force_densities ≈ expected_force_densities end @testset "ut_flaw_function" begin stress::Float64 = 5.3 - @test flaw_function(Dict(), Vector{Float64}([1, 2]), stress) == stress + @test PeriLab.Solver_control.Material_Basis.flaw_function(Dict(), Vector{Float64}([1, 2]), stress) == stress - @test isnothing(flaw_function(Dict("Flaw Function" => Dict()), Vector{Float64}([1, 2]), + @test isnothing(PeriLab.Solver_control.Material_Basis.flaw_function(Dict("Flaw Function" => Dict()), Vector{Float64}([1, 2]), stress)) - @test isnothing(flaw_function(Dict("Flaw Function" => Dict("Active" => false)), + @test isnothing(PeriLab.Solver_control.Material_Basis.flaw_function(Dict("Flaw Function" => Dict("Active" => false)), Vector{Float64}([1, 2]), stress)) - @test flaw_function(Dict("Flaw Function" => Dict("Active" => false, + @test PeriLab.Solver_control.Material_Basis.flaw_function(Dict("Flaw Function" => Dict("Active" => false, "Function" => "Pre-defined")), Vector{Float64}([1, 2]), stress) == stress - @test isnothing(flaw_function(Dict("Flaw Function" => Dict("Active" => true, + @test isnothing(PeriLab.Solver_control.Material_Basis.flaw_function(Dict("Flaw Function" => Dict("Active" => true, "Function" => "Pre-defined", "Flaw Location X" => 1.1, "Flaw Location Y" => 1.1, @@ -126,7 +110,7 @@ end "Flaw Size" => 0.2)), Vector{Float64}([1, 2]), stress)) - @test isnothing(flaw_function(Dict("Flaw Function" => Dict("Active" => true, + @test isnothing(PeriLab.Solver_control.Material_Basis.flaw_function(Dict("Flaw Function" => Dict("Active" => true, "Function" => "Pre-defined", "Flaw Location X" => 1.1, "Flaw Location Y" => 1.1, @@ -135,7 +119,7 @@ end Vector{Float64}([1, 2]), stress)) - @test isapprox(flaw_function(Dict("Flaw Function" => Dict("Active" => true, + @test isapprox(PeriLab.Solver_control.Material_Basis.flaw_function(Dict("Flaw Function" => Dict("Active" => true, "Function" => "Pre-defined", "Flaw Location X" => 1.1, "Flaw Location Y" => 1.1, @@ -145,7 +129,7 @@ end stress), 5.29999999) - @test isapprox(flaw_function(Dict("Flaw Function" => Dict("Active" => true, + @test isapprox(PeriLab.Solver_control.Material_Basis.flaw_function(Dict("Flaw Function" => Dict("Active" => true, "Function" => "Pre-defined", "Flaw Location X" => 1.1, "Flaw Location Y" => 1.1, @@ -156,30 +140,30 @@ end stress), 5.29999999) - # @test flaw_function(Dict("Flaw Function" => Dict("Active" => true, "Function" => "x*x")), Vector{Float64}([1, 2]), stress) == 1 + # @test PeriLab.Solver_control.Material_Basis.flaw_function(Dict("Flaw Function" => Dict("Active" => true, "Function" => "x*x")), Vector{Float64}([1, 2]), stress) == 1 end @testset "check_symmetry" begin - @test isnothing(check_symmetry(Dict(), 2)) - @test isnothing(check_symmetry(Dict(), 3)) - @test isnothing(check_symmetry(Dict("Symmetry" => "a"), 2)) - @test isnothing(check_symmetry(Dict("Symmetry" => "plane"), 2)) - @test isnothing(check_symmetry(Dict("Symmetry" => "stress"), 2)) - @test isnothing(check_symmetry(Dict("Symmetry" => "strain"), 2)) - check_symmetry(Dict("Symmetry" => "plane stress"), 2) - check_symmetry(Dict("Symmetry" => "plane strain"), 2) - check_symmetry(Dict("Symmetry" => "3D"), 3) + @test isnothing(PeriLab.Solver_control.Material_Basis.check_symmetry(Dict(), 2)) + @test isnothing(PeriLab.Solver_control.Material_Basis.check_symmetry(Dict(), 3)) + @test isnothing(PeriLab.Solver_control.Material_Basis.check_symmetry(Dict("Symmetry" => "a"), 2)) + @test isnothing(PeriLab.Solver_control.Material_Basis.check_symmetry(Dict("Symmetry" => "plane"), 2)) + @test isnothing(PeriLab.Solver_control.Material_Basis.check_symmetry(Dict("Symmetry" => "stress"), 2)) + @test isnothing(PeriLab.Solver_control.Material_Basis.check_symmetry(Dict("Symmetry" => "strain"), 2)) + PeriLab.Solver_control.Material_Basis.check_symmetry(Dict("Symmetry" => "plane stress"), 2) + PeriLab.Solver_control.Material_Basis.check_symmetry(Dict("Symmetry" => "plane strain"), 2) + PeriLab.Solver_control.Material_Basis.check_symmetry(Dict("Symmetry" => "3D"), 3) end @testset "get_symmetry" begin - @test get_symmetry(Dict()) == "3D" - @test get_symmetry(Dict("Symmetry" => "iso plane stress")) == "plane stress" - @test get_symmetry(Dict("Symmetry" => "iso plane stress")) == "plane stress" - @test get_symmetry(Dict("Symmetry" => "iso Plane Stress")) == "plane stress" - - @test get_symmetry(Dict("Symmetry" => "plane strain")) == "plane strain" - @test get_symmetry(Dict("Symmetry" => "plane Strain")) == "plane strain" - @test get_symmetry(Dict("Symmetry" => "PLANE strain")) == "plane strain" - @test get_symmetry(Dict("Symmetry" => "plan strain")) == "3D" + @test PeriLab.Solver_control.Material_Basis.get_symmetry(Dict()) == "3D" + @test PeriLab.Solver_control.Material_Basis.get_symmetry(Dict("Symmetry" => "iso plane stress")) == "plane stress" + @test PeriLab.Solver_control.Material_Basis.get_symmetry(Dict("Symmetry" => "iso plane stress")) == "plane stress" + @test PeriLab.Solver_control.Material_Basis.get_symmetry(Dict("Symmetry" => "iso Plane Stress")) == "plane stress" + + @test PeriLab.Solver_control.Material_Basis.get_symmetry(Dict("Symmetry" => "plane strain")) == "plane strain" + @test PeriLab.Solver_control.Material_Basis.get_symmetry(Dict("Symmetry" => "plane Strain")) == "plane strain" + @test PeriLab.Solver_control.Material_Basis.get_symmetry(Dict("Symmetry" => "PLANE strain")) == "plane strain" + @test PeriLab.Solver_control.Material_Basis.get_symmetry(Dict("Symmetry" => "plan strain")) == "3D" end @testset "get_all_elastic_moduli" begin @@ -194,37 +178,37 @@ end "Shear Modulus" => 0, "Poisson's Ratio" => 0, "Symmetry" => "isotropic") - test = get_all_elastic_moduli(test_data_manager, + test = PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, Dict{String,Any}("Material Model" => "PD Solid Elastic")) @test isnothing(test) parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Bulk Modulus" => 1000, "Young's Modulus" => 10) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test sort(collect(keys(parameter))) == sort(collect(keys(ref_parameter))) parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Bulk Modulus" => 1, "Shear Modulus" => 10) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test sort(collect(keys(parameter))) == sort(collect(keys(ref_parameter))) parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Bulk Modulus" => 1, "Shear Modulus" => 10, "Poisson's Ratio" => 0.2) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test sort(collect(keys(parameter))) == sort(collect(keys(ref_parameter))) parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Bulk Modulus" => 10) - @test isnothing(get_all_elastic_moduli(test_data_manager, parameter)) + @test isnothing(PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter)) parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Bulk Modulus" => 10, "Shear Modulus" => 10) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test parameter["Young's Modulus"] == Float64(22.5) @test parameter["Poisson's Ratio"] == Float64(0.125) @test parameter["Bulk Modulus"] == 10 @@ -233,7 +217,7 @@ end parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Bulk Modulus" => 5, "Shear Modulus" => 1.25) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test parameter["Young's Modulus"] / 3.4615384615384617 - 1 < 1e-7 @test parameter["Poisson's Ratio"] / 0.45454545454545453 - 1 < 1e-7 @test parameter["Bulk Modulus"] == 5 @@ -242,14 +226,14 @@ end parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Bulk Modulus" => 5, "Young's Modulus" => 1.25) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test parameter["Shear Modulus"] / 4.2857142857142855e-1 - 1 < 1e-7 @test parameter["Poisson's Ratio"] / 0.4583333333333333 - 1 < 1e-7 parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Poisson's Ratio" => 0.45, "Shear Modulus" => 1.25) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test parameter["Young's Modulus"] / 3.625e+0 - 1 < 1e-8 @test parameter["Bulk Modulus"] / 1.2083333333333336e+1 - 1 < 1e-7 @test parameter["Poisson's Ratio"] == Float64(0.45) @@ -258,7 +242,7 @@ end parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Young's Modulus" => 5, "Poisson's Ratio" => 0.125) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test parameter["Bulk Modulus"] / 2.2222222222222223e+0 - 1 < 1e-7 @test parameter["Shear Modulus"] / 2.2222222222222223e+0 - 1 < 1e-7 @test parameter["Poisson's Ratio"] == Float64(0.125) @@ -266,7 +250,7 @@ end parameter = Dict{String,Any}("Material Model" => "Bond-based Elastic", "Young's Modulus" => 5) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test parameter["Bulk Modulus"] == 5 @test parameter["Shear Modulus"] == 1.875 @test parameter["Poisson's Ratio"] == Float64(1 / 3) @@ -275,7 +259,7 @@ end parameter = Dict{String,Any}("Material Model" => "Bond-based Elastic", "Young's Modulus" => 5, "Poisson's Ratio" => 0.125) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test parameter["Bulk Modulus"] == 5 @test parameter["Shear Modulus"] == 1.875 @test parameter["Poisson's Ratio"] == Float64(1 / 3) @@ -284,7 +268,7 @@ end test_data_manager.create_constant_node_field("Bulk_Modulus", Float64, 1, 10) parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Shear Modulus" => 10) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test parameter["Young's Modulus"] == [22.5, 22.5, 22.5] @test parameter["Poisson's Ratio"] == [0.125, 0.125, 0.125] @test parameter["Bulk Modulus"] == [10, 10, 10] @@ -293,7 +277,7 @@ end parameter = Dict{String,Any}("Material Model" => "Unified Bond-based Elastic", "Young's Modulus" => 5, "Poisson's Ratio" => 0.125) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) @test parameter["Young's Modulus"] == [22.5, 22.5, 22.5] @test parameter["Poisson's Ratio"] == [0.125, 0.125, 0.125] @@ -303,12 +287,12 @@ end parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Symmetry" => "Anisotropic", "C11" => 5) - @test isnothing(get_all_elastic_moduli(test_data_manager, parameter)) + @test isnothing(PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter)) parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", "Symmetry" => "Orthotropic", "Young's Modulus X" => 5) - @test isnothing(get_all_elastic_moduli(test_data_manager, parameter)) + @test isnothing(PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter)) end @testset "get_Hooke_matrix" begin @@ -319,13 +303,13 @@ end "Shear Modulus" => 1.25, "Poisson's Ratio" => 0.2, "Compute_Hook" => false) - get_all_elastic_moduli(test_data_manager, parameter) + PeriLab.Solver_control.Material_Basis.get_all_elastic_moduli(test_data_manager, parameter) symmetry = "isotropic" E = parameter["Young's Modulus"] nu = parameter["Poisson's Ratio"] temp = 1 / ((1 + nu) * (1 - 2 * nu)) - C = get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) + C = PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) for iID in 1:3 @test isapprox(C[iID, iID], E * (1 - nu) * temp) @test C[iID+3, iID+3] == (1 - 2 * nu) * temp * E @@ -337,7 +321,7 @@ end end symmetry = "isotropic plane strain" - C2D = get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) + C2D = PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) for iID in 1:2 @test C2D[iID, iID] / (E * (1 - nu) * temp) - 1 < 1e-7 for jID in 1:2 @@ -349,7 +333,7 @@ end @test C2D[3, 3] == parameter["Shear Modulus"] symmetry = "missing" - C2D = get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) + C2D = PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) for iID in 1:2 @test C2D[iID, iID] / (E * (1 - nu) * temp) - 1 < 1e-7 for jID in 1:2 @@ -366,7 +350,7 @@ end C2D_test[1:2, 1:2] = Cinv[1:2, 1:2] C2D_test[3, 3] = Cinv[6, 6] C2D_test = inv(C2D_test) - C = get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) + C = PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) for iID in 1:3 for jID in 1:3 if C2D_test[iID, jID] != 0 @@ -382,10 +366,10 @@ end end symmetry = "isotropic missing" - @test isnothing(get_Hooke_matrix(test_data_manager, parameter, symmetry, 2)) + @test isnothing(PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 2)) symmetry = "anisotropic" - C = get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) + C = PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) for iID in 1:6 for jID in 1:6 @test C[iID, jID] == C[jID, iID] @@ -396,7 +380,7 @@ end end symmetry = "anisotropic plane strain" - C = get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) + C = PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) for iID in 1:2 for jID in 1:2 @test C[iID, jID] == C[jID, iID] @@ -412,7 +396,7 @@ end @test C[3, 2] == parameter["C26"] # symmetry = "anisotropic plane stress" - # C = get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) + # C = PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 2) # for iID = 1:3 # for jID = 1:3 # if C2D_test[iID, jID] != 0 @@ -435,7 +419,7 @@ end "Shear Modulus YZ" => 2, "Shear Modulus XZ" => 3, "Compute_Hook" => true) - C = get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) + C = PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) @test C[1, 1] == 5.9692770078477215 @test C[1, 2] == 1.2773417932876945 @test C[1, 3] == 2.8051427617298383 @@ -463,7 +447,7 @@ end "Shear Modulus YZ" => G, "Shear Modulus XZ" => G, "Compute_Hook" => true) - C = get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) + C = PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) symmetry = "isotropic" parameter = Dict{String,Any}("Material Model" => "PD Solid Elastic", @@ -471,7 +455,7 @@ end "Poisson's Ratio" => nu, "Shear Modulus" => G, "Compute_Hook" => true) - @test C == get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) + @test C == PeriLab.Solver_control.Material_Basis.get_Hooke_matrix(test_data_manager, parameter, symmetry, 3) end @testset "ut_compute_Piola_Kirchhoff_stress" begin @@ -479,27 +463,6 @@ end deformation_gradient = [2.0 0.0; 0.0 2.0] expected_result = [2.0 0.0; 0.0 2.0] result = zeros(2, 2) - compute_Piola_Kirchhoff_stress!(stress, deformation_gradient, result) + PeriLab.Solver_control.Material_Basis.compute_Piola_Kirchhoff_stress!(stress, deformation_gradient, result) @test isapprox(result, expected_result) end - -@testset "ut_matrix_to_voigt" begin - matrix = Matrix{Float64}([1 2; 3 4]) - voigt = matrix_to_voigt(matrix) - @test voigt[1] == 1 - @test voigt[2] == 4 - @test voigt[3] == 2.5 - matrix = Matrix{Float64}([1 2 3; 4 5 6; 7 8 9]) - voigt = matrix_to_voigt(matrix) - @test voigt[1] == 1 - @test voigt[2] == 5 - @test voigt[3] == 9 - @test voigt[4] == 7 - @test voigt[5] == 5 - @test voigt[6] == 3 - matrix = Matrix{Float64}([1 2 3 3; 4 5 6 3; 7 8 9 3]) - @test isnothing(matrix_to_voigt(matrix)) -end -@testset "ut_voigt_to_matrix" begin - @test isnothing(voigt_to_matrix([1, 2.2])) -end diff --git a/test/unit_tests/Models/Pre_calculation/ut_pre_bond_associated_correspondence.jl b/test/unit_tests/Models/Pre_calculation/ut_pre_bond_associated_correspondence.jl index 0b5dd784d..04b272d6c 100644 --- a/test/unit_tests/Models/Pre_calculation/ut_pre_bond_associated_correspondence.jl +++ b/test/unit_tests/Models/Pre_calculation/ut_pre_bond_associated_correspondence.jl @@ -3,7 +3,6 @@ # SPDX-License-Identifier: BSD-3-Clause using Test -include("../../../../src/Models/Pre_calculation/pre_bond_associated_correspondence.jl") #include("../../../../src/PeriLab.jl") #using .PeriLab @@ -14,7 +13,7 @@ include("../../../../src/Models/Pre_calculation/pre_bond_associated_corresponden horizon = 3.0 expected_Q = [1.0 / 3.0, 2.0 / 3.0] Q = zeros(2) - Q = Pre_Bond_Associated_Correspondence.calculate_Q(accuracy_order, + Q = PeriLab.Solver_control.Model_Factory.Pre_Calculation.Pre_Bond_Associated_Correspondence.calculate_Q(accuracy_order, dof, undeformed_bond, horizon, @@ -34,7 +33,7 @@ include("../../../../src/Models/Pre_calculation/pre_bond_associated_corresponden 0.4444444444444444 ] Q = zeros(5) - Q = Pre_Bond_Associated_Correspondence.calculate_Q(accuracy_order, + Q = PeriLab.Solver_control.Model_Factory.Pre_Calculation.Pre_Bond_Associated_Correspondence.calculate_Q(accuracy_order, dof, undeformed_bond, horizon, @@ -58,7 +57,7 @@ include("../../../../src/Models/Pre_calculation/pre_bond_associated_corresponden 2.777777777777778 ] Q = zeros(9) - Q = Pre_Bond_Associated_Correspondence.calculate_Q(accuracy_order, + Q = PeriLab.Solver_control.Model_Factory.Pre_Calculation.Pre_Bond_Associated_Correspondence.calculate_Q(accuracy_order, dof, undeformed_bond, horizon, @@ -67,13 +66,13 @@ include("../../../../src/Models/Pre_calculation/pre_bond_associated_corresponden @test isapprox(Q, expected_Q) Q = zeros(3) undeformed_bond = [1.0, 0.0, 0] - @test Pre_Bond_Associated_Correspondence.calculate_Q(1, dof, undeformed_bond, 1.0, Q) == + @test PeriLab.Solver_control.Model_Factory.Pre_Calculation.Pre_Bond_Associated_Correspondence.calculate_Q(1, dof, undeformed_bond, 1.0, Q) == [1, 0, 0] undeformed_bond = [0.0, 1.0, 0] - @test Pre_Bond_Associated_Correspondence.calculate_Q(1, dof, undeformed_bond, 1.0, Q) == + @test PeriLab.Solver_control.Model_Factory.Pre_Calculation.Pre_Bond_Associated_Correspondence.calculate_Q(1, dof, undeformed_bond, 1.0, Q) == [0, 1, 0] undeformed_bond = [0.0, 0.0, 1.0] - @test Pre_Bond_Associated_Correspondence.calculate_Q(1, dof, undeformed_bond, 1.0, Q) == + @test PeriLab.Solver_control.Model_Factory.Pre_Calculation.Pre_Bond_Associated_Correspondence.calculate_Q(1, dof, undeformed_bond, 1.0, Q) == [0, 0, 1] end @@ -104,7 +103,7 @@ end weighted_volume = test_data_manager.create_constant_node_field("Weighted Volume", Float64, 1) - Pre_Bond_Associated_Correspondence.compute_weighted_volume!(weighted_volume, + PeriLab.Solver_control.Model_Factory.Pre_Calculation.Pre_Bond_Associated_Correspondence.compute_weighted_volume!(weighted_volume, nodes, nlist, volume, @@ -136,7 +135,7 @@ end Minv = zeros(5, 5) M = zeros(5, 5) - Pre_Bond_Associated_Correspondence.compute_Lagrangian_gradient_weights(nodes, + PeriLab.Solver_control.Model_Factory.Pre_Calculation.Pre_Bond_Associated_Correspondence.compute_Lagrangian_gradient_weights(nodes, dof, accuracy_order, volume, diff --git a/test/unit_tests/Models/Thermal/ut_Heat_transfer.jl b/test/unit_tests/Models/Thermal/ut_Heat_transfer.jl index 99185f6b8..7e72f159e 100644 --- a/test/unit_tests/Models/Thermal/ut_Heat_transfer.jl +++ b/test/unit_tests/Models/Thermal/ut_Heat_transfer.jl @@ -4,12 +4,10 @@ using Test -include("../../../../src/Models/Thermal/heat_transfer.jl") -using .Heat_transfer #include("../../../../src/PeriLab.jl") #import .PeriLab -@test Heat_transfer.thermal_model_name() == "Heat Transfer" +@test PeriLab.Solver_control.Model_Factory.Thermal.Heat_transfer.thermal_model_name() == "Heat Transfer" @testset "ut_calculate_specific_volume" begin nnodes = 10 @@ -60,7 +58,7 @@ using .Heat_transfer specific_volume_check = test_data_manager.create_constant_node_field("Specific Volume Check", Bool, 1, true) rotation_tensor = nothing - Heat_transfer.calculate_specific_volume!(specific_volume, + PeriLab.Solver_control.Model_Factory.Thermal.Heat_transfer.calculate_specific_volume!(specific_volume, nodes, nlist, active, @@ -90,7 +88,7 @@ end test_data_manager.create_constant_node_field("Specific Volume", Float64, 1) test_data_manager.create_constant_node_field("Surface_Nodes", Bool, 1) test_data_manager.create_bond_field("Bond Damage", Float64, 1) - @test Heat_transfer.compute_model(test_data_manager, + @test PeriLab.Solver_control.Model_Factory.Thermal.Heat_transfer.compute_model(test_data_manager, Vector{Int64}(1:10), Dict("Heat Transfer Coefficient" => 1, "Environmental Temperature" => 1.2, @@ -102,7 +100,7 @@ end dof = 3 test_data_manager.set_dof(dof) - @test Heat_transfer.compute_model(test_data_manager, + @test PeriLab.Solver_control.Model_Factory.Thermal.Heat_transfer.compute_model(test_data_manager, Vector{Int64}(1:10), Dict("Heat Transfer Coefficient" => 1, "Environmental Temperature" => 1.2, diff --git a/test/unit_tests/Models/Thermal/ut_Thermal_Factory.jl b/test/unit_tests/Models/Thermal/ut_Thermal_Factory.jl index 053b9f89a..da57159bd 100644 --- a/test/unit_tests/Models/Thermal/ut_Thermal_Factory.jl +++ b/test/unit_tests/Models/Thermal/ut_Thermal_Factory.jl @@ -3,10 +3,6 @@ # SPDX-License-Identifier: BSD-3-Clause using Test -include("../../../../src/Models/Thermal/Thermal_Factory.jl") -using .Thermal -# include("../../../../src/Core/Data_manager.jl") - @testset "init_fields" begin test_data_manager = PeriLab.Data_manager test_data_manager.initialize_data() @@ -18,7 +14,7 @@ using .Thermal nn[3] = 1 nn[4] = 2 - Thermal.init_fields(test_data_manager) + PeriLab.Solver_control.Model_Factory.Thermal.init_fields(test_data_manager) field_keys = test_data_manager.get_all_field_keys() @test "TemperatureN" in field_keys @test "TemperatureNP1" in field_keys @@ -47,7 +43,7 @@ end test_data_manager.set_properties(1, "Thermal Model", Dict("Thermal Model" => "Heat Transfer")) - Thermal.init_model(test_data_manager, [1], 1) + PeriLab.Solver_control.Model_Factory.Thermal.init_model(test_data_manager, [1], 1) test_data_manager.set_properties(2, "Thermal Model", Dict("Thermal Model" => "Missing")) - @test isnothing(Thermal.init_model(test_data_manager, [1], 2)) + @test isnothing(PeriLab.Solver_control.Model_Factory.Thermal.init_model(test_data_manager, [1], 2)) end diff --git a/test/unit_tests/Models/Thermal/ut_Thermal_expansion.jl b/test/unit_tests/Models/Thermal/ut_Thermal_expansion.jl index ac3762f36..abb19f76a 100644 --- a/test/unit_tests/Models/Thermal/ut_Thermal_expansion.jl +++ b/test/unit_tests/Models/Thermal/ut_Thermal_expansion.jl @@ -3,13 +3,10 @@ # SPDX-License-Identifier: BSD-3-Clause using Test - -include("../../../../src/Models/Thermal/thermal_expansion.jl") -using .Thermal_expansion #include("../../../../src/PeriLab.jl") #import .PeriLab -@test Thermal_expansion.thermal_model_name() == "Thermal Expansion" +@test PeriLab.Solver_control.Model_Factory.Thermal.Thermal_expansion.thermal_model_name() == "Thermal Expansion" @testset "ut_thermal_deformation" begin nnodes = 2 @@ -73,7 +70,7 @@ using .Thermal_expansion "Reference Temperature" => 0.0) temperature_NP1 .= 0 - test_data_manager = Thermal_expansion.compute_model(test_data_manager, nodes, + test_data_manager = PeriLab.Solver_control.Model_Factory.Thermal.Thermal_expansion.compute_model(test_data_manager, nodes, thermal_parameter, 1, 1.0, 1.0) for iID in nodes @@ -85,7 +82,7 @@ using .Thermal_expansion end # temperature_NP1 .= 1 - # test_data_manager = Thermal_expansion.compute_model(test_data_manager, nodes, thermal_parameter, 1, 1.0, 1.0) + # test_data_manager = PeriLab.Solver_control.Model_Factory.Thermal.Thermal_expansion.compute_model(test_data_manager, nodes, thermal_parameter, 1, 1.0, 1.0) # for iID in nodes # for jID in nn[iID] @@ -94,7 +91,7 @@ using .Thermal_expansion # end # temperature_NP1 .= 2 - # test_data_manager = Thermal_expansion.compute_model(test_data_manager, nodes, thermal_parameter, 1, 1.0, 1.0) + # test_data_manager = PeriLab.Solver_control.Model_Factory.Thermal.Thermal_expansion.compute_model(test_data_manager, nodes, thermal_parameter, 1, 1.0, 1.0) # for iID in nodes # for jID in nn[iID] @@ -107,7 +104,7 @@ using .Thermal_expansion # temperature_NP1[2] = -23 # thermal_parameter = Dict("Thermal Expansion Coefficient" => [-1.1,2.1], "Reference Temperature" => 0.0) - # test_data_manager = Thermal_expansion.compute_model(test_data_manager, nodes, thermal_parameter, 1, 1.0, 1.0) + # test_data_manager = PeriLab.Solver_control.Model_Factory.Thermal.Thermal_expansion.compute_model(test_data_manager, nodes, thermal_parameter, 1, 1.0, 1.0) # for iID in nodes # for jID in nn[iID] diff --git a/test/unit_tests/Models/Thermal/ut_Thermal_flow.jl b/test/unit_tests/Models/Thermal/ut_Thermal_flow.jl index fe538ea1e..271655bff 100644 --- a/test/unit_tests/Models/Thermal/ut_Thermal_flow.jl +++ b/test/unit_tests/Models/Thermal/ut_Thermal_flow.jl @@ -4,35 +4,33 @@ using Test -include("../../../../src/Models/Thermal/thermal_flow.jl") -using .Thermal_Flow #include("../../../../src/PeriLab.jl") #using .PeriLab -@test Thermal_Flow.thermal_model_name() == "Thermal Flow" +@test PeriLab.Solver_control.Model_Factory.Thermal.Thermal_Flow.thermal_model_name() == "Thermal Flow" @testset "ut_init_model" begin test_data_manager = PeriLab.Data_manager - @test isnothing(Thermal_Flow.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Thermal.Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), Dict("a" => 1, "Thermal Conductivity" => 100))) - @test isnothing(Thermal_Flow.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Thermal.Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), Dict("Type" => "a", "Thermal Conductivity" => 100))) - @test Thermal_Flow.init_model(test_data_manager, + @test PeriLab.Solver_control.Model_Factory.Thermal.Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), Dict("Type" => "Bond based", "Thermal Conductivity" => 100)) == test_data_manager - @test Thermal_Flow.init_model(test_data_manager, + @test PeriLab.Solver_control.Model_Factory.Thermal.Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), Dict("Type" => "Correspondence", "Thermal Conductivity" => 100)) == test_data_manager - @test isnothing(Thermal_Flow.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Thermal.Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), Dict("Type" => "Bond based"))) - @test isnothing(Thermal_Flow.init_model(test_data_manager, + @test isnothing(PeriLab.Solver_control.Model_Factory.Thermal.Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), Dict("Type" => "Correspondence"))) parameter = Dict("Type" => "Correspondence", @@ -51,13 +49,13 @@ using .Thermal_Flow coordinates[3, 3] = 1 test_data_manager.set_dof(3) - @test Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), parameter) == + @test PeriLab.Solver_control.Model_Factory.Thermal.Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), parameter) == test_data_manager @test haskey(parameter, "Print Bed Temperature") test_data_manager.set_dof(2) - @test Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), parameter) == + @test PeriLab.Solver_control.Model_Factory.Thermal.Thermal_Flow.init_model(test_data_manager, Vector{Int64}(1:3), parameter) == test_data_manager @test !haskey(parameter, "Print Bed Temperature") diff --git a/test/unit_tests/Models/ut_Model_Factory.jl b/test/unit_tests/Models/ut_Model_Factory.jl index 89d52d258..65296bc78 100644 --- a/test/unit_tests/Models/ut_Model_Factory.jl +++ b/test/unit_tests/Models/ut_Model_Factory.jl @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: BSD-3-Clause -include("../../../src/Models/Model_Factory.jl") #include("../../../src/PeriLab.jl") #using .PeriLab using Test @@ -35,7 +34,7 @@ using Test "Additive Models" => Dict("add" => Dict("value" => "ad", "bool" => false)))) - Model_Factory.get_block_model_definition(params, + PeriLab.Solver_control.Model_Factory.get_block_model_definition(params, block_list, block_id_list, prop_keys, @@ -90,7 +89,7 @@ end "Thermal Models" => Dict("therm" => Dict("value" => "hot", "bool" => true, "name" => "t3")))) - Model_Factory.read_properties(params, test_data_manager_read_properties, false) + PeriLab.Solver_control.Model_Factory.read_properties(params, test_data_manager_read_properties, false) @test isnothing(test_data_manager_read_properties.get_property(1, "Material Model", "value")) @@ -101,7 +100,7 @@ end @test test_data_manager_read_properties.get_property(3, "Thermal Model", "bool") == params["Models"]["Thermal Models"]["therm"]["bool"] - Model_Factory.read_properties(params, test_data_manager_read_properties, true) + PeriLab.Solver_control.Model_Factory.read_properties(params, test_data_manager_read_properties, true) @test test_data_manager_read_properties.get_property(1, "Material Model", "value") == params["Models"]["Material Models"]["a"]["value"] @test test_data_manager_read_properties.get_property(2, "Material Model", "value") == @@ -121,5 +120,5 @@ end @testset "ut_add_model" begin test_data_manager = PeriLab.Data_manager test_data_manager.initialize_data() - @test isnothing(Model_Factory.add_model(test_data_manager, "Test")) + @test isnothing(PeriLab.Solver_control.Model_Factory.add_model(test_data_manager, "Test")) end diff --git a/test/unit_tests/Support/Parameters/ut_parameter_handling.jl b/test/unit_tests/Support/Parameters/ut_parameter_handling.jl index fde2d4f10..896cd8438 100644 --- a/test/unit_tests/Support/Parameters/ut_parameter_handling.jl +++ b/test/unit_tests/Support/Parameters/ut_parameter_handling.jl @@ -10,67 +10,67 @@ using DataFrames # include("../../../../src/PeriLab.jl") # using .PeriLab @testset "ut_get_element_degree" begin - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_element_degree(Dict())) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_element_degree(Dict("Degree" => "ABC"))) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_element_degree(Dict("Degree" => "1"))) - @test PeriLab.Solver_control.Parameter_Handling.get_element_degree(Dict("Degree" => 1)) == + @test isnothing(PeriLab.Parameter_Handling.get_element_degree(Dict())) + @test isnothing(PeriLab.Parameter_Handling.get_element_degree(Dict("Degree" => "ABC"))) + @test isnothing(PeriLab.Parameter_Handling.get_element_degree(Dict("Degree" => "1"))) + @test PeriLab.Parameter_Handling.get_element_degree(Dict("Degree" => 1)) == 1 - @test PeriLab.Solver_control.Parameter_Handling.get_element_degree(Dict("Degree" => [ - 1, - 2, - 3 - ])) == [1, 2, 3] - @test PeriLab.Solver_control.Parameter_Handling.get_element_degree(Dict("Degree" => [ - 1, - 2, - 3, - 5 - ])) == + @test PeriLab.Parameter_Handling.get_element_degree(Dict("Degree" => [ + 1, + 2, + 3 + ])) == [1, 2, 3] + @test PeriLab.Parameter_Handling.get_element_degree(Dict("Degree" => [ + 1, + 2, + 3, + 5 + ])) == [1, 2, 3, 5] end @testset "ut_get_element_type" begin - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_element_type(Dict())) - @test PeriLab.Solver_control.Parameter_Handling.get_element_type(Dict("Element Type" => "ABC")) == + @test isnothing(PeriLab.Parameter_Handling.get_element_type(Dict())) + @test PeriLab.Parameter_Handling.get_element_type(Dict("Element Type" => "ABC")) == "ABC" - @test PeriLab.Solver_control.Parameter_Handling.get_element_type(Dict("Element Type" => 12)) == + @test PeriLab.Parameter_Handling.get_element_type(Dict("Element Type" => 12)) == "12" end @testset "ut_get_output_type" begin - @test PeriLab.Solver_control.Parameter_Handling.get_output_type(Dict("Output1" => Dict()), - "Output1") == "Exodus" - @test PeriLab.Solver_control.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "CSV")), - "Output1") == "CSV" - @test PeriLab.Solver_control.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "Exodus"), - "Output2" => Dict("Output File Type" => "CSV")), - "Output1") == "Exodus" - @test PeriLab.Solver_control.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "Exodus"), - "Output2" => Dict("Output File Type" => "CSV")), - "Output2") == "CSV" - @test PeriLab.Solver_control.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "CSV"), - "Output2" => Dict()), - "Output2") == "Exodus" - @test PeriLab.Solver_control.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "Exodus")), - "Output1") == "Exodus" + @test PeriLab.Parameter_Handling.get_output_type(Dict("Output1" => Dict()), + "Output1") == "Exodus" + @test PeriLab.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "CSV")), + "Output1") == "CSV" + @test PeriLab.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "Exodus"), + "Output2" => Dict("Output File Type" => "CSV")), + "Output1") == "Exodus" + @test PeriLab.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "Exodus"), + "Output2" => Dict("Output File Type" => "CSV")), + "Output2") == "CSV" + @test PeriLab.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "CSV"), + "Output2" => Dict()), + "Output2") == "Exodus" + @test PeriLab.Parameter_Handling.get_output_type(Dict("Output1" => Dict("Output File Type" => "Exodus")), + "Output1") == "Exodus" end @testset "ut_get_bond_filters" begin params = Dict("Discretization" => Dict()) - check, bfList = PeriLab.Solver_control.Parameter_Handling.get_bond_filters(params) + check, bfList = PeriLab.Parameter_Handling.get_bond_filters(params) @test !check @test bfList == Dict{String,Dict{String,Any}}() params = Dict("Discretization" => Dict("Bond Filters" => Dict())) - check, bfList = PeriLab.Solver_control.Parameter_Handling.get_bond_filters(params) + check, bfList = PeriLab.Parameter_Handling.get_bond_filters(params) @test check @test bfList == Dict() params = Dict("Discretization" => Dict("Bond Filters" => Dict("a" => Dict("a" => 1)))) - check, bfList = PeriLab.Solver_control.Parameter_Handling.get_bond_filters(params) + check, bfList = PeriLab.Parameter_Handling.get_bond_filters(params) @test check @test bfList == Dict("a" => Dict("a" => 1)) params = Dict("Discretization" => Dict("Bond Filters" => Dict("a" => Dict("a" => 1), "g" => Dict("a" => 1), "adas" => Dict("a" => 1)))) - check, bfList = PeriLab.Solver_control.Parameter_Handling.get_bond_filters(params) + check, bfList = PeriLab.Parameter_Handling.get_bond_filters(params) @test check @test bfList == Dict("a" => Dict("a" => 1), "g" => Dict("a" => 1), "adas" => Dict("a" => 1)) @@ -80,33 +80,33 @@ end params = Dict{Any,Any}() @info "Error messages are tested and therefore okay." - @test isnothing(PeriLab.Solver_control.Parameter_Handling.validate_yaml(params)) + @test isnothing(PeriLab.Parameter_Handling.validate_yaml(params)) params = Dict{Any,Any}("PeriLab" => Dict{Any,Any}("Models" => Dict{Any,Any}())) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.validate_yaml(params)) + @test isnothing(PeriLab.Parameter_Handling.validate_yaml(params)) params = Dict{Any,Any}("PeriLab" => Dict{Any,Any}("Models" => Dict{Any,Any}("Material Models" => Dict{Any, Any}()), "Discretization" => Dict{Any,Any}())) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.validate_yaml(params)) + @test isnothing(PeriLab.Parameter_Handling.validate_yaml(params)) params = Dict{Any,Any}("PeriLab" => Dict{Any,Any}("Models" => Dict{Any,Any}("Material Models" => Dict{Any, Any}()), "Discretization" => Dict{Any,Any}(), "Blocks" => Dict{Any,Any}())) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.validate_yaml(params)) + @test isnothing(PeriLab.Parameter_Handling.validate_yaml(params)) params = Dict{Any,Any}("PeriLab" => Dict{Any,Any}("Models" => Dict{Any,Any}("Material Models" => Dict{Any, Any}()), "Blocks" => Dict{Any,Any}())) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.validate_yaml(params)) + @test isnothing(PeriLab.Parameter_Handling.validate_yaml(params)) params = Dict{Any,Any}("PeriLab" => Dict{Any,Any}("Models" => Dict{Any,Any}(), "Discretization" => Dict{Any,Any}(), "Blocks" => Dict{Any,Any}(), "Solver" => Dict{Any,Any}())) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.validate_yaml(params)) + @test isnothing(PeriLab.Parameter_Handling.validate_yaml(params)) params = Dict{Any,Any}("PeriLab" => Dict{Any,Any}("Blocks" => Dict{Any,Any}())) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.validate_yaml(params)) + @test isnothing(PeriLab.Parameter_Handling.validate_yaml(params)) params = Dict{Any,Any}("PeriLab" => Dict{Any,Any}("Models" => Dict{Any,Any}("Material Models" => Dict{Any, Any}("mat_1" => Dict{Any, @@ -119,7 +119,7 @@ end "Horizon" => "1.0")), "Solver" => Dict{Any,Any}("Final Time" => 1.0, "Initial Time" => 0.0))) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.validate_yaml(params)) + @test isnothing(PeriLab.Parameter_Handling.validate_yaml(params)) params = Dict{Any,Any}("PeriLab" => Dict{Any,Any}("Models" => Dict{Any,Any}("Material Models" => Dict{Any, Any}("mat_1" => Dict{Any, Any}("Material Model" => "a"))), @@ -132,45 +132,45 @@ end "Horizon" => 1.0)), "Solver" => Dict{Any,Any}("Final Time" => 1.0, "Initial Time" => 0.0))) - @test PeriLab.Solver_control.Parameter_Handling.validate_yaml(params) == + @test PeriLab.Parameter_Handling.validate_yaml(params) == params["PeriLab"] end @testset "ut_get_external_topology_name" begin params = Dict("Discretization" => Dict()) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_external_topology_name(params, - "")) + @test isnothing(PeriLab.Parameter_Handling.get_external_topology_name(params, + "")) params = Dict("Discretization" => Dict("Input External Topology" => Dict())) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_external_topology_name(params, - "")) + @test isnothing(PeriLab.Parameter_Handling.get_external_topology_name(params, + "")) name = randstring(12) params = Dict("Discretization" => Dict("Input External Topology" => Dict("File" => name))) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_external_topology_name(params, - "")) + @test isnothing(PeriLab.Parameter_Handling.get_external_topology_name(params, + "")) end @testset "ut_get_mesh_name" begin params = Dict("Discretization" => Dict()) - @test PeriLab.Solver_control.Parameter_Handling.get_mesh_name(params) === nothing + @test PeriLab.Parameter_Handling.get_mesh_name(params) === nothing name = randstring(12) params = Dict("Discretization" => Dict("Input Mesh File" => name)) - @test PeriLab.Solver_control.Parameter_Handling.get_mesh_name(params) == name + @test PeriLab.Parameter_Handling.get_mesh_name(params) == name end @testset "ut_get_output_filenames" begin params = Dict() - filenames = PeriLab.Solver_control.Parameter_Handling.get_output_filenames(params, "") + filenames = PeriLab.Parameter_Handling.get_output_filenames(params, "") @test filenames == [] params = Dict("Outputs" => Dict("Output1" => Dict("Output Filename" => "1"), "Output2" => Dict("Output Filename" => "2"))) - filenames = PeriLab.Solver_control.Parameter_Handling.get_output_filenames(params, "") + filenames = PeriLab.Parameter_Handling.get_output_filenames(params, "") @test filenames[1] == "1.e" @test filenames[2] == "2.e" params = Dict("Outputs" => Dict("Output1" => Dict("Output Filename" => "3", "Output File Type" => "CSV"), "Output2" => Dict("Output Filename" => "4", "Output File Type" => "Exodus"))) - filenames = PeriLab.Solver_control.Parameter_Handling.get_output_filenames(params, - "test") + filenames = PeriLab.Parameter_Handling.get_output_filenames(params, + "test") @test filenames[1] == "test/3.csv" @test filenames[2] == "test/4.e" end @@ -181,10 +181,10 @@ end variables = ["DisplacementsNP1", "Forces"] computes = ["External_Displacements"] output_type = "Exodus" - fieldnames = PeriLab.Solver_control.Parameter_Handling.get_output_fieldnames(outputs, - variables, - computes, - output_type) + fieldnames = PeriLab.Parameter_Handling.get_output_fieldnames(outputs, + variables, + computes, + output_type) @test fieldnames == [ ["Displacements", "NP1"], ["External_Displacements", "Constant"], @@ -192,24 +192,24 @@ end ] outputs = Dict("Displacements" => "true") - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_output_fieldnames(outputs, - variables, - computes, - output_type)) + @test isnothing(PeriLab.Parameter_Handling.get_output_fieldnames(outputs, + variables, + computes, + output_type)) outputs = Dict("External_Displacements" => true) output_type = "CSV" - fieldnames = PeriLab.Solver_control.Parameter_Handling.get_output_fieldnames(outputs, - variables, - computes, - output_type) + fieldnames = PeriLab.Parameter_Handling.get_output_fieldnames(outputs, + variables, + computes, + output_type) @test fieldnames == [["External_Displacements", "Constant"]] outputs = Dict("External_Forces" => true) - fieldnames = PeriLab.Solver_control.Parameter_Handling.get_output_fieldnames(outputs, - variables, - computes, - output_type) + fieldnames = PeriLab.Parameter_Handling.get_output_fieldnames(outputs, + variables, + computes, + output_type) @test fieldnames == [] end @@ -219,23 +219,23 @@ end params = Dict("Outputs" => Dict("Output1" => Dict("Output Frequency" => 2), "Output2" => Dict("Number of Output Steps" => 1, "Output Frequency" => 1))) - freq = PeriLab.Solver_control.Parameter_Handling.get_output_frequency(params, nsteps) + freq = PeriLab.Parameter_Handling.get_output_frequency(params, nsteps) @test freq[1] == 2 @test freq[2] == 40 params = Dict("Outputs" => Dict("Output1" => Dict("Output Frequency" => 20), "Output2" => Dict("Number of Output Steps" => 10))) - freq = PeriLab.Solver_control.Parameter_Handling.get_output_frequency(params, nsteps) + freq = PeriLab.Parameter_Handling.get_output_frequency(params, nsteps) @test freq[1] == 20 @test freq[2] == 4 nsteps = 1000 - freq = PeriLab.Solver_control.Parameter_Handling.get_output_frequency(params, nsteps) + freq = PeriLab.Parameter_Handling.get_output_frequency(params, nsteps) @test freq[1] == 20 @test freq[2] == 100 nsteps = 2 - freq = PeriLab.Solver_control.Parameter_Handling.get_output_frequency(params, nsteps) + freq = PeriLab.Parameter_Handling.get_output_frequency(params, nsteps) @test freq[1] == 2 @test freq[2] == 1 @@ -244,7 +244,7 @@ end "Output2" => Dict("Number of Output Steps" => 10, "Output Frequency" => 20))) nsteps = 1000 - freq = PeriLab.Solver_control.Parameter_Handling.get_output_frequency(params, nsteps) + freq = PeriLab.Parameter_Handling.get_output_frequency(params, nsteps) @test (freq[1] == 100) || (freq[1] == 20) @test (freq[2] == 100) || (freq[2] == 20) end @@ -273,9 +273,9 @@ test_data_manager = PeriLab.Data_manager "M" => true)))) vector::Vector{String} = [] - outputs = PeriLab.Solver_control.Parameter_Handling.get_outputs(params, - testfield_keys, - vector) + outputs = PeriLab.Parameter_Handling.get_outputs(params, + testfield_keys, + vector) @test ["A", "Constant"] in outputs["Output1"]["fieldnames"] @test (["B", "NP1"] in outputs["Output1"]["fieldnames"]) == false @@ -296,9 +296,9 @@ test_data_manager = PeriLab.Data_manager "D" => false, "E" => true, "M" => true)))) - outputs = PeriLab.Solver_control.Parameter_Handling.get_outputs(params, - testfield_keys, - String["M"]) + outputs = PeriLab.Parameter_Handling.get_outputs(params, + testfield_keys, + String["M"]) @test !(["A", "Constant"] in outputs["Output1"]["fieldnames"]) @test !(["B", "NP1"] in outputs["Output1"]["fieldnames"]) @test !(["C", "Constant"] in outputs["Output1"]["fieldnames"]) @@ -310,28 +310,28 @@ test_data_manager = PeriLab.Data_manager "Output File Type" => "CSV", "Output Variables" => Dict("M" => true, "A" => true)))) - outputs = PeriLab.Solver_control.Parameter_Handling.get_outputs(params, - testfield_keys, - String["M"]) + outputs = PeriLab.Parameter_Handling.get_outputs(params, + testfield_keys, + String["M"]) @test !(["A", "Constant"] in outputs["Output1"]["fieldnames"]) @test ["M", "Constant"] in outputs["Output1"]["fieldnames"] params = Dict("Outputs" => Dict("Output1" => Dict("fieldnames" => [], "Output Variables" => Dict()))) - outputs = PeriLab.Solver_control.Parameter_Handling.get_outputs(params, - testfield_keys, - String[]) + outputs = PeriLab.Parameter_Handling.get_outputs(params, + testfield_keys, + String[]) @test outputs["Output1"]["fieldnames"] == [] params = Dict("Outputs" => Dict("Output1" => Dict("fieldnames" => []))) - outputs = PeriLab.Solver_control.Parameter_Handling.get_outputs(params, - testfield_keys, - String[]) + outputs = PeriLab.Parameter_Handling.get_outputs(params, + testfield_keys, + String[]) @test outputs["Output1"]["fieldnames"] == [] end @testset "ut_get_computes" begin params = Dict() testfield_keys = test_data_manager.get_all_field_keys() - @test PeriLab.Solver_control.Parameter_Handling.get_computes(params, testfield_keys) == + @test PeriLab.Parameter_Handling.get_computes(params, testfield_keys) == Dict() params = Dict("Compute Class Parameters" => Dict("External_Forces" => Dict("Compute Class" => "Block_Data", @@ -346,8 +346,8 @@ end "Calculation Type" => "Maximum", "Block" => "block_1"))) - computes = PeriLab.Solver_control.Parameter_Handling.get_computes(params, - testfield_keys) + computes = PeriLab.Parameter_Handling.get_computes(params, + testfield_keys) @test haskey(computes, "External_Forces") @test haskey(computes, "External_Displacements") @@ -367,37 +367,37 @@ end "Block" => "block_1", "Variable" => "B"))) - computes_names = PeriLab.Solver_control.Parameter_Handling.get_computes_names(params) + computes_names = PeriLab.Parameter_Handling.get_computes_names(params) @test "External_Forces" in computes_names @test "External_Displacements" in computes_names end @testset "ut_get_output_variables" begin - @test PeriLab.Solver_control.Parameter_Handling.get_output_variables("Forces", - [ - "Forces", - "DisplacementsNP1" - ]) == "Forces" - @test PeriLab.Solver_control.Parameter_Handling.get_output_variables("Displacements", - [ - "Forces", - "DisplacementsNP1" - ]) == + @test PeriLab.Parameter_Handling.get_output_variables("Forces", + [ + "Forces", + "DisplacementsNP1" + ]) == "Forces" + @test PeriLab.Parameter_Handling.get_output_variables("Displacements", + [ + "Forces", + "DisplacementsNP1" + ]) == "Displacements" - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_output_variables("Stress", - [ - "Forces", - "DisplacementsNP1" - ])) + @test isnothing(PeriLab.Parameter_Handling.get_output_variables("Stress", + [ + "Forces", + "DisplacementsNP1" + ])) end @testset "ut_get_bc_definitions" begin params = Dict() - bcs = PeriLab.Solver_control.Parameter_Handling.get_bc_definitions(params) + bcs = PeriLab.Parameter_Handling.get_bc_definitions(params) @test length(bcs) == 0 params = Dict("Boundary Conditions" => Dict()) - bcs = PeriLab.Solver_control.Parameter_Handling.get_bc_definitions(params) + bcs = PeriLab.Parameter_Handling.get_bc_definitions(params) @test length(bcs) == 0 params = Dict("Boundary Conditions" => Dict("BC_1" => Dict("Variable" => "Forces", "Node Set" => "Nset_1", @@ -407,7 +407,7 @@ end "Node Set" => "Nset_2", "Coordinate" => "y", "Value" => "0"))) - bcs = PeriLab.Solver_control.Parameter_Handling.get_bc_definitions(params) + bcs = PeriLab.Parameter_Handling.get_bc_definitions(params) @test length(bcs) == 2 @test bcs["BC_1"] == Dict("Variable" => "Forces", "Node Set" => "Nset_1", @@ -424,92 +424,92 @@ end "Additive Models" => true, "Thermal Models" => true, "Degradation Models" => true)) - solver_options = PeriLab.Solver_control.Parameter_Handling.get_model_options(params["Solver"]) + solver_options = PeriLab.Parameter_Handling.get_model_options(params["Solver"]) @test solver_options == ["Additive", "Damage", "Pre_Calculation", "Thermal", "Degradation", "Material"] params = Dict("Solver" => Dict()) - solver_options = PeriLab.Solver_control.Parameter_Handling.get_model_options(params["Solver"]) + solver_options = PeriLab.Parameter_Handling.get_model_options(params["Solver"]) @test solver_options == ["Pre_Calculation", "Material"] params = Dict("Solver" => Dict("Material Models" => false, "Damage Models" => true, "Thermal Models" => true)) - solver_options = PeriLab.Solver_control.Parameter_Handling.get_model_options(params["Solver"]) + solver_options = PeriLab.Parameter_Handling.get_model_options(params["Solver"]) @test solver_options == ["Damage", "Pre_Calculation", "Thermal"] end @testset "ut_block_values" begin params = Dict("Blocks" => Dict()) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_horizon(params, 1)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_density(params, 1)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_heat_capacity(params, 1)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling._get_values(params, 1, - "Density")) - @test isnothing(PeriLab.Solver_control.Parameter_Handling._get_values(params, 1, - "not there")) + @test isnothing(PeriLab.Parameter_Handling.get_horizon(params, 1)) + @test isnothing(PeriLab.Parameter_Handling.get_density(params, 1)) + @test isnothing(PeriLab.Parameter_Handling.get_heat_capacity(params, 1)) + @test isnothing(PeriLab.Parameter_Handling._get_values(params, 1, + "Density")) + @test isnothing(PeriLab.Parameter_Handling._get_values(params, 1, + "not there")) params = Dict("Blocks" => Dict("block_1" => Dict("Block ID" => 1), "block_2" => Dict("Block ID" => 2))) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_horizon(params, 1)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_density(params, 1)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_heat_capacity(params, 1)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling._get_values(params, 1, - "Density")) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_horizon(params, 2)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_density(params, 2)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_heat_capacity(params, 2)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling._get_values(params, 2, - "Density")) + @test isnothing(PeriLab.Parameter_Handling.get_horizon(params, 1)) + @test isnothing(PeriLab.Parameter_Handling.get_density(params, 1)) + @test isnothing(PeriLab.Parameter_Handling.get_heat_capacity(params, 1)) + @test isnothing(PeriLab.Parameter_Handling._get_values(params, 1, + "Density")) + @test isnothing(PeriLab.Parameter_Handling.get_horizon(params, 2)) + @test isnothing(PeriLab.Parameter_Handling.get_density(params, 2)) + @test isnothing(PeriLab.Parameter_Handling.get_heat_capacity(params, 2)) + @test isnothing(PeriLab.Parameter_Handling._get_values(params, 2, + "Density")) params = Dict("Blocks" => Dict("block_1" => Dict("Block ID" => 1, "Density" => 1, "Specific Heat Capacity" => 3), "block_2" => Dict("Block ID" => 2, "Density" => 12.3, "Horizon" => 2))) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, 1, "Density") == 1 - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, 2, "Density") == + @test PeriLab.Parameter_Handling._get_values(params, 1, "Density") == 1 + @test PeriLab.Parameter_Handling._get_values(params, 2, "Density") == 12.3 - @test isnothing(PeriLab.Solver_control.Parameter_Handling._get_values(params, 3, - "Density")) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, - 1, - "Specific Heat Capacity") == + @test isnothing(PeriLab.Parameter_Handling._get_values(params, 3, + "Density")) + @test PeriLab.Parameter_Handling._get_values(params, + 1, + "Specific Heat Capacity") == 3 - @test isnothing(PeriLab.Solver_control.Parameter_Handling._get_values(params, - 2, - "Specific Heat Capacity")) - @test isnothing(PeriLab.Solver_control.Parameter_Handling._get_values(params, - 3, - "Specific Heat Capacity")) - @test isnothing(PeriLab.Solver_control.Parameter_Handling._get_values(params, 1, - "Horizon")) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, 2, "Horizon") == 2 - @test isnothing(PeriLab.Solver_control.Parameter_Handling._get_values(params, 3, - "Horizon")) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, 1, "Density") == - PeriLab.Solver_control.Parameter_Handling.get_density(params, 1) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, 2, "Density") == - PeriLab.Solver_control.Parameter_Handling.get_density(params, 2) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, 3, "Density") == - PeriLab.Solver_control.Parameter_Handling.get_density(params, 3) - - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, 1, "Horizon") == - PeriLab.Solver_control.Parameter_Handling.get_horizon(params, 1) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, 2, "Horizon") == - PeriLab.Solver_control.Parameter_Handling.get_horizon(params, 2) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, 3, "Horizon") == - PeriLab.Solver_control.Parameter_Handling.get_horizon(params, 3) - - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, - 1, - "Specific Heat Capacity") == - PeriLab.Solver_control.Parameter_Handling.get_heat_capacity(params, 1) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, - 2, - "Specific Heat Capacity") == - PeriLab.Solver_control.Parameter_Handling.get_heat_capacity(params, 2) - @test PeriLab.Solver_control.Parameter_Handling._get_values(params, - 3, - "Specific Heat Capacity") == - PeriLab.Solver_control.Parameter_Handling.get_heat_capacity(params, 3) + @test isnothing(PeriLab.Parameter_Handling._get_values(params, + 2, + "Specific Heat Capacity")) + @test isnothing(PeriLab.Parameter_Handling._get_values(params, + 3, + "Specific Heat Capacity")) + @test isnothing(PeriLab.Parameter_Handling._get_values(params, 1, + "Horizon")) + @test PeriLab.Parameter_Handling._get_values(params, 2, "Horizon") == 2 + @test isnothing(PeriLab.Parameter_Handling._get_values(params, 3, + "Horizon")) + @test PeriLab.Parameter_Handling._get_values(params, 1, "Density") == + PeriLab.Parameter_Handling.get_density(params, 1) + @test PeriLab.Parameter_Handling._get_values(params, 2, "Density") == + PeriLab.Parameter_Handling.get_density(params, 2) + @test PeriLab.Parameter_Handling._get_values(params, 3, "Density") == + PeriLab.Parameter_Handling.get_density(params, 3) + + @test PeriLab.Parameter_Handling._get_values(params, 1, "Horizon") == + PeriLab.Parameter_Handling.get_horizon(params, 1) + @test PeriLab.Parameter_Handling._get_values(params, 2, "Horizon") == + PeriLab.Parameter_Handling.get_horizon(params, 2) + @test PeriLab.Parameter_Handling._get_values(params, 3, "Horizon") == + PeriLab.Parameter_Handling.get_horizon(params, 3) + + @test PeriLab.Parameter_Handling._get_values(params, + 1, + "Specific Heat Capacity") == + PeriLab.Parameter_Handling.get_heat_capacity(params, 1) + @test PeriLab.Parameter_Handling._get_values(params, + 2, + "Specific Heat Capacity") == + PeriLab.Parameter_Handling.get_heat_capacity(params, 2) + @test PeriLab.Parameter_Handling._get_values(params, + 3, + "Specific Heat Capacity") == + PeriLab.Parameter_Handling.get_heat_capacity(params, 3) end @testset "ut_solver" begin @@ -519,46 +519,46 @@ end "Verlet" => Dict("Safety Factor" => 0.95, "Numerical Damping" => 5e-6, "Fixed dt" => 1e-3))) - @test PeriLab.Solver_control.Parameter_Handling.get_solver_name(params["Solver"]) == + @test PeriLab.Parameter_Handling.get_solver_name(params["Solver"]) == "Verlet" - @test PeriLab.Solver_control.Parameter_Handling.get_final_time(params["Solver"], - test_data_manager) == + @test PeriLab.Parameter_Handling.get_final_time(params["Solver"], + test_data_manager) == params["Solver"]["Final Time"] - @test PeriLab.Solver_control.Parameter_Handling.get_initial_time(params["Solver"], - test_data_manager) == + @test PeriLab.Parameter_Handling.get_initial_time(params["Solver"], + test_data_manager) == params["Solver"]["Initial Time"] - @test PeriLab.Solver_control.Parameter_Handling.get_safety_factor(params["Solver"]) == + @test PeriLab.Parameter_Handling.get_safety_factor(params["Solver"]) == params["Solver"]["Verlet"]["Safety Factor"] - @test PeriLab.Solver_control.Parameter_Handling.get_fixed_dt(params["Solver"]) == + @test PeriLab.Parameter_Handling.get_fixed_dt(params["Solver"]) == params["Solver"]["Verlet"]["Fixed dt"] - @test PeriLab.Solver_control.Parameter_Handling.get_numerical_damping(params["Solver"]) == + @test PeriLab.Parameter_Handling.get_numerical_damping(params["Solver"]) == params["Solver"]["Verlet"]["Numerical Damping"] params = Dict("Solver" => Dict("Verlet" => Dict())) - @test PeriLab.Solver_control.Parameter_Handling.get_safety_factor(params["Solver"]) == 1 - @test PeriLab.Solver_control.Parameter_Handling.get_fixed_dt(params["Solver"]) == -1.0 - @test PeriLab.Solver_control.Parameter_Handling.get_nsteps(params["Solver"]) == 1 - @test PeriLab.Solver_control.Parameter_Handling.get_nsteps(Dict("Verlet" => Dict("Safety Factor" => 0.95, - "Numerical Damping" => 5e-6), - "Number of Steps" => 6)) == + @test PeriLab.Parameter_Handling.get_safety_factor(params["Solver"]) == 1 + @test PeriLab.Parameter_Handling.get_fixed_dt(params["Solver"]) == -1.0 + @test PeriLab.Parameter_Handling.get_nsteps(params["Solver"]) == 1 + @test PeriLab.Parameter_Handling.get_nsteps(Dict("Verlet" => Dict("Safety Factor" => 0.95, + "Numerical Damping" => 5e-6), + "Number of Steps" => 6)) == 6 - @test PeriLab.Solver_control.Parameter_Handling.get_numerical_damping(params["Solver"]) == + @test PeriLab.Parameter_Handling.get_numerical_damping(params["Solver"]) == 0.0 - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_initial_time(Dict("Solver" => Dict()), - test_data_manager)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_final_time(Dict("Solver" => Dict()), - test_data_manager)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_final_time(Dict("Solver" => Dict()), - test_data_manager)) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_solver_name(Dict("Solver" => Dict("Solvername" => Dict())))) + @test isnothing(PeriLab.Parameter_Handling.get_initial_time(Dict("Solver" => Dict()), + test_data_manager)) + @test isnothing(PeriLab.Parameter_Handling.get_final_time(Dict("Solver" => Dict()), + test_data_manager)) + @test isnothing(PeriLab.Parameter_Handling.get_final_time(Dict("Solver" => Dict()), + test_data_manager)) + @test isnothing(PeriLab.Parameter_Handling.get_solver_name(Dict("Solver" => Dict("Solvername" => Dict())))) params = Dict("Solver" => Dict("Initial Time" => 0.0, "Final Time" => 1.0, "Static" => Dict("Residual tolerance" => 1e-3))) - @test PeriLab.Solver_control.Parameter_Handling.get_solver_name(params["Solver"]) == + @test PeriLab.Parameter_Handling.get_solver_name(params["Solver"]) == "Static" params = Dict("Solver" => Dict("Initial Time" => 1.0)) test_data_manager.set_current_time(2.0) - @test PeriLab.Solver_control.Parameter_Handling.get_initial_time(params["Solver"], - test_data_manager) == + @test PeriLab.Parameter_Handling.get_initial_time(params["Solver"], + test_data_manager) == 2.0 end @@ -584,33 +584,33 @@ params = Dict("Models" => Dict("Material Models" => Dict("A" => Dict("s" => 0, "block_2" => Dict("Material Model" => "B"))) @testset "ut_find_data_files" begin - @test PeriLab.Solver_control.Parameter_Handling.find_data_files(params["Models"]["Material Models"]["A"]) == + @test PeriLab.Parameter_Handling.find_data_files(params["Models"]["Material Models"]["A"]) == ["B", "A", ["C", "Sub"]] - @test PeriLab.Solver_control.Parameter_Handling.find_data_files(params["Models"]["Material Models"]["B"]) == + @test PeriLab.Parameter_Handling.find_data_files(params["Models"]["Material Models"]["B"]) == ["Young's_Modulus"] - @test PeriLab.Solver_control.Parameter_Handling.find_data_files(params["Models"]["Damage Models"]["E"]) == + @test PeriLab.Parameter_Handling.find_data_files(params["Models"]["Damage Models"]["E"]) == [] end @testset "ut_get_model_parameter" begin block_models = Dict{Int32,Dict{String,String}}() testData = Dict("Material Model" => Dict(), "Damage Model" => Dict()) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_model_parameter(params, - "Does not exist Model", - "A")) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_model_parameter(params, - "Does not exist Model", - "s")) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.get_model_parameter(params, - "Material Model", - "s")) - testData["Material Model"] = PeriLab.Solver_control.Parameter_Handling.get_model_parameter(params, - "Material Model", - "A") + @test isnothing(PeriLab.Parameter_Handling.get_model_parameter(params, + "Does not exist Model", + "A")) + @test isnothing(PeriLab.Parameter_Handling.get_model_parameter(params, + "Does not exist Model", + "s")) + @test isnothing(PeriLab.Parameter_Handling.get_model_parameter(params, + "Material Model", + "s")) + testData["Material Model"] = PeriLab.Parameter_Handling.get_model_parameter(params, + "Material Model", + "A") @test testData["Material Model"]["s"] == 0 @test testData["Material Model"]["d"] == true - testData["Material Model"] = PeriLab.Solver_control.Parameter_Handling.get_model_parameter(params, - "Material Model", - "B") + testData["Material Model"] = PeriLab.Parameter_Handling.get_model_parameter(params, + "Material Model", + "B") @test testData["Material Model"]["sa"] == [3.2, 2, 3] @test testData["Material Model"]["d"] == "true" test_dict = testData["Material Model"]["Young's_Modulus"] @@ -619,21 +619,21 @@ end @test test_dict["Data"]["min"] == -2.5 @test typeof(test_dict["Data"]["spl"]) == Dierckx.Spline1D - testData["Damage Model"] = PeriLab.Solver_control.Parameter_Handling.get_model_parameter(params, - "Damage Model", - "E") + testData["Damage Model"] = PeriLab.Parameter_Handling.get_model_parameter(params, + "Damage Model", + "E") @test testData["Damage Model"]["ss"] == 0 @test testData["Damage Model"]["d"] == 1.1 end @testset "ut_check_for_duplicates" begin - @test !(PeriLab.Solver_control.Parameter_Handling.check_for_duplicates(["a", "b", "c"])) - @test isnothing(PeriLab.Solver_control.Parameter_Handling.check_for_duplicates([ - "a", - "b", - "c", - "a" - ])) + @test !(PeriLab.Parameter_Handling.check_for_duplicates(["a", "b", "c"])) + @test isnothing(PeriLab.Parameter_Handling.check_for_duplicates([ + "a", + "b", + "c", + "a" + ])) end @testset "ut_validate_structure_recursive" begin @@ -661,10 +661,10 @@ end validate = true checked_keys = [] validate, - checked_keys = PeriLab.Solver_control.Parameter_Handling.validate_structure_recursive(expected_structure, - params, - validate, - checked_keys) + checked_keys = PeriLab.Parameter_Handling.validate_structure_recursive(expected_structure, + params, + validate, + checked_keys) @test validate @test checked_keys == ["PeriLab", "Blocks", "Material Model", "Density", "Any"] @@ -672,19 +672,19 @@ end Any}("Density" => "Test", "Material Model" => "Test")))) validate, - checked_keys = PeriLab.Solver_control.Parameter_Handling.validate_structure_recursive(expected_structure, - params, - validate, - checked_keys) + checked_keys = PeriLab.Parameter_Handling.validate_structure_recursive(expected_structure, + params, + validate, + checked_keys) @test !validate params = Dict("PeriLab" => Dict{Any,Any}("Blocks" => Dict{Any,Any}("Any" => Dict{Any, Any}("Material Model" => "Test")))) validate, - checked_keys = PeriLab.Solver_control.Parameter_Handling.validate_structure_recursive(expected_structure, - params, - validate, - checked_keys) + checked_keys = PeriLab.Parameter_Handling.validate_structure_recursive(expected_structure, + params, + validate, + checked_keys) @test !validate end @testset "ut_node_sets" begin @@ -693,9 +693,9 @@ end lenNumbers = length(numbers) params = Dict("Discretization" => Dict()) - @test PeriLab.Solver_control.Parameter_Handling.get_node_sets(params, - "", - DataFrame(x = [])) == + @test PeriLab.Parameter_Handling.get_node_sets(params, + "", + DataFrame(x = [])) == Dict{String,Any}() params = Dict("Discretization" => Dict("Node Sets" => Dict("Nset_1" => "1 2 3 4 5 6 7", "Nset_2" => filename))) @@ -707,9 +707,9 @@ end end close(file) - nsets = PeriLab.Solver_control.Parameter_Handling.get_node_sets(params, - "", - DataFrame(x = [])) + nsets = PeriLab.Parameter_Handling.get_node_sets(params, + "", + DataFrame(x = [])) @test "Nset_1" in keys(nsets) @test "Nset_2" in keys(nsets) @test length(nsets["Nset_1"]) == 7 @@ -723,9 +723,9 @@ end params = Dict("Discretization" => Dict("Node Sets" => Dict("Nset_1" => "1:7", "Nset_2" => filename))) - nsets = PeriLab.Solver_control.Parameter_Handling.get_node_sets(params, - "", - DataFrame(x = [])) + nsets = PeriLab.Parameter_Handling.get_node_sets(params, + "", + DataFrame(x = [])) @test length(nsets["Nset_1"]) == 7 for i in 1:7 @test nsets["Nset_1"][i] == i @@ -737,18 +737,18 @@ end file = open(filename, "w") println(file, "header: global_id") close(file) - nsets = PeriLab.Solver_control.Parameter_Handling.get_node_sets(params, - "", - DataFrame(x = [])) + nsets = PeriLab.Parameter_Handling.get_node_sets(params, + "", + DataFrame(x = [])) @test haskey(nsets, "Nset_1") @test !haskey(nsets, "Nset_2") rm(filename) filename = "test.txt" file = open(filename, "w") close(file) - nsets = PeriLab.Solver_control.Parameter_Handling.get_node_sets(params, - "", - DataFrame(x = [])) + nsets = PeriLab.Parameter_Handling.get_node_sets(params, + "", + DataFrame(x = [])) @test haskey(nsets, "Nset_1") @test !haskey(nsets, "Nset_2") rm(filename) @@ -758,9 +758,9 @@ end "Input Mesh File" => filename, "Node Sets" => Dict("Nset_1" => "1 2 3 4 5 6 7", "Nset_2" => filename))) - nsets = PeriLab.Solver_control.Parameter_Handling.get_node_sets(params, - "unit_tests/Support/Parameters", - DataFrame(x = [])) + nsets = PeriLab.Parameter_Handling.get_node_sets(params, + "unit_tests/Support/Parameters", + DataFrame(x = [])) @test "Set-1" in keys(nsets) @test "Set-2" in keys(nsets) @test "Set-3" in keys(nsets) diff --git a/test/unit_tests/Support/ut_geometry.jl b/test/unit_tests/Support/ut_geometry.jl index 4c60f3757..2ff64a1b4 100644 --- a/test/unit_tests/Support/ut_geometry.jl +++ b/test/unit_tests/Support/ut_geometry.jl @@ -20,16 +20,16 @@ using Test deformation_gradient[1, :, :] = [1 0; 0 1] deformation_gradient[2, :, :] = [1 0; 0 1] - @test PeriLab.IO.Geometry.compute_bond_level_deformation_gradient(nodes, - nlist, - dof, - bond_geometry, - bond_length, - bond_deformation, - deformation_gradient, - ba_deformation_gradient)[1][1, - :, - :] == + @test PeriLab.Geometry.compute_bond_level_deformation_gradient(nodes, + nlist, + dof, + bond_geometry, + bond_length, + bond_deformation, + deformation_gradient, + ba_deformation_gradient)[1][1, + :, + :] == [1 0; 0 1] end @@ -43,12 +43,12 @@ end ba_rotation_tensor = [zeros(Float64, 1, dof, dof) for _ in 1:dof] - @test PeriLab.IO.Geometry.compute_bond_level_rotation_tensor(nodes, - nlist, - ba_deformation_gradient, - ba_rotation_tensor)[1][1, - :, - :] == + @test PeriLab.Geometry.compute_bond_level_rotation_tensor(nodes, + nlist, + ba_deformation_gradient, + ba_rotation_tensor)[1][1, + :, + :] == [1 0; 0 1] end @@ -60,9 +60,9 @@ end rot_tensor = zeros(Float64, 2, dof, dof) deformation_gradient[:, 1, 1] .= 1 deformation_gradient[:, 2, 2] .= 1 - rot_tensor = PeriLab.IO.Geometry.deformation_gradient_decomposition(nodes, - deformation_gradient, - rot_tensor) + rot_tensor = PeriLab.Geometry.deformation_gradient_decomposition(nodes, + deformation_gradient, + rot_tensor) @test rot_tensor == deformation_gradient @@ -74,9 +74,9 @@ end deformation_gradient[1, :, :] = rot * deformation_gradient[1, :, :] deformation_gradient[2, :, :] = rot * deformation_gradient[2, :, :] - rot_tensor = PeriLab.IO.Geometry.deformation_gradient_decomposition(nodes, - deformation_gradient, - rot_tensor) + rot_tensor = PeriLab.Geometry.deformation_gradient_decomposition(nodes, + deformation_gradient, + rot_tensor) @test rot_tensor[1, :, :] == rot @test rot_tensor[1, :, :] == rot @@ -112,11 +112,11 @@ end coor[4, 1] = 0 coor[4, 2] = 1 - PeriLab.IO.Geometry.calculate_bond_length!(undeformed_bond[1], - undeformed_bond_length[1], - 1, - coor, - nlist[1]) + PeriLab.Geometry.calculate_bond_length!(undeformed_bond[1], + undeformed_bond_length[1], + 1, + coor, + nlist[1]) @test undeformed_bond[1][1][1] == 0.5 @test undeformed_bond[1][1][2] == 0.5 @@ -125,11 +125,11 @@ end @test undeformed_bond[1][2][2] == 0 @test undeformed_bond_length[1][2] == 1 - PeriLab.IO.Geometry.bond_geometry!(undeformed_bond, - undeformed_bond_length, - Vector(1:nnodes), - nlist, - coor) + PeriLab.Geometry.bond_geometry!(undeformed_bond, + undeformed_bond_length, + Vector(1:nnodes), + nlist, + coor) @test undeformed_bond[1][1][1] == 0.5 @test undeformed_bond[1][1][2] == 0.5 @@ -155,11 +155,11 @@ end @test undeformed_bond[4][1][1] == 0.5 @test undeformed_bond[4][1][2] == -0.5 @test undeformed_bond_length[4][1] / sqrt(1.25) - 1 < 1e-8 - PeriLab.IO.Geometry.bond_geometry!(undeformed_bond, - undeformed_bond_length, - Vector(1:nnodes), - nlist, - coor) + PeriLab.Geometry.bond_geometry!(undeformed_bond, + undeformed_bond_length, + Vector(1:nnodes), + nlist, + coor) # test if a sum exists or not @test undeformed_bond[1][1][1] == 0.5 @test undeformed_bond[1][1][2] == 0.5 @@ -193,11 +193,11 @@ end end end - PeriLab.IO.Geometry.bond_geometry!(undeformed_bond, - undeformed_bond_length, - Vector(1:nnodes), - nlist, - coor) + PeriLab.Geometry.bond_geometry!(undeformed_bond, + undeformed_bond_length, + Vector(1:nnodes), + nlist, + coor) end @testset "ut_compute_left_stretch_tensor" begin @@ -207,9 +207,9 @@ end expected_result = [[1.0 0.0; 0.0 1.0], [0.5 0.5; 0.5 0.5]] left_stretch_tensor = zeros(Float64, 2, 2, 2) result = zeros(2, 2, 2) - result = PeriLab.IO.Geometry.compute_left_stretch_tensor(deformation_gradient[1, :, :]) + result = PeriLab.Geometry.compute_left_stretch_tensor(deformation_gradient[1, :, :]) @test result[:, :] == expected_result[1] - result = PeriLab.IO.Geometry.compute_left_stretch_tensor(deformation_gradient[2, :, :]) + result = PeriLab.Geometry.compute_left_stretch_tensor(deformation_gradient[2, :, :]) @test isapprox(result[:, :], expected_result[2]) alpha = 22 * pi / 180 rot = zeros(2, 2) @@ -218,9 +218,9 @@ end # compute_left_stretch_tensor should "filter" the rotation deformation_gradient[1, :, :] = deformation_gradient[1, :, :] * rot deformation_gradient[2, :, :] = deformation_gradient[2, :, :] * rot - result = PeriLab.IO.Geometry.compute_left_stretch_tensor(deformation_gradient[1, :, :]) + result = PeriLab.Geometry.compute_left_stretch_tensor(deformation_gradient[1, :, :]) @test result == expected_result[1] - result = PeriLab.IO.Geometry.compute_left_stretch_tensor(deformation_gradient[2, :, :]) + result = PeriLab.Geometry.compute_left_stretch_tensor(deformation_gradient[2, :, :]) @test isapprox(result[:, :], expected_result[2]) end @testset "ut_shape_tensor_and_deformation_gradient" begin @@ -274,32 +274,32 @@ end coor[4, 1] = 1 coor[4, 2] = 0.5 - PeriLab.IO.Geometry.bond_geometry!(undeformed_bond, - undeformed_bond_length, - Vector(1:nnodes), - nlist, - coor) - PeriLab.IO.Geometry.compute_shape_tensors!(shape_tensor, - inverse_shape_tensor, - nodes, - nlist, - volume, - omega, - bond_damage, - undeformed_bond) + PeriLab.Geometry.bond_geometry!(undeformed_bond, + undeformed_bond_length, + Vector(1:nnodes), + nlist, + coor) + PeriLab.Geometry.compute_shape_tensors!(shape_tensor, + inverse_shape_tensor, + nodes, + nlist, + volume, + omega, + bond_damage, + undeformed_bond) deformed_coor = copy(coor) - PeriLab.IO.Geometry.compute_deformation_gradients!(deformation_gradient, - nodes, - dof, - nlist, - volume, - omega, - bond_damage, - deformed_bond, - undeformed_bond, - inverse_shape_tensor) + PeriLab.Geometry.compute_deformation_gradients!(deformation_gradient, + nodes, + dof, + nlist, + volume, + omega, + bond_damage, + deformed_bond, + undeformed_bond, + inverse_shape_tensor) for i in 1:nnodes @test deformation_gradient[i, 1, 1] - 1 < 1e-7 @test deformation_gradient[i, 1, 2] < 1e-7 @@ -311,21 +311,21 @@ end deformed_coor[2, 1] = 0.25 deformed_coor[4, 1] = 0.25 - PeriLab.IO.Geometry.bond_geometry!(deformed_bond, - deformed_bond_length, - Vector(1:nnodes), - nlist, - deformed_coor) - PeriLab.IO.Geometry.compute_deformation_gradients!(deformation_gradient, - nodes, - dof, - nlist, - volume, - omega, - bond_damage, - deformed_bond, - undeformed_bond, - inverse_shape_tensor) + PeriLab.Geometry.bond_geometry!(deformed_bond, + deformed_bond_length, + Vector(1:nnodes), + nlist, + deformed_coor) + PeriLab.Geometry.compute_deformation_gradients!(deformation_gradient, + nodes, + dof, + nlist, + volume, + omega, + bond_damage, + deformed_bond, + undeformed_bond, + inverse_shape_tensor) for i in 1:nnodes for j in 1:nn[i] @@ -341,21 +341,21 @@ end deformed_coor[3, 2] = 1.5 deformed_coor[4, 2] = 1.5 - PeriLab.IO.Geometry.bond_geometry!(deformed_bond, - deformed_bond_length, - Vector(1:nnodes), - nlist, - deformed_coor) - PeriLab.IO.Geometry.compute_deformation_gradients!(deformation_gradient, - nodes, - dof, - nlist, - volume, - omega, - bond_damage, - deformed_bond, - undeformed_bond, - inverse_shape_tensor) + PeriLab.Geometry.bond_geometry!(deformed_bond, + deformed_bond_length, + Vector(1:nnodes), + nlist, + deformed_coor) + PeriLab.Geometry.compute_deformation_gradients!(deformation_gradient, + nodes, + dof, + nlist, + volume, + omega, + bond_damage, + deformed_bond, + undeformed_bond, + inverse_shape_tensor) for i in 1:nnodes for j in nn[i] test_vector = deformation_gradient[i, :, :] * undeformed_bond[i][j] - @@ -375,21 +375,21 @@ end deformed_coor[4, 1] = 1.5 deformed_coor[4, 2] = 0.5 - PeriLab.IO.Geometry.bond_geometry!(deformed_bond, - deformed_bond_length, - Vector(1:nnodes), - nlist, - deformed_coor) - PeriLab.IO.Geometry.compute_deformation_gradients!(deformation_gradient, - nodes, - dof, - nlist, - volume, - omega, - bond_damage, - deformed_bond, - undeformed_bond, - inverse_shape_tensor) + PeriLab.Geometry.bond_geometry!(deformed_bond, + deformed_bond_length, + Vector(1:nnodes), + nlist, + deformed_coor) + PeriLab.Geometry.compute_deformation_gradients!(deformation_gradient, + nodes, + dof, + nlist, + volume, + omega, + bond_damage, + deformed_bond, + undeformed_bond, + inverse_shape_tensor) for i in 1:nnodes for j in nn[i] test_vector = deformation_gradient[i, :, :] * undeformed_bond[i][j] - @@ -426,17 +426,17 @@ end Float64, dof, VectorOrMatrix = "Matrix") - PeriLab.IO.Geometry.compute_deformation_gradients!(deformation_gradient, - nodes, - dof, - nlist, - volume, - omega, - bond_damage, - undeformed_bond, - undeformed_bond, - inverse_shape_tensor) - PeriLab.IO.Geometry.compute_strain(nodes, deformation_gradient, strain) + PeriLab.Geometry.compute_deformation_gradients!(deformation_gradient, + nodes, + dof, + nlist, + volume, + omega, + bond_damage, + undeformed_bond, + undeformed_bond, + inverse_shape_tensor) + PeriLab.Geometry.compute_strain(nodes, deformation_gradient, strain) for i in 1:nnodes @test strain[i, 1, 1] == 0 @@ -458,9 +458,9 @@ end deformation_gradient_3D[1, 3, 3] = 3.0 strain_3D = test_data_manager.create_constant_node_field("Strain_3D", Float64, 3, VectorOrMatrix = "Matrix") - PeriLab.IO.Geometry.compute_strain(view(nodes, eachindex(nodes)), - deformation_gradient_3D, - strain_3D) + PeriLab.Geometry.compute_strain(view(nodes, eachindex(nodes)), + deformation_gradient_3D, + strain_3D) identity = zeros(3, 3) identity[1, 1] = 1 identity[2, 2] = 1 @@ -475,12 +475,12 @@ end end end @testset "ut_rotation_tensor" begin - rot = PeriLab.IO.Geometry.rotation_tensor(fill(Float64(0), (1)), 2) + rot = PeriLab.Geometry.rotation_tensor(fill(Float64(0), (1)), 2) @test rot[1, 1] == 1 @test rot[1, 2] == 0 @test rot[2, 1] == 0 @test rot[2, 2] == 1 - rot = PeriLab.IO.Geometry.rotation_tensor(fill(Float64(0), (3)), 3) + rot = PeriLab.Geometry.rotation_tensor(fill(Float64(0), (3)), 3) @test rot[1, 1] == 1 @test rot[1, 2] == 0 @test rot[1, 3] == 0 @@ -490,13 +490,13 @@ end @test rot[3, 1] == 0 @test rot[3, 2] == 0 @test rot[3, 3] == 1 - rot = PeriLab.IO.Geometry.rotation_tensor(fill(Float64(90), (1)), 2) + rot = PeriLab.Geometry.rotation_tensor(fill(Float64(90), (1)), 2) @test rot[1, 1] < 1e-10 @test rot[1, 2] == -1 @test rot[2, 1] == 1 @test rot[2, 2] < 1e-10 - @test isnothing(PeriLab.IO.Geometry.rotation_tensor(fill(Float64(90), (1)), 3)) - @test isnothing(PeriLab.IO.Geometry.rotation_tensor(fill(Float64(0), (3)), 2)) + @test isnothing(PeriLab.Geometry.rotation_tensor(fill(Float64(90), (1)), 3)) + @test isnothing(PeriLab.Geometry.rotation_tensor(fill(Float64(0), (3)), 2)) end @testset "ut_compute_weighted_deformation_gradient" begin @@ -508,12 +508,12 @@ end displacement = [0.0 0.0 0.0; 1.0 1.0 1.0] deformation_gradient = zeros(Float64, length(nnodes), dof, dof) - PeriLab.IO.Geometry.compute_weighted_deformation_gradient(nnodes, - nlist, - volume, - gradient_weight, - displacement, - deformation_gradient) + PeriLab.Geometry.compute_weighted_deformation_gradient(nnodes, + nlist, + volume, + gradient_weight, + displacement, + deformation_gradient) @test deformation_gradient[1, :, :] == [1.1 0.1 0.1; 0.1 1.1 0.1; 0.1 0.1 1.1] @test deformation_gradient[2, :, :] == diff --git a/test/unit_tests/Support/ut_helpers.jl b/test/unit_tests/Support/ut_helpers.jl index 888e77ec0..3936cfc84 100644 --- a/test/unit_tests/Support/ut_helpers.jl +++ b/test/unit_tests/Support/ut_helpers.jl @@ -117,7 +117,7 @@ end @testset "rotate_second_order_tensor" begin angles = [0] - rot = PeriLab.IO.Geometry.rotation_tensor(angles, 2) + rot = PeriLab.Geometry.rotation_tensor(angles, 2) tensor = zeros(2, 2) tensor[1, 1] = 1 dof = 2 @@ -127,7 +127,7 @@ end back) @test tensorTest == tensor angles = [90.0] - rot = PeriLab.IO.Geometry.rotation_tensor(angles, 2) + rot = PeriLab.Geometry.rotation_tensor(angles, 2) tensorTest = PeriLab.Solver_control.Helpers.rotate_second_order_tensor(Matrix{Float64}(rot), tensor, back) @@ -143,7 +143,7 @@ end @test tensorTest == tensor angles = [0, 0, 0] - rot = PeriLab.IO.Geometry.rotation_tensor(angles, 3) + rot = PeriLab.Geometry.rotation_tensor(angles, 3) tensor = zeros(3, 3) tensor[1, 1] = 1 dof = 3 @@ -154,7 +154,7 @@ end back) @test tensorTest == tensor angles = [0, 0, 90.0] - rot = PeriLab.IO.Geometry.rotation_tensor(angles, 3) + rot = PeriLab.Geometry.rotation_tensor(angles, 3) tensorTest = PeriLab.Solver_control.Helpers.rotate_second_order_tensor(Matrix{Float64}(rot), tensor, back) @@ -175,7 +175,7 @@ end @test tensorTest == tensor angles = [10, 20, 90.0] - rot = PeriLab.IO.Geometry.rotation_tensor(angles, 3) + rot = PeriLab.Geometry.rotation_tensor(angles, 3) tensorTest = PeriLab.Solver_control.Helpers.rotate_second_order_tensor(Matrix{Float64}(rot), tensor, true) @@ -460,3 +460,24 @@ end @test isnothing(PeriLab.Solver_control.Helpers.is_dependent("Value", params, test_data_manager)) end + +@testset "ut_matrix_to_voigt" begin + matrix = Matrix{Float64}([1 2; 3 4]) + voigt = PeriLab.Solver_control.Helpers.matrix_to_voigt(matrix) + @test voigt[1] == 1 + @test voigt[2] == 4 + @test voigt[3] == 2.5 + matrix = Matrix{Float64}([1 2 3; 4 5 6; 7 8 9]) + voigt = PeriLab.Solver_control.Helpers.matrix_to_voigt(matrix) + @test voigt[1] == 1 + @test voigt[2] == 5 + @test voigt[3] == 9 + @test voigt[4] == 7 + @test voigt[5] == 5 + @test voigt[6] == 3 + matrix = Matrix{Float64}([1 2 3 3; 4 5 6 3; 7 8 9 3]) + @test isnothing(PeriLab.Solver_control.Helpers.matrix_to_voigt(matrix)) +end +@testset "ut_voigt_to_matrix" begin + @test isnothing(PeriLab.Solver_control.Helpers.voigt_to_matrix([1, 2.2])) +end