I am continuing my work through the Pixar Physics Simulation Animation Course, in particular the article on implicit numerical methods. Last week, we introduced first-order implicit methods. This week, we’ll be studying second-order implicit methods.
This lesson will open the door to understanding and creating cloth simulations. Of course, cloth simulations (woven and knitted) are all about using mass-spring systems. Unlike the simulation of the particle system we created a few weeks ago where we used an explicit solver, we’ll be using a second-order implicit Euler solver for our cloth simulation!
Let’s review: Phase Space
As I said, a cloth simulation is like a particle system simulation. Recall that the particles are represented in space in a configuration called phase space.
Each particle is represented in space by two generalized coordinate vectors (x, v) where x is a position vector and v is a velocity vector. The phase space vector builds itself from vectors x and v one after the other, thus it will have a size of 2*n elements (where _n* is the amount of dimensions represented in our system).
⚠️ If you are already lost, see the discussion on particles where I introduced this topic. It’s a good idea that you understand this topic before proceeding!
Second Order Ordinary Differential Equations (ODE)
The Pixar resource states:
Most dynamic problems are written in terms of a second-order differential equation:
where is the second-order derivative of position x(t). We already know that this value is the acceleration. is the derivative of position… known as velocity.
Solving a second-order differential equation is not ideal because it is expensive and complicated. We’ll see that we can avoid this calculation by approximating the second-order term using the Taylor series in a process called linearization. By introducing and setting the variable , we can rewrite these equations to first order:
Let us simplify this system by recalling that the implicit Euler step is defined as follows:
and that:
…we can introduce variables and to finally have an equation to solve an implicit Euler step:
Linearization
As I said, we can approximate thanks to Taylor series expansion:
💡 We can approximate a two-variable real function using the Taylor series as follows:
See this resource for more on the Taylor Series and this exact derivation.
So the equation becomes:
An aside: dimensions
It must be said that the dimensions of and are decided by us. In this example, we can assume that our particle is defined by a 3D position and a velocity .
This distinction helps us better understand the dimensions of this calculation. Let’s assume in this case that is 3D. A resource I recommend for creating cloth simulations tells us that is the force in the system, but I’m not so sure at this point because I haven’t studied it yet. In any case, we can assume that
💡Thanks to vector calculus, we see how to calculate the derivation of a vector in 3D:
The derivation is called the Jacobian matrix. We will come back to this with more details in a later part
Substituting in the equation for , we arrive at the following:
Linear form
We have finally arrived at the heart of an implicit method. We can easily see that goes on either side of the equals sign. It is not enough to resolve the value of the variable by placing it on one side only. So we have to solve a linear system using the linear form .
💡 A linear system can be solved using the form:
where A is the matrix of coefficients, x is the solution vector and b is the constant vector. Consider this example with a linear system as follows:
Using the form , we arrive at:
After arranging our terms in the form , we arrive at:
where Iis the identity matrix ().
The next step is of course to solve . I will do that in the next series - when we create a cloth simulation!
Next time
I continue to study physics by creating a cloth simulation!