-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate ways to make the equilibrium detection more "sticky" #378
Comments
I wanted to quantify the problem a bit before changing any code. I tested the behavior on main using the a11y view. Using the Photons screen, I tried various combinations of gas concentration and cloud presence, and the temperature always stabilized and stayed that way. Here's an example of the readout from the a11y view: On the Layer Model screen, I tried setting the solar intensity to the max and starting the sun, and it equilibrated. Then I added a layer, and the ground and the layer went into and out of equilibrium several times before staying there. This is what the readout looked like: So, I basically need to fix up the behavior of the Layer Model screen without breaking the other screens. Sounds like some sort of options to the equilibrium detection algorithm may be what we need. |
Here's another test case that shows the behavior that we'd like to avoid. This is with max solar intensity, min albedo, max number of layers, all at 100% absorption. This is a screenshot of when the ground is reaching equilibrium, and it shows several messages from the ground and some from the layers: Here it is a few seconds later, with several messages about layers becoming stable. The goal will be to get to where there is only one message for each layer, including the ground, but that if things change we would then see a new set of "temperature stable" messages, but just one for each layer. |
I've added the ability to configure some aspects of the equilibrium detection algorithm, and things are a bit better, but not good enough yet. For example, with the configuration I committed, the test described in the previous comment behaves reasonably well in that there is only one alert for the stabilization of each layer, including the ground. However, if I get to this state and then suddenly remove all layers, there are no subsequent announcements about the ground cooling off. I'm going to have to return to this later. I am considering making a full overhaul of the equilibrium detection algorithm and have it be based on the temperature change in a moving window. That will likely be a bit simpler, and since we can watch the temperatures on the ground and atmosphere layers, it may be a bit easier to tweak as well. |
I thought it would be helpful to graph the temperature of the ground over time on the 3rd screen when there is a single layer present, because I was seeing a stair-step-ish sort of behavior, and I wanted to be able to visualize it better. Here is what this looks like. The x axis is in seconds, the y axis is in Kelvin. This illustrates why this problem is tricky. One could argue that it is going in and out of equilibrium all the time for short periods, but that's not the behavior we want, so we need to make sure that our criteria rule on the early "steps" that we are seeing in this data. |
I wasn't having any luck with the approach of adding hysteresis for the difference between the incoming and outgoing energy because adjusting the thresholds to make the algorithm more "sticky" made it too sticky in some situations, and there was no intuitive way to figure out how to adjust these thresholds. I decided to use a different approach altogether for the equilibrium detection where a history of the temperature values for the layer are kept in a moving window, and those values are evaluated at each step for whether the temperature has stayed within a given span. If it does, the layer is in equilibrium, if not, it's not. I used different values for this temperature span when transitioning from in to out or from out to in equilibrium. So far, this approach seems to work well in that it detects equilibrium of the layers reasonably quickly, recognizes when they layer goes out of equilibrium quickly, and doesn't bounce around between in and out of equilibrium. |
@arouinfar - assigning to you to test the current behavior on main and see if the alerts related to equilibrium are coming out when they should and not coming out when they shouldn't. |
This is a nice improvement @jbphet, especially for the Layer Model screen. The repeated "temperature stable" statements negatively impacted the usability of that screen, and I'm glad that's no longer happening. The behavior on the first two screens seems relatively undisturbed, but the "temperature stable" always triggers 0.1 degrees before reaching true equilibrium. However, I think this is an acceptable trade-off, as a 0.1-degree discrepancy is unlikely to cause pedagogical issues. Overall, great work @jbphet! I'm happy with the results, closing. |
In #374 we are working on adding description for the Layer Model screen. There is an item in the Layer Model description spec where the layers, including the ground, dispatch an alert when they reach energy equilibrium (i.e. the amount of energy being absorbed equals the amount being radiated). However, the layers currently report going into and out of equilibrium several times before "settling in". I think this is because the amount of energy coming into the layers tends to oscillate a bit, which I think is due to the way the layers can suddenly appear and start sending energy back to the ground.
It would be better if there were a bit of hysteresis around detecting when the layers go into and come out of equilibrium. We may even need to parameterize the algorithm so that the behavior on the Layer Model screen can be adjust relative to that on the Waves and Photons screens.
The text was updated successfully, but these errors were encountered: