added void coefficient
This commit is contained in:
parent
c5fc2cbc22
commit
468691d1b3
|
@ -12,9 +12,18 @@ struct fluid_t
|
||||||
const double gPmol; // g/mol
|
const double gPmol; // g/mol
|
||||||
const double jPg; // J/g latent heat of vaporisation
|
const double jPg; // J/g latent heat of vaporisation
|
||||||
const double jPgk; // J/g/K heat capacity
|
const double jPgk; // J/g/K heat capacity
|
||||||
|
const double bubble_speed; // m/s
|
||||||
|
|
||||||
const coolant::vapor_pressure vapor_pressure;
|
const coolant::vapor_pressure vapor_pressure;
|
||||||
|
|
||||||
constexpr fluid_t(double gPl, double gPmol, double jPg, double jPgk, coolant::vapor_pressure vapor_pressure) : gPl(gPl), gPmol(gPmol), jPg(jPg), jPgk(jPgk), vapor_pressure(vapor_pressure) { }
|
constexpr fluid_t(double gPl, double gPmol, double jPg, double jPgk, double bubble_speed, coolant::vapor_pressure vapor_pressure) :
|
||||||
|
gPl(gPl), gPmol(gPmol),
|
||||||
|
jPg(jPg), jPgk(jPgk),
|
||||||
|
vapor_pressure(vapor_pressure),
|
||||||
|
bubble_speed(bubble_speed)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
constexpr double g_to_mol(double g) const { return g / gPmol; }
|
constexpr double g_to_mol(double g) const { return g / gPmol; }
|
||||||
constexpr double mol_to_g(double mol) const { return mol * gPmol; }
|
constexpr double mol_to_g(double mol) const { return mol * gPmol; }
|
||||||
|
@ -24,7 +33,7 @@ struct fluid_t
|
||||||
constexpr double l_to_mol(double l) const { return g_to_mol(l_to_g(l)); }
|
constexpr double l_to_mol(double l) const { return g_to_mol(l_to_g(l)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr const fluid_t WATER = fluid_t(1000, 18, 2257, 4.1816, {8.07131, 1730.63, 233.426});
|
constexpr const fluid_t WATER = fluid_t(1000, 18, 2257, 4.1816, 0.3, {8.07131, 1730.63, 233.426});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ int main()
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sim::reactor::coolant::vessel vessel(200, 400, sim::coolant::WATER);
|
sim::reactor::coolant::vessel vessel(8, 10, 300, sim::coolant::WATER);
|
||||||
sim::reactor::reactor<5, 5> reactor = sim::reactor::builder<5, 5>(
|
sim::reactor::reactor<5, 5> reactor = sim::reactor::builder<5, 5>(
|
||||||
sim::reactor::fuel::fuel_rod(2000, 4000),
|
sim::reactor::fuel::fuel_rod(2000, 4000),
|
||||||
sim::reactor::control::control_rod(vessel, 10000, 1),
|
sim::reactor::control::control_rod(vessel, 10000, 1),
|
||||||
|
@ -101,7 +101,7 @@ secs: ss << s << "s\n";
|
||||||
reactor.update(rand, dt);
|
reactor.update(rand, dt);
|
||||||
pump.update(dt);
|
pump.update(dt);
|
||||||
valve.update(dt);
|
valve.update(dt);
|
||||||
vessel.update();
|
vessel.update(dt);
|
||||||
secs += dt;
|
secs += dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ pipe::pipe(coolant::vessel& v)
|
||||||
|
|
||||||
double pipe::get_k(val_t type) const
|
double pipe::get_k(val_t type) const
|
||||||
{
|
{
|
||||||
return vessel->get_level() / vessel->get_volume() * 0.5;
|
return vessel->get_level() / vessel->get_volume() * (1 - vessel->get_void_ratio()) * 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pipe::update(double secs)
|
void pipe::update(double secs)
|
||||||
|
|
|
@ -2,17 +2,31 @@
|
||||||
#include "vessel.hpp"
|
#include "vessel.hpp"
|
||||||
#include "../../constants.hpp"
|
#include "../../constants.hpp"
|
||||||
#include "../../conversions/temperature.hpp"
|
#include "../../conversions/temperature.hpp"
|
||||||
|
#include "../fuel/half_life.hpp"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
using namespace sim::reactor::coolant;
|
using namespace sim::reactor::coolant;
|
||||||
|
|
||||||
vessel::vessel(double level, double volume, sim::coolant::fluid_t fluid) : volume(volume), fluid(fluid)
|
constexpr static double calc_cylinder(double h, double d)
|
||||||
{
|
{
|
||||||
this->level = level;
|
double r = d / 2;
|
||||||
|
|
||||||
|
return M_PI * r * r * h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vessel::update()
|
vessel::vessel(double height, double diameter, double level, sim::coolant::fluid_t fluid) :
|
||||||
|
height(height),
|
||||||
|
diameter(diameter),
|
||||||
|
volume(calc_cylinder(height, diameter)),
|
||||||
|
fluid(fluid),
|
||||||
|
level(level),
|
||||||
|
bubble_hl(height * 0.5 / fluid.bubble_speed)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void vessel::update(double secs)
|
||||||
{
|
{
|
||||||
double V = (volume - level) * 0.001;
|
double V = (volume - level) * 0.001;
|
||||||
double P = fluid.vapor_pressure.calc_p(heat);
|
double P = fluid.vapor_pressure.calc_p(heat);
|
||||||
|
@ -46,6 +60,9 @@ void vessel::update()
|
||||||
steam = s;
|
steam = s;
|
||||||
level = fluid.g_to_l(l);
|
level = fluid.g_to_l(l);
|
||||||
heat -= diff * fluid.jPg / (fluid.l_to_g(level) + steam) / fluid.jPgk;
|
heat -= diff * fluid.jPg / (fluid.l_to_g(level) + steam) / fluid.jPgk;
|
||||||
|
|
||||||
|
if(diff > 0) steam_suspended += diff;
|
||||||
|
steam_suspended *= fuel::half_life::get(secs, bubble_hl);
|
||||||
}
|
}
|
||||||
|
|
||||||
double vessel::add_heat(double t1)
|
double vessel::add_heat(double t1)
|
||||||
|
@ -116,6 +133,7 @@ std::ostream& operator<<(std::ostream& o, const vessel& v)
|
||||||
o << "Steam: " << v.get_steam() << " g\n";
|
o << "Steam: " << v.get_steam() << " g\n";
|
||||||
o << "Heat: " << v.get_heat() << " C\n";
|
o << "Heat: " << v.get_heat() << " C\n";
|
||||||
o << "Pressure: " << (v.get_pressure() * 0.001) << " kPa\n";
|
o << "Pressure: " << (v.get_pressure() * 0.001) << " kPa\n";
|
||||||
|
o << "Void Ratio: " << (v.get_void_ratio() * 100) << " %\n";
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,26 +13,34 @@ class vessel
|
||||||
double level; // litres
|
double level; // litres
|
||||||
double heat = 0; // celcius
|
double heat = 0; // celcius
|
||||||
double steam = 0; // grams
|
double steam = 0; // grams
|
||||||
|
double steam_suspended = 0; // grams
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
const double height; // meters
|
||||||
|
const double diameter; // meters
|
||||||
const double volume; // litres
|
const double volume; // litres
|
||||||
|
const double bubble_hl; // seconds
|
||||||
|
|
||||||
const sim::coolant::fluid_t fluid;
|
const sim::coolant::fluid_t fluid;
|
||||||
|
|
||||||
vessel(double level, double volume, sim::coolant::fluid_t fluid);
|
vessel(double height, double diameter, double level, sim::coolant::fluid_t fluid);
|
||||||
|
|
||||||
void update();
|
void update(double secs);
|
||||||
double add_heat(double amount);
|
double add_heat(double amount);
|
||||||
double add_fluid(double amount, double heat);
|
double add_fluid(double amount, double heat);
|
||||||
double extract_steam(double dt, double a, double p2);
|
double extract_steam(double dt, double a, double p2);
|
||||||
|
|
||||||
constexpr double get_volume() const { return volume; }
|
constexpr double get_volume() const { return volume; } // litres
|
||||||
constexpr double get_level() const { return level; }
|
constexpr double get_level() const { return level; } // litres
|
||||||
constexpr double get_heat() const { return heat; }
|
constexpr double get_heat() const { return heat; } // celsius
|
||||||
constexpr double get_steam() const { return steam; }
|
constexpr double get_steam() const { return steam; } // grams
|
||||||
constexpr double get_mass() const { return fluid.l_to_g(level) + steam; }
|
constexpr double get_mass() const { return fluid.l_to_g(level) + steam; } // grams
|
||||||
|
constexpr double get_steam_density() const { return steam / (volume - level); } // g/L
|
||||||
|
constexpr double get_steam_suspended() const { return steam_suspended; } // grams
|
||||||
|
constexpr double get_void_ratio() const { double s = steam_suspended / get_steam_density(); return s / (level + s); }
|
||||||
|
|
||||||
double get_pressure() const;
|
double get_pressure() const; // pascals
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue