CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   gaThermoPhysics thermo type and Cv (http://www.cfd-online.com/Forums/openfoam-programming-development/106773-gathermophysics-thermo-type-cv.html)

ChrisA September 7, 2012 14:38

gasThermoPhysics thermo type and Cv
 
I'm fairly new to OpenFOAM and my C++ experience is limited/rusty. I've done my best to understand how OpenFOAM organises itself at runtime but I'm having some issues. My nomenclature may be off while describing my problem but hopefully I'm somewhat understandable.

I want to be able to call Cv in my solver (rhoCentralFoam solver with reactions, my starting point was Nakul's reactingFoam implementation posted here: here). The original rhoCentralFoam solver is able to call Cv from the basicPsiThermo class which solves for it in specieThermo with my case's given thermotype.

When implementing the reactions in the solver hsCombustionThermo is the class used to make the Cp/Cv calls. Cp is called and solved for fine but Cv gets the basicThermo notimplimented runtime error message. I can't figure out the issue as basicPsiThermo is called within hsCombustionThermo and the gasThermoPhysics thermotype has specieThermo defined within it. As far as I can tell there should be no difference between the two implementations.

I think it has something to do with how OpenFoam handles the gasThermoPhysics thermotype at runtime but I can't be positive. Has anyone had a similar issue or able to offer up some insight regarding this?

ChrisA September 7, 2012 18:15

I finally found the missing link. hsPsiMixtureThermo doesn't have Cv defined, I copied the Cp functions and it seems to work now.

Hagen January 11, 2013 04:49

Hi Chris, I face the same problem and also added the missing member functions Cv, and Cv(T, face i) in hsRhoMixtureThermo by copying Cp and Cp(T, face i). Unfortunately this causes a new problem. When running a case I got the following message:

"new cannot satisfy memory request.
This does not necessarily mean you have run out of virtual memory.
It could be due to a stack violation caused by e.g. bad use of pointers or an out of date shared library
Aborted"

I figured it has to be in the line:
tmp<scalarField> tCv(new scalarField(T.size()));

Unfortunately I have no clue how to solve this. Did you have similar problems? Any idea why this doesn't work?

Any help is appreciated, Hagen

ChrisA January 11, 2013 13:52

Hi Hagen,

I'm not sure I'll be of much help, my C++ is rusty at best, but I'll try! Where does this line pop up in the code? You have to copy the cp/Cp functions all the way down to where their calculated and not just in hsRhoMixtureThermo, I think... it was a really long time ago when I did this change and I seem to have only made notes on the non-obvious addition (for me, which was hsPsiMixtureThermo).

Hagen January 12, 2013 10:26

Thank you for your help! I found the problem in the meantime. The error was however not in the implementation but in the wrong inclusion of Header files. I forgot to include the modified thermophysicalProperties, when compiling the turbulenceModels, but included them in the solver. The compiler did not complane at compile-time but called Cv during the calculation of the viscosity, which is nonsense. Recompiling the turbulenceModels helped. Thanks again and sorry for bothering you with this.

tatu February 11, 2013 10:07

Hi Chris,

Quote:

I want to be able to call Cv in my solver (rhoCentralFoam solver with reactions, my starting point was Nakul's reactingFoam implementation posted here: here).
If you are using ideal gas, and you have access to Cp, you can calculate Cv simply by using the Cp - Cv = R, right?

Tatu

ChrisA February 11, 2013 12:49

That is correct, but if memory serves, at the time I was having issues calling up the specific ideal gas constant for the mixture as well. So I had the choice to figure out how to get Cv or R, I picked Cv. At any rate, the whole adventure allowed me to better understand the internal structure of the thermodynamic and mixture solvers in OF.


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