Jump to content

Conduction between reactor fuel and coolant is calculated incorrectly


ghkbrew
  • Branch: Preview Branch Version: Windows Known Issue

The current code incorrectly calculates how much heat to transfer from reactor fuel to coolant.  It results in massively more heat being added to the coolant than is removed from the fuel.  Because of this, heat output of the research reactor is effectively proportional to the amount of active coolant present.  This means that running a reactor no coolant or small amounts of coolant causes it to produce significantly less heat than when run with the maximum amount of coolant present.

 

The reason this happens is as follows:

Temperatures in the research reactor are currently updated in two steps:

1) Every tick, the active fuel is increased in temperature by 2C

Spoiler

This is implemented in the code in the "Reactor.React" method:

    float temperatureDelta = GameUtil.EnergyToTemperatureDelta(-10f * dt * activeFuel.Mass, activeFuel);
    activeFuel.Temperature += temperatureDelta;

This is calculates the temperature delta from adding (10 * dt * mass) DTUs which is (10 * dt * mass) / (SHC * mass).  Because SHC of refined uranium is 1, dt is always .2, and the mass terms cancel out: this is always 2.

2) The temperatures of the fuel and the coolant are recalculated to be equal.  The apparent intention of this code is to bring the fuel and the coolant into thermal equilibrium in a single step.  However given typical values mass and temperature it actually adds massively more heat to the coolant than is removed from the fuel.

Spoiler

  public static void ForceConduction(PrimaryElement a, PrimaryElement b, float dt)
  {
    float num1 = Mathf.Min(a.Element.thermalConductivity, b.Element.thermalConductivity) * dt;
    float num2 = a.Temperature * a.Element.specificHeatCapacity * a.Mass;
    float temperature1 = a.Temperature;
    float num3 = b.Temperature * b.Element.specificHeatCapacity * b.Mass;
    float temperature2 = b.Temperature;
    float num4 = num3 / (num2 + num3) * num1;
    a.Temperature = (temperature2 - temperature1) * num4 + temperature1;
    b.Temperature = (float) (((double) temperature1 - (double) temperature2) * (1.0 - (double) num4)) + temperature2;
  }

This function is called with fuel as "a" and coolant as "b"

For example immediately after venting there will be ~2.75kg of enriched uranium at ~400C.  30kg of reserve coolant water (at 95C) will then interact with the fuel.  In a single step this will result in fuel at 364C (a loss of 98kDTUs) and water at 364C (a gain of 33,760kDTUs).

On the next step the ~2.75kg of reactor fuel will be increased by 2C then "equilibrated" down by .3C "balanced" by the 30kg of water increasing 1.7C.

 

Edit: this code would correctly bring the two materials into thermal equilibrium:

Spoiler

  public static void ForceConduction(PrimaryElement a, PrimaryElement b, float dt)
  {
    #float num1 = Mathf.Min(a.Element.thermalConductivity, b.Element.thermalConductivity) * dt; #TC of materials is irrelevant
    float num2 = a.Element.specificHeatCapacity * a.Mass; #Heat capacity of material 1 (does not depend on temperature)
    float temperature1 = a.Temperature;
    float num3 = b.Element.specificHeatCapacity * b.Mass; # Heat capacity of material 2( does not depend on temperature)
    float temperature2 = b.Temperature;
    float num4 = num3 / (num2 + num3); # Heat capacity of b as fraction of total heat capacity
    a.Temperature = (temperature2 - temperature1) * num4 + temperature1;
    b.Temperature = (float) (((double) temperature1 - (double) temperature2) * (1.0 - (double) num4)) + temperature2;
  }

 


Steps to Reproduce

1) Run the research reactor with abundant coolant.  And measure heat output.

2) Run the research reactor with restricted coolant (e.g. 100g/s of water) and measure heat output.

1) will produce an order of magnitude more heat than 2)

  • Like 2



User Feedback


It looks like you are attempting an energy balance with the assumption that the thermal conductivity is the limiting factor in how fast energy can be transferred.

 

The problem is the final temp calculation.

a.Temperature = (temperature2 - temperature1) * num4 + temperature1;

 

The first half, (temperature2 - temperature1) * num4, has units of energy (energy per distance if you want to be specific.) while the second half has units of temperature.

 

It should be:

a.Temperature = ((temperature2 - temperature1) * num4)/(a.Element.specificHeatCapacity * a.Mass) + temperature1;

 

and

 

b.Temperature = (float) ((((double) temperature1 - (double) temperature2) * (1.0 - (double) num4))/((double) b.Element.specificHeatCapacity * (double) b.Mass)) + temperature2;

 

This results in a.Temperature = 399.987 C (673.137K) and

b.Temperature = 95.002 C (368.152K)

 

A rather slow way to transfer heat.

 

A complete energy balance would be:

a.Temperature = b.Temperature =(num2 + num3)/(a.Element.specificHeatCapacity * a.Mass + b.Element.specificHeatCapacity * b.Mass)

Which gives the same result as the edited function above, 101.547 C (374.697 K)

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...