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

Procedure to implement a new equation of State

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 16, 2021, 05:43
Default Procedure to implement a new equation of State
  #1
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
Hello to all,


I would like to implement a new Equation of State (EoS) in OpenFOAM 7.


From what I was able to understand, we just need to copy and paste an Equation of State (e.g., perfect Gas) and change it accordingly.



The density (rho) function is known.


The compressibility (psi) should be the derivative of density with respect to pressure (dRho/dp)



However, I am struggling to understand how to define the departure equations for enthalpy, Cp, internal energy, CV and CpMCv.



Are there general equations to define these?


Can anyone complement the procedure to implement a new Equation of State.


At the end, and to use the new EoS, we just need to add a new model in either rhoThermos.C or psiThermos.C depending on the thermophysical model.





Thanks in advance!
Shibi is offline   Reply With Quote

Old   February 23, 2021, 13:48
Default
  #2
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
Anyone with some insight on this matter?
Shibi is offline   Reply With Quote

Old   February 24, 2021, 05:19
Default
  #3
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 746
Rep Power: 14
Tobermory will become famous soon enough
Look in section 7.1.3 of the user guide:
https://cfd.direct/openfoam/user-gui...hermophysical/
and you'll see that Cp etc are defined by the "thermo" type. The guide tells you that options are hconst, janaf etc. Now go look these up in Doxygen, and you'll see where Cp etc are defined, eg

https://cpp.openfoam.org/v8/janafThe...ce.html#l00171

or

https://cpp.openfoam.org/v8/hConstTh...8H_source.html

You probably need to get your head around each of the components in the thermophysicalProperties dictionary:
Code:
thermoType
{
    type            hePsiThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}
before trying to implement your new EOS. Good luck.
Tobermory is offline   Reply With Quote

Old   September 8, 2021, 11:54
Default
  #4
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
Sorry if this is too basic, but I have been reading through the derivation of rhoSimpleFoam (https://openfoamwiki.net/index.php/RhoSimpleFoam) and was wondering the following:

The density correction is given has \rho_i^{'}=\psi (p_i-p_i^{k-1})

This is true for ideal gases, \rho = \psi p but if I want to implement something where:

\rho = C+ \ln(p)
then:
\psi = \frac{1}{p}
so:
\rho \neq \psi p


This should mean that I need to create a new pressure equation for this model, correct? Which means that rhoSimpleFoam basiically only work for gas-like EoS, right?

Last edited by Shibi; September 9, 2021 at 16:42.
Shibi is offline   Reply With Quote

Reply

Tags
equation of state, programming


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
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 06:21
Writing an equation of state FAKHREDDINE CFX 2 April 3, 2017 13:08
Simple piston movement in cylinder- fluid models arun1994 CFX 4 July 8, 2016 03:54
continuity equation was diverging in transient state stenber FLUENT 0 March 19, 2016 23:37
Real gas equation of state for gas mixture ahourri FLUENT 0 April 30, 2008 12:23


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