Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/PeriHub/PeriLab.jl into main
Browse files Browse the repository at this point in the history
  • Loading branch information
CWillberg committed Mar 24, 2024
2 parents e9232bf + 2c31031 commit 99c74b7
Show file tree
Hide file tree
Showing 32 changed files with 488 additions and 466 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ jobs:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Edit the following line to reflect the actual name of the GitHub Secret containing your private key
ssh: ${{ secrets.DOCUMENTER_KEY }}
# ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}
ssh: ${{ secrets.SSH_KEY }}
DockerHub:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions src/IO/IO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ using Reexport
@reexport using .Parameter_Handling
export initialize_data
export init_write_results
export get_results_mapping
export init_orientations
export write_results
export merge_exodus_files
export show_block_summary
Expand Down
6 changes: 4 additions & 2 deletions src/Support/data_manager.jl
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,13 @@ Returns a list of all field keys.
"""
function clear_data_manager()
global field_types
global nsets
global nnsets
global physics_options

field_types = Dict()
nsets = Dict()
nnsets = 0
physics_options = Dict("Deformed Bond Geometry" => true,
"Deformation Gradient" => false,
"Shape Tensor" => false,
Expand All @@ -391,13 +395,11 @@ function clear_data_manager()
# global properties
# global fields
# global model_modules
# global nsets
# field_array_type = Dict()
# fields_to_synch = Dict()
# properties = Dict()
# fields = Dict()
# model_modules = Dict()
# nsets = Dict()
end

"""
Expand Down
7 changes: 4 additions & 3 deletions test/unit_tests/Compute/ut_compute_field_values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# SPDX-License-Identifier: BSD-3-Clause

using Test
include("../../../src/Support/data_manager.jl")
# include("../../../src/Support/data_manager.jl")
include("../../../src/Compute/compute_field_values.jl")
@testset "ut_get_forces_from_force_density" begin
test_Data_manager = Data_manager
test_Data_manager = PeriLab.Data_manager
test_Data_manager.clear_data_manager()
test_Data_manager.set_num_controller(5)

test_Data_manager.create_node_field("Forces", Float64, 3)
Expand All @@ -27,7 +28,7 @@ include("../../../src/Compute/compute_field_values.jl")
end

@testset "ut_get_partial_stresses" begin
test_Data_manager = Data_manager
test_Data_manager = PeriLab.Data_manager
test_Data_manager.set_dof(3)
test_Data_manager.set_num_controller(5)
nn = test_Data_manager.create_constant_node_field("Number of Neighbors", Int64, 1)
Expand Down
12 changes: 6 additions & 6 deletions test/unit_tests/Compute/ut_compute_global_values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# SPDX-License-Identifier: BSD-3-Clause

using Test
include("../../../src/Support/data_manager.jl")
# include("../../../src/Support/data_manager.jl")
include("../../../src/Compute/compute_global_values.jl")

@testset "ut_global_value_sum" begin
test_Data_manager = Data_manager
test_Data_manager = PeriLab.Data_manager
test_Data_manager.set_num_controller(4)
nodes = Vector{Int64}(1:4)
(forcesN, forcesNP1) = test_Data_manager.create_node_field("Forces", Float64, 3)
Expand Down Expand Up @@ -41,7 +41,7 @@ include("../../../src/Compute/compute_global_values.jl")
end

@testset "ut_global_value_max" begin
test_Data_manager = Data_manager
test_Data_manager = PeriLab.Data_manager
test_Data_manager.set_num_controller(4)
nodes = Vector{Int64}(1:4)
(forcesN, forcesNP1) = test_Data_manager.create_node_field("Forces", Float64, 3)
Expand Down Expand Up @@ -76,7 +76,7 @@ end
end

@testset "ut_global_value_min" begin
test_Data_manager = Data_manager
test_Data_manager = PeriLab.Data_manager
test_Data_manager.set_num_controller(4)
nodes = Vector{Int64}(1:4)
(forcesN, forcesNP1) = test_Data_manager.create_node_field("Forces", Float64, 3)
Expand Down Expand Up @@ -108,7 +108,7 @@ end
@test isnothing(calculate_nodelist(test_Data_manager, "not there", 1, "Minimum", nodes))
end
@testset "ut_global_value_avg" begin
test_Data_manager = Data_manager
test_Data_manager = PeriLab.Data_manager
test_Data_manager.set_num_controller(4)
nodes = Vector{Int64}(1:4)
(forcesN, forcesNP1) = test_Data_manager.create_node_field("Forces", Float64, 3)
Expand Down Expand Up @@ -141,7 +141,7 @@ end
end

@testset "ut_calculate_block" begin
test_Data_manager = Data_manager
test_Data_manager = PeriLab.Data_manager
test_Data_manager.create_constant_node_field("Block_Id", Int64, 1)
@test isnothing(calculate_block(test_Data_manager, "no field", 1, "sum", 1))
@test isnothing(calculate_block(test_Data_manager, "Disp", 1, "no option", 1))
Expand Down
4 changes: 2 additions & 2 deletions test/unit_tests/Core/Module_inclusion/ut_set_Modules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include("../../../../src/Core/Module_inclusion/set_Modules.jl")

using Test
using Random
using .Set_modules
# using .Set_modules

@testset "ut_find_jl_files" begin
Random.seed!(rand(1:100000))
Expand Down Expand Up @@ -47,7 +47,7 @@ using .Set_modules
io = open(folder * "/" * filename4 * ".dat", "w")
close(io)

