Remix.run Logo
IIAOPSW 8 days ago

Probably what you want is "numerical methods" and "computational physics".

"Physical simulation" is a very broad scope, so your code for simulating fluids is going to be very different from your code for simulating planetary orbits, and at times it may feel a bit ad hoc. But at its foundation physical laws are written in differential equations and linear algebra.

So whatever algorithm lets you numerically integrate several inter-related variables is going to be broadly applicable to simulating any physical phenomena. At the simplest end of the spectrum you just naively approximate integration by brute force. Eg at each step just update your physical state variables by doing velocity += acceleration, position += velocity. This is called Euler's method, and while simple, it accumulates unacceptable errors rather quickly in most circumstance. The more advanced approach is to use a method like Runge Kutta. In circumstances where you have some known property, like say energy conservation, you can implement a method which explicitly imposes the constraint. This is good for cases where the motion is highly periodic as it prevents the numerical error from accumulating exponentially in orbits that spiral out of control.

Of course at some point you'll have to grapple with the issue of if you are simulating trajectories of free particles or values of neighboring grid points in a field. This question of how best to encode physical systems and simulate them cuts to the heart of physics.

I'll leave it at the old cliche "information is physical"