dilevin / CSC417-a2-mass-spring-3d

Assignment 2 for CSC2549
11 stars 13 forks source link

T during simulation is always 0 #25

Closed TRDizer closed 4 years ago

TRDizer commented 4 years ago

In my current implementation, everything in the simulation looks alright (ie. motion of dragged vertices, bunny wouldn't deform unpredictably for a long duration simulation, some level of changes in V when the mess deforms), but the T is always really small so that the plot appears to be constantly 0, so is the actual reading of T, as a result of small per particle qdot even during "violent" movement.

Any suggestion on how to troubleshoot this? I have been checking my gradient and hessian, and everything seems to add up correctly.

abhimadan commented 4 years ago

This sounds like your springs are essentially much stiffer than they should be, which indicates a math bug (though it could be something else). Try verifying your derivatives with symbolic differentiation in Matlab, or by using finite differences (checking gradients by estimating partial derivatives by computing the slope of a secant line (V(q) + V(q+epsilon))/epsilon).

TRDizer commented 4 years ago

Hi Abhishek, I double checked my gradient and hessian using Matlab; despite the tool being really useful and honestly appreciating the recommendation, they do not seem to be the source of my problem. Since you mentioned that my springs could be overly stiff, I also checked my stiffness and force assembly (although the assembly just distributes the value we obtained from per-spring potential energy hessian and gradient, and the only quantitative change in them is the negation), but this has led me nowhere either.

I am still checking my codes on and off, but thanks a lot for your previous feedback.