Continuation setup for B&S2026 model
This article covers episodes 2-4 in the repository. The goal here was to reproduce Figure 1 from the paper, which is the first real numerical continuation result. It shows equilibrium solutions across a range of model parameter choices. It’s a simple continuation problem to start with, simple enough that the agent asked me a couple of times “are you sure you want to do this?”, but it’s a good test for what I want to do.
What I’m doing here is using this simple problem as “training wheels” to get the three continuation tools I want to use working, which are custom Python continuation code, AUTO (which means reimplementing the model in Fortran) and LOCA (which means reimplementing the model in C++). There is a lot of machinery associated with using AUTO and LOCA, so having a simple problem to start with helps to get that all set up.
The figure we’re reproducing shows equilibrium solutions for , and under three temperature conditions for three different updraft velocity values. The traces for the Python, AUTO and LOCA calculations are essentially indistinguishable and match the calculations in the paper (validated by digitizing the curves in the paper figure).
The three continuation methods have different emphases here:
- Python continuation: This is intended as a sort of reference implementation, because it’s the most transparent (at least for simple cases) and easy to inspect. At least to begin with, I’m mostly going to get the agent to implement this version of things first before looking at AUTO and LOCA.
- AUTO: This is an independent (and very old-school) continuation and bifurcation toolkit. Old-school means mature and well-tested, but it also means “not very easy to use”. I’ve used it before and never liked it much, but wanted to use it as a kind of difficulty comparison case for seeing how much easier (if any) LOCA is to use.
- LOCA/Trilinos continuation: This is the system that I would use for working with larger systems. Trilinos is HPC-ready in a way that AUTO isn’t. Again, not all that easy to use. Or so I thought. But then I saw the automatic differentiation code for the Jacobian of the system for tracing the equilibrium branches. It’s pretty nice. One thing that’s quite funny about the code that the agent wrote here is that it implemented its own Gauss elimination for solving the 3×3 matrix in the Newton corrector. A 3×3 matrix is beneath the consideration of Trilinos…
Comparing the results from the three solvers isn’t that interesting in this case, since it’s a simple problem, but they are all very close:
So, this was a good warm up. Next, we’ll move on to something more interesting, looking at the Hopf bifurcations that give these oscillatory solutions you can see in the previous article.