Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <molecule/reducedUnits.H>
00027
00028
00029
00030 const Foam::scalar Foam::reducedUnits::kb = 1.3806504e-23;
00031
00032
00033
00034
00035 void Foam::reducedUnits::calcRefValues()
00036 {
00037 if
00038 (
00039 refTime_ < VSMALL
00040 || refLength_ < VSMALL
00041 || refMass_ < VSMALL
00042 )
00043 {
00044 FatalErrorIn("Foam::reducedUnits::calcRefValues() ")
00045 << "One of more referencence values too small for floating point "
00046 << "calculation: "
00047 << "refTime_ = " << refTime_
00048 << ", refLength = " << refTemp_
00049 << ", refMass = " << refMass_
00050 << nl << abort(FatalError);
00051 }
00052
00053 refEnergy_ = refLength_*refLength_*refMass_/(refTime_*refTime_);
00054
00055 refTemp_ = refEnergy_ / kb;
00056
00057 refForce_ = refEnergy_/refLength_;
00058
00059 refVelocity_ = Foam::sqrt(refEnergy_/refMass_);
00060
00061 refVolume_ = Foam::pow(refLength_,3.0);
00062
00063 refPressure_ = refEnergy_/refVolume_;
00064
00065 refMassDensity_ = refMass_/refVolume_;
00066
00067 refNumberDensity_ = 1.0/refVolume_;
00068 }
00069
00070
00071
00072
00073 Foam::reducedUnits::reducedUnits()
00074 :
00075 refLength_(1e-9),
00076 refTime_(1e-12),
00077 refMass_(1.660538782e-27)
00078 {
00079 calcRefValues();
00080 }
00081
00082
00083 Foam::reducedUnits::reducedUnits
00084 (
00085 scalar refLength,
00086 scalar refTime,
00087 scalar refMass
00088 )
00089 :
00090 refLength_(refLength),
00091 refTime_(refTime),
00092 refMass_(refMass)
00093 {
00094 calcRefValues();
00095 }
00096
00097
00098 Foam::reducedUnits::reducedUnits(const IOdictionary& reducedUnitsDict)
00099 :
00100 refLength_(),
00101 refTime_(),
00102 refMass_()
00103 {
00104 setRefValues(reducedUnitsDict);
00105 }
00106
00107
00108
00109
00110 Foam::reducedUnits::~reducedUnits()
00111 {}
00112
00113
00114
00115
00116 void Foam::reducedUnits::setRefValues
00117 (
00118 scalar refLength,
00119 scalar refTime,
00120 scalar refMass
00121 )
00122 {
00123 refLength_ = refLength;
00124
00125 refTime_ = refTime;
00126
00127 refMass_ = refMass;
00128
00129 calcRefValues();
00130 }
00131
00132
00133 void Foam::reducedUnits::setRefValues
00134 (
00135 const IOdictionary& reducedUnitsDict
00136 )
00137 {
00138 refLength_ = readScalar(reducedUnitsDict.lookup("refLength"));
00139
00140 refTime_ = readScalar(reducedUnitsDict.lookup("refTime"));
00141
00142 refMass_ = readScalar(reducedUnitsDict.lookup("refMass"));
00143
00144 calcRefValues();
00145 }
00146
00147
00148
00149
00150 void Foam::reducedUnits::operator=(const reducedUnits& rhs)
00151 {
00152
00153 if (this == &rhs)
00154 {
00155 FatalErrorIn
00156 (
00157 "Foam::reducedUnits::operator=(const Foam::reducedUnits&)"
00158 ) << "Attempted assignment to self"
00159 << abort(FatalError);
00160 }
00161 }
00162
00163
00164