constants: Standardise use of kmol instead of mol

This prevents spurious factors of 1000 from being introduced in
thermodynamic models. It also generalises the system further with
respect to alternative unit sets.
This commit is contained in:
Will Bainbridge
2023-12-13 14:34:32 +00:00
parent f1a70fab7e
commit 58e38a761f
15 changed files with 22 additions and 41 deletions

View File

@ -8,7 +8,7 @@
invW += Y[i][0]/W[i];
}
Rspecific[0] = 1000.0*constant::physicoChemical::R.value()*invW;
Rspecific[0] = constant::physicoChemical::RR.value()*invW;
p[0] = rho0*Rspecific[0]*thermo.T()[0];
rho[0] = rho0;

View File

@ -120,6 +120,7 @@ DimensionedConstants
physicoChemical
{
mu [1 0 0 0 0 0 0] 1.66054e-27;
NA [0 0 0 0 -1 0 0] 6.02214e+26;
k [1 2 -2 -1 0 0 0] 1.38065e-23;
}
@ -156,6 +157,7 @@ DimensionedConstants
physicoChemical
{
mu [1 0 0 0 0 0 0] 3.66083e-27;
NA [0 0 0 0 -1 0 0] 6.02214e+26;
k [1 2 -2 -1 0 0 0] 1.82012e-22;
}
@ -182,7 +184,7 @@ DimensionSets
m [0 1 0 0 0 0 0] 1;
s [0 0 1 0 0 0 0] 1;
K [0 0 0 1 0 0 0] 1;
mol [0 0 0 0 1 0 0] 1;
kmol [0 0 0 0 1 0 0] 1;
A [0 0 0 0 0 1 0] 1;
Cd [0 0 0 0 0 0 1] 1;
@ -204,11 +206,13 @@ DimensionSets
// UniformDimensionedField. Not supported in DimensionedField or
// GeometricField.
g [kg] 1e-3;
um [m] 1e-6;
mm [m] 1e-3;
cm [m] 1e-2;
km [m] 1e3;
us [s] 1e-6;
ms [s] 1e-3;
mol [kmol] 1e-3;
}
USCSCoeffs
@ -218,7 +222,7 @@ DimensionSets
ft [0 1 0 0 0 0 0] 1;
s [0 0 1 0 0 0 0] 1;
R [0 0 0 1 0 0 0] 1;
mol [0 0 0 0 1 0 0] 1;
kmol [0 0 0 0 1 0 0] 1;
A [0 0 0 0 0 1 0] 1;
Cd [0 0 0 0 0 0 1] 1;
}

View File

@ -29,7 +29,7 @@ mixture
specie
{
nMoles 1;
molWeight 28.9; // [g/mol]
molWeight 28.9; // [kg/kmol]
}
thermodynamics
{

View File

@ -29,7 +29,7 @@ mixture
specie
{
nMoles 1;
molWeight 27; // [g/mol]
molWeight 27; // [kg/kmol]
}
transport

View File

@ -29,7 +29,7 @@ mixture
specie
{
nMoles 1;
molWeight 63.5; // [g/mol]
molWeight 63.5; // [kg/kmol]
}
transport

View File

@ -29,7 +29,7 @@ mixture
specie
{
nMoles 1;
molWeight 18.0; // [g/mol]
molWeight 18.0; // [kg/kmol]
}
equationOfState
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -108,11 +108,7 @@ const Foam::dimensionedScalar physicoChemical::NA
(
physicoChemical::group,
"NA",
dimensionedScalar
(
dimensionSet(0, 0, 0, 0, -1), // dimless/dimMoles,
6.0221417930e+23
)
dimensionSet(0, 0, 0, 0, -1)
)
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,28 +41,13 @@ const char* const physicoChemical::group = "physicoChemical";
// Note: cannot use dimless etc. as they may not have been constructed yet
const Foam::dimensionedScalar physicoChemical::R
(
dimensionedConstant
(
physicoChemical::group,
"R",
physicoChemical::NA*physicoChemical::k
)
);
// Note: the 1e3 converts from /mol to /kmol for consistency with the
// SI choice of kg rather than g for mass.
// This is not appropriate for USCS and will be changed to an entry in
// the DimensionedConstants dictionary in etc/controlDict
const Foam::dimensionedScalar physicoChemical::RR
(
dimensionedConstant
(
physicoChemical::group,
"RR",
1000*physicoChemical::R
physicoChemical::NA*physicoChemical::k
)
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,13 +48,10 @@ namespace physicoChemical
//- Group name for physico-chemical constants
extern const char* const group;
//- Universal gas constant: default SI units: [J/mol/K]
extern const dimensionedScalar R;
//- Universal gas constant: default SI units: [J/kmol/K]
extern const dimensionedScalar RR;
//- Faraday constant: default SI units: [C/mol]
//- Faraday constant: default SI units: [C/kmol]
extern const dimensionedScalar F;
//- Stefan-Boltzmann constant: default SI units: [W/m^2/K^4]

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "specie.H"
#include "constants.H"
/* * * * * * * * * * * * * * * public constants * * * * * * * * * * * * * * */

View File

@ -29,7 +29,7 @@ mixture
specie
{
nMoles 1;
molWeight 18; // [g/mol]
molWeight 18; // [kg/kmol]
}
equationOfState
{

View File

@ -29,7 +29,7 @@ mixture
specie
{
nMoles 1;
molWeight 28.9; // [g/mol]
molWeight 28.9; // [kg/kmol]
}
thermodynamics
{

View File

@ -29,7 +29,7 @@ mixture
specie
{
nMoles 1;
molWeight 27; // [g/mol]
molWeight 27; // [kg/kmol]
}
transport

View File

@ -29,7 +29,7 @@ mixture
specie
{
nMoles 1;
molWeight 63.5; // [g/mol]
molWeight 63.5; // [kg/kmol]
}
transport

View File

@ -29,7 +29,7 @@ mixture
specie
{
nMoles 1;
molWeight 18.0; // [g/mol]
molWeight 18.0; // [kg/kmol]
}
equationOfState
{