DLR-SR / ThermofluidStream

The DLR Thermofluid Stream Library
BSD 3-Clause "New" or "Revised" License
65 stars 27 forks source link

Ideal gas check #175

Open RaphaelGebhart opened 8 months ago

RaphaelGebhart commented 8 months ago

ThermofluidStream.Processes.Compressor, ThermofluidStream.Processes.Fan and ThermofluidStream.Processes.Turbine checks if ideal gas law is applicable using:

Real R_in(unit="J/(kg.K)") = p_in/Medium.temperature(inlet.state)/Medium.density(inlet.state);
Real R_out(unit="J/(kg.K)") = p_out/Medium.temperature(outlet.state)/Medium.density(outlet.state);

equation
  // test for ideal gas
  assert(abs(R_in- R_in)/R_in < max_rel_R, "Medium in compressor is assumed to be ideal gas, but check failed", dropOfCommons.assertionLevel);

1) It should probably be abs(R_out- R_in)/R_in < max_rel_R instead of abs(R_in- R_in)/R_in < max_rel_R 2) We should rather base that check on compressibility factor, i.e. something like

Z_in = (p*v/(R*T))_in;
Z_out = (p*v/(R*T))_out;
assert(abs(Z_in-1) < error_IdealGas_max);
assert(abs(Z_out-1) < error_IdealGas_max);