|
[Sponsors] |
rho calculating and updating in buoyantPimpleFoam |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 ![]() |
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:
|
|
![]() |
![]() |
![]() |
![]() |
#3 | |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 ![]() |
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 psithermo-based solver e.g. rhoSimpleFoam. But it doesn't work in rhothermo-based 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 rho-based solver. Thank you for any suggestion given. |
||
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 ![]() |
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/user-gui...35-2660007.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. |
|
![]() |
![]() |
![]() |
![]() |
#5 | |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 ![]() |
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 variable-density 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. |
||
![]() |
![]() |
![]() |
![]() |
#6 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 ![]() |
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/user-gui...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 |
|
![]() |
![]() |
![]() |
![]() |
#7 | |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 ![]() |
Quote:
So the aim is decoupling rho and p. But I not sure how to modify the code. Thank you. |
||
![]() |
![]() |
![]() |
![]() |
#8 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#9 | |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 ![]() |
Quote:
In pressure-based solver, such as buoyantPimpleFoam, the uodate of rho is related to pressure. So I need to decouple them. |
||
![]() |
![]() |
![]() |
![]() |
#10 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 ![]() |
There are a few equations of state which you may find usefull: icoPolynomial and incompressiblePerfectGas
see https://cfd.direct/openfoam/user-gui...hermophysical/. A tutorial where icoPolynomial is used can be found in tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
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 |