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-2020 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 
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  //- Disallow default bitwise copy construction
124  reducedUnits(const reducedUnits&) = delete;
125 
126 
127  //- Destructor
128  ~reducedUnits();
129 
130 
131  // Member Functions
132 
133  void setRefValues
134  (
135  scalar refLength,
136  scalar refTime,
137  scalar refMass
138  );
139 
140  void setRefValues(const IOdictionary& reducedUnitsDict);
141 
142 
143  // Access
144 
145  inline scalar refLength() const;
146 
147  inline scalar refTime() const;
148 
149  inline scalar refMass() const;
150 
151  inline scalar refTemp() const;
152 
153  inline scalar refEnergy() const;
154 
155  inline scalar refForce() const;
156 
157  inline scalar refVelocity() const;
158 
159  inline scalar refVolume() const;
160 
161  inline scalar refPressure() const;
162 
163  inline scalar refMassDensity() const;
164 
165  inline scalar refNumberDensity() const;
166 
167 
168  // Member Operators
169 
170  //- Disallow default bitwise assignment
171  void operator=(const reducedUnits&) = delete;
172 
173 
174  // IOstream Operators
175 
176  friend Ostream& operator<<(Ostream&, const reducedUnits&);
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #include "reducedUnitsI.H"
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
void operator=(const reducedUnits &)=delete
Disallow default bitwise assignment.
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:53
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:54
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:100
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