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

How to add a new Equation of State

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 9 Post By dkxls

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 21, 2013, 09:20
Default How to add a new Equation of State
  #1
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
Hej,

I have been trying to find out how to add a new equation of state in such a way that OF 2.2.x can understand that it is part of the rhoThermo selection package.

Like this
Code:
thermoType
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState icoIAPWS;
    specie          specie;
    energy          sensibleEnthalpy;
}
Besides the changes in the thermophysicalProperties dictionary, I also added the library containing the new EOS in the controlDict

Code:
libs
(
    "icoIAPWS.so"
);
For now I just copied icoPolynomial and renamed it to icoIAWPS and I am trying to get it to be recognized by openfoam in one of the rhoThermo solvers like buoyantPimpleFOAM. However, I have been very unsuccessful in doing so.

I think it should be somehow related to typeDef such as in the case of http://www.cfd-online.com/Forums/ope...epository.html or http://www.cfd-online.com/Forums/ope...-openfoam.html

However, I haven't really gotten behind this whole typedef and getting it onto the runtimeselection table. A first attempt is attached to this post.
Attached Files
File Type: gz icoIAPWS.tar.gz (2.7 KB, 97 views)
__________________
~roman
romant is offline   Reply With Quote

Old   August 22, 2013, 04:21
Default
  #2
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18
Chris Lucas is on a distinguished road
Hi,

have you defined your new makeThermo in "rhoThermos.C"?

Christian
Chris Lucas is offline   Reply With Quote

Old   August 22, 2013, 05:07
Default
  #3
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
Quote:
Originally Posted by Chris Lucas View Post
Hi,

have you defined your new makeThermo in "rhoThermos.C"?

Christian
I have looked at it and I am wondering if there is a way to not have to recompile the full thermophysicalModels library/folder. Such as to include the makeThermo(...,...,...,) somehow into one of the source files of new equation of state which is supposed to be used.
__________________
~roman
romant is offline   Reply With Quote

Old   August 22, 2013, 05:26
Default
  #4
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 202
Rep Power: 18
Chris Lucas is on a distinguished road
Hi,

I don't think that this will work.

Your could copy the heRhoThermo and all related files, rename them and uses this new thermo model if you don't want to change the OF core files.

Christian
Chris Lucas is offline   Reply With Quote

Old   September 15, 2013, 22:08
Default
  #5
Member
 
赵庆良
Join Date: Aug 2013
Posts: 56
Rep Power: 13
zqlhzx is on a distinguished road
Dear Chris Lucas and Romant:
I want use the thermo type as the following:

thermoType
{
type hePsiThermo;
mixture reactingMixture;
transport sutherland;
thermo janaf;
energy absoluteEnthalpy;
equationOfState perfectGas;
specie specie;
}
but class hePsiThermo only have "sensibleEnthalpy" insteadingof "absoluteEnthalpy".In 2.2.1,only when I use heheuPsiThermo,can I use "absoluteEnthalpy".So I have to according to class heheuPsiThermo to add "absoluteEnthalpy" in class hePsiThermo .However,when I run my case,the error showed me that there no change with "Valid psiThermo types ".In other word ,my modifies did not work.the file I modified is "thermophysicalModels/reactionThermo/psiReactionThermos.C"I just add the following code:
makeReactionThermo
(
PsiThermo,
PsiReactionThermo,
hePsiThermo,
reactingMixture,
sutherland,
absoluteEnthalpy,
janafThermo,
perfectGas,
specie;
) and #include "absoluteEntalpy.H" to psiReactionThermos.C.As you know ,it did not work.could you tell me how to modify psiReactionThermos.C to make my difined thermo type :
{
type hePsiThermo;
mixture reactingMixture;
transport sutherland;
thermo janaf;
energy absoluteEnthalpy;
equationOfState perfectGas;
specie specie;
}to be useful?
Or can I build myThermo library that include thermotype what I want to use?Please someone could give some advise!

Please!here is my new thermotype librarymyThermo.zip
zqlhzx is offline   Reply With Quote

Old   September 16, 2013, 04:45
Default
  #6
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19
dkxls will become famous soon enough
Quote:
Originally Posted by Chris Lucas View Post
Your could copy the heRhoThermo and all related files, rename them and uses this new thermo model if you don't want to change the OF core files.
That would be a rather bad idea! Lot of dublicated code and lot of work. Don't do that!


Roman, you are on the right track with the makeThermo(...).
I attached a zip archive that adds the missing pieces.
What I essentially did is:
1. copy icoPolynomial and rename it to icoIAPWS
2. Create icoIAPWSThermos.C, this is where the magic happens.
you just compile this file and all the other stuff will be put to the right places by the OpenFOAM macros. (See also the Make folder).

To get it running:
1. wmake libso
2. Include this in your controlDict
Code:
libs
(
    "libicoIAPWSThermo.so"
);
3. set the equation of state in thermophysicalProperties to 'icoIAPWS'

I already posted a similar thing in this thread:
http://www.cfd-online.com/Forums/ope...tml#post451645
Attached Files
File Type: gz icoIAPWS.tar.gz (3.6 KB, 377 views)
AleDR, olivierG, romant and 6 others like this.
dkxls is offline   Reply With Quote

Old   October 4, 2013, 06:02
Default
  #7
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Eindhoven, NL
Posts: 374
Rep Power: 21
romant is on a distinguished road
Thank you Armin, this worked.
__________________
~roman
romant is offline   Reply With Quote

Old   May 7, 2019, 06:59
Default
  #8
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Hi foamers

I have added a new simple equation of state to foam 4.0, but when I select it in a case, it can't find it!

What's the problem?

Thanks
alimea is offline   Reply With Quote

Old   October 14, 2020, 07:14
Default
  #9
New Member
 
Join Date: Aug 2019
Posts: 19
Rep Power: 7
Didu is on a distinguished road
I'm trying to use the linear equation of State, and so far with no success, any tips?
Thanks in advance
Didu is offline   Reply With Quote

Old   February 22, 2022, 08:30
Default
  #10
New Member
 
Pengcheng Zhang
Join Date: Aug 2021
Posts: 14
Rep Power: 5
Zane is on a distinguished road
Hi, everyone!

First, many thanks to Armin. With your help, I have implemented a new linear equation of state successfully.

It is worth mentioning that maybe because of the different OpenFOAM version, I failed at first. I use foam-extend-4.1. Hence I modified the code that Armin provided, and finally succeeded. Here is the code I use.

Hope that helps.
Attached Files
File Type: gz linearRho.tar.gz (2.4 KB, 52 views)
Zane 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
InterFoam: Add an equation to only one phase voingiappone OpenFOAM Programming & Development 41 June 7, 2022 10:04
how to add source-term in momentum equation for interFoam? anon_g OpenFOAM 9 October 18, 2011 13:47
Real gas equation of state for gas mixture ahourri FLUENT 0 April 30, 2008 12:23
Equation of state for water? jinwon park Main CFD Forum 2 December 20, 2007 08:32
equation of state imbalance(engine simulation) hennie Siemens 1 July 4, 2002 04:21


All times are GMT -4. The time now is 19:08.