modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
479 stars 169 forks source link

Bug in calculation of thermal conductivity for mixture gases #1187

Closed modelica-trac-importer closed 7 years ago

modelica-trac-importer commented 7 years ago

Reported by bernath on 28 Jun 2013 10:06 UTC Hello everybody, the results of the calculation for thermal conductivity of mixture gases ("Modelica.Media.IdealGases.Common.MixtureGasNasa.thermalConductivity") is not correct. I think the bug is, that the gas constant is not assigned in the function

lambdaX[i] :=SingleGasNasa.thermalConductivityEstimate(Cp=cp[i], eta=eta[i], method=method);

In function "Modelica.Media.IdealGases.Common.SingleGasNasa.thermalConductivityEstimate" the value "data.R" is always 0

lambda := if method == 1 then eta*(Cp - data.R + (9/4)*data.R) else eta*(Cp-data.R)*(1.32 + 1.77/((Cp/Modelica.Constants.R) - 1.0));

I've corrected the bug with an additional input "Rs" in "...MixtureGasNasa.thermalConductivity"

lambdaX[i] :=SingleGasNasa.thermalConductivityEstimate(Cp=cp[i], eta=eta[i],method=method,Rs=Modelica.Constants.R/fluidConstants![1].molarMass);

and in "...SingleGasNasa.thermalConductivityEstimate"

lambda := if method == 1 then eta*(Cp - Rs + (9/4)*Rs) else (eta)*(1.32*Cp+0.45*Rs);

Maybe it is not the smartest solution, but now the calculation is correct.

Best regards Michael Bernath bernath\@tum.de


Migrated-From: https://trac.modelica.org/Modelica/ticket/1187

modelica-trac-importer commented 7 years ago

Comment by hubertus on 28 Jun 2013 12:54 UTC If my memory does not fail me this bug was fixed in trunk, but I have no time to verify this now.

modelica-trac-importer commented 7 years ago

Comment by otter on 1 Jul 2013 12:11 UTC I quickly checked by running on the trunk ModelicaTest.Media.TestOnly.DryAirNasa with DryAirNasa (a polynomial is used to determine thermal conductivity) and Modelica.Media.IdealGases.MixtureGases.CombustionAir (a mixture of N2 and O2; thermal conductivity is computed by SingleGasNasa.thermalConductivityEstimate. In both cases nearly the same thermal conductivity is computed.

To summarize, this bug was already fixed on trunk.