list = Set_modules.find_jl_files(base)
list = PeriLab.Solver.FEM.Set_modules.find_jl_files(base)
folder * "/" * filename1 * ".jl" in list
@test subfolder1 * "/" * filename2 * ".jl" in list
@test subfolder1 * "/" * filename3 * ".jl" in list
Expand Down
20 changes: 10 additions & 10 deletions test/unit_tests/Core/Solver/ut_Solver_control.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
using Test
using MPI
using TimerOutputs
include("../../../../src/Core/Solver/Solver_control.jl")
include("../../../../src/Support/geometry.jl")
if !isdefined(@__MODULE__, :Data_manager)
include("../../../../src/Support/data_manager.jl")
end
include("../../../../src/Support/Parameters/parameter_handling.jl")
using Reexport
@reexport using .Parameter_Handling
import .Solver
# include("../../../../src/Core/Solver/Solver_control.jl")
# include("../../../../src/Support/geometry.jl")
# if !isdefined(@__MODULE__, :Data_manager)
# include("../../../../src/Support/data_manager.jl")
# end
# include("../../../../src/Support/Parameters/parameter_handling.jl")
# using Reexport
# @reexport using .Parameter_Handling
# import .Solver

@testset "ut_get_block_nodes" begin
block_ids = [1, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 2, 3, 3, 1, 1, 2]
block_nodes = Solver.get_block_nodes(block_ids, length(block_ids))
block_nodes = PeriLab.Solver.get_block_nodes(block_ids, length(block_ids))
@test block_nodes[1] == [1, 2, 3, 10, 11, 15, 16]
@test block_nodes[2] == [4, 5, 12, 17]
@test block_nodes[3] == [6, 7, 8, 9, 13, 14]
Expand Down
52 changes: 26 additions & 26 deletions test/unit_tests/Core/Solver/ut_Verlet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,45 @@
using Test


include("../../../../src/Core/BC_manager.jl")
include("../../../../src/Core/Solver/Verlet.jl")
include("../../../../src/Core/Solver/Solver_control.jl")
include("../../../../src/Support/geometry.jl")
# include("../../../../src/Core/BC_manager.jl")
# include("../../../../src/Core/Solver/Verlet.jl")
# include("../../../../src/Core/Solver/Solver_control.jl")
# include("../../../../src/Support/geometry.jl")

if !isdefined(@__MODULE__, :Data_manager)
include("../../../../src/Support/data_manager.jl")
end
include("../../../../src/Support/Parameters/parameter_handling.jl")
using Reexport
@reexport using .Parameter_Handling
using .Data_manager
using .Geometry
using .Boundary_conditions
using .Solver
using .Verlet
# if !isdefined(@__MODULE__, :Data_manager)
# include("../../../../src/Support/data_manager.jl")
# end
# include("../../../../src/Support/Parameters/parameter_handling.jl")
# using Reexport
# @reexport using .Parameter_Handling
# using .Data_manager
# using .Geometry
# using .Boundary_conditions
# using .Solver
# using .Verlet
using MPI
@testset "ut_test_timestep" begin
@test Verlet.test_timestep(1.0, 2.0) == 1
@test Verlet.test_timestep(2.0, 1.1) == 1.1
@test Verlet.test_timestep(2.0, 2.0) == 2
@test PeriLab.Solver.Verlet.test_timestep(1.0, 2.0) == 1
@test PeriLab.Solver.Verlet.test_timestep(2.0, 1.1) == 1.1
@test PeriLab.Solver.Verlet.test_timestep(2.0, 2.0) == 2
end

@testset "ut_get_integration_steps" begin
@test isnothing(Verlet.get_integration_steps(0.0, 0.0, -1.0))
@test Verlet.get_integration_steps(0.0, 1.0, 1.0) == (1, 1.0)
@test Verlet.get_integration_steps(0.0, 2.0, 1.0) == (2, 1.0)
@test Verlet.get_integration_steps(0.0, 6.0, 2.0) == (3, 2.0)
@test Verlet.get_integration_steps(2.0, 6.0, 2.0) == (2, 2.0)
@test isnothing(PeriLab.Solver.Verlet.get_integration_steps(0.0, 0.0, -1.0))
@test PeriLab.Solver.Verlet.get_integration_steps(0.0, 1.0, 1.0) == (1, 1.0)
@test PeriLab.Solver.Verlet.get_integration_steps(0.0, 2.0, 1.0) == (2, 1.0)
@test PeriLab.Solver.Verlet.get_integration_steps(0.0, 6.0, 2.0) == (3, 2.0)
@test PeriLab.Solver.Verlet.get_integration_steps(2.0, 6.0, 2.0) == (2, 2.0)
end

@testset "ut_get_cs_denominator" begin
volume = Float64[1, 2, 3]
undeformed_bond = [1, 2, 3]
@test Verlet.get_cs_denominator(volume, undeformed_bond) == 3
@test PeriLab.Solver.Verlet.get_cs_denominator(volume, undeformed_bond) == 3
undeformed_bond = [2, 4, 6]
@test Verlet.get_cs_denominator(volume, undeformed_bond) == 1.5
@test PeriLab.Solver.Verlet.get_cs_denominator(volume, undeformed_bond) == 1.5
undeformed_bond = [1, 0.5, 2]
@test Verlet.get_cs_denominator(volume, undeformed_bond) == 6.5
@test PeriLab.Solver.Verlet.get_cs_denominator(volume, undeformed_bond) == 6.5
end

# nnodes = 5
Expand Down
Loading

0 comments on commit 99c74b7

Please sign in to comment.