Boxes, Gases and (relatively safe) explosions

Start: LogEntry_0003
SolYear: 8760.83

Right, in my last log entry I had worked out some basic statistics for simulating my gases, well rather the basic statistics needed to set up my gases for simulation. 

Bildet kan inneholde: rektangel, erme, gjøre, sirkel, auto del.
Gas box illustration

I can now set them up in a basic box, like illustrated above. But how do I simulate them and get anything useful from it?

I'm thinking I can do a simple numerical simulation, this will mean that I have to set up some variables, that I will need to define, let's do this!

Wait wait, hold up, first I need to make sure that I've defined what I'm actually looking at! Okay, I'm looking at an ideal gas, meaning I have no particle to particle interactions, I'm going to ignore the gravitational force on my particles, since it will be negligibly small over the duration of my simulation and in the environment this will be used in, I will also assume that when the particles hit the sides of my box, that the collisions will be perfectly elastic, meaning the kinetic energy of the particle is conserved, or put more simply, it bounces back with the same velocity it bounced into the wall. I've made a little rough representation of how it looks, this is only in 2 dimensions though, but it will behave exactly the same when we add the 3rd one.

Bildet kan inneholde: skråningen, triangel, kreativ kunst, parallell, gjøre.
Illustration of how a perfectly elastic collision occurs, note that the absolute value of the momentum is conserved.

Now, I can define my variables, I will use \(P\) as a variable for all the particle positions and \(V\) for all the particle velocities, given my definitions above my particle velocities won't change, so I won't need to deal with any particle acceleration.

I can now set up a simple system of equations to solve \(P_{n+1} = P_{n} + \big(V *dt \big)\), however this will just have our particles fly off into the distance, so to take into account the walls of our box, we need to do some fancy tricks at every timestep. The method used for this is pretty similar to the Euler method of numerical integration, which can be shown in equation form as \(y_{n+1} = y_n + \big( h * f(t_n, y_n) \big)\), where \(h\) is equivalent to our \(dt\), and \(f(t_n, y_n)\) is equivalent to our velocity \(V\). I do not currently intend to elaborate further on the Euler method, but later when I'm going to calculate the orbits of the planets in this solar system, I will explore it, and other methods of numerical integration, further. This method is far from perfect, but I'm going to elaborate on some sanity checks I can do later, which means I can verify the veracity of my work.

I can't easily show these fancy tricks mathematically, but basically, at every timestep I check if a particle is outside the box in all spatial dimensions, flip the velocity(multiply by \(-1\)) of the particles which are outside in the relevant dimension, and correct it back into the box for every timestep.

I then also take note of how "hard" the wall was hit by figuring out the momentum of the particle that hit the wall, across  all walls, to calculate the pressure in the box. Finally, I create a little nozzle in my box, which particles can escape through, count the particles that escape, and record the momentum "lost" through this nozzle, to calculate the thrust of the box, we can only count the momentum "lost" in the direction that is normal(perpendicular) to the side of the box the nozzle is on.

After doing all of this, I can figure out how much thrust a single box can produce, how much fuel that box will use per second, to produce this thrust, and finally the pressure of the box. 

This would be a lot to calculate by hand, on my own, especially for hundreds of thousands of particles, but my little autonomous robot helpers can luckily do the calculations for me, though still by hand.

But, how can I check whether my work is entirely unreasonable or not? Is the pressure I think my box will make hundreds of times greater or smaller than what a box like that would actually produce?

This Bol-TZ-mann character has also given me some analytical solutions to figure out the pressure of a gas, which is the equation \(P = \frac{N k_{b}T}{V}\), where \(P \) is pressure, \(N \) is the amount of particles in the gas,  \(k_{B}\) is still the constant named after him,  \(T\) is the temperature of the gas, and finally \(V\) is the volume the gas occupies.

If the pressure calculated through my simulation, coincides with the pressure found with this analytical solution, reasonably well, then I feel pretty confident that my work is good.

 

But, I've just simulated a tiny box, and not a massive rocket engine, can I actually use this to approximate a massive rocket engine? I would argue so, yes, since this tiny box can basically be scaled up to a larger rocket engine, it's just that the calculations would take way way way way longer, and I don't have that amount of time to do this.

There is apparently not only local flora, but also some local fauna, and they don't seem to appreciate my presence, which I cannot understand.

Bildet kan inneholde: veibane, asfalt, anlegg, organisme, grå.
These locals are not very happy about my presence here. For some unknown reason.

 

On another note, my factory is coming along nicely, I think I'll be able to get out of here eventually. 

Coal reprocessing
I've found a way to reprocess raw coal into easily useable fuel cells.
Bildet kan inneholde: vindu, urbant design, sameiet, gjøre, høyblokk.
I've finally made steam power, now I can do most of my work using electricity.

Well, back to my rocket plans! 

Now that I have a way to figure out how much thrust, fuel and pressure my boxes produce, I can play around with the initial values in my simulations, and find some results that work for me.

Well, now I need to figure out some way to deal with the local, weirdly aggressive fauna.

 

Oh, and I've made a rough sketch of my spaceship plans, saving them here just in case.

Spaceship sketch

 

End: LogEntry0003

 

Publisert 21. sep. 2021 17:48 - Sist endret 22. sep. 2021 22:18