Skip to content

Commit

Permalink
coupling prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
CWillberg committed Dec 14, 2024
1 parent 8cb6783 commit 5fa9bd0
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 24 deletions.
9 changes: 6 additions & 3 deletions examples/FEM_Bar/FEM_p1_2d_coupled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ PeriLab:
Element Type: "Lagrange"
Degree: 1
Material Model: "Mat_1"
Coupling:
Coupling Type: "Arlequin"
PD Weight: 0.5 # standard is 0.5
Models:
Material Models:
Mat_1:
Expand Down Expand Up @@ -49,16 +52,16 @@ PeriLab:
Type: Dirichlet
Solver:
Initial Time: 0.0
Final Time: 1e-04
Final Time: 2e-04
Verlet:
Safety Factor: 1.00
Numerical Damping: 1e-05
Fixed dt: 5e-9
Fixed dt: 1e-9
Outputs:
Output1:
Output Filename: "FEM_p1_2d_coupled"
Output File Type: Exodus
Output Frequency: 100
Output Frequency: 500
Output Variables:
Cauchy Stress: True
Displacements: True
2 changes: 1 addition & 1 deletion src/FEM/Coupling/Arlequin_coupling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function compute_coupling_matrix(
I = ones(1, 1)
Np = [N1p N2p N3p N4p]

local_coupl_matrix = kappa * [I -Np; -Np' Np'*Np]
local_coupl_matrix = kappa * [I Np; Np' Np'*Np]

return local_coupl_matrix
end
Expand Down
34 changes: 17 additions & 17 deletions src/Models/Model_Factory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,7 @@ function compute_models(
)
fem_option = datamanager.fem_active()
if fem_option
# no damage occur here. Therefore, it runs one time
fe_nodes = datamanager.get_field("FE Nodes")
nelements = datamanager.get_num_elements()
# in future the FE analysis can be put into the block loop. Right now it is outside the block.
@timeit to "FEM eval" datamanager = FEM.eval(
datamanager,
Vector{Int64}(1:nelements),
datamanager.get_properties(1, "FEM"),
time,
dt,
)
end

active_list = datamanager.get_field("Active")
Expand Down Expand Up @@ -284,14 +274,24 @@ function compute_models(
end

if fem_option
@timeit to "FEM" begin
nelements = datamanager.get_num_elements()
active_nodes =
find_active_nodes(fe_nodes, active_nodes, 1:datamanager.get_nnodes(), false)

active_nodes =
find_active_nodes(fe_nodes, active_nodes, 1:datamanager.get_nnodes(), false)
@timeit to "FEM_PD_coupling" datamanager = FEM.Coupling_PD_FEM.compute_coupling(
datamanager,
active_nodes,
datamanager.get_properties(1, "FEM"),
)
@timeit to "eval" datamanager = FEM.eval(
datamanager,
Vector{Int64}(1:nelements),
datamanager.get_properties(1, "FEM"),
time,
dt,
)
@timeit to "coupling" datamanager = FEM.Coupling_PD_FEM.compute_coupling(
datamanager,
active_nodes,
datamanager.get_properties(1, "FEM"),
)
end
end

#=
Expand Down
Binary file modified test/fullscale_tests/test_DCB/Reference/DCBmodel_unified_bb.e
Binary file not shown.
1 change: 1 addition & 0 deletions test/fullscale_tests/test_DCB/test_DCB.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

folder_name = basename(@__FILE__)[1:end-3]
cd("fullscale_tests/" * folder_name) do
run_perilab("DCBmodel_unified_bb", 1, true, folder_name)
run_perilab("DCBmodel_correspondence", 1, true, folder_name)
# run_perilab("DCBmodel_UMAT", 1, true, folder_name)
run_perilab("DCBmodel_PD_solid", 1, true, folder_name)
Expand Down
5 changes: 4 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,11 @@ MPI.Init()
@testset "test_point_wise_material" begin
include("fullscale_tests/test_point_wise_material/test_point_wise_material.jl")
end
@testset "test_FEM_coupling" begin
# include("fullscale_tests/test_FEM_coupling/test_FEM_coupling.jl")
end
@testset "test_FEM" begin
include("fullscale_tests/test_FEM_coupling/test_FEM_coupling.jl")
include("fullscale_tests/test_FEM/test_FEM.jl")
end
end

Expand Down
1 change: 1 addition & 0 deletions test/unit_tests/Compute/ut_compute_field_values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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
Expand Down
12 changes: 10 additions & 2 deletions test/unit_tests/FEM/ut_FEM_routines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
#
# SPDX-License-Identifier: BSD-3-Clause
include("../../../src/FEM/FEM_routines.jl")
include("../../../src/FEM/Element_formulation/lagrange_element.jl")
# 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

Expand Down

0 comments on commit 5fa9bd0

Please sign in to comment.