@@ -195,12 +195,10 @@ function SolidMechanics(params::Parameters)
195
195
end
196
196
strain_energy = 0.0
197
197
stiffness = spzeros (0 , 0 )
198
- diag_stiffness = Float64[]
199
198
mass = spzeros (0 , 0 )
200
199
lumped_mass = Float64[]
201
200
body_force = Float64[]
202
201
compute_stiffness = true
203
- compute_diag_stiffness = true
204
202
compute_mass = true
205
203
compute_lumped_mass = true
206
204
mesh_smoothing = get (params, " mesh smoothing" , false )
@@ -223,14 +221,12 @@ function SolidMechanics(params::Parameters)
223
221
stored_energy,
224
222
strain_energy,
225
223
stiffness,
226
- diag_stiffness,
227
224
mass,
228
225
lumped_mass,
229
226
body_force,
230
227
free_dofs,
231
228
time,
232
229
compute_stiffness,
233
- compute_diag_stiffness,
234
230
compute_mass,
235
231
compute_lumped_mass,
236
232
failed,
@@ -534,14 +530,6 @@ function add_internal_force!(Fi::MVector{M,T}, grad_op::SMatrix{9,M,T}, stress::
534
530
@einsum Fi[i] += grad_op[j, i] * stress[j] * dV
535
531
end
536
532
537
- function add_diag_stiff! (K:: MVector{M,T} , grad_op:: SMatrix{9,M,T} , C:: SMatrix{9,9,T} , dV:: T ) where {M,T}
538
- @inbounds for i in 1 : M
539
- g = grad_op[:, i]
540
- K[i] += dV * dot (g, C * g)
541
- end
542
- return nothing
543
- end
544
-
545
533
function add_lumped_mass! (M:: MVector{R,T} , Nξ:: SVector{N,T} , density:: T , dV:: T ) where {R,N,T}
546
534
@assert R == 3 N
547
535
s = sum (Nξ)
@@ -565,11 +553,9 @@ function compute_flags(model::SolidMechanics, integrator::TimeIntegrator, solver
565
553
is_implicit = is_implicit_dynamic || is_implicit_static
566
554
is_hessian_opt = solver isa HessianMinimizer
567
555
is_matrix_free = solver isa SteepestDescent
568
- need_diag_stiffness = is_implicit && is_matrix_free
569
556
need_lumped_mass = is_explicit_dynamic || (is_implicit_dynamic && is_matrix_free)
570
557
need_stiffness = is_implicit && is_hessian_opt
571
558
need_mass = is_dynamic && is_hessian_opt
572
- compute_diag_stiffness = need_diag_stiffness && model. compute_diag_stiffness
573
559
compute_lumped_mass = need_lumped_mass && model. compute_lumped_mass
574
560
compute_stiffness = need_stiffness && model. compute_stiffness
575
561
compute_mass = need_mass && model. compute_mass
@@ -580,11 +566,9 @@ function compute_flags(model::SolidMechanics, integrator::TimeIntegrator, solver
580
566
is_implicit,
581
567
is_hessian_opt,
582
568
is_matrix_free,
583
- need_diag_stiffness,
584
569
need_lumped_mass,
585
570
need_stiffness,
586
571
need_mass,
587
- compute_diag_stiffness,
588
572
compute_lumped_mass,
589
573
compute_stiffness,
590
574
compute_mass,
@@ -598,11 +582,6 @@ function create_threadlocal_arrays(model::SolidMechanics, flags::EvaluationFlags
598
582
energy = zeros (nthreads ())
599
583
internal_force = create_threadlocal_coo_vectors (num_dofs)
600
584
601
- diag_stiffness = create_threadlocal_coo_vectors (flags. compute_diag_stiffness ? num_dofs : 0 )
602
- if flags. compute_diag_stiffness && model. kinematics == Infinitesimal
603
- model. compute_diag_stiffness = false
604
- end
605
-
606
585
lumped_mass = create_threadlocal_coo_vectors (flags. compute_lumped_mass ? num_dofs : 0 )
607
586
if flags. compute_lumped_mass
608
587
model. compute_lumped_mass = false
@@ -623,19 +602,18 @@ function create_threadlocal_arrays(model::SolidMechanics, flags::EvaluationFlags
623
602
if flags. compute_mass
624
603
model. compute_mass = false
625
604
end
626
- return SMThreadLocalArrays (energy, internal_force, diag_stiffness, lumped_mass, stiffness, mass)
605
+ return SMThreadLocalArrays (energy, internal_force, lumped_mass, stiffness, mass)
627
606
end
628
607
629
608
function create_element_threadlocal_arrays (num_element_nodes:: Int64 , flags:: EvaluationFlags )
630
609
valN = Val (num_element_nodes)
631
610
energy = zeros (nthreads ())
632
611
dofs = create_threadlocal_element_vectors (Int64, valN)
633
612
internal_force = create_threadlocal_element_vectors (Float64, valN)
634
- diag_stiffness = create_threadlocal_element_vectors (Float64, flags. compute_diag_stiffness ? valN : Val (0 ))
635
613
lumped_mass = create_threadlocal_element_vectors (Float64, flags. compute_lumped_mass ? valN : Val (0 ))
636
614
stiffness = create_threadlocal_element_matrices (Float64, flags. compute_stiffness ? valN : Val (0 ))
637
615
mass = create_threadlocal_element_matrices (Float64, flags. compute_mass ? valN : Val (0 ))
638
- return SMElementThreadLocalArrays (energy, dofs, internal_force, diag_stiffness, lumped_mass, stiffness, mass)
616
+ return SMElementThreadLocalArrays (energy, dofs, internal_force, lumped_mass, stiffness, mass)
639
617
end
640
618
641
619
function reset_element_threadlocal_arrays! (
@@ -651,9 +629,6 @@ function reset_element_threadlocal_arrays!(
651
629
element_arrays_tl. dofs[t] = reshape (3 .* node_indices' .- [2 , 1 , 0 ], :)
652
630
element_arrays_tl. energy[t] = 0.0
653
631
fill! (element_arrays_tl. internal_force[t], 0.0 )
654
- if flags. compute_diag_stiffness == true
655
- fill! (element_arrays_tl. diag_stiffness[t], 0.0 )
656
- end
657
632
if flags. compute_lumped_mass == true
658
633
fill! (element_arrays_tl. lumped_mass[t], 0.0 )
659
634
end
@@ -682,10 +657,6 @@ function compute_element_threadlocal_arrays!(
682
657
stress = SVector {9,Float64} (P)
683
658
element_arrays_tl. energy[t] += W * dvol
684
659
add_internal_force! (element_arrays_tl. internal_force[t], grad_op, stress, dvol)
685
- if flags. compute_diag_stiffness == true
686
- moduli = second_from_fourth (AA)
687
- add_diag_stiff! (element_arrays_tl. diag_stiffness[t], grad_op, moduli, dvol)
688
- end
689
660
if flags. compute_lumped_mass == true
690
661
add_lumped_mass! (element_arrays_tl. lumped_mass[t], Np, density, dvol)
691
662
end
@@ -709,9 +680,6 @@ function assemble_element_threadlocal_arrays!(
709
680
t = threadid ()
710
681
arrays_tl. energy[t] += element_arrays_tl. energy[t]
711
682
assemble! (arrays_tl. internal_force[t], element_arrays_tl. internal_force[t], element_arrays_tl. dofs[t])
712
- if flags. compute_diag_stiffness == true
713
- assemble! (arrays_tl. diag_stiffness[t], element_arrays_tl. diag_stiffness[t], element_arrays_tl. dofs[t])
714
- end
715
683
if flags. compute_lumped_mass == true
716
684
assemble! (arrays_tl. lumped_mass[t], element_arrays_tl. lumped_mass[t], element_arrays_tl. dofs[t])
717
685
end
@@ -729,9 +697,6 @@ function merge_threadlocal_arrays(
729
697
)
730
698
model. strain_energy = sum (arrays_tl. energy)
731
699
model. internal_force = merge_threadlocal_coo_vectors (arrays_tl. internal_force, num_dofs)
732
- if flags. compute_diag_stiffness == true
733
- model. diag_stiffness = merge_threadlocal_coo_vectors (arrays_tl. diag_stiffness, num_dofs)
734
- end
735
700
if flags. compute_lumped_mass == true
736
701
model. lumped_mass = merge_threadlocal_coo_vectors (arrays_tl. lumped_mass, num_dofs)
737
702
end
@@ -787,7 +752,6 @@ function evaluate(model::SolidMechanics, integrator::TimeIntegrator, solver::Sol
787
752
J = det (F)
788
753
if J ≤ 0.0 || isfinite (J) == false
789
754
model. failed = true
790
- model. compute_stiffness = model. compute_diag_stiffness = true
791
755
model. compute_mass = model. compute_lumped_mass = true
792
756
norma_log (0 , :error , " Non-positive Jacobian detected! This may indicate element distortion." )
793
757
norma_logf (4 , :warning , " det(F) = %.3e" , J)
0 commit comments