initial commit of updated dimensioned constants

This commit is contained in:
andy
2009-08-28 15:23:01 +01:00
parent 6e527c58d0
commit 243bff1a55
17 changed files with 1310 additions and 32 deletions

View File

@ -877,34 +877,68 @@ OptimisationSwitches
DimensionedConstants DimensionedConstants
{ {
// SI units unitSet SI; // USCS
//- Universal gas constant [J/(kmol K)] SICoeffs
R 8314.51; {
universal
//- Standard pressure [Pa] {
Pstd 1.0e5; c c [ 0 1 -1 0 0 0 0 ] 2.99792e+08;
G G [ -1 3 -2 0 0 0 0 ] 6.67429e-11;
//- Standard temperature [K] h h [ 1 2 -1 0 0 0 0 ] 6.62607e-34;
Tstd 298.15; }
electromagnetic
//- Stefan-Boltzmann constant [J/(K4 m2 s)] {
sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 5.670e-08; e e [ 0 0 -1 0 0 1 0 ] 1.60218e-19;
}
/* USCS units atomic
{
//- Universal gas constant [lbm ft2/(s2 kmol R)] me me [ 1 0 0 0 0 0 0 ] 9.10938e-31;
R 3406.78; mp mp [ 1 0 0 0 0 0 0 ] 1.67262e-27;
}
//- Standard pressure [lbm/(ft2)] physicoChemical
Pstd 2088.6; {
mu mu [ 1 0 0 0 0 0 0 ] 1.66054e-27;
//- Standard temperature [degR] k k [ 1 2 -2 -1 0 0 0 ] 1.38065e-23;
Tstd 536.67; }
standard
//- Stefan-Boltzmann constant [lbm /(degR4 ft s)] {
sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 8.2292e-08; //- 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;
}
}
} }

View File

@ -1,5 +1,6 @@
global/global.Cver global/global.Cver
global/dimensionedConstants/dimensionedConstants.C global/dimensionedConstants/dimensionedConstants.C
global/dimensionedConstants/constants/constants.C
global/argList/argList.C global/argList/argList.C
global/clock/clock.C global/clock/clock.C

View File

@ -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
)
)
);
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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"
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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)
)
)
);
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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")
);
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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
)
)
);
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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))
)
)
);
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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 } // End namespace Foam

View File

@ -40,6 +40,7 @@ SourceFiles
#define dimensionedConstants_H #define dimensionedConstants_H
#include "dictionary.H" #include "dictionary.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,20 +51,42 @@ namespace Foam
dictionary& dimensionedConstants(); dictionary& dimensionedConstants();
dimensionedScalar dimensionedConstant(const word& group, const word& varName);
template<class T> template<class T>
T dimensionedConstant T dimensionedConstant
( (
const char* switchName, const word& group,
const T defaultValue 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<T>(dimensionedConstants().lookup(switchName)); dictionary& groupDict = unitDict.subDict(group);
if (groupDict.found(varName))
{
return pTraits<T>(groupDict.lookup(varName));
}
else
{
groupDict.add(varName, defaultValue);
return defaultValue;
}
} }
else else
{ {
dimensionedConstants().add(switchName, defaultValue); unitDict.add(group, dictionary::null);
unitDict.subDict(group).add(varName, defaultValue);
return defaultValue; return defaultValue;
} }
} }