CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How do I get density (https://www.cfd-online.com/Forums/openfoam-programming-development/103065-how-do-i-get-density.html)

 bme79 June 9, 2012 20:49

How do I get density

I need to get a density in a cell. I am using rhoPimpleFoam and the code is

forAll(mesh.C(), celli)
{
scalar rro=rho[celli];
.....
}

I am getting an error. "error: invalid types ‘float[Foam::label {aka int}]’ for array subscript"

I spend two day tryng to understand why I can not get density.

 Chris Lucas June 11, 2012 09:48

Hi,

have a look at hPsiThermo.C

Kind Regards,
Christian

 bme79 June 11, 2012 22:53

Thank you Christian for your reply, but it did not help me. I looked to this file and it did not tell me how to get density.

Could you please describe what I should check in this file.

Quote:
 Originally Posted by Chris Lucas (Post 365827) Hi, have a look at hPsiThermo.C Kind Regards, Christian

 Chris Lucas June 12, 2012 02:54

Hi,

get the pressure and psi of the cell (as seen in class function calculate) and multiply them (have a look at hPsiThermo.H)

Best Regards,
Christian

 bme79 June 12, 2012 18:55

One more question.

My rho[celli]=psi[celli]*p[celli]

I can get p[celli] but when I try to get psi[celli] I am getting error.

How can I get a p[celli] ???

Thank you one more time.

QUOTE=Chris Lucas;365934]Hi,

get the pressure and psi of the cell (as seen in class function calculate) and multiply them (have a look at hPsiThermo.H)

Best Regards,
Christian[/QUOTE]

 bme79 June 12, 2012 19:49

One more question.

My rho[celli]=psi[celli]*p[celli]

I can get p[celli] but when I try to get psi[celli] I am getting error.

How can I get a p[celli] ???

Thank you one more time.

QUOTE=Chris Lucas;365934]Hi,

get the pressure and psi of the cell (as seen in class function calculate) and multiply them (have a look at hPsiThermo.H)

Best Regards,
Christian[/QUOTE]

 All times are GMT -4. The time now is 23:16.