From 243bff1a55f18b3e80e97bca677446d9f1d3143f Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 28 Aug 2009 15:23:01 +0100 Subject: [PATCH] initial commit of updated dimensioned constants --- etc/controlDict | 88 +++++++--- src/OpenFOAM/Make/files | 1 + .../constants/atomic/atomicConstants.C | 132 ++++++++++++++ .../constants/atomic/atomicConstants.H | 81 +++++++++ .../constants/constants.C | 42 +++++ .../constants/constants.H | 59 +++++++ .../electromagneticConstants.C | 164 ++++++++++++++++++ .../electromagneticConstants.H | 89 ++++++++++ .../fundamental/fundamentalConstants.C | 128 ++++++++++++++ .../fundamental/fundamentalConstants.H | 101 +++++++++++ .../constants/math/mathConstants.H | 69 ++++++++ .../physicoChemicalConstants.C | 132 ++++++++++++++ .../physicoChemicalConstants.H | 85 +++++++++ .../constants/universal/universalConstants.C | 53 ++++++ .../constants/universal/universalConstants.H | 66 +++++++ .../dimensionedConstants.C | 19 ++ .../dimensionedConstants.H | 33 +++- 17 files changed, 1310 insertions(+), 32 deletions(-) create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/constants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/constants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H diff --git a/etc/controlDict b/etc/controlDict index c1d7416515..97af349e7a 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -877,34 +877,68 @@ OptimisationSwitches DimensionedConstants { - // SI units + unitSet SI; // USCS - //- Universal gas constant [J/(kmol K)] - R 8314.51; - - //- Standard pressure [Pa] - Pstd 1.0e5; - - //- Standard temperature [K] - Tstd 298.15; - - //- Stefan-Boltzmann constant [J/(K4 m2 s)] - sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 5.670e-08; - - /* USCS units - - //- Universal gas constant [lbm ft2/(s2 kmol R)] - R 3406.78; - - //- Standard pressure [lbm/(ft2)] - Pstd 2088.6; - - //- Standard temperature [degR] - Tstd 536.67; - - //- Stefan-Boltzmann constant [lbm /(degR4 ft s)] - sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 8.2292e-08; - */ + SICoeffs + { + universal + { + c c [ 0 1 -1 0 0 0 0 ] 2.99792e+08; + G G [ -1 3 -2 0 0 0 0 ] 6.67429e-11; + h h [ 1 2 -1 0 0 0 0 ] 6.62607e-34; + } + electromagnetic + { + e e [ 0 0 -1 0 0 1 0 ] 1.60218e-19; + } + atomic + { + me me [ 1 0 0 0 0 0 0 ] 9.10938e-31; + mp mp [ 1 0 0 0 0 0 0 ] 1.67262e-27; + } + physicoChemical + { + mu mu [ 1 0 0 0 0 0 0 ] 1.66054e-27; + k k [ 1 2 -2 -1 0 0 0 ] 1.38065e-23; + } + standard + { + //- Standard pressure [Pa] + Pstd Pstd [ 1 -1 -2 0 0 0 0 ] 100000; + //- Standard temperature [degK] + Tstd Tstd [ 0 0 0 1 0 0 0 ] 298.15; + } + } + USCSCoeffs + { + universal + { + c c [ 0 1 -1 0 0 0 0 ] 9.83558e+08; + G G [ -1 3 -2 0 0 0 0 ] 1.06909e-09; + h h [ 1 2 -1 0 0 0 0 ] 1.57234e-32; + } + electromagnetic + { + e e [ 0 0 -1 0 0 1 0 ] 1.60218e-19; + } + atomic + { + me me [ 1 0 0 0 0 0 0 ] 2.00825e-30; + mp mp [ 1 0 0 0 0 0 0 ] 3.68746e-27; + } + physicoChemical + { + mu mu [ 1 0 0 0 0 0 0 ] 3.66083e-27; + k k [ 1 2 -2 -1 0 0 0 ] 1.82012e-22; + } + standard + { + //- Standard pressure [lbm/ft^2] + Pstd Pstd [ 1 -1 -2 0 0 0 0 ] 2088.6; + //- Standard temperature [degR] + Tstd Tstd [ 0 0 0 1 0 0 0 ] 536.67; + } + } } diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 7bff2143ec..6ba6b90cf1 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -1,5 +1,6 @@ global/global.Cver global/dimensionedConstants/dimensionedConstants.C +global/dimensionedConstants/constants/constants.C global/argList/argList.C global/clock/clock.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C new file mode 100644 index 0000000000..943bdc5c38 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "mathConstants.H" +#include "universalConstants.H" +#include "electromagneticConstants.H" +#include "atomicConstants.H" + +#include "dimensionedConstants.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +const char* Foam::constant::atomic::group = "atomic"; + + +const Foam::dimensionedScalar Foam::constant::atomic::alpha +( + dimensionedConstant + ( + group, + "alpha", + dimensionedScalar + ( + "alpha", + sqr(constant::electromagnetic::e) + /( + dimensionedScalar("C", dimless, 2.0) + *constant::electromagnetic::epsilon0 + *constant::universal::h + *constant::universal::c + ) + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::atomic::Rinf +( + dimensionedConstant + ( + group, + "Rinf", + dimensionedScalar + ( + "Rinf", + sqr(alpha)*me*constant::universal::c + /(dimensionedScalar("C", dimless, 2.0)*constant::universal::h) + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::atomic::a0 +( + dimensionedConstant + ( + group, + "a0", + dimensionedScalar + ( + "a0", + alpha + /(dimensionedScalar("C", dimless, 4.0*constant::math::pi)*Rinf) + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::atomic::re +( + dimensionedConstant + ( + group, + "re", + dimensionedScalar + ( + "re", + sqr(constant::electromagnetic::e) + /( + dimensionedScalar("C", dimless, 4.0*constant::math::pi) + *constant::electromagnetic::epsilon0 + *me + *sqr(constant::universal::c) + ) + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::atomic::Eh +( + dimensionedConstant + ( + group, + "Eh", + dimensionedScalar + ( + "Eh", + dimensionedScalar("C", dimless, 2.0) + *Rinf*constant::universal::h*constant::universal::c + ) + ) +); + + +// ************************************************************************* // + + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H new file mode 100644 index 0000000000..c257374441 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Namespace + Foam::constant::atom + +Description + Atomic constants + +\*---------------------------------------------------------------------------*/ + +#ifndef atomicConstants_H +#define atomicConstants_H + +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace constant +{ +namespace atomic +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + //- Group name for atomic constants + extern const char* group; + + //- Fine-structure constant: default SI units: [] + extern const dimensionedScalar alpha; + + //- Rydberg constant: default SI units: [1/m] + extern const dimensionedScalar Rinf; + + //- Bohr radius: default SI units: [m] + extern const dimensionedScalar a0; + + //- Classical electron radius: default SI units: [m] + extern const dimensionedScalar re; + + //- Hartree energy: default SI units: [J] + extern const dimensionedScalar Eh; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace atomic +} // end namespace constant +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/constants.C b/src/OpenFOAM/global/dimensionedConstants/constants/constants.C new file mode 100644 index 0000000000..f921cba983 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/constants.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Collection of dimensioned constants + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Constants supplied in the main controlDict +#include "fundamentalConstants.C" + +// Derived constants +#include "universalConstants.C" +#include "electromagneticConstants.C" +#include "atomicConstants.C" +#include "physicoChemicalConstants.C" + + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/constants.H b/src/OpenFOAM/global/dimensionedConstants/constants/constants.H new file mode 100644 index 0000000000..14ab108667 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/constants.H @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Namespace + Foam::constant + +Description + Collection of constants + +\*---------------------------------------------------------------------------*/ + +#ifndef constants_H +#define constants_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Dimensionless coefficents + +// Mathematical constants +#include "mathConstants.H" + + +// Dimensioned constants + +// Fundamental constants +#include "fundamentalConstants.H" + +// Derived constants +#include "universalConstants.H" +#include "electromagneticConstants.H" +#include "atomicConstants.H" +#include "physicoChemicalConstants.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C new file mode 100644 index 0000000000..77e2fec40c --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "mathConstants.H" +#include "universalConstants.H" +#include "electromagneticConstants.H" +#include "atomicConstants.H" + +#include "dimensionedConstants.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +const char* Foam::constant::electromagnetic::group = "electromagnetic"; + + +const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0 +( + dimensionedConstant + ( + group, + "mu0", + dimensionedScalar + ( + "mu0", + dimless, + 4.0*constant::math::pi*1e-07 + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::electromagnetic::epsilon0 +( + dimensionedConstant + ( + group, + "epsilon0", + dimensionedScalar + ( + "epsilon0", + dimensionedScalar("C", dimless, 1.0) + /(mu0*sqr(constant::universal::c)) + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::electromagnetic::Z0 +( + dimensionedConstant + ( + group, + "Z0", + dimensionedScalar + ( + "Z0", + mu0*constant::universal::c + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::electromagnetic::kappa +( + dimensionedConstant + ( + group, + "kappa", + dimensionedScalar + ( + "kappa", + dimensionedScalar("C", dimless, 1.0/(4.0*constant::math::pi)) + /epsilon0 + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::electromagnetic::G0 +( + dimensionedConstant + ( + group, + "G0", + dimensionedScalar + ( + "G0", + dimensionedScalar("C", dimless, 2)*sqr(e)/constant::universal::h + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::electromagnetic::KJ +( + dimensionedConstant + ( + group, + "KJ", + dimensionedScalar + ( + "KJ", + dimensionedScalar("C", dimless, 2)*e/constant::universal::h + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::electromagnetic::phi0 +( + dimensionedConstant + ( + group, + "phi0", + dimensionedScalar + ( + "phi0", + constant::universal::h/(dimensionedScalar("C", dimless, 2)*e) + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::electromagnetic::RK +( + dimensionedConstant + ( + group, + "RK", + dimensionedScalar + ( + "RK", + constant::universal::h/sqr(e) + ) + ) +); + + +// ************************************************************************* // + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H new file mode 100644 index 0000000000..54586cda47 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Namespace + Foam::constant::em + +Description + Electromagnetic constants + +\*---------------------------------------------------------------------------*/ + +#ifndef electromagneticConstants_H +#define electromagneticConstants_H + +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace constant +{ +namespace electromagnetic +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + //- Group name for electromagnetic constants + extern const char* group; + + //- Magnetic constant/permeability of free space: default SI units: [H/m] + extern const dimensionedScalar mu0; + + //- Electric constant: default SI units: [F/m] + extern const dimensionedScalar epsilon0; + + //- Characteristic impedance of a vacuum: default SI units: [ohm] + extern const dimensionedScalar Z0; + + //- Coulomb constant: default SI units: [N.m2/C2] + extern const dimensionedScalar kappa; + + //- Conductance quantum: default SI units: [S] + extern const dimensionedScalar G0; + + //- Josephson constant: default SI units: [Hz/V] + extern const dimensionedScalar KJ; + + //- Magnetic flux quantum: default SI units: [Wb] + extern const dimensionedScalar phi0; + + //- von Klitzing constant: default SI units: [ohm] + extern const dimensionedScalar RK; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace electromagnetic +} // end namespace constant +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C new file mode 100644 index 0000000000..37e7bf4806 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Fundamental dimensioned constants + +\*---------------------------------------------------------------------------*/ + +#include "fundamentalConstants.H" + +#include "universalConstants.H" +#include "electromagneticConstants.H" +#include "atomicConstants.H" +#include "physicoChemicalConstants.H" + +#include "dimensionedConstants.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Universal constants + +const Foam::dimensionedScalar Foam::constant::universal::c +( + dimensionedConstant(universal::group, "c") +); + + +const Foam::dimensionedScalar Foam::constant::universal::G +( + dimensionedConstant(universal::group, "G") +); + + +const Foam::dimensionedScalar Foam::constant::universal::h +( + dimensionedConstant(universal::group, "h") +); + + +// Electromagnetic + +const Foam::dimensionedScalar Foam::constant::electromagnetic::e +( + dimensionedConstant(electromagnetic::group, "e") +); + + +// Atomic + +const Foam::dimensionedScalar Foam::constant::atomic::me +( + dimensionedConstant(atomic::group, "me") +); + + +const Foam::dimensionedScalar Foam::constant::atomic::mp +( + dimensionedConstant(atomic::group, "mp") +); + + +// Physico-chemical + +const Foam::dimensionedScalar Foam::constant::physicoChemical::mu +( + dimensionedConstant(physicoChemical::group, "mu") +); + + +const Foam::dimensionedScalar Foam::constant::physicoChemical::NA +( +// dimensionedConstant(physicoChemical::group, "NA") + dimensionedConstant + ( + physicoChemical::group, + "NA", + dimensionedScalar + ( + "NA", + dimless/dimMoles, + 6.0221417930e+23 + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::physicoChemical::k +( + dimensionedConstant(physicoChemical::group, "k") +); + + +// Standard + +const Foam::dimensionedScalar Foam::constant::standard::Pstd +( + dimensionedConstant("standard", "Pstd") +); + + +const Foam::dimensionedScalar Foam::constant::standard::Tstd +( + dimensionedConstant("standard", "Tstd") +); + + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H new file mode 100644 index 0000000000..de30291fe8 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Fundamental dimensioned constants + +\*---------------------------------------------------------------------------*/ + +#ifndef fundamentalConstants_H +#define fundamentalConstants_H + +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace constant +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace universal +{ + //- Speed of light in a vacuum + extern const dimensionedScalar c; + + //- Newtonian constant of gravitation + extern const dimensionedScalar G; + + //- Planck constant + extern const dimensionedScalar h; +} + +namespace electromagnetic +{ + //- Elementary charge + extern const dimensionedScalar e; +} + +namespace atomic +{ + //- Electron mass + extern const dimensionedScalar me; + + //- Proton mass + extern const dimensionedScalar mp; +} + +namespace physicoChemical +{ + //- Atomic mass unit + extern const dimensionedScalar mu; + + //- Avagadro number + extern const dimensionedScalar NA; + + //- Boltzmann constant + extern const dimensionedScalar k; +} + +namespace standard +{ + //- Standard pressure + extern const dimensionedScalar Pstd; + + //- Standard temperature + extern const dimensionedScalar Tstd; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace constant +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H new file mode 100644 index 0000000000..f18f97d749 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Namespace + Foam::constant::math + +Description + mathematical constants + +\*---------------------------------------------------------------------------*/ + +#ifndef mathConstants_H +#define mathConstants_H + +#include "scalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace constant +{ +namespace math +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + static word group = "math"; + + const scalar e(M_E); + const scalar pi(M_PI); + const scalar twoPi(2*pi); + const scalar piByTwo(0.5*pi); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace math +} // end namespace constant +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C new file mode 100644 index 0000000000..7446c67d97 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "mathConstants.H" +#include "universalConstants.H" +#include "electromagneticConstants.H" +#include "physicoChemicalConstants.H" + +#include "dimensionedConstants.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +const char* Foam::constant::physicoChemical::group = "physicoChemical"; + + +const Foam::dimensionedScalar Foam::constant::physicoChemical::R +( + dimensionedConstant + ( + group, + "R", + dimensionedScalar + ( + "R", + NA*k + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::physicoChemical::F +( + dimensionedConstant + ( + group, + "F", + dimensionedScalar + ( + "F", + NA*constant::electromagnetic::e + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::physicoChemical::sigma +( + dimensionedConstant + ( + group, + "sigma", + dimensionedScalar + ( + "sigma", + dimensionedScalar("C", dimless, sqr(constant::math::pi)/60.0) + *pow4(k)/(pow3(constant::universal::hr)*sqr(constant::universal::c)) + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::physicoChemical::b +( + dimensionedConstant + ( + group, + "b", + dimensionedScalar + ( + "b", + (constant::universal::h*constant::universal::c/k) + /dimensionedScalar("C", dimless, 4.965114231) + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::physicoChemical::c1 +( + dimensionedConstant + ( + group, + "c1", + dimensionedScalar + ( + "c1", + dimensionedScalar("C", dimless, constant::math::twoPi) + *constant::universal::h*sqr(constant::universal::c) + ) + ) +); + + +const Foam::dimensionedScalar Foam::constant::physicoChemical::c2 +( + dimensionedConstant + ( + group, + "c2", + dimensionedScalar + ( + "c2", + constant::universal::h*constant::universal::c/k + ) + ) +); + + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H new file mode 100644 index 0000000000..28ddd776c8 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Namespace + Foam::constant::phys + +Description + Physico-chemical constants + +\*---------------------------------------------------------------------------*/ + +#ifndef physicoChemicalConstants_H +#define physicoChemicalConstants_H + +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace constant +{ +namespace physicoChemical +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + //- Group name for physico-chemical constants + extern const char* group; + + //- Universal gas constant: default SI units: [J/kg/K] + extern const dimensionedScalar R; + + //- Faraday constant: default SI units: [C/mol] + extern const dimensionedScalar F; + + //- Stefan-Boltzmann constant: default SI units: [W/m2/K4] + extern const dimensionedScalar sigma; + + //- Wien displacement law constant: default SI units: [m.K] + extern const dimensionedScalar b; + + //- First radiation constant: default SI units: [W/m2] + extern const dimensionedScalar c1; + + //- Second radiation constant: default SI units: [m.K] + extern const dimensionedScalar c2; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace physicoChemical +} // end namespace constant +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + + + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C new file mode 100644 index 0000000000..3284c51d4d --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "universalConstants.H" +#include "mathConstants.H" + +#include "dimensionedConstants.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +const char* Foam::constant::universal::group = "universal"; + + +const Foam::dimensionedScalar Foam::constant::universal::hr +( + dimensionedConstant + ( + group, + "hr", + dimensionedScalar + ( + "hr", + h/(dimensionedScalar("C", dimless, constant::math::twoPi)) + ) + ) +); + + +// ************************************************************************* // + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H new file mode 100644 index 0000000000..305e30fe19 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Namespace + Foam::constant::uni + +Description + Universal constants + +\*---------------------------------------------------------------------------*/ + +#ifndef universalConstants_H +#define universalConstants_H + +#include "dimensionedScalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace constant +{ +namespace universal +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + //- Group name for universal constants + extern const char* group; + + //- Reduced Planck constant: default SI units: [J/s] + extern const dimensionedScalar hr; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace universal +} // End namespace constant +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C index a3a9893fde..b9a7d4277b 100644 --- a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C +++ b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C @@ -44,6 +44,25 @@ dictionary& dimensionedConstants() ); } + +dimensionedScalar dimensionedConstant +( + const word& group, + const word& varName +) +{ + dictionary& dict = dimensionedConstants(); + + const word unitSet(dict.lookup("unitSet")); + + dictionary& unitDict(dict.subDict(unitSet + "Coeffs")); + + dictionary& groupDict = unitDict.subDict(group); + + return dimensionedScalar(groupDict.lookup(varName)); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H index 476638dbc7..989089c0b0 100644 --- a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H +++ b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H @@ -40,6 +40,7 @@ SourceFiles #define dimensionedConstants_H #include "dictionary.H" +#include "dimensionedScalar.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,20 +51,42 @@ namespace Foam dictionary& dimensionedConstants(); + +dimensionedScalar dimensionedConstant(const word& group, const word& varName); + + template T dimensionedConstant ( - const char* switchName, - const T defaultValue + const word& group, + const word& varName, + const T& defaultValue ) { - if (dimensionedConstants().found(switchName)) + dictionary& dict = dimensionedConstants(); + + const word unitSet(dict.lookup("unitSet")); + + dictionary& unitDict(dict.subDict(unitSet + "Coeffs")); + + if (unitDict.found(group)) { - return pTraits(dimensionedConstants().lookup(switchName)); + dictionary& groupDict = unitDict.subDict(group); + if (groupDict.found(varName)) + { + return pTraits(groupDict.lookup(varName)); + } + else + { + groupDict.add(varName, defaultValue); + return defaultValue; + } } else { - dimensionedConstants().add(switchName, defaultValue); + unitDict.add(group, dictionary::null); + unitDict.subDict(group).add(varName, defaultValue); + return defaultValue; } }