reducedUnits.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  Foam::reducedUnits
26 
27 Description
28 
29 SourceFiles
30  reducedUnitsI.H
31  reducedUnits.C
32  reducedUnitsIO.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef reducedUnits_H
37 #define reducedUnits_H
38 
39 #include "scalar.H"
40 #include "IOdictionary.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of friend functions and operators
48 
49 class reducedUnits;
50 
51 Ostream& operator<<(Ostream&, const reducedUnits&);
52 
53 
54 /*---------------------------------------------------------------------------*\
55  Class reducedUnits Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class reducedUnits
59 {
60  // Private data
61 
62  // Reduced units
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  //- Disallow default bitwise copy construct
96  reducedUnits(const reducedUnits&);
97 
98  //- Disallow default bitwise assignment
99  void operator=(const reducedUnits&);
100 
101 
102 public:
103 
104  // Static data members
105 
106  //- Static data someStaticData
107  static const scalar kb;
108 
109 
110  // Constructors
111 
112  //- Construct with no argument, uses default values:
113  // length = 1nm
114  // mass = 1.660538782e-27kg (unified atomic mass unit)
115  // temperature = 1K (therefore, energy = 1*kb)
116  reducedUnits();
117 
118  //- Construct from components
120  (
121  scalar refLength,
122  scalar refTime,
123  scalar refMass
124  );
125 
126  //- Construct from dictionary
127  reducedUnits(const IOdictionary& reducedUnitsDict);
128 
129 
130  //- Destructor
131  ~reducedUnits();
132 
133 
134  // Member Functions
135 
136  void setRefValues
137  (
138  scalar refLength,
139  scalar refTime,
140  scalar refMass
141  );
142 
143  void setRefValues(const IOdictionary& reducedUnitsDict);
144 
145 
146  // Access
147 
148  inline scalar refLength() const;
149 
150  inline scalar refTime() const;
151 
152  inline scalar refMass() const;
153 
154  inline scalar refTemp() const;
155 
156  inline scalar refEnergy() const;
157 
158  inline scalar refForce() const;
159 
160  inline scalar refVelocity() const;
161 
162  inline scalar refVolume() const;
163 
164  inline scalar refPressure() const;
165 
166  inline scalar refMassDensity() const;
167 
168  inline scalar refNumberDensity() const;
169 
170 
171  // IOstream Operators
172 
173  friend Ostream& operator<<(Ostream&, const reducedUnits&);
174 };
175 
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #include "reducedUnitsI.H"
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
scalar refLength() const
Definition: reducedUnitsI.H:28
scalar refEnergy() const
Definition: reducedUnitsI.H:52
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
scalar refTime() const
Definition: reducedUnitsI.H:34
scalar refNumberDensity() const
Definition: reducedUnitsI.H:88
scalar refVolume() const
Definition: reducedUnitsI.H:70
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
scalar refMass() const
Definition: reducedUnitsI.H:40
scalar refTemp() const
Definition: reducedUnitsI.H:46
reducedUnits()
Construct with no argument, uses default values:
Definition: reducedUnits.C:73
~reducedUnits()
Destructor.
Definition: reducedUnits.C:110
scalar refForce() const
Definition: reducedUnitsI.H:58
static const scalar kb
Static data someStaticData.
Definition: reducedUnits.H:106
void setRefValues(scalar refLength, scalar refTime, scalar refMass)
Definition: reducedUnits.C:117
Ostream & operator<<(Ostream &, const ensightPart &)
scalar refVelocity() const
Definition: reducedUnitsI.H:64
friend Ostream & operator<<(Ostream &, const reducedUnits &)
Namespace for OpenFOAM.
scalar refPressure() const
Definition: reducedUnitsI.H:76
scalar refMassDensity() const
Definition: reducedUnitsI.H:82