aboutsummaryrefslogtreecommitdiffstats
path: root/engine.c
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-03-02 14:24:56 -0500
committerSam Anthony <sam@samanthony.xyz>2025-03-02 14:24:56 -0500
commit9e6a82e0bfe9cf0a884dc110293f497aa21bdb6d (patch)
tree531ad1737382e6113fdefc0cf54dc45e1ea8aa20 /engine.c
parentb4fd126b2c779c800bdf3f2c4a47bd85ade9668a (diff)
downloadvolute-9e6a82e0bfe9cf0a884dc110293f497aa21bdb6d.zip
calculate mass flow rate at ambient conditions
Diffstat (limited to 'engine.c')
-rw-r--r--engine.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/engine.c b/engine.c
index ad1932e..d0a1b38 100644
--- a/engine.c
+++ b/engine.c
@@ -17,6 +17,9 @@ static const double C_V_AIR = 718.0;
/* Heat capacity ratio of dry air at T=300K [J/(kg*K)]. */
static const double GAMMA_AIR = C_P_AIR / C_V_AIR;
+/* Gas constant of air [J/(kg*K)]. */
+static const double R_AIR = 287.05;
+
static VolumeFlowRate port_volume_flow_rate(const Engine *e);
static double density_ratio(const Engine *e);
@@ -100,3 +103,16 @@ density_ratio(const Engine *e) {
t3 = manifold_temperature(e);
return (p3 * t1) / (p1 * t3);
}
+
+/* Mass flow rate through the engine (corrected to ambient conditions). */
+MassFlowRate
+mass_flow_rate(const Engine *e) {
+ Pressure p;
+ VolumeFlowRate v;
+ Temperature t;
+
+ p = e->ambient_pressure;
+ v = volume_flow_rate(e);
+ t = e->ambient_temperature;
+ return (p * v) / (R_AIR * t);
+}