Skip to content

Commit b9c06a1

Browse files
committed
test fix
1 parent 144728e commit b9c06a1

File tree

12 files changed

+55
-43
lines changed

12 files changed

+55
-43
lines changed

src/Core/Solver/Matrix_linear_static.jl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,15 +415,27 @@ Arguments:
415415
- F_temp: Temporary force vector (pre-allocated)
416416
417417
"""
418-
function compute_displacements!(K::AbstractMatrix{Float64}, # VOLLE K-Matrix
419-
active_dofs::AbstractVector{Int64}, # Aktive DOFs
420-
active_non_BCS::AbstractVector{Int64}, # Non-BC DOFs (lokal indexiert)
418+
function compute_displacements!(K::AbstractMatrix{Float64},
419+
active_dofs::AbstractVector{Int},
420+
active_non_BCS::AbstractVector{Int},
421421
u_active::AbstractMatrix{Float64},
422422
F_int_active::AbstractMatrix{Float64},
423423
F_ext_active::AbstractMatrix{Float64},
424424
solver::DisplacementSolverCache)
425425
isempty(active_non_BCS) && return nothing
426426

427+
# SCHRITT 1: Cache K[active_dofs, active_dofs] if active_dofs changed
428+
if solver.K_active_cached === nothing || solver.last_active_dofs != active_dofs
429+
@timeit "extract K_active" begin
430+
solver.K_active_cached = K[active_dofs, active_dofs]
431+
solver.last_active_dofs = copy(active_dofs)
432+
end
433+
solver.K_free_lu = nothing
434+
end
435+
436+
K_active = solver.K_active_cached
437+
438+
# Step 2: Modify force vector to account for prescribed displacements
427439
u_vec = vec(u_active)
428440
F_int_vec = vec(F_int_active)
429441
F_ext_vec = vec(F_ext_active)
@@ -456,6 +468,7 @@ function compute_displacements!(K::AbstractMatrix{Float64}, # VOLLE K-
456468
solver.F_modified[idx] = F_ext_vec[i] - F_int_vec[i]
457469
end
458470

471+
# Step 3: LU cachen
459472
if solver.K_free_lu === nothing || solver.last_non_BCs != active_non_BCS
460473
@timeit "LU factorization" begin
461474
K_free = K_active[active_non_BCS, active_non_BCS]

src/Models/Thermal/Thermal_Factory.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
module Thermal
66

77
using ....Data_Manager
8+
using TimerOutputs: @timeit
89
using ...Solver_Manager: find_module_files, create_module_specifics
910
global module_list = find_module_files(@__DIR__, "thermal_model_name")
1011
for mod in module_list
@@ -52,7 +53,7 @@ function compute_model(nodes::AbstractVector{Int64},
5253
thermal_models = map(r -> strip(r), thermal_models)
5354
for thermal_model in thermal_models
5455
mod = get_model_module(thermal_model)
55-
mod.compute_model(nodes, model_param, block, time, dt)
56+
@timeit "$thermal_model" mod.compute_model(nodes, model_param, block, time, dt)
5657
end
5758
end
5859

@@ -71,10 +72,10 @@ function init_model(nodes::AbstractVector{Int64},
7172
thermal_models = split(model_param["Thermal Model"], "+")
7273
thermal_models = map(r -> strip(r), thermal_models)
7374
for thermal_model in thermal_models
74-
mod = create_module_specifics(thermal_model,
75-
module_list,
76-
@__MODULE__,
77-
"thermal_model_name")
75+
@timeit "$thermal_model" mod=create_module_specifics(thermal_model,
76+
module_list,
77+
@__MODULE__,
78+
"thermal_model_name")
7879
if isnothing(mod)
7980
@error "No thermal model of name " * thermal_model * " exists."
8081
return nothing

src/Models/Thermal/thermal_expansion.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
module Thermal_Expansion
1010
using LinearAlgebra
1111
using StaticArrays
12-
12+
using TimerOutputs: @timeit
1313
using .....Data_Manager
1414
using ...Pre_Calculation.Deformation_Gradient
1515
export fields_for_local_synchronization

src/Models/Thermal/thermal_flow.jl

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module Thermal_Flow
66
using LinearAlgebra
77
using StaticArrays
8-
8+
using TimerOutputs: @timeit
99
using .....Data_Manager
1010
using .....Helpers: rotate_second_order_tensor
1111
export compute_model
@@ -119,23 +119,22 @@ function compute_model(nodes::AbstractVector{Int64},
119119
if length(lambda) > 1
120120
lambda = lambda[1]
121121
end
122-
heat_flow = compute_heat_flow_state_bond_based(nodes,
123-
dof,
124-
nlist,
125-
lambda,
126-
apply_print_bed,
127-
t_bed,
128-
lambda_bed,
129-
print_bed_z_coord,
130-
coordinates,
131-
bond_damage,
132-
active,
133-
undeformed_bond,
134-
undeformed_bond_length,
135-
horizon,
136-
temperature,
137-
volume,
138-
heat_flow)
122+
@timeit "heat_flow" heat_flow=compute_heat_flow_state_bond_based(nodes,
123+
dof,
124+
nlist,
125+
lambda,
126+
apply_print_bed,
127+
t_bed,
128+
lambda_bed,
129+
print_bed_z_coord,
130+
coordinates,
131+
bond_damage,
132+
active,
133+
undeformed_bond_length,
134+
horizon,
135+
temperature,
136+
volume,
137+
heat_flow)
139138
return
140139

141140
elseif thermal_parameter["Type"] == "Correspondence"
@@ -150,17 +149,17 @@ function compute_model(nodes::AbstractVector{Int64},
150149
lambda_matrix[i, i] = lambda[i]
151150
end
152151
end
153-
heat_flow = compute_heat_flow_state_correspondence(nodes,
154-
dof,
155-
nlist,
156-
lambda_matrix,
157-
rotation_tensor,
158-
bond_damage,
159-
undeformed_bond,
160-
Kinv,
161-
temperature,
162-
volume,
163-
heat_flow)
152+
@timeit "heat_flow_correspondence" heat_flow=compute_heat_flow_state_correspondence(nodes,
153+
dof,
154+
nlist,
155+
lambda_matrix,
156+
rotation_tensor,
157+
bond_damage,
158+
undeformed_bond,
159+
Kinv,
160+
temperature,
161+
volume,
162+
heat_flow)
164163
end
165164
end
166165

@@ -245,7 +244,6 @@ function compute_heat_flow_state_bond_based(nodes::AbstractVector{Int64},
245244
coordinates::Matrix{Float64},
246245
bond_damage::BondScalarState{Float64},
247246
active::Vector{Bool},
248-
undeformed_bond::BondVectorState{Float64},
249247
undeformed_bond_length::BondScalarState{Float64},
250248
horizon::NodeScalarField{Float64},
251249
temperature::NodeScalarField{Float64},
@@ -265,7 +263,8 @@ function compute_heat_flow_state_bond_based(nodes::AbstractVector{Int64},
265263
print_bed_distance = coordinates[iID, 3] - print_bed_z_coord
266264
if print_bed_distance < horizon[iID]
267265
temp_state = t_bed - temperature[iID]
268-
print_bed_volume = (pi*print_bed_distance^2/3)*(3*horizon[iID]-print_bed_distance) #Partial spherical volume below print bed
266+
print_bed_volume = (pi * print_bed_distance^2 / 3) *
267+
(3 * horizon[iID] - print_bed_distance) #Partial spherical volume below print bed
269268
heat_flow[iID] -= lambda_bed * kernel * temp_state * print_bed_volume /
270269
print_bed_distance
271270
end
@@ -277,10 +276,9 @@ function compute_heat_flow_state_bond_based(nodes::AbstractVector{Int64},
277276
temp_state = bond_damage[iID][jID] *
278277
(temperature[neighborID] - temperature[iID])
279278
heat_flow[iID] -= lambda * kernel * temp_state *
280-
volume[neighborID]/undeformed_bond_length[iID][jID]
279+
volume[neighborID] / undeformed_bond_length[iID][jID]
281280
end
282281
end
283-
return heat_flow
284282
end
285283

286284
"""
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)