reducedUnits.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::reducedUnits
28 
29 Description
30 
31 SourceFiles
32  reducedUnitsI.H
33  reducedUnits.C
34  reducedUnitsIO.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef reducedUnits_H
39 #define reducedUnits_H
40 
41 #include "scalar.H"
42 #include "IOdictionary.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declarations
50 
51 class reducedUnits;
52 
53 Ostream& operator<<(Ostream&, const reducedUnits&);
54 
55 
56 /*---------------------------------------------------------------------------*\
57  Class reducedUnits Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class reducedUnits
61 {
62  // Private data
63 
64  // Fundamental values
65 
66  scalar refLength_;
67 
68  scalar refTime_;
69 
70  scalar refMass_;
71 
72  // Derived values
73 
74  scalar refEnergy_;
75 
76  scalar refTemp_;
77 
78  scalar refForce_;
79 
80  scalar refVelocity_;
81 
82  scalar refVolume_;
83 
84  scalar refPressure_;
85 
86  scalar refMassDensity_;
87 
88  scalar refNumberDensity_;
89 
90 
91  // Private Member Functions
92 
93  void calcRefValues();
94 
95 
96 public:
97 
98  // Static data members
99 
100  //- Static data someStaticData
101  static const scalar kb;
102 
103 
104  // Constructors
105 
106  //- Construct with no argument, uses default values:
107  // length = 1nm
108  // mass = 1.660538782e-27kg (unified atomic mass unit)
109  // temperature = 1K (therefore, energy = 1*kb)
110  reducedUnits();
111 
112  //- Construct from components
114  (
115  scalar refLength,
116  scalar refTime,
117  scalar refMass
118  );
119 
120  //- Construct from dictionary
121  reducedUnits(const IOdictionary& reducedUnitsDict);
122 
123 
124  //- Destructor
125  ~reducedUnits() = default;
126 
127 
128  // Member Functions
129 
130  void setRefValues
131  (
132  scalar refLength,
133  scalar refTime,
134  scalar refMass
135  );
136 
137  void setRefValues(const IOdictionary& reducedUnitsDict);
138 
139 
140  // Access
141 
142  inline scalar refLength() const;
143 
144  inline scalar refTime() const;
145 
146  inline scalar refMass() const;
147 
148  inline scalar refTemp() const;
149 
150  inline scalar refEnergy() const;
151 
152  inline scalar refForce() const;
153 
154  inline scalar refVelocity() const;
155 
156  inline scalar refVolume() const;
157 
158  inline scalar refPressure() const;
159 
160  inline scalar refMassDensity() const;
161 
162  inline scalar refNumberDensity() const;
163 
164 
165  // IOstream Operators
166 
167  friend Ostream& operator<<(Ostream&, const reducedUnits&);
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #include "reducedUnitsI.H"
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::reducedUnits::reducedUnits
reducedUnits()
Construct with no argument, uses default values:
Definition: reducedUnits.C:75
Foam::reducedUnits::refPressure
scalar refPressure() const
Definition: reducedUnitsI.H:78
Foam::reducedUnits::refMass
scalar refMass() const
Definition: reducedUnitsI.H:42
Foam::reducedUnits::operator<<
friend Ostream & operator<<(Ostream &, const reducedUnits &)
Foam::reducedUnits::refForce
scalar refForce() const
Definition: reducedUnitsI.H:60
Foam::reducedUnits::refVelocity
scalar refVelocity() const
Definition: reducedUnitsI.H:66
Foam::reducedUnits::refNumberDensity
scalar refNumberDensity() const
Definition: reducedUnitsI.H:90
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::reducedUnits::refTime
scalar refTime() const
Definition: reducedUnitsI.H:36
Foam::reducedUnits::refLength
scalar refLength() const
Definition: reducedUnitsI.H:30
Foam::reducedUnits::~reducedUnits
~reducedUnits()=default
Destructor.
scalar.H
Foam::reducedUnits::refVolume
scalar refVolume() const
Definition: reducedUnitsI.H:72
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::reducedUnits::refMassDensity
scalar refMassDensity() const
Definition: reducedUnitsI.H:84
Foam::reducedUnits::refTemp
scalar refTemp() const
Definition: reducedUnitsI.H:48
IOdictionary.H
Foam::reducedUnits::setRefValues
void setRefValues(scalar refLength, scalar refTime, scalar refMass)
Definition: reducedUnits.C:113
Foam::reducedUnits::refEnergy
scalar refEnergy() const
Definition: reducedUnitsI.H:54
Foam::reducedUnits::kb
static const scalar kb
Static data someStaticData.
Definition: reducedUnits.H:100
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::reducedUnits
Definition: reducedUnits.H:59
reducedUnitsI.H