I've isolated the source of the thermodynamics issue reported a couple weeks ago.
The root of the problem is in UpdateLiquid() when liquids "fall" (i.e. SimEvents::SpawnFallingLiquid) is called, it is called with the pre-tick temperature. In the situation where this cell has already participated in liquid advection from an adjacent cell, this causes net deletion.
Consider:
Each of these have 200kg of petrol at 100C next to 100kg of petrol at 0C. If you let them settle, they will settle at different temperatures: the situation on the left (where the bug happens) settles ~63.1C. The one on the right settles at the (correct) 66.6.
The reason is processing order. The situation on the left:
1. First the temperatures are shared, resulting in 200kg @ 87.5C and 100kg @ 25.
2. CopyFrom() is called, pre-tick is reset to post-tick.
3. Mass movement (UpdateLiquid).
2a. The cell on the left pushes 25kg @ 87.5C to the cell in the middle, resulting in 125kg @ 37.5C.
2b. Now the cell in the middle is called, and it wants to push 25kg off the ledge. The problem is that it does this at the "pre-tick" temperature. In other words, we're deleting 25kg at 37.5C and Spawning it at a different temperature.
The situation on the right conserves heat because the liquid is pushed off the ledge first (before it has felt the "push" from the right), so pre- and post-tick temperatures are the same, so there is no instantaneous loss of heat.
Create the situations above and let them settle.
-
2
-
1
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now