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/)
-   -   Regarding the energy equation(Internal energy equation) in the sonicFoam solver. (https://www.cfd-online.com/Forums/openfoam-programming-development/249909-regarding-energy-equation-internal-energy-equation-sonicfoam-solver.html)

applekiller May 15, 2023 22:26

Regarding the energy equation(Internal energy equation) in the sonicFoam solver.
 
Hello,every Foamer, This is my first time posting a question in this community, and I am looking forward to everyone's answers.

I have a question about solving the energy equation (internal energy equation) in sonicFoam.

In EEqn.H of sonicFoam(I added some comments :D)
HTML Code:

    fvScalarMatrix EEqn                       
    (
        fvm::ddt(rho, e) + fvm::div(phi, e)
      + fvc::ddt(rho, K) + fvc::div(phi, K)
      + fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U), p, "div(phiv,p)") // fvc::absolute does nothing for static mesh
      - fvm::laplacian(turbulence->alphaEff(), e)  // turbulence->alphaEff() returns lambda/c_p or lambda/c_v depending on the solution variable e or h
            ==
        fvOptions(rho, e)
        );

The equation represented by this code seems to be
\frac{\partial \rho e}{\partial t} + \frac{1}{2}\frac{\partial \rho\pmb{u}^2}{\partial t} + \nabla\cdot(\rho e\pmb{u})+\frac{1}{2}\nabla\cdot(\rho \pmb{u}\pmb{u^2}) + \nabla\cdot(\pmb{u}p) + \nabla\cdot\pmb{q} = 0

In above equation
\pmb{u}^2 = \pmb{u}\cdot\pmb{u}
\pmb{q} = -\lambda\nabla T

e = C_v T

But if the total energy equation

\frac{\partial \rho E}{\partial t} + \nabla\cdot(\pmb{u}(\rho E+p)) - \nabla\cdot(\pmb{\tau}\cdot\pmb{u}) + \nabla\cdot \pmb{q} = 0

is expanded into the form of an internal energy equation, then the internal energy equation is like this.

\frac{\partial \rho e}{\partial t} + \frac{1}{2}\frac{\partial \rho\pmb{u}^2}{\partial t} + \nabla\cdot(\rho e\pmb{u})+\frac{1}{2}\nabla\cdot(\rho \pmb{u}\pmb{u^2}) + \nabla\cdot(\pmb{u}p) - \underline{\nabla\cdot(\pmb{\tau}\cdot\pmb{u})}+ \nabla\cdot\pmb{q} = 0

By comparing the internal energy equation represented in the code in OpenFOAM with the internal energy equation we derived, it can be seen that the internal energy equation solved in OpenFOAM lacks the viscous term-\nabla\cdot(\pmb{\tau\cdot\pmb{u}}).

So my question is,
1) Why does OpenFOAM omit the viscous term in solving the internal energy equation?
2) Does this handling have a significant impact on the results? (After all, the viscous term is missing from the internal energy equation)

I am looking forward to everyone's answer to this question and best wishes for everyone. :)

dlahaye May 16, 2023 03:11

Quote:

1) Why does OpenFOAM omit the viscous term in solving the internal energy equation?
The default OpenFoam implementation assumes that the effect of viscous dissipation is small. The additional computational cost to compute the viscous dissipation is thrown overboard. OpenFoam assumes this assumption to be satisfied in situations in which the solver is applied. OpenFoam assumes the user of the solver to verify the hypothesis or to at least raise healthy questions as you are doing.

Quote:

2) Does this handling have a significant impact on the results? (After all, the viscous term is missing from the internal energy equation).
Again, the hypothesis is that the effect of viscous dissipation is small. In situations in which viscous dissipation is important, it could be added using the fvOptions(rho,e) term.

applekiller May 16, 2023 04:53

Quote:

Originally Posted by dlahaye (Post 850250)
The default OpenFoam implementation assumes that the effect of viscous dissipation is small. The additional computational cost to compute the viscous dissipation is thrown overboard. OpenFoam assumes this assumption to be satisfied in situations in which the solver is applied. OpenFoam assumes the user of the solver to verify the hypothesis or to at least raise healthy questions as you are doing.



Again, the hypothesis is that the effect of viscous dissipation is small. In situations in which viscous dissipation is important, it could be added using the fvOptions(rho,e) term.

thanks for your timely reply!

Is this solver mainly used for supersonic flow? (So OpenFOAM defaults to a relatively low viscosity dissipation).:D

dlahaye May 16, 2023 08:55

Quote:

Is this solver mainly used for supersonic flow?
Yes and no.

Yes, sonicFoam is intended mainly for supersonic flows (hence the name).

No, however, rhoS/PimpleFoam also excluded viscous dissipation by default.

applekiller May 16, 2023 09:52

Quote:

Originally Posted by dlahaye (Post 850283)
Yes and no.

Yes, sonicFoam is intended mainly for supersonic flows (hence the name).

No, however, rhoS/PimpleFoam also excluded viscous dissipation by default.

Can this be understood as OpenFOAM's default expectation for users to decide how to handle viscous term(for example, as you mentioned, add it to the fvOptions term)?

I have seen some OpenFOAM code where solvers sometimes lack some terms in discrete equations, which has been bothering me for a while.:confused:

Thank you very much for your answer !!!


All times are GMT -4. The time now is 06:43.