warp icon indicating copy to clipboard operation
warp copied to clipboard

[BUG] Spring instability in XBPD integrator

Open CliffieVanR opened this issue 10 months ago • 0 comments

Bug Description

I've noticed that a trivial cloth simulation in XPBD with no constraints operating other than springs can explode for realistic cloth densities (around 0.15kgm-2). I've enclosed a modified version of your cloth example where I've switched the integrator to XPBD, disabled the ground, the fixed edge constraint, the bending constraint, and the bunny, for the sake of simplicity. Higher time steps and/or lower springs stiffnesses can help to alleviate the issue. But it seems to me that a piece of horizontally-oriented cloth falling under gravity should not undergo any deformation, let alone explode. Having looked at this for a couple of days, I think maybe some small numerical precision issue is being amplified through iteration steps, but as yet have been unable to say so with certainty. It seems I can't add the full example file, but I'll paste here the relevant part to repro the bug. Thanks in advance!

    elif self.integrator_type == IntegratorType.XPBD:
        cloth_width = 4.0
        cloth_height = 4.0
        cell_width = cloth_width / self.sim_width
        cell_height = cloth_height / self.sim_width
        area = self.sim_width * self.sim_height * cell_width * cell_height
        num_particles = (self.sim_width + 1) * (self.sim_height + 1)
        density = 0.15 # kgm-2
        mass = area * density
        mass_per_particle = mass / num_particles

        builder.add_cloth_grid(
            pos=wp.vec3(0.0, 4.0, 0.0),
            rot=wp.quat_from_axis_angle(wp.vec3(1.0, 0.0, 0.0), math.pi * 0.5),
            vel=wp.vec3(0.0, 0.0, 0.0),
            dim_x=self.sim_width,
            dim_y=self.sim_height,
            cell_x=cell_width,
            cell_y=cell_height,
            mass=mass_per_particle,
            fix_left=False,
            edge_ke=0.0,
            edge_kd=0.0,
            add_springs=True,
            spring_ke=1.0e3,
            spring_kd=0.0,
            particle_radius = 0.2 * cell_width
        )

System Information

No response

CliffieVanR avatar Apr 10 '25 11:04 CliffieVanR