Factoring in the Coriolis Force
I undertook this exercise after watching a certain cyclone-focused film and thinking “it would be fun to make a little toy model that creates spinning cyclones based on simple imputs.” The two inputs I decided to focus on are pressure and temperature, but in order to get things to spin, you need to factor in the Coriolis effect.
If you’re unaware, the coriolis effect is a pseudoforce that is a result of objects moving over the surface of a rotating sphere. PUT MORE BREAKDOWN HERE. The effect when it comes to larger scale weather patterns is that low pressure systems in the northern hemisphere tend to rotate in a counterclockwise direction and high pressure in the opposite direction. The effect is scaled by velocity, and consequently stronger systems tend to exhibit more pronounced rotation.
When building a system like this, it’s often better to start with a simple system that can be quickly tested before diving head first into volume simulation. The coriolis effect doesn’t just affect the weather, it affects any object that’s been launched through the atmosphere at sufficient speed and distance. In fact, the effect was originally noted from the observation of the ballistic paths of artillery. So, we’ll start by applying our force to a singe ballistic particle.
Actually, we’ll use two particles: one as a baseline without the coriolis effect, and one with our coriolis effect so that we have a point of comparison. We’ll put down two particles at 0,0,0 using the add node, and give them an initial velocity that points mostly forward but a bit up so that the particle flies in an arc when subjected to gravity. I used the values v@v = {10,5,0};
. Source both of those particles in a POP network, only for frame 1.
Then, use a pop wrangle on one of the points that creates and adds our calculated coriolis effect to the @force attribute. The equation for the force describing the effect we’re pursuing is
\[ \begin{aligned} F=-2m(\omega \times v') \end{aligned} \]Where omega (the one that looks like a curly w) represents the spin rate of your sphere (typically the earth)
We represent that in code as follows.
// Most mathematic descriptions you'll find are in a
// different space than we're used to in Houdini. The
// matrix m is here to compensate for that difference.
matrix3 m = maketransform({0,1,0},{0,0,1});
float lat = radians(chf("latitude"));
vector o2 = set(0, cos(lat), sin(lat));
vector vel = v@v;
vel.y = 0;
vel *= m;
vector omega = chf("spin_rate") * o2;
v@omega = omega * invert(m);
vector coriolis = (-2 * cross(omega, vel)) * invert(m);
coriolis.y = 0;
v@force += coriolis;