# Physics simulator based on conservation laws?

http://en.wikipedia.org/wiki/Newton%27s_laws_of_motion#Relationship_to_the_conservation_laws

there's a section stating that:

In modern physics, the laws of conservation of momentum, energy, and angular momentum are of more general validity than Newton's laws

I've also seen lectures by Richard Feynman where he talked about how the law of angular momentum can be derived if one assumes Newton's laws. But it turns out the law of angular momentum is much more general than Newton's laws. Which is also in agreement with that is stated above.

However, one thing I can't wrap my head around is that the conservation laws doesn't seem to be as "directly implementable" as for instance Newton's laws. It is rather trivial to write a simulator based on Newton's laws, or at least some approximating of them. Such a simulator could operate by solving the differential equations or it could numerically solve/simulate such equations using small time steps etc.. The conservation laws, on the other hand, seem more indirect. How would one base a simulator on the conservation laws? Would the simulator have to constantly examine all possible outcomes and then select those that conserve all the quantities that have to be conserved etc. These laws by themselves don't seem to lend themselves as well to implementation.

The same is true for other fundamental laws like the second law of thermodynamics. This too seems to be a very fundamental law even though it can be derived from other laws in various contexts, and would automatically be at least statistically true in a simulator implementing Newtonian mechanics. But again it seems to be more generally valid than these derivations suggest and is in that sense more fundamental. But again, it seems difficult to write a simulator that uses this as the fundamental principle.

Of course, there's no guarentee that the fundamental laws of nature would lend themselves well to implementation. But "intuitively" it feels like the fundamental laws of nature should be something that could be put into a simulation program where each time step could be executed in some constant time - and not, i.e. a program based on brute-forcing all possible outcomes and then selecting those that satisfies various constraints. Of course there's no guraentee this is so, but it seems it would require an improportionate "computational power" by the universe to simulate even the simplest of situations. Maybe this is already so considering how every mass in the universe is in some sense in constant gravitational interaction with all other mass in the universe etc.

