CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   rhoPimpleFoam energy equation understanding problem he (https://www.cfd-online.com/Forums/openfoam-programming-development/227424-rhopimplefoam-energy-equation-understanding-problem-he.html)

superkelle May 28, 2020 08:04

rhoPimpleFoam energy equation understanding problem he
 
Hey,I looked into rhoPimpleFoam source code and I wonder about the energy equation. I have some questions for that.



1) Why is he.name() == "e" necessary?


2) I applied an fvOptions scalarCodedSource term to it, what was only possible on "e"
not on "he", but fvOptions(rho, he) is coded into the equation, and also the correction is called on "he" fvOptions.correct(he). Is that just because of 1) ?
https://www.cfd-online.com/Forums/op...at-source.html


3) Where does the temperature field "T" gets calculated, since it does not even get created in "createFields"? ( I think it has to be somehow implemented in the "thermo" functionality what is for me whitchcraft until now, I would be very happy for some advice to begin my research about "thermo")





Code:

{
    volScalarField& he = thermo.he();

    fvScalarMatrix EEqn
    (
        fvm::div(phi, he)
      + (
            he.name() == "e"
          ? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho))
          : fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
        )
      - fvm::laplacian(turbulence->alphaEff(), he)
    ==
        fvOptions(rho, he)
    );

    EEqn.relax();

    fvOptions.constrain(EEqn);

    EEqn.solve();

    fvOptions.correct(he);

    thermo.correct();
}

It would be very nice if someone of you takes some time for answering, or even just giving some hints. Thank you in advance.

mAlletto May 28, 2020 11:15

In openfoam you can either solve an equation for the internal energy ("e") or enthalpy ("he").



This is the if else statement in the energy equation.



Once solved the energy equation, the temperature is calculated in the termo package.


For the latter see https://caefn.com/openfoam/temperature-calculation

superkelle May 28, 2020 11:33

Isn't it quite confusing that there is not a dummy variable instead of "he" ? So for example "x" that get set to "e" or "he" .

jherb July 12, 2020 19:18

he is the dummy variable. Enthalpy is "h". In he.name() it is store, what is actually solved (e or h) and then the energy equation is modified accordingly. See : https://cfd.direct/openfoam/energy-equation/


All times are GMT -4. The time now is 11:56.