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

Tabulated fluid thermo model

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 5, 2016, 05:43
Default
  #21
New Member
 
Luka Denies
Join Date: Oct 2014
Posts: 28
Rep Power: 12
LukaD is on a distinguished road
First and foremost, I have pushed some changes to the repository lately. The most important one is that I no longer use the built-in method to evaluate the temperature T from enthalpy h. Instead, I do a reverse interpolation of the enthalpy table to obtain the correct temperature. This fixes the problem of non-converging temperature, which can occur at near-critical conditions because of the sharp temperature gradients. However, the resulting thermophysical library no longer contains the standard thermos.

Quote:
Originally Posted by hcl734 View Post
Is it also possible to define just one property using the tables and the others let's say using icoPolynomial?
At the moment this is not possible. However, this would be fairly easy to implement for yourself. Either generate a very simple table yourself (e.g. with only two pressures), or add a new makeThermo in psiThermos.C

Quote:
Originally Posted by hcl734 View Post
Did you test this Utility with chtMultiRegionSimpleFoam?
Yes, I tested it with this solver and later modified the solver for my own use.
LukaD is offline   Reply With Quote

Old   January 7, 2016, 06:16
Default
  #22
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
We also need to keep in mind that some solvers might not be developed to support a pressure dependence of the fluid properties. So in general it is necessary to look into the algorithm of a solver to see if all terms are considered and if the properties are updated when the pressure changes. It's possible that some solvers don't update their properties by calling thermo.correct() in the pressure corrector loop or elsewhere. If pressure dependent properties are accessed in this case they will be from a previous iteration or time step and this might lead to numerical errors.
chriss85 is offline   Reply With Quote

Old   December 15, 2020, 08:04
Default
  #23
New Member
 
Cuber Jeo
Join Date: Nov 2020
Posts: 5
Rep Power: 6
FluidDynamicsTheory is on a distinguished road
Hi Luka,
I want to know what version of Ubantu and OpenFOAM you used? I can't run the "smartGenerator.py“ and "thermoClass.py" in Ubantu 20.04 wih OpenFOAMv2006 and OpenFOAM8. I will appreciate if you can help me!
FluidDynamicsTheory is offline   Reply With Quote

Old   December 15, 2020, 14:34
Default
  #24
New Member
 
Luka Denies
Join Date: Oct 2014
Posts: 28
Rep Power: 12
LukaD is on a distinguished road
I'm not sure, it is a long time ago. Probably OpenFOAM 3 and Ubuntu 14.4.
LukaD is offline   Reply With Quote

Old   December 21, 2020, 09:42
Default
  #25
New Member
 
Cuber Jeo
Join Date: Nov 2020
Posts: 5
Rep Power: 6
FluidDynamicsTheory is on a distinguished road
Thank you very much for you reply! I’ll try it!
FluidDynamicsTheory is offline   Reply With Quote

Old   December 25, 2020, 04:38
Default
  #26
New Member
 
Cuber Jeo
Join Date: Nov 2020
Posts: 5
Rep Power: 6
FluidDynamicsTheory is on a distinguished road
Quote:
Originally Posted by chriss85 View Post
Table structure goes like this:
(
(x1 (y11 z11)(y12 z12)...)
(x2 (y21 z21)(y22 z22)...)
...
)

You will have to write these files yourself using a small script. I could provide a python script if you have an input csv file like this:
0 x1 x2 ...
y1 z11 z21 ...
y2 z21 z22 ...
...

I don't remember the exact ordering from my head, you would have to check that yourself.
Hi, chriss,
You have ever said a python script can generate a table structure if we have an input csv file like this:
0 x1 x2 ...
y1 z11 z21 ...
y2 z21 z22 ...
...
The table structure goes like this:
(
(x1 (y11 z11)(y12 z12)...)
(x2 (y21 z21)(y22 z22)...)
...
)
Could you provide a python script example to me? I have a problem to generate the files myself. I'll appreciate if you can help me!
FluidDynamicsTheory is offline   Reply With Quote

Old   December 25, 2020, 05:11
Default
  #27
New Member
 
Cuber Jeo
Join Date: Nov 2020
Posts: 5
Rep Power: 6
FluidDynamicsTheory is on a distinguished road
Quote:
Originally Posted by LukaD View Post
I have programmed a new thermo model to use tabulated fluid properties instead of the existing models. The model covers an equation of state, the thermodynamic properties as well as transport properties. All of these must be defined by the user in two-dimensional (p,T) tables that are then interpolated.

This feature is especially useful when simulating supercritical fluids that have rapidly changing properties near the critical point. Tabulating the properties avoids real-time calculation with complex equations for each cell.

The first version is available at https://github.com/ldenies/tabulatedProperties Note that the code is not very tidy and still contains some remnants of the perfectGas files that were used as a basis.

One question I have is how to load the table files from the case directory. I am currently loading them directly from my home directory which is neither desirable nor flexible; see beneath.

Code:
cpTable_ ("/home/luka/cp")
I would prefer to put the files in the constant directory and load them from there. I tried to program the following but this failed to compile because runTime was not defined in this scope.

Code:
cpTable_ (runTime.path()/"constant/cp")
Any thoughts on how to implement this?
Hi, Luka,
I have problems to generated the table structure files by using your Python script "thermoClass.py" and "smartGenerator.py". When I input "python thermoClass.py", the error information is as follow:
Traceback (most recent call last):
File "thermoClass.py", line 10, in <module>
from scipy.interpolate import interp1d
ImportError: No module named scipy.interpolate

Besides, I input "python smartGenerator.py", the error information is:
Traceback (most recent call last):
File "smartGenerator.py", line 16, in <module>
from thermoClass import thermo
File "/home/jeo-1/OpenFOAM/tabulatedProperties-master/tableGenerator/thermoClass.py", line 10, in <module>
from scipy.interpolate import interp1d
ImportError: No module named scipy.interpolate

The system is Ubuntu 14.04 and the python is "Python 2.7.6 (default, Nov 13 2018, 12:45:42) [GCC 4.8.4] on linux2".
I don't know how to deal with these problems. Please let me know if you know where I'm wrong! Thanks
Attached Images
File Type: jpg Phyton Errors.jpg (94.3 KB, 10 views)
Attached Files
File Type: zip tableGenerator.zip (16.7 KB, 3 views)
FluidDynamicsTheory is offline   Reply With Quote

Old   August 3, 2021, 07:27
Default
  #28
New Member
 
Joao Coelho
Join Date: Jun 2021
Posts: 23
Rep Power: 5
jcoelho5 is on a distinguished road
Quote:
Originally Posted by FluidDynamicsTheory View Post
Hi Luka,
I want to know what version of Ubantu and OpenFOAM you used? I can't run the "smartGenerator.py“ and "thermoClass.py" in Ubantu 20.04 wih OpenFOAMv2006 and OpenFOAM8. I will appreciate if you can help me!
Were you able to install the application in the OpenFOAM8. Was your only problem using the .py scripts?

I am having some troubles installing this in general. Anyone has some kind of simple instructions to do after downloading the code from Denis git-repo?
jcoelho5 is offline   Reply With Quote

Reply

Tags
equation of state, supercritical, tabulated, thermo


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
how to incorporate the temperature of fluid in pressure based cavitation model arindamsantra7 Main CFD Forum 0 September 23, 2014 11:46
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 15:32
Modeling interface of fluid and porous, not with default setting ftab CFX 27 May 20, 2014 07:58
Question about CFX transitional fluid model Anna Tian CFX 1 January 28, 2013 21:14
How to apply negtive pressure to outlet bioman66 CFX 5 June 3, 2006 02:40


All times are GMT -4. The time now is 14:36.