• The conservation laws alone are not enough to describe motion. Consider this simple example: a pair of neutral particles moving away from each other with an equal but opposite velocity, and then they both spontaneously reverse their directions and head towards each other. This could never happen in real life, but no conservation law is violated here (Newton's third law is though). – lemon Apr 4 '15 at 9:51
• @lemon: OK but even then the fundamental question remains, if we assume that the conservation laws + some additional laws (in order to unambigiously specify every situation) are really the fundamental laws, it begs the question how the conservation laws would be implemented in a simulation program? Of course, the problem would go away if the "additional laws" are by themselves enough (and are more directly implementable) to specify what happens. But in that case, the conservation laws are not really necessary and certainly not laws, since everything would be contained in the additional laws. – Morty Apr 4 '15 at 10:41
• The "additional laws" are indeed enough by themselves. In molecular dynamics simulations, for instance, there's no explicit reference to conservation laws. We just integrate Newton's second law, and that naturally gives rise to energy and momentum conservation. I will let someone better qualified address the 'fundamental nature' of conservation laws though (in the meantime, you may be interested to read up on Noether's theorem). – lemon Apr 4 '15 at 10:50
• @lemon: Yes that is also my understanding. But yet it seems that the conservation laws and the 2nd law of thermodynamics and treated as more fundamental and not just consequences of other laws. It seems in specific situations they are derivable consequencs of other laws, but the fact that they are derivable in so many different situations (which were not even anticipated at the time the laws were first noted) suggests they are really fundamental. But still I have trouble thinking about them as fundamental for the reasons stated earlier. – Morty Apr 4 '15 at 11:09
• @lemon, Newton's 3rd is not violated in your initial example as such, but assuming the change of motion was due to a 3rd law pair would violate locality. – dmckee --- ex-moderator kitten Apr 4 '15 at 19:40

Let's dive right into an example -- let's say you are simulating a fluid. First, you need to pick your reference frame. Are you going to simulate a fixed domain in space and have your fluid move through it, meaning you have a grid and at each point on the grid you store and solve for the fluid properties (Eulerian frame)? Or will you track each discrete packet of fluid as it moves around and interacts with the things around it (Lagrangian frame)? Both are useful in various cases and which one you choose tends to give more or less complexity. And you can easily go between the two in some cases as we'll see below.

Okay, so let's say for now that you are going to be in a Lagrangian frame. You can now use Newton's Law:

$$a_i = \frac{F_i}{m} = \frac{D u_i}{D t}$$

which says that the change in velocity in the i-direction of a fluid packet is due to the net force on the packet in the i-direction divided by the mass. Or, you can use the Navier-Stokes equations:

$$\frac{D u_i}{D t} = -\frac{1}{\rho}\frac{\partial P}{\partial x_i} + \nu \frac{\partial^2 u_i}{\partial x_i x_j}$$

which are just an expression of conservation of momentum. It turns out, however, that these two equations are really just expressions of the exact same thing. So Newton's Law is the conservation of momentum and vice versa. The total force on my fluid packet is due to the differences in pressure on each side of my packet and also due to the collision of my packet with other packets (which is modeled by the viscous term).

I said it is easy to go between Lagrangian and Eulerian frames. The time derivative, $D/Dt$ is called the substantial derivative and is defined as:

$$\frac{D}{Dt} = \frac{\partial}{\partial t} + u_i\frac{\partial}{\partial x_i}$$

which will transform the equations into an Eulerian reference frame.

When it comes to simulation, the conservation laws are directly implementable. It's easier sometimes to understand the conservation laws when they are written in an integral form:

$$\frac{\partial }{\partial t} \iiint\limits_V \vec{W} dV + \iint\limits_{S(V)} \left[\vec{F}-\vec{G}\right] \cdot dS = \vec{S}$$

where:

\begin{aligned} \vec{W} &= \begin{bmatrix} \rho \\ \rho u_i \\ \rho E \end{bmatrix}\qquad \vec{F} = \begin{bmatrix} \rho u_i \hat{n}_i \\ \rho u_i u_j \hat{n}_j + p \hat{n}_i \\ \rho u_i \left(E+p\right)\hat{n}_i \end{bmatrix}\qquad \vec{G} = \begin{bmatrix} 0 \\ \tau_{ij}\hat{n}_j \\ u_j \tau_{ij} \hat{n}_i + \kappa \frac{\partial T}{\partial x_i}\hat{n}_i \end{bmatrix}\\ \vec{S} &= \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} \end{aligned}

In this case, these are the conservation equations (mass, momentum and energy) for a compressible fluid in an Eulerian reference frame. $\vec{F}$ is the inviscid flux vector (so how the properties change due to inviscid motion) and $\vec{G}$ is the viscous flux vector (how the properties change to the viscous effects) and $\vec{S}$ is the source vector.

I said this is easier to see the conservation law form but then it looks all nasty. But here is why it is easier: $\iiint \vec{W} dV$ is the total amount of a property within your control volume; $\iint \vec{F}-\vec{G} dS$ is the amount moved into and out of your control volume through the edges/faces of it; $\vec{S}$ is the amount created or destroyed within your control volume. In words, what is inside is equal to what comes in minus what leaves plus whatever is made inside.

Notice that since mass, momentum and energy are neither created nor destroyed, the source vector for all of those terms is 0.

These equations are "directly implementable" in a simulation and do not require summing up things everywhere and trying to find an answer that will conserve everything. If you are solving those equations, you are conserving everything and no extra effort needs to be made*.

*. Okay, so that's a bit of a lie. In a simulation, considerable effort needs to be made to make sure your numerical method conserves things properly. It turns out, they only will do so if they are consistent and convergent, and if you use an infinite number of points and an infinitely small time step. Otherwise, numerical errors will manifest essentially as source terms in each of those equations and you will get mass/energy/momentum production or destruction. But it's not the equations' fault, it just turns out solving them is pretty darn hard.

• It might be useful to mention the adjective that is applied to algorithms that preserve some constant of motion is "symplectic". – dmckee --- ex-moderator kitten Apr 4 '15 at 19:42
• @dmckee Very true, although that term appears in mechanical systems far more often than in fluids. We probably just use another word for it, but I can't think of what it would be. – tpg2114 Apr 4 '15 at 19:46
• Hi thanks for your thorough and helpful response. I agree that it is possible to solve these equations in simulator directly. But in this case the equations are really just "rewritings" of Newton's laws which we already knew were directly implementable. My question arose because of the claim that the conservation laws to be more fundamental than the Newton laws due but it seems more difficult to imagine a simulator that only "knows" conservation laws. But your post certainly helps to see how it could be possible. – Morty Apr 5 '15 at 9:48
• But I'm still wondering why the cons. laws are considered so fundamental rather than being mere consequences of the "true" laws. – Morty Apr 5 '15 at 9:49
• @Morty For classical mechanics, conservation laws are "just rewriting" of the commonly known laws. But once you get into the relativistic realm or the quantum realm, the common laws don't apply but you can still write conservation laws. – tpg2114 Apr 5 '15 at 13:15