Prashanth · research log
← Log

Week 3

Speeding up some thermo

2026-06-11 (Thu, 11th Jun)

Ok so in order to get to the next steps in PowerCycles.jl I’ll need to use ideal gas thermo instead of fixed gas properties. Almost all the computational cost in gas type in sizing or off design calculation is actually in the thermo, so I’m going to go back to my other package (that is already much much faster than pyCycle because it uses the NASA-9 polynomials instead of equilibrium calculations), to try and clean it up and make it more AD friendly.

Claude tells me everything I did wrong

Right off the bat, Claude found some obvious areas for performance enhancement (I tried this with Fable 5 just because they announced they are going to take it away from us very soon). when I initially wrote this package about two years ago, I took some care to try and minimize all the allocations and try and do smart things like calculate things only once, cache them etc… but turns out making almost all of my types immutable and testing the performance would have shown me how I could make it faster. Claude wrote the benchmarks and convinced me that these changes will make the most frequent calculations (set temperature and query cp,h,sc_p, h, s for a gas) by 5-10x and make it AD compatible.

You can see how I asked Claude to show me it’s work here. Now I really need to sleep.

2026-06-12 (Fri, 12th Jun) More interestingly this forced me to think of the architecture a little differently. I always had this mental model of a gas “object” that’s stores the current state of a gas. So you could do things like:

print(gas.T, gas.P, gas.cp)

This seemed like the sort of natural OOP model, where then you’d have methods like set_TP etc1 Technically in Julia this would not be a method of the object but rather a dispatch on the type of Gas, so something like set_TP(gas, T, P) but regardless the gas type was storing both it’s identity “I’am hydrogen” and it’s state “I am at 298.15 K”.. But some benchmarks have convinced me that the benefits of thinking more functionally are actually quite substantial (ofc this is something that might be obvious to people who have more software smarts and who think about performance all the time, but it was a pretty good learning for me I think).

HA Claude was so snarky about something I had tried to do a while back (without the all knowing wisdom of AI…) that was sitting uncommitted in my local repo: (Amusingly, the untracked FlowStations.jl scratch file in the repo was groping toward exactly this.)

2026-06-14 (Sun, 14th Jun)

In another session, I was able to clean up almost all the remaining features that the new frozen gas object FrozenGas did not have. The “show-work” of everything the agent implemented is here.

It became really important to work on the unit tests for this, specifically ensuring that these are property based tests so future agents (or humans!) looking at errors can understand what failed and why.

2026-06-16 (Tue, 16th Jun)

I was able to clean up all of this and actually post a PR to my repo that showcases the benefit of having a immutable structure. You can see that almost every comment that has been called with Claude.

Side note an interesting “julia” weridness bug that I was able to investigate quickly (which I would have struggled with for a long time had it not been for AI) had to do with the allocation checks behaving very differently within test suites vs called elsewhere… in certain versions of Julia. The CI and automated testing caught this and I was able to verify what the issue was by getting claude to write a bunch of “throw-away” tests.

A live demo recreating a published figure

2026-06-18 (Thu, 18th Jun)

Something I thought would be actually cool for class today is to recreate a figure that has been published in the literature in an agentic manner - i.e., a single prompt describing what I want to recreate to a “package” that can reproduce a figure from the paper.

I chose a paper by Petters & Kreidenweis on the hygroscopic growth of particles 2 Petters, M. D., & Kreidenweis, S. M. (2007). A single parameter representation of hygroscopic growth and cloud condensation nucleus activity. Atmospheric Chemistry and Physics, 7(8), 1961–1971. doi.5194/acp-7-1961-2007, since it was something that I was talking with Marcos about for his research recently. they have this fairly simple looking figure that shows how the critical supersaturation varies as a function of dry diameter and the hygroscopicity of the particles.

20260618_pk_figure1.png

I tried this on a couple different models. The best one so far has been gpt-5-mini: figure1_recreated.pngSonnet did better: fig1_sonnet.png

I think the demo went pretty well actually! I forgot to record the agent session so instead I had pi running gpt5.5 to recreate the session from the logs and create a video.