KSP-RO / RealFuels

Modular fuel tanks and engines, with real fuels and realistic performance.
54 stars 66 forks source link

Cryogenic resources should not have specific heat assigned #294

Closed Starwaster closed 11 months ago

Starwaster commented 2 years ago

Cryogenic resources should not have specific heat (the hsp field) assigned. The reason it was removed in the first place is because the boiloff system separates thermodynamics into tank + resource and handles heat transfer from one to the other. Putting hsp back in means stock only increases the thermal mass/inertia of the tank part and increases the amount of energy that must be removed to reduce tank temperature. (whether through radiators or boiloff cooling)

Another example of where this will result in incorrect behavior would be if you try to move a resource (LOX for example) from a 174K tank to a 90K tank. You would in essence be adding heat to the cooler tank which doesn't make sense. The LOX would be treated as though it had a temperature of 174K.

The only time you would ever want to add specific heat to these resources is if you add the ability for Real Fuels to independently track resource temperature in ModuleFuelTanksRF, and even then you would not want to use the stock system (hsp)

Reference pull request #286

Starwaster commented 1 year ago

One last try because this issue is now over its 1 year anniversary. It's a bad and unrealistic idea to have reintroduced specific heat to resources that it was removed from (due to latent heat being added to them)

  1. In physics, liquids at their boiling temperature are treated as having specific heat(or sensible heat) equal to infinity. This is to express the fact that a liquid cannot be heated above its boiling temperature until it has phase changed into a gas. It's better to to just set hsp = 0 for cryogenics so that game physics don't touch the cryo resource at all. Let Real Fuels handle the situation like it was designed to (using latent heat of vaporization, i.e. vsp).

  2. Assigning specific heat (sensible heat) to cryogenic resources introduces more sensible heat into the system than should be present. For long term cryo depots this means it will be harder for radiators to remove heat without unrealistic radiator configs. Without radiators, there will also be higher levels of boiloff in the long run.

  3. Already mentioned in first item but this deserves its own bullet point: NO LIQUID CAN GO ABOVE ITS BOILING TEMPERATURE. (for a given pressure. You can raise or lower the boiling temperature but you cannot go over it.) When you assign specific heat to the cryogenic resource, you are in fact letting it go over its boiling temperature and any radiators present must remove that extra thermal energy along with the tank wall's thermal energy.

3B. It's not realistic in the slightest to allow resources to go above their boiling temperature. This is supposed to be REAL fuels and for the RO folks: realism. Nothing realistic about the change and specific heat should never have been reintroduced to the cryogenic resources or any other resource that has had vsp assigned to it. There's a reason why hsp was removed in the first place.

NathanKell commented 1 year ago

I thought @Capkirk123 was going to reply but looks like he hasn't had a chance yet. I'll look into this when I have a sec. The issue makes sense to me, thanks!

NathanKell commented 1 year ago

(I say look into because I think there are some edge cases with analytic thermo that I have to deal with wherein KSP makes assumptions about hsp that aren't valid here. It's been a while.)

Capkirk123 commented 1 year ago

Sorry, I was busy and didn’t get the chance to respond to this.

Having no specific heat for cryogenic liquids is probably fine for stuff like LH2 and LOX, where they will almost certainly spend all of their time at or near their saturation point. However, for stuff like liquid ammonia or MON10, which has a boiling point not far below room temperature and significant specific heat, it’s not unreasonable that it could naturally find its way well under it’s boiling point, at which point it’s specific heat would help greatly in keeping it from reaching it’s boiling point if it is subjected to temporary heating (reentry, exposure to sunlight, etc).

If KSP is just lumping the resource specific heat in with the tank internal temp, that is somewhat concerning, as it is possible for the temperature to go quite a bit above the boiling point (although that potentially implies that our boiloff calculations are not aggressive enough and/or our insulation factors are applied to the wrong specific heats, the walls of the tank really shouldn’t be able to get much hotter than the boiling point of the liquid inside them).

if this is the case though, that’s probably a good justification for removing specific heat values from a lot of cryogenic resources, especially the deeper cryogenics, at least until the behavior is improved. The stuff that boils closer to room temp can probably keep it though, as mentioned it can actually reasonably buffer part temperatures, and is much less likely to find itself far above its boiling point.

TwistedGiraffe commented 1 year ago

NO LIQUID CAN GO ABOVE ITS BOILING TEMPERATURE.

Except you can. You just need a pressure cooker. Liquids can exist at temperatures higher than their nominal boiling points when they have more than one atmosphere of vapor pressure above them.

This is supposed to be REAL fuels

REAL fuels are typically stored under several bars of helium, even in a non-HP tank. The fuel tanks would happily take a few bars of vapor pressure if you vent some helium. This is done in real life (and simulated in RealFuel), where the boiloff hydrogen gas provides ullage for the Centaur. This head vapor pressure is also why, in RealFuel, liquid oxygen in non-HP tanks boils at 94 K instead of 90 K, and why cryogens have higher boiling points in HP tanks than in non-HP tanks: the former can take more vapor pressure and increase the boiling point more. Therefore, it is not unrealistic to allow the cryogen's temperature to temporarily go above its "boiling point" defined in its game, as long as this short-term pressure hike does not undermine the structural integrity of the tank (safety factor is a thing).

Starwaster commented 1 year ago

Having no specific heat for cryogenic liquids is probably fine for stuff like LH2 and LOX, where they will almost certainly spend all of their time at or near their saturation point. However, for stuff like liquid ammonia or MON10, which has a boiling point not far below room temperature and significant specific heat, it’s not unreasonable that it could naturally find its way well under it’s boiling point, at which point it’s specific heat would help greatly in keeping it from reaching it’s boiling point if it is subjected to temporary heating (reentry, exposure to sunlight, etc).

The issue with resources going under their boiling point is fine except that KSP just does not handle resource thermal in a realistic manner. It's too abstract and does not allow for insulation of the resource from the part. The correct way to deal with it would be to either to:

If KSP is just lumping the resource specific heat in with the tank internal temp, that is somewhat concerning, as it is possible for the temperature to go quite a bit above the boiling point (although that potentially implies that our boiloff calculations are not aggressive enough and/or our insulation factors are applied to the wrong specific heats, the walls of the tank really shouldn’t be able to get much hotter than the boiling point of the liquid inside them).

The reason why tank wall temps are significantly higher is because of SOFI insulation and abstraction. It's not JUST the tank wall that is that temperature, it's the insulation too. Mathematically it's fine, it's just the conduction equation at work. If you were to remove the SOFI then you would see the tank wall temps drop significantly as you expect.

Starwaster commented 1 year ago

NO LIQUID CAN GO ABOVE ITS BOILING TEMPERATURE.

Except you can. You just need a pressure cooker. Liquids can exist at temperatures higher than their nominal boiling points when they have more than one atmosphere of vapor pressure above them.

Except that you can't. You really cannot go above the boiling temperature. What you are describing is the boiling temperature being RAISED. You didn't go over it at all. It's just that you increased the pressure so that the temperature at which the liquid boils is higher now. RF does allow for raising the boiling temperature because that is set in the tank and not the resource.