CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Energy equation in RhoPimple solvers (https://www.cfd-online.com/Forums/main/209656-energy-equation-rhopimple-solvers.html)

TommyM October 22, 2018 06:11

Energy equation in RhoPimple solvers
 
Hi,
Does anyone know where the Energy equation is solved in rhoPimple algorithm?
From what I understood, the algorithm "chronological order" is the following:
1- Pressure is guessed
2- Momentum equations provide Velocity
3- Velocity is inserted into Mass equation to provide Pressure
4- Pressure is used to correct Velocity
Then, the cycle restarts.
In some books, I read that Energy equation (to provide Density) is solved between steps 2-3, while in other books I found that it is the last step (after step 4).
Most likely, something is missing in my reasoning.
Could someone help me, please?
Thank you in advance,


Tommy M.

LuckyTran October 22, 2018 09:50

Well you don't ever solve the energy equation for density. You solve the energy equation for the energy, i.e. internal energy or enthalpy. Getting density is another problem. Actually you get the density from the continuity equation.

From rhoPimpleFoam.c

Code:

        while (pimple.loop())
        {
            #include "UEqn.H"
            #include "EEqn.H"

            // --- Pressure corrector loop
            while (pimple.correct())
            {
                #include "pEqn.H"
            }

            if (pimple.turbCorr())
            {
                turbulence->correct();
            }
          }

The energy equation is solved (solved in EEqn.h) after the momentum predictor step (UEqn.h, which is your step #2) and before the corrector step in pEqn.h (your step 3-4). The density is updated at the beginning of pEqn.h (between steps 2 and 3) and at end of pEqn.h, so after your step #4. However, there is yet a third place in pEqn.h where you solve for the density using the continuity equation after applying the corrector (in steady solvers this step doesn't exist). The final step at the end of pEqn.h is due to application of under-relaxation which means you don't take the full update of pressure available.

So both are correct. You just confused solving for energy with solving for density. The energy equation does not provide density. Density is updated twice (often more) because you just solved for the new energy, so the density needs to be updated for the latest energy. Then after you do the corrector step you have a new pressure, so here again you should update the density for the latest pressure.

It is a lot of things to keep track of because there are several algorithms embedded in one another all running at the same time. The first one is you are solving a basic set of equations (continuity, momentum, energy). The second is you are using SIMPLE/PISO/PIMPLE to solve the pressure-velocity coupling problem. The third is you are constantly updating density (using your equation of state) always using the latest available pressure & energy. The fourth is you are applying under-relaxation! It's much easier to analyze when you are dealing with only 1 or 2 aspects, but having all 4 at the same time gets confusing fast if you don't even recognize that you have 4 different reasons for doing things.

TommyM October 22, 2018 10:34

Ok. Hence Energy equation is solved to obtain internal energy (or enthalpy) which is linked to temperature through a thermodynamic relation (e.g. dh=cpdT), then density is corrected through a State equation (e.g. rho = p/RT) to take into account for the change in energy, right?
Thank you for your help!

LuckyTran October 22, 2018 10:47

Right... Notice that you only solve for energy only once in this entire mess (because solving the energy equation is not part of SIMPLE, because SIMPLE solves only the continuity & momentum problem). Hence why you usually have to repeat this whole cycle several times. Most of this mess is caused by SIMPLE and trying to applying under-relaxation on top of it.

TommyM October 22, 2018 11:31

Ok. Thank you! Your help is very much appreciated.


All times are GMT -4. The time now is 19:24.