CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Using liquidMixtureProperties

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 3, 2012, 12:50
Default Using liquidMixtureProperties
  #1
Member
 
Adam
Join Date: Jun 2011
Posts: 30
Rep Power: 5
Smed is on a distinguished road
I would like to use the water properties functions offered by the liquidMixtureProperties class, specifically, I want to calculate the mixture density in a sprayFoam calculation. The density function requires the pressure, temperature, and mole fraction (http://foam.sourceforge.net/docs/cpp...b69ac33c0e3962). The problem for me seems to be in passing the mole fraction in the correct format. Here is the code that I've placed in sprayFoam.C:

Code:
const scalar pc = p[cellI];
const scalar Tc = T[cellI];
const scalarField& Y_(Y[0]);
// Find the mole fraction, given the mass fraction
const scalarField X_ = slgThermo.liquids().X(Y_);
const scalar rho_ = slgThermo.liquids().rho(pc, Tc, X_);
The code compiles, but fails in the line that defines X_. It steps into the X function of liquidMixtureProperties with a Y which has a size of 4000 (number of cells in my mesh), which causes a failure on the second iteration. It looks like the X function can only handle a Y of size 1, but I don't understand why, or how to supply a Y of size 1. I have also tried,

Code:
const scalarField& Y_(Y[0][0]);
but this fails to compile with the following error message,
Quote:
error: invalid initialization of reference of type 'const FOAM::scalarField&' from expression of type 'double'
Any help with this would be greatly appreciated.
Smed is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 19:56.