|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
Hallo everyone
I am studying a Transient, turbulent, compressible flow regime. I think the "rhoPimpleFoam" solver is a good start, but are interested in investigating the governing equation, so i know exactly what the OF is doing. Can anybody help me get the source code of the solver ? - Fridrik Magnusson |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Member
ano
Join Date: Jan 2017
Location: Delft
Posts: 58
Rep Power: 10 ![]() |
Hi Fridrik
1. source your OpenFoam version. 2. type "sol" to go to the source code for solvers 3. Code:
cd compressible/rhoPimpleFoam |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
Thanks ano
I might need a bit of help with deciphering the Source-code. Where can i see that the solver, solves the continuity, momentum and energy equation ? (Sourcecode of rhoPimpleFoam.C below) Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Application rhoPimpleFoam Group grpCompressibleSolvers Description Transient solver for turbulent flow of compressible fluids for HVAC and similar applications. Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and pseudo-transient simulations. \*---------------------------------------------------------------------------*/ #include "fvCFD.H" #include "fluidThermo.H" #include "turbulentFluidThermoModel.H" #include "bound.H" #include "pimpleControl.H" #include "pressureControl.H" #include "fvOptions.H" #include "localEulerDdtScheme.H" #include "fvcSmooth.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { #include "postProcess.H" #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createControl.H" #include "createTimeControls.H" #include "initContinuityErrs.H" #include "createFields.H" #include "createFieldRefs.H" #include "createFvOptions.H" turbulence->validate(); if (!LTS) { #include "compressibleCourantNo.H" #include "setInitialDeltaT.H" } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; while (runTime.run()) { #include "readTimeControls.H" if (LTS) { #include "setRDeltaT.H" } else { #include "compressibleCourantNo.H" #include "setDeltaT.H" } runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; if (pimple.nCorrPIMPLE() <= 1) { #include "rhoEqn.H" } // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { #include "UEqn.H" #include "EEqn.H" // --- Pressure corrector loop while (pimple.correct()) { if (pimple.consistent()) { #include "pcEqn.H" } else { #include "pEqn.H" } } if (pimple.turbCorr()) { turbulence->correct(); } } rho = thermo.rho(); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; } // ************************************************************************* // |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Member
ano
Join Date: Jan 2017
Location: Delft
Posts: 58
Rep Power: 10 ![]() |
Hello Fridrik,
1. The code includes some "header" files, basically it just copies the included file at these positions, for the momentum predictor for example: Code:
# include "UEqn.H" The density calculation happens after the Pimple loop using thermo.rho() (in which your thermophysical model such as ideal gas is hidden) 2. It is helpful to have a look at the explanation of the simpleFoam implementation (and pimpleFoam , the first one explains more about the code). |
|
![]() |
![]() |
![]() |
![]() |
#5 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
Thanks Ano,
That really helped, i have one question on the implementation of the energy equation. Why is the governing equation defined as: ![]() Why not: ![]() Why can the density jump in and out of the material differential ? (unless the density is constant) Last edited by Fridrik; October 18, 2017 at 02:07. Reason: missing equations: |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Member
ano
Join Date: Jan 2017
Location: Delft
Posts: 58
Rep Power: 10 ![]() |
Hi Fridrik,
this is a very good question. ![]() In the last term the continuity equation is hidden, which is zero: ![]() Consequently ![]() I attach a detailed derivation of the energy equation like it is used in many OF solvers (I noted this down some time ago. If you find mistakes, please tell me. Only the energy dissipation term due to viscous stresses in the second last equation is typically neglected as well.) |
|
![]() |
![]() |
![]() |
![]() |
#7 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
Hi ano
It seems to add up, but i cannot agree on the continuity equation yet, can because i derive it to be: ![]() Am i missing something fundamental ? a quick derivation of the cont eq. conteq.PNG |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Member
ano
Join Date: Jan 2017
Location: Delft
Posts: 58
Rep Power: 10 ![]() |
You are right. I should correct that in my notes.
But also including the compressible terms in the Navier-Stokes equations you get rid of the density in the material derivative in the end. |
|
![]() |
![]() |
![]() |
![]() |
#9 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
||
![]() |
![]() |
![]() |
![]() |
#10 | |
Member
ano
Join Date: Jan 2017
Location: Delft
Posts: 58
Rep Power: 10 ![]() |
Quote:
(If not, please post which additional term you can not get rid of or where you got stuck.) |
||
![]() |
![]() |
![]() |
![]() |
#11 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
Ano you where right, After deriving the energy equation. The cont. eq. arrived.
I have showned the proof below Capture.PNG -Fridrik Magnusson |
|
![]() |
![]() |
![]() |
Tags |
governing equation, rhopimplefoam |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
rhoPimpleFoam Boundary Condition Problem | dancfd | OpenFOAM Pre-Processing | 18 | September 16, 2021 07:43 |
rhoPimpleFoam solver | adrieno | OpenFOAM Running, Solving & CFD | 11 | April 6, 2016 11:01 |
Pressure stair-step behaviour using rhopimplefoam | joegi.geo | OpenFOAM Running, Solving & CFD | 3 | December 12, 2014 12:10 |
rhoPimpleFoam floating point error | dancfd | OpenFOAM Running, Solving & CFD | 6 | January 5, 2014 20:57 |
Questions about buoyantPimpleFoam and rhoPimpleFoam | Mojtaba.a | OpenFOAM Running, Solving & CFD | 6 | August 1, 2012 04:50 |