From: John Kreuder on
Does anyone know of a program internal or external to MATLAB that I could call from within a script to calculate the properties of a fluid or material?

I would like to feed temperature and pressure as inputs and receive back specific heat, density, viscosity (for fluids) and thermal conductivity (for solids) as outputs.

Also, if the properties were to be calculated by an external program, how would I go about coding the procedure? Can I launch an external program from within a .m script? How do I interface with that program from within MATLAB?

Thanks,
-John
From: Walter Roberson on
John Kreuder wrote:
> Does anyone know of a program internal or external to MATLAB that I
> could call from within a script to calculate the properties of a fluid
> or material?
>
> I would like to feed temperature and pressure as inputs and receive back
> specific heat, density, viscosity (for fluids) and thermal conductivity
> (for solids) as outputs.

I had a brief look at viscosity. It appears that it is not easy to
calculate it "from scratch" (apparently the models have a hard time with
the ionic interactions in water). So instead the calculations rely upon
measured properties under conditions appropriate for the material to be
a liquid. And that implies that a program such as you propose would
require a fairly large look-up table.

Effectively, you are asking for a non-trivial portion of the CRC
Handbook of Chemistry and Physics to be stored in the program :(


You have specified the inputs as temperature and pressure, but you have
not specified chemical composition or state as input. Viscosity, for
example, depends upon the proportions of the fluids in a mix.

> Also, if the properties were to be calculated by an external program,
> how would I go about coding the procedure? Can I launch an external
> program from within a .m script? How do I interface with that program
> from within MATLAB?

There are a variety of choices, from system() to creating a mex
interface, to using an ActiveX control... it depends a lot on how much
interactivity and speed you need.