View Issue Details

IDProjectCategoryView StatusLast Update
0003958OpenFOAMBugpublic2023-02-20 13:45
Reportershock77 Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformGNU/LinuxOSUbuntuOS Version15.04
Summary0003958: Wrong solution with rhoCentralFoam selecting sensibleEnthalpy
DescriptionIt could be a bug or a user mistake, depending how you defined it. I stumbled on a thread in cfd-online, where a user reprorted, that he could only reproduce the results for a sod shock tube with sensibleInternalEnergy as energy variable and not with sensibleEnthalpy using rhoCentralFoam. I could reproduce this issue and I think I found the problem:

The energy equation is defined in the internal energy form in rhoCentralFoam.C. However, it is allowed to use sensibleEnthalpie as energy variable and sometimes needed (e.g. Peng-Robinson EQS). The problem arises in createFields.H with:

volScalarField& e = thermo.he();

he is derived from HE in thermoI.H:

return this->HE(p, T)*this->W();

HE is derived from HS in sensibleEnthalpy.H:

 return thermo.Hs(p, T);

And HS finally in hConstThermoI.H from:

   return Cp_*T + EquationOfState::H(p, T);

Which leads to e=cp*T, which is wrong. A similar case was reported here: https://bugs.openfoam.org/view.php?id=571. Since rhoCentralFoam is a compressible solver, the statement e=h is not true due to work done on compression.

I looked for theses online and found people using rhoCentralFoam with sensibleEnthalpy. I guess they did not know about this issue. A simple work around is to define the Cp in thermophysicalProperties with the value of Cv. I tried it and it worked. However, fields like Ma and gamma will be wrong, since they depend on Cp and need a new definition. The fields for p,T and U are correct.

If needed and wanted, I can try to work on a fix, once I have a bit free time. If you say its an user error and since I am not an expert in coding, the report can also be closed.
Steps To ReproduceRun the simulation.
Change sensibleInternalEnergy to sensibleEnthalpie.
Compare the results.

E.g. the peak velocity behind the moving shock sould be around 880 m/s and the static temperature about 520K according to the analytical solution.
TagsNo tags attached.

Activities

shock77

2023-02-20 11:03

reporter  

testcase.zip (242,350 bytes)

henry

2023-02-20 11:50

manager   ~0012950

Your interpretation is correct, rhoCentralFoam does not support sensibleEnthalpy

henry

2023-02-20 11:53

manager   ~0012951

Note that rhoCentralFoam is setup to conserve total energy which provides the best shock-capturing characteristics of all the options we tested, so the energy representation in the thermo must be sensibleInternalEnergy.

shock77

2023-02-20 13:24

reporter   ~0012952

Thanks for this clear statement. Some physical models require the enthalpy form and I think that makes users use sensibleEnthalpy. But it is an user issue then.

henry

2023-02-20 13:44

manager   ~0012953

In OpenFOAM-dev rhoCentralFoam has been superseded by the new shockFluid solver module in which I added a thermo validation check to ensure sensibleInternalEnergy has been selected.

Issue History

Date Modified Username Field Change
2023-02-20 11:03 shock77 New Issue
2023-02-20 11:03 shock77 File Added: testcase.zip
2023-02-20 11:50 henry Note Added: 0012950
2023-02-20 11:53 henry Note Added: 0012951
2023-02-20 13:24 shock77 Note Added: 0012952
2023-02-20 13:44 henry Note Added: 0012953
2023-02-20 13:45 henry Assigned To => henry
2023-02-20 13:45 henry Status new => closed
2023-02-20 13:45 henry Resolution open => no change required