You are browsing as a guest. Sign up (or log in) to start making projects!

6h 9m 56s logged

Devlog #7

Unfortunately, it was not that easy to finish CCEC.

The problem

I was getting consistently inaccurate results with H2-O2 reactions, overestimating the combustion temperature by hundreds of degrees. Troubleshooting a problem like this is very difficult because its almost impossible to figure out where exactly in the algorithm it all went wrong with just console logs. It was only really H2-O2 and H2-F2 reactions that were off; CH4-O2 and Aerozine-NTO reactions were mostly unaffected.

Fix #1

When I added the ability to specify the temperatures of each reactant, I forgot to consider the fact that the NASA-9 polynomials I was using only worked for temperature ranging from 1000-6000K. That means that when I try to use 90K oxygen as reactant, the enthalpy (kind of like the total energy) is completely off. This was a pretty easy fix because I just had to use a different part of the dataset for low-temperature reactants. While this improved numbers by a little bit, it didn’t fix the hydrogen problem.

Shot-in-the-dark #2

This attempt involved poking around at many different numbers while trying not to break anything. This is what took most of the hours recorded for this devlog. This did not fix the problem.

The solution

During the last devlog, I tried optimizing the program by cutting out any chemicals under a certain value every iteration of the chemistry solver. This was a terrible mistake. It improved the numbers for CH4-O2 by a little bit and made the solver considerably faster, so I didn’t think too much of it. However, as it turns out, this is what caused hydrogen combustion to overshoot temperature. After removing this evil line of code, everything worked perfectly fine again and I was getting great numbers!

Optimization

While 3 seconds on my laptop for solving CH4-O2 combustion is plenty good, 30 seconds for solving a much more complex Aerozine-NTO combustion is unacceptable. This meant I had to optimize my algorithm even more. The main way I did this was reducing the number of iterations for my binary search, since each iteration ran MinimizeGibbsEnergy which is what I’ve been working towards developing since day 1 and is the main bottleneck since it takes so long. Now I can get Aerozine-NTO results in around 7 seconds.

The future

Now I can hopefully finally start working on the engine fluid flow calculations, which shouldn’t take too long since I have them in Desmos already. However, I think in order to get the best results I have to solve the chemistry 3 times in total to get the data I need for the rocket engine. One for the combustion chamber, throat, and nozzle mouth respectively. This is quite unfortunate and means I may have to optimize CCEC even further.

TL;DR

Took forever to find a problem, also did some optimization

(Finally figured out how to use markdown. Thank you Hackclub for giving the preview option for devlogs)

0
10

Comments 0

No comments yet. Be the first!