View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004141 | OpenFOAM | Bug | public | 2024-08-23 19:30 | 2024-09-09 07:12 |
Reporter | michael_h | Assigned To | chris | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | assigned | Resolution | open | ||
Platform | GNU/Linux | OS | Other | OS Version | (please specify) |
Product Version | 12 | ||||
Summary | 0004141: User guide states incorrect information in section thermodynamic models | ||||
Description | The user guide for OpenFOAM v12 incorrectly states in section 8.1.3 "Thermodynamic models" for eTabulated and hTabulated that value pairs of type (T, Cp) would be required. https://doc.cfd.direct/openfoam/user-guide-v12/thermophysical#x44-2380008.1.3 Actually a matrix is required which specifies the heat capacity as a 2D function of pressure and temperature. Additionally, for eTabulated Cv(p,T) and for eIcoTabulated Cv(T) are required and not Cp. The documentation shown by foamInfo is correct. | ||||
Tags | No tags attached. | ||||
|
@michael_h Thanks for reporting this. I don't really think the header file, output by foamInfo, tells a clear story at all. You seem to have worked it out, but I think the user guide should say more than "a matrix is required which specifies the heat capacity as a 2D function of pressure and temperature" Could you provide a simple example of what the "values" entry might look like? |
|
There is a complex example of the format available in $FOAM_TUTORIALS/resources/thermoData/wallBoiling-vapour.gz for hTabulated, which is used in e.g., $FOAM_TUTORIALS/multiphaseEuler/wallBoildingIATE. It would need to be adapted to have es specified instead of hs, but for just showing the syntax, it could already be a good starting point, or could even be mentioned in the user guide as an example? I'd have another question: What is the reason that eTabulated also requires specification of Cp and hTabulated requiring Cv? eTabulated requring Cp, lines 59ff in eTabulatedThermo.C: Cp_ ( "Cp", {dimPressure, dimTemperature, dimSpecificHeatCapacity}, dict.subDict("thermodynamics").subDict("Cp") ), hTabulated requiring Cv, lines 65ff of hTabulatedThermo.C: Cv_ ( "Cv", {dimPressure, dimTemperature, dimSpecificHeatCapacity}, dict.subDict("thermodynamics").subDict("Cv") ) |
|
I made a simple test case and did some more experiments. Attached example calculates the adiabatic heating of liquid water. The data is taken from https://webbook.nist.gov/chemistry/fluid/ Apparently both models require Cv as well as Cp. The syntax with pLow/pHigh does not work. A valid specification looks like this: thermodynamics { hf 0; sf 0; hs { low ( 0.05e6 280 ); high ( 300.05e6 340 ); values 4 7 ( ( 28844 70774 112608 154406 196204 238025 279884) (122300 161776 201482 241352 281344 321429 361589) (208221 246607 285322 324230 363257 402362 441521) (289736 327531 365748 404163 442668 481209 519760) ); } Cp { low ( 0.05e6 280 ); high ( 300.05e6 340 ); values 4 7 ( (4201.1 4186.8 4180.8 4179.4 4180.7 4183.8 4188.4) (3932.8 3960.6 3979.7 3993.6 4004.2 4012.5 4019.3) (3814.8 3858.1 3882.7 3897.6 3907.1 3913.5 3918.0) (3746.2 3805.7 3834.1 3847.2 3852.9 3854.9 3855.1) ); } Cv { low ( 0.05e6 280 ); high ( 300.05e6 340 ); values 4 7 ( (4200.0 4168.2 4130.3 4087.8 4041.5 3992.5 3941.5) (3886.8 3886.9 3875.1 3855.0 3828.8 3798.0 3763.6) (3704.4 3722.6 3722.3 3711.3 3693.1 3670.0 3643.3) (3581.9 3618.5 3626.9 3620.4 3605.2 3584.8 3560.9) ); } } |
|
So the scalars hf (enthalpy of formation) and sf (standard entropy) are required for both, and hs, Cp and Cv (hTabulated) or es, Cp and Cv (eTabulated) are required as Function2 of pressure and temperature, where the first argument should be pressure and the second argument should be temperature. In theory, any Function2 that OpenFOAM offers could be used, but UniformTable seems to be the choice for most cases. What remains open is why hTabulated requires also Cv (it seems that none of the other h options - hConst, hIcoTabulated, hPower, and hPolynomial do not read any Cv values / coefficients), and vice versa for eTabulated and Cp. When looking up UniformTable2 documentation, I noticed a small imprecision in the header, in UniformTable2.H, it reads: Usage \table Property | Description Tlow | Lower temperature limit of the uniformTable Thigh | Upper temperature limit of the uniformTable values | Property values, assumed uniformly distributed \endtable but UniformTable2 can take any arguments, it does not need to be temperature. The current description of UniformTable2 resembles JANAF coefficient specification. I attached a small patch which tries to improve the header description of UniformTable2. UniformTable2.H.diff (804 bytes)
diff --git a/src/OpenFOAM/primitives/functions/Function2/UniformTable2/UniformTable2.H b/src/OpenFOAM/primitives/functions/Function2/UniformTable2/UniformTable2.H index 7900d63..dc340c6 100644 --- a/src/OpenFOAM/primitives/functions/Function2/UniformTable2/UniformTable2.H +++ b/src/OpenFOAM/primitives/functions/Function2/UniformTable2/UniformTable2.H @@ -31,8 +31,8 @@ Description Usage \table Property | Description - Tlow | Lower temperature limit of the uniformTable - Thigh | Upper temperature limit of the uniformTable + low | Pair of lower limits of the independent variables + high | Pair of upper limits of the independent variables values | Property values, assumed uniformly distributed \endtable |
|
To document this effectively, it surely needs information about which way the data goes in the matrix. First variable is vertical. Second variable is horizontal. Correct? Good documentation needs to lead with the basic information, then details later. |
|
Correct. The first value is pressure range and the number of rows. The second value is the temperature range and the number of columns. |
|
A mathematical notation would be: low ( p1 T1 ); high ( pm Tn ); values m n ( (hs(p1,T1) hs(p1,T2) .... hs(p1,Tn)) (hs(p2,T1) hs(p2,T2) .... hs(p2,Tn)) ... (hs(pm,T1) hs(pm,T2) .... hs(pm,Tn)) ); |
|
The need to define both Cv and Cp came here: https://github.com/OpenFOAM/OpenFOAM-dev/commit/d2d557cdba39a5dffd4292f7631a709f6bce42a9 Which is related to performance optimization of caching Cp and Cv, to make multicomponent simulations significantly faster: https://github.com/OpenFOAM/OpenFOAM-dev/commit/5e146ccf588bfe2d93f92032cf9471e4a71787ce |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-08-23 19:30 | michael_h | New Issue | |
2024-08-26 10:59 | wyldckat | Assigned To | => chris |
2024-08-26 10:59 | wyldckat | Status | new => assigned |
2024-08-29 08:33 | chris | Note Added: 0013384 | |
2024-08-29 09:50 | cgoessni | Note Added: 0013385 | |
2024-08-29 19:50 | michael_h | Note Added: 0013386 | |
2024-08-29 19:50 | michael_h | File Added: thermophysicalModels.tar.gz | |
2024-08-30 06:37 | cgoessni | Note Added: 0013387 | |
2024-08-30 06:37 | cgoessni | File Added: UniformTable2.H.diff | |
2024-09-02 18:58 | chris | Note Added: 0013388 | |
2024-09-02 19:49 | michael_h | Note Added: 0013389 | |
2024-09-03 07:02 | michael_h | Note Added: 0013390 | |
2024-09-09 07:12 | Juho | Note Added: 0013396 | |
2024-09-09 07:12 | Juho | File Added: image.png |