
[Sponsors] 
rho calculating and updating in buoyantPimpleFoam 

LinkBack  Thread Tools  Search this Thread  Display Modes 
December 20, 2018, 08:00 
rho calculating and updating in buoyantPimpleFoam

#1 
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 7 
Hello foamers,
I am facing some issues about rho updating in buoyantPimpleFoam. I am confused that how rho is calculated and updating. in pEqn.H: p = p_rgh + rho*gh; thermo.correctRho(psi*p  psip0); #include "rhoEqn.H" rho is calculated through rhoEqn.H,right? in buoyantPimpleFoam.C: while (pimple.loop()) { #include "UEqn.H" #include "EEqn.H" while (pimple.correct()) { #include "pEqn.H" } if (pimple.turbCorr()) { turbulence>correct(); } } rho = thermo.rho(); When the solver finishes pimple.loop(), it appears rho = thermo.rho(). What's its function? Does it also update rho? Where is the final updating place of rho? I have another related question: If I want to read rho value through looking up constant/rho file. How should I modify the code? in creatfield.H,I change NO READ to READ_IF_PRESENT: volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, //NO READ, IOobject::AUTO_WRITE //NO WRITE ), thermo.rho() ); but it doesn't work. I have no idea about these questions. Any hints or suggestion is highly appreciated. 

December 29, 2018, 17:06 

#2 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
buoyantPimpleFoam
is a pressure bases solver. That means that the continuity equation and the momentum equation are used to derive an equation for the pressure to ensure mass conservation. A derivation of the equations can be found in https://openfoamwiki.net/index.php/ChtMultiRegionFoam and references therein. So after solving the pressure equation the density is corrected by using the function thermo.correctRho(psi*p  psip0); > this function adds the correction psi*p  psip0 to the density previous to the pressure equation psip0. rho = thermo.rho() > returns a reference to the rho attribute of the thermo classe the description of the class can be found in https://www.openfoam.com/documentati...8C_source.html PHP Code:


December 29, 2018, 22:04 

#3  
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 7 
Quote:
So what's the function of #include "rhoEqn.H" which is in the end of p.Eqn? I want to use tabular mathod to read rho ,Cp ,mu..... from tabulated tables. the tabular library works well in psithermobased solver e.g. rhoSimpleFoam. But it doesn't work in rhothermobased solver e.g. buoyantPimpleFoam. So I think maybe the reason is the different definitions of rho in two solvers. Maybe I should write another version of library code which is suitable for rhobased solver. Thank you for any suggestion given. 

December 30, 2018, 05:42 

#4 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
equally I do not know the use of rhoEqn.H in pressure based solver. In all tutorials of where pressure based solver are used for compressible flows the equation is not solved.
If you tabular values for rho you have to write your own equation of state. Or maybe you can use one which is already available in openfoam: https://cfd.direct/openfoam/usergui...352660007.1.5 maybe the linear equation of state is good enough for your purpose. It assumes a linear variation of the density rho with the pressure p. 

March 12, 2019, 04:41 

#5  
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 7 
Quote:
With the deeper research, now I should create a low mach number solver, which decouple rho and p, which means the variations of p do not affect rho. I think the relationship between rho and p in variabledensity solver of openfoam is : rho = psi*p So I think I cannot use it under low mach number assumption. For buoyantPimpleFoam, the code: Code:
...... fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) ...... thermo.correctRho(psi*p  psip0); ****** So any suggestion is highly appreciated. 

March 12, 2019, 05:55 

#6 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
I did not understand what you're trying to do but there are different equations of state you can select from. Among this also a constant density. See
https://cfd.direct/openfoam/usergui...hermophysical/. Since it is a pressure based solver and not a density based solver it should work fairly well also for low mach number flows 

March 12, 2019, 08:53 

#7  
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 7 
Quote:
So the aim is decoupling rho and p. But I not sure how to modify the code. Thank you. 

March 13, 2019, 07:55 

#8 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
psi plays a role only in the compressible part of the pressure equation. For a constant rho (see https://github.com/OpenFOAM/OpenFOAM...st/rhoConstI.H) psi = 0 and you get the incompressible pressure equation.
For the equations used see e.g. and references therein https://openfoamwiki.net/index.php/ChtMultiRegionFoam 

March 13, 2019, 09:41 

#9  
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 7 
Quote:
In pressurebased solver, such as buoyantPimpleFoam, the uodate of rho is related to pressure. So I need to decouple them. 

March 13, 2019, 10:17 

#10 
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 
There are a few equations of state which you may find usefull: icoPolynomial and incompressiblePerfectGas
see https://cfd.direct/openfoam/usergui...hermophysical/. A tutorial where icoPolynomial is used can be found in tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
[openSmoke] libOpenSMOKE  Tobi  OpenFOAM Community Contributions  562  January 25, 2023 09:21 
Updating the turbulent schmidt number in dynamic smagorinsky model  pvpnrao  OpenFOAM Running, Solving & CFD  3  November 6, 2020 03:52 
Questions on dynamicTopoFvMesh  danvica  OpenFOAM Running, Solving & CFD  80  April 16, 2019 16:58 
Maximum number of iterations exceeded when calculating T with AMI baffles only  blebon  OpenFOAM Running, Solving & CFD  1  August 26, 2017 17:43 
How to update polyPatchbs localPoints  liu  OpenFOAM Running, Solving & CFD  6  December 30, 2005 17:27 