Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing restrictions on inputs array sizes in Modelica.Media.IdealGases.Common.MixtureGasNasa #1732

Closed
modelica-trac-importer opened this issue Jan 15, 2017 · 5 comments
Assignees
Labels
bug Critical/severe issue L: Media Issue addresses Modelica.Media
Milestone

Comments

@modelica-trac-importer
Copy link

Reported by hansolsson on 11 Jun 2015 13:23 UTC
Several functions in the Media library assumedly require that several input arrays have the same length - but that is not declared in the Modelica code.

It would be better to make that assumption explicit, and in case there is an error that will be detected more easily.

In case I am wrong and additional elements are allowed in some vectors that should be stated more clearly.

Examples with proposed changes (all the uses of size(y,1) below):

within Modelica.Media.IdealGases.Common.MixtureGasNasa;
function gasMixtureViscosity 
  "Return viscosities of gas mixtures at low pressures (Wilke method)"
  extends Modelica.Icons.Function;
  input MoleFraction[:] yi "Mole fractions";
  input MolarMass[size(yi,1)] M "Mole masses";
  input DynamicViscosity[size(yi,1)] eta "Pure component viscosities";
...
function mixtureViscosityChung 
  "Return the viscosity of gas mixtures without access to component viscosities (Chung, et. al. rules)"
extends Modelica.Icons.Function;

  input Temperature T "Temperature";
  input Temperature[size(y,1)] Tc "Critical temperatures";
  input MolarVolume[size(y,1)] Vcrit "Critical volumes (m3/mol)";
  input Real[size(y,1)] w "Acentric factors";
  input Real[size(y,1)] mu "Dipole moments (debyes)";
  input MolarMass[size(y,1)] MolecularWeights "Molecular weights (kg/mol)";
  input MoleFraction[:] y "Molar Fractions";
  input Real[:] kappa =  zeros(nX) "Association Factors";
...
function lowPressureThermalConductivity 
  "Return thermal conductivities of low-pressure gas mixtures (Mason and Saxena Modification)"
  extends Modelica.Icons.Function;
  input MoleFraction[:] y "Mole fraction of the components in the gas mixture";
  input Temperature T "Temperature";
  input Temperature[size(y,1)] Tc "Critical temperatures";
  input AbsolutePressure[size(y,1)] Pc "Critical pressures";
  input MolarMass[size(y,1)] M "Molecular weights";
  input ThermalConductivity[size(y,1)] lambda 

Additionally h_TX in the same package should use 'nX' as size for the X input (since its derivative has this restriction).
(There are other functions that also allow a reduced X-vector.)


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

@modelica-trac-importer modelica-trac-importer added bug Critical/severe issue L: Media Issue addresses Modelica.Media labels Jan 15, 2017
@modelica-trac-importer
Copy link
Author

Comment by hansolsson on 17 Jun 2015 12:54 UTC
The package Modelica.Media.Interfaces.PartialRealCondensingGases should likely also use "nX" instead of ":" (same as h_TX above) - see also #1572

@modelica-trac-importer
Copy link
Author

Modified by hubertus on 7 Dec 2015 14:07 UTC

@modelica-trac-importer modelica-trac-importer added this to the MSL3.2.2 milestone Jan 15, 2017
@modelica-trac-importer
Copy link
Author

Comment by hubertus on 13 Dec 2015 01:54 UTC
Fixed in 9da23e9

@modelica-trac-importer
Copy link
Author

Modified by hubertus on 13 Dec 2015 01:55 UTC

@modelica-trac-importer
Copy link
Author

Changelog modified by hubertus on 13 Dec 2015 01:55 UTC
Added input size restrictions to mixture property functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: Media Issue addresses Modelica.Media
Projects
None yet
Development

No branches or pull requests

2 participants