|
[Sponsors] |
[Other] Tabulated thermophysicalProperties library |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 14, 2018, 05:38 |
tabulated properties for OpenFOAM 5.x
|
#21 |
New Member
Join Date: Feb 2018
Location: France
Posts: 15
Rep Power: 8 |
Hi,
tilasoldo and I have rewritten the chriss85 code for OpenFOAM 5.x. It is available at GitHUB : https://github.com/Yuusha0/tabulatedThermophysicalProperties The tabulated tables model works with psiThermo and rhoThermo. It has been improved to work with multi species simulations. However, due to OpenFOAM design, simulations are very slow with large tables. The heTabularThermo thermophysical type currently doesn't work. Please use hePsiThermo or heRhoThermo. Table files design is the same as chriss85 original version. A python script is provided to easily transpose tables (like h(p, T)) from (T, p) to (p, T). More informations can be found in the README.md file. Feel free to report bugs and/or submit patch on GitHub. |
|
July 5, 2018, 06:10 |
|
#22 |
New Member
Jan Gaertner
Join Date: Nov 2017
Posts: 20
Rep Power: 9 |
Hey,
great work Yuusha for porting it to OpenFOAM-5.x. I have downloaded your github repo and compilation went fine. Now when I wanted to test it on one of the tutorials (buoyantPimpleFoam/hotRoom/) I get the error message of unknown rhoThermo type and a list of possible options. This was my thermophysicalProperties file thermoType { type heRhoThermo; mixture pureMixture; transport const; thermo hTabular; equationOfState tabularEOS; specie specie; energy sensibleEnthalpy; } |
|
July 8, 2018, 13:25 |
|
#23 |
New Member
Join Date: Feb 2018
Location: France
Posts: 15
Rep Power: 8 |
Hi,
Maybe I'm not as clear as I think in the README. If you want to use this class with buoyantPimpleFoam, you have to recompile it. If you have made a standard installation of OpenFOAM, in the Make/options file, under the EXE_INC, add :
Maybe you have to slightly adapt it function of how your OpenFOAM is installed. |
|
July 12, 2018, 04:31 |
|
#24 |
New Member
Jan Gaertner
Join Date: Nov 2017
Posts: 20
Rep Power: 9 |
Hello Yuusha,
I have actually found a different way now. I think it is probably not as clean but for me it had worked to test the libraries. BuoyantPimpleFoam uses the rhoThermo class, therefore I have changed the rhoThermos.C file directly to allow the tabularEOS and hTabular options and recompiled the library. In the system/controlDict file I added then the library Code:
libs ( "libuserspecie.so" ); With this the solver worked and I could test it. I used your code now as a basis to extend it for my work with superheated flows. I have seen that the lookup function in the tables loop always over the complete table in the worst case to find the correct index. As my tables are generally constructed with a uniform spacing the lookup can be done directly. My tests showed an improvement of the speed of up to 20 for 200x200 tables. If you are interested in these interpolation tables I can share this over GitHub with you. Best, Jan |
|
July 12, 2018, 10:36 |
|
#25 |
New Member
Join Date: Feb 2018
Location: France
Posts: 15
Rep Power: 8 |
Hi Jan,
I'm very interested by your improvement to the table reading. Chriss85 gave an improved version of table interpolation but we were unable to compile it. So the actual version is not the best. Can you make a pull request on GitHub ? I will test and merge your improved version. |
|
July 16, 2018, 11:11 |
|
#26 |
New Member
Jan Gaertner
Join Date: Nov 2017
Posts: 20
Rep Power: 9 |
I am still working on the tabularThermo directory for my personal code.
I have uploaded a gitHub repo with just the tables. I don't work much with GitHub, hope you can use and compare it with these too. https://github.com/JanGaertner/fastInterpolationTable |
|
July 23, 2018, 09:28 |
Version 2.0
|
#27 |
New Member
Join Date: Feb 2018
Location: France
Posts: 15
Rep Power: 8 |
Hi,
A new version (v2.0) of thermophysical tables is available at GitHub : https://github.com/Yuusha0/tabulated...icalProperties It features a new uniform search model (thanks to janGaertner), a bisection search algorithm, an optional tabular enthalpy of formation (if your data come from equilibrium chemistry for example) and a test case using rhoSimpleFoam. |
|
September 30, 2018, 05:53 |
Update to OpenFOAM 6 version
|
#28 |
New Member
Join Date: Feb 2018
Location: France
Posts: 15
Rep Power: 8 |
Hi,
A new version is available at GitHub : https://github.com/Yuusha0/tabulated...icalProperties. It features the compatibility with OpenFOAM 6 and an improved python script to import and convert thermophysical tables. People who still use OpenFOAM 5 can still use the version 2.0.2. |
|
November 30, 2018, 05:22 |
Incertitude about the enthalpy
|
#29 |
Member
Join Date: Sep 2018
Location: France
Posts: 62
Rep Power: 8 |
Hello guys,
First of all, thanks a lot for providing this tabulated method. I have a doubt regarding the enthalpy I should provide in the table. In the tutorial made by Yuusha, I cannot find where those values for the enthalpy come from for the air. Do you think I can put the enthalpy calculated by the NIST database? Cheers. |
|
November 30, 2018, 17:21 |
|
#30 |
New Member
Join Date: Feb 2018
Location: France
Posts: 15
Rep Power: 8 |
Hi John,
You can find the link to the source for the tables in constant/thermophysicalProperties. Data come from Thermal Plasmas : Fundamentals and Applicationsby Maher I. Boulos, Pierre Fauchais, Emil Pfender (https://doi.org/10.1007/978-1-4899-1337-1). You can use data from any sources including NIST database. If your thermophysical properties are formated in csv, you can use the python script located in the python directory. Try python3 thermophysicalTable.py --help to see available options. |
|
December 20, 2018, 23:58 |
|
#31 |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 |
Hello,
I am using tabulated tables with buoyantPimpleFoam, which is based on rhoThermo. In creatfields.H: volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), thermo.rho() ); I want to read rho by looking up "rho" file in constant. I changed : ...... IOobject::READ_IF_PRESENT, // IOobject::NO_READ, IOobject::AUTO_WRITE // IOobject::NO_WRITE ...... But it doesn't work. When using rhosimpleFoam which is based on psiThermo, It can read the "rho" file with the same code of rho. I guess the difference is caused by rhothermo and psithermo? How can I look up rho in file when using buoyantPimpleFoam? I am also confused the function of rho = thermo.rho() in buoyantPimpleFoam, does it update rho? Can someone help me with these confusing problems? Thank you very much. |
|
January 4, 2019, 08:48 |
|
#32 |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 |
Thanks for the given library, it can work in psiThermo-based solver.
I want to check if Cp is changed with T. So in EEqn.H, I add these lines below thermo.correct(): ...... thermo.correct(); volScalarField cp = thermo.Cp(); Info << "Cp: " << cp << endl; The result is Cp is almost constant and T changed a lot. It seems Cp is not read from constant/cpTable according to the change of T. Can someone give me some ideas? Thank you. |
|
January 4, 2019, 08:59 |
|
#33 | |
New Member
Jan Gaertner
Join Date: Nov 2017
Posts: 20
Rep Power: 9 |
Quote:
how is your table built up? Note, that the cp table is called with temperature as the first argument and then pressure, which is opposite of how the function is called! (see: https://github.com/Yuusha0/tabulated...bularThermoI.H) @Yuusha: Maybe it would be good to change this to be consistent with the function call. |
||
January 4, 2019, 09:10 |
|
#34 | |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 |
Quote:
I just use the cpTable given in github for testing. Its format is: ( (300 ((1.e5 693.695))) (400 ((1.e5 693.698))) (500 ((1.e5 693.73))) (600 ((1.e5 693.884))) (700 ((1.e5 694.296))) (800 ((1.e5 695.077))) ...... Do you mean that I should change the position of p and T in hTabularThermoI.H as follows: inline Foam::scalar Foam::hTabularThermo<EquationOfState>::Cp ( const scalar T, const scalar p ) const { // Info << "cp for T= " << T << ", p= " << p << ": " << cpTable(T, p) << endl; return cpTable(T, p) + EquationOfState::Cp(T, p); } Or other places should I modify? Thank you. |
||
January 4, 2019, 09:13 |
|
#35 |
New Member
Jan Gaertner
Join Date: Nov 2017
Posts: 20
Rep Power: 9 |
No, do not change the call of the equation of state Cp. In most cases this value is zero anyways.
You would need to change the function call of the extrapolationTable. But your test table looks correct for this. So first temperature than pressure. Maybe introduce a info statement in the file I have linked to see if this is the function actually called. I will give some coding example a bit later. |
|
January 4, 2019, 09:25 |
|
#36 | |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 |
Quote:
But cp is almost staying constant, so it is not updated and the function is not called successfully? Or should I put some info to check? And how can I check kappa value? I also want to check the relation between kappa and T. Thank you. |
||
January 4, 2019, 09:47 |
|
#37 |
New Member
Jan Gaertner
Join Date: Nov 2017
Posts: 20
Rep Power: 9 |
Can you show me how your thermophysicalProperties file looks like? You should use hTabular to have the value dof the cpTable.
Best thing to check if the function with the table is called is to add an Info statement by including the commented out info statement Code:
template<class EquationOfState> inline Foam::scalar Foam::hTabularThermo<EquationOfState>::Cp ( const scalar p, const scalar T ) const { Info << "cp for T= " << T << ", p= " << p << ": " << cpTable(T, p) << endl; return cpTable(T, p) + EquationOfState::Cp(p, T); } |
|
January 4, 2019, 10:19 |
|
#38 | |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 |
Quote:
Code:
thermoType { type heTabularThermo; mixture pureMixture; transport tabular; thermo hTabular; equationOfState tabularEOS; specie specie; energy sensibleInternalEnergy; } mixture { specie { molWeight 28.9; } equationOfState { fileName "constant/densityTable"; outOfBounds extrapolate; } thermodynamics { Cp { fileName "constant/cpTable"; outOfBounds extrapolate; } h { fileName "constant/hTable"; outOfBounds extrapolate; } hf { Hf 0; } } transport { mu { fileName "constant/muTable"; outOfBounds extrapolate; } kappa { fileName "constant/kappaTable"; outOfBounds extrapolate; } } } |
||
January 5, 2019, 10:32 |
|
#39 | |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 |
Quote:
I add the info statement as you suggest. Then the values of cp, rho, mu, kappa were shown in the terminal, they are all correctly read from tables. I am confused about the difference between muTable(T, p)/kappa(T,p) and muTable(p, T)/kappa(p,T), do they have different efficiency? Which one is more suggested? Thank you. |
||
January 5, 2019, 18:16 |
|
#40 | |
New Member
Jan Gaertner
Join Date: Nov 2017
Posts: 20
Rep Power: 9 |
Quote:
What you use depends on the table you have. If your viscosity table is organized with temperature as the first argument you have to use muTable(T,p) otherwise muTable(p,T). The efficiency of the extrapolationTable depends on the table size and the search method.
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Multi species mass transport library [update] | novyno | OpenFOAM Community Contributions | 111 | November 10, 2021 00:37 |
ERROR: unable to find library | HJH | CFX | 6 | February 26, 2019 07:52 |
Forcing a solver to use your custom library. | cdunn6754 | OpenFOAM Programming & Development | 0 | March 30, 2017 17:05 |
Compiled library vs. inInclude Files, DSMC solver crashes after run | GPesch | OpenFOAM Programming & Development | 8 | April 18, 2013 08:17 |
OpenFOAM141dev linking error on IBM AIX 52 | matthias | OpenFOAM Installation | 24 | April 28, 2008 16:49 |