CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

gaThermoPhysics thermo type and Cv

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 7, 2012, 14:38
Default gasThermoPhysics thermo type and Cv
  #1
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
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?

Last edited by ChrisA; September 7, 2012 at 15:04.
ChrisA is offline   Reply With Quote

Old   September 7, 2012, 18:15
Default
  #2
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
I finally found the missing link. hsPsiMixtureThermo doesn't have Cv defined, I copied the Cp functions and it seems to work now.
ChrisA is offline   Reply With Quote

Old   January 11, 2013, 03:49
Default
  #3
Member
 
Hagen Müller
Join Date: Nov 2010
Posts: 34
Rep Power: 15
Hagen is on a distinguished road
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
Hagen is offline   Reply With Quote

Old   January 11, 2013, 12:52
Default
  #4
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
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).

Last edited by ChrisA; January 11, 2013 at 14:09.
ChrisA is offline   Reply With Quote

Old   January 12, 2013, 09:26
Default
  #5
Member
 
Hagen Müller
Join Date: Nov 2010
Posts: 34
Rep Power: 15
Hagen is on a distinguished road
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.
Hagen is offline   Reply With Quote

Old   February 11, 2013, 09:07
Default
  #6
New Member
 
Tatu Pinomaa
Join Date: Oct 2012
Location: Finland
Posts: 16
Rep Power: 13
tatu is on a distinguished road
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

Last edited by tatu; February 22, 2013 at 03:55. Reason: typo: + sign --> - sign
tatu is offline   Reply With Quote

Old   February 11, 2013, 11:49
Default
  #7
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
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.
ChrisA is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 12:45.