1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "reducedUnits.H"
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 const Foam::scalar Foam::reducedUnits::kb = 1.3806504e-23;
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35 void Foam::reducedUnits::calcRefValues()
40 || refLength_ < VSMALL
44 FatalErrorIn("Foam::reducedUnits::calcRefValues() ")
45 << "One of more referencence values too small for floating point "
47 << "refTime_ = " << refTime_
48 << ", refLength = " << refTemp_
49 << ", refMass = " << refMass_
50 << nl << abort(FatalError);
53 refEnergy_ = refLength_*refLength_*refMass_/(refTime_*refTime_);
55 refTemp_ = refEnergy_ / kb;
57 refForce_ = refEnergy_/refLength_;
59 refVelocity_ = Foam::sqrt(refEnergy_/refMass_);
61 refVolume_ = Foam::pow(refLength_,3.0);
63 refPressure_ = refEnergy_/refVolume_;
65 refMassDensity_ = refMass_/refVolume_;
67 refNumberDensity_ = 1.0/refVolume_;
71 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
73 Foam::reducedUnits::reducedUnits()
77 refMass_(1.660538782e-27)
83 Foam::reducedUnits::reducedUnits
90 refLength_(refLength),
98 Foam::reducedUnits::reducedUnits(const IOdictionary& reducedUnitsDict)
104 setRefValues(reducedUnitsDict);
108 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
110 Foam::reducedUnits::~reducedUnits()
114 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
116 void Foam::reducedUnits::setRefValues
123 refLength_ = refLength;
133 void Foam::reducedUnits::setRefValues
135 const IOdictionary& reducedUnitsDict
138 refLength_ = readScalar(reducedUnitsDict.lookup("refLength"));
140 refTime_ = readScalar(reducedUnitsDict.lookup("refTime"));
142 refMass_ = readScalar(reducedUnitsDict.lookup("refMass"));
148 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
150 void Foam::reducedUnits::operator=(const reducedUnits& rhs)
152 // Check for assignment to self
157 "Foam::reducedUnits::operator=(const Foam::reducedUnits&)"
158 ) << "Attempted assignment to self"
159 << abort(FatalError);
164 // ************************************************************************* //