# rhoPimpleFoam Initial Density

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

 December 22, 2020, 07:03 rhoPimpleFoam Initial Density #1 New Member   Join Date: Jul 2020 Posts: 5 Rep Power: 5 Dear Foamers, I am trying to calculate a compressible fluid using rhoPimpleFoam(OpenFOAM1806). My question is the calculation of density. I use the ideal gas law (perfect Gas) to calculate density. Do you know how the density at the start of the calculation is calculated? It was found that the density was calculated from the pressure, gas constant, and temperature, and the initial value of the pressure was read in createfields.H. I didn't know how the initial temperature values ​​were read. Thanks in advance.

 December 22, 2020, 15:36 #2 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 15 https://cfd.direct/openfoam/user-gui...hermophysical/ See equation of state

 December 22, 2020, 23:46 #3 New Member   Join Date: Jul 2020 Posts: 5 Rep Power: 5 Dear mAlletto, Thank you for your reply. I apply perfectGas to calculate the density. I understand that the density field is calculated using pressure field, temperature field, and gas constant at any time step (after starting time loop). I can not understand that how the density is calculated BEFORE starting time loop. In the createfields.H, pressure is initialized, then, density is initialized. But where Temperature is initialized? I apologize for the difficulty in reading in my poor English.

 December 23, 2020, 02:22 #4 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 15 The temperature is calculated in the thermopackage from the energy. https://caefn.com/openfoam/temperature-calculation

 December 23, 2020, 02:44 #5 New Member   Join Date: Jul 2020 Posts: 5 Rep Power: 5 Dear mAlletto, Thank you for your reply. Thanks to the link you pasted, I understand the existence of a function that transforms energy into temperature. At first of the calculation, temperature is initialized using the function. Thank you for your kindness.

 Tags compressible, density, rhopimplefoam