@@ -460,70 +460,40 @@ end
460460 end
461461end
462462
463- # @testitem "reproducing kernel polynomial reproduction test " begin
464- # using Peridynamics.StaticArrays, Peridynamics.LinearAlgebra
463+ @testitem " Maximum damage switch in the RKCMaterial " begin
464+ using Peridynamics. StaticArrays, Peridynamics. LinearAlgebra
465465
466- # # Test polynomial reproduction property for each kernel
467- # # This tests the fundamental property that reproducing kernels should work
468- # # correctly for basic deformation scenarios
469-
470- # kernels = [:C1, :RK1]#, :RK2, :PD2]
471-
472- # for kernel in kernels
473- # # Test with a simple 1x1x1 box for now (simpler case)
474- # pos, vol = uniform_box(1, 1, 1, 0.4)
475- # body = Body(RKCMaterial(reprkernel=kernel), pos, vol)
476- # material!(body; horizon=1.5, rho=1, E=210e9, nu=0.25, Gc=1.0)
477-
478- # dh = Peridynamics.threads_data_handler(body, VelocityVerlet(steps=1), 1)
479- # chunk = dh.chunks[1]
480- # (; storage) = chunk
481- # (; position, defgrad) = storage
482-
483- # original_pos = copy(position)
484-
485- # # Test 1: Identity deformation (should yield identity deformation gradient)
486- # Peridynamics.calc_force_density!(dh, 0.0, 0.0)
487-
488- # # Check that we get approximately identity matrices for most points
489- # identity_successful = 0
490- # I_matrix = SMatrix{3,3}([1.0 0.0 0.0; 0.0 1.0 0.0; 0.0 0.0 1.0])
491- # for i in axes(position, 2)
492- # F = Peridynamics.get_tensor(defgrad, i)
493- # # For kernels that work well, this should be very close to identity
494- # if norm(F - I_matrix) < 0.2 # Allow some tolerance for all kernels
495- # identity_successful += 1
496- # end
497- # end
498-
499- # # All kernels should at least get identity approximately right for most points
500- # @test identity_successful >= div(length(vol), 2)
501-
502- # # Test 2: Simple uniform scaling (isotropic deformation)
503- # # This should be exactly representable by any reproducing kernel
504- # scale_factor = 1.1
505- # scale_F = SMatrix{3,3}([scale_factor 0.0 0.0; 0.0 scale_factor 0.0; 0.0 0.0 scale_factor])
506-
507- # for i in axes(position, 2)
508- # position[:, i] = scale_factor * original_pos[:, i]
509- # end
510-
511- # Peridynamics.calc_force_density!(dh, 0.0, 0.0)
512-
513- # # Check uniform scaling reproduction
514- # scaling_successful = 0
515- # for i in axes(position, 2)
516- # F = Peridynamics.get_tensor(defgrad, i)
517- # # Uniform scaling should be captured well by all kernels
518- # if norm(F - scale_F) < 0.3 # Allow more tolerance for all kernels
519- # scaling_successful += 1
520- # end
521- # end
522-
523- # # At least some points should reproduce uniform scaling reasonably well
524- # @test scaling_successful >= div(length(vol), 4)
525-
526- # # Reset positions for next kernel test
527- # position .= original_pos
528- # end
529- # end
466+ pos, vol = uniform_box (1 , 1 , 1 , 0.25 )
467+ body = Body (RKCMaterial (maxdmg = 0.5 ), pos, vol)
468+ material! (body; horizon= 1.5 , rho= 1 , E= 210e9 , nu= 0.25 , Gc= 1.0 )
469+ velocity_ic! (p -> 0.1 * p[1 ], body, :all_points , :x )
470+
471+ ts = VelocityVerlet (steps= 1 )
472+ dh = Peridynamics. threads_data_handler (body, ts, 1 )
473+ Peridynamics. init_time_solver! (ts, dh)
474+ Peridynamics. calc_force_density! (dh, 0.0 , ts. Δt)
475+
476+ chunk = dh. chunks[1 ]
477+ (; storage, system, paramsetup, mat) = chunk
478+ params = paramsetup
479+ (; b_int, damage) = storage
480+ point_id = 1
481+
482+ b0 = Peridynamics. get_vector (b_int, point_id)
483+ @test norm (b0) > 0
484+
485+ # -- next step --
486+ b_int .= 0.0
487+ Peridynamics. force_density_point! (storage, system, mat, params, 0.0 , ts. Δt, point_id)
488+ b1 = Peridynamics. get_vector (b_int, point_id)
489+ @test norm (b0) > 0
490+
491+ # -- next step --
492+ b_int .= 0.0
493+ # somehow the damage field changed and is now higher than the maxdmg value
494+ damage[point_id] = 0.8
495+ Peridynamics. force_density_point! (storage, system, mat, params, 0.0 , ts. Δt, point_id)
496+ # now the force density should be zero and the point excluded from the calculations
497+ b1 = Peridynamics. get_vector (b_int, point_id)
498+ @test norm (b1) ≈ 0 atol= eps ()
499+ end
0 commit comments