Calculating Cp, gamma and others during runtime
Hi,
I would like to calculate the specific heat capacity cp, specific heat ratio gamma and Ma number during the computation. I have compiled a new solver based on rhoCentralFoam for this purpose. In createFields.H I have added: Code:
volScalarField cp I wanted to add also the total temperature and total pressure for compressible fluids to be calculated during runtime, but I would like to calculate them using the Mach Number, which is not calculated right at the moment. Can anyone tell what I did wrong? Kind regards, shock77 |
Just found the solution to the problem.
For anyone with the same issue: Like meantioned in this thread (https://www.cfd-online.com/Forums/op...roperties.html), it has to added, that those values are written during runtime. I have also changed IOobject::READ_IF_PRESENT to IOobject::NO_READ So in the "while (runTime.run())" loop has to be added for example: cp = thermo.Cp(); |
Must_read_if_modified
Hey,
Have you tried changing IOobject::READ_IF_PRESENT to IOobject::MUST_READ_IF_MODIFIED? Since your coefficients are set to AUTO_WRITE, it means at end of each runTime iter those variables get written to the time directory. While the proposed method above will achieve the same result as your method, it could be an alternative way to solve this issue (just to add to discussion). So in this way, you don't need to add Code:
cp = thermo.Cp() |
Hi,
yes, actually I have tried it before, but without success. I think it couldnt be updated, because it didnt change, since cp and so on werent calculated for further timesteps. Kind regards, shock77 |
Have you tried the function object writeObjects? https://www.openfoam.com/documentati...teObjects.html
You could try either Cp or thermo.Cp and look if you get the fields written to the time folders (depending also on the writeInterval settings) |
Hi,
I actually haven't tried that, since it worked like I have described it above. But I think it is a good idea and when I have to do sth similar, I will try that too! Kind regards, shock77 |
Today, OpenFOAM 8 has been released. It includes two improvements, which might also be helpful in this regard:
objectRegistry: Added support for optionally caching temporary objects https://github.com/OpenFOAM/OpenFOAM...9dc79ea4ba08ea objectRegistry: Corrected caching of registered temporary objects https://github.com/OpenFOAM/OpenFOAM...53fc652ead5395 |
All times are GMT -4. The time now is 13:50. |