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]; 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]; p[0] = rho0*Rspecific[0]*thermo.T()[0];
rho[0] = rho0; rho[0] = rho0;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,28 +41,13 @@ const char* const physicoChemical::group = "physicoChemical";
// Note: cannot use dimless etc. as they may not have been constructed yet // 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 const Foam::dimensionedScalar physicoChemical::RR
( (
dimensionedConstant dimensionedConstant
( (
physicoChemical::group, physicoChemical::group,
"RR", "RR",
1000*physicoChemical::R physicoChemical::NA*physicoChemical::k
) )
); );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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