Rapid simulation of motion in a fluid
The missing fluid
When simulating fluid dynamics in a mass and spring system, it seems desirable
to avoid simulating individual elements in the fluid (where possible) - in order
to minimise the computational requirements of the simulation.
Instead of modelling the fluid itself, we model the effect of the fluid on the masses and rods in the system.
Basic modelThe nodes are considered to be point masses (and are not directly affected by the fluid), and the rods are considered to be in motion through a stationary liquid.
The liquid offers least resistance to the motion when a node is moving through the fluid in the same direction as the attached rod. It offers most resistance when the rod is perpendicular to the direction of motion.
The force applied to a node by a rod depends on three factors:
This is calculated by computing a unit vector normal to the velocity of the node, and applying a dot product between this and the rod.
The resulting force is applied at right angles to the rod. No force is ever applied along the rod - the rod may always more freely in this direction.
Hopefully a diagram will help at this point:
The force applied is a resistive (or frictional force). Making the force larger has diminishing effects, and making it infinitely large has (at most) the effect of minimizing the node's motion in that direction during the current time step.
ExplanationTwo forces are calulated per rod. It is hoped that doing this copes with situations such as the following one more effectively:
Considering two forces has a computational cost, though. A more rough-and-ready approach might get away with using only one force per rod, and averaging the velocities of the nodes at either end.