1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "reducedUnits.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 const Foam::scalar Foam::reducedUnits::kb = 1.3806504e-23;
34 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
36 void Foam::reducedUnits::calcRefValues()
41 || refLength_ < VSMALL
45 FatalErrorIn("Foam::reducedUnits::calcRefValues() ")
46 << "One of more referencence values too small for floating point "
48 << "refTime_ = " << refTime_
49 << ", refLength = " << refTemp_
50 << ", refMass = " << refMass_
51 << nl << abort(FatalError);
54 refEnergy_ = refLength_*refLength_*refMass_/(refTime_*refTime_);
56 refTemp_ = refEnergy_ / kb;
58 refForce_ = refEnergy_/refLength_;
60 refVelocity_ = Foam::sqrt(refEnergy_/refMass_);
62 refVolume_ = Foam::pow(refLength_,3.0);
64 refPressure_ = refEnergy_/refVolume_;
66 refMassDensity_ = refMass_/refVolume_;
68 refNumberDensity_ = 1.0/refVolume_;
72 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
74 Foam::reducedUnits::reducedUnits()
78 refMass_(1.660538782e-27)
84 Foam::reducedUnits::reducedUnits
91 refLength_(refLength),
99 Foam::reducedUnits::reducedUnits(const IOdictionary& reducedUnitsDict)
105 setRefValues(reducedUnitsDict);
109 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
111 Foam::reducedUnits::~reducedUnits()
115 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
117 void Foam::reducedUnits::setRefValues
124 refLength_ = refLength;
134 void Foam::reducedUnits::setRefValues
136 const IOdictionary& reducedUnitsDict
139 refLength_ = readScalar(reducedUnitsDict.lookup("refLength"));
141 refTime_ = readScalar(reducedUnitsDict.lookup("refTime"));
143 refMass_ = readScalar(reducedUnitsDict.lookup("refMass"));
149 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
151 void Foam::reducedUnits::operator=(const reducedUnits& rhs)
153 // Check for assignment to self
158 "Foam::reducedUnits::operator=(const Foam::reducedUnits&)"
159 ) << "Attempted assignment to self"
160 << abort(FatalError);
165 // ************************************************************************* //