phasePair.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) 2014-2018 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::phasePair
28 
29 Description
30 
31 SourceFiles
32  phasePair.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef phasePair_H
37 #define phasePair_H
38 
39 #include "phaseModel.H"
40 #include "phasePairKey.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class phasePair Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class phasePair
53 :
54  public phasePairKey
55 {
56 public:
57 
58  // Hash table types
59 
60  //- Dictionary hash table
62  dictTable;
63 
64  //- Scalar hash table
67 
68 
69 private:
70 
71  // Private data
72 
73  //- Phase 1
74  const phaseModel& phase1_;
75 
76  //- Phase 2
77  const phaseModel& phase2_;
78 
79  //- Gravitational acceleration
81 
82 
83  // Private member functions
84 
85  // Etvos number for given diameter
86  tmp<volScalarField> EoH(const volScalarField& d) const;
87 
88 
89 public:
90 
91  // Constructors
92 
93  //- Construct from two phases and gravity
94  phasePair
95  (
96  const phaseModel& phase1,
97  const phaseModel& phase2,
98  const bool ordered = false
99  );
100 
101 
102  //- Destructor
103  virtual ~phasePair();
104 
105 
106  // Member Functions
107 
108  //- Dispersed phase
109  virtual const phaseModel& dispersed() const;
110 
111  //- Continuous phase
112  virtual const phaseModel& continuous() const;
113 
114  //- Pair name
115  virtual word name() const;
116 
117  //- Other pair name
118  virtual word otherName() const;
119 
120  //- Average density
121  tmp<volScalarField> rho() const;
122 
123  //- Relative velocity magnitude
124  tmp<volScalarField> magUr() const;
125 
126  //- Relative velocity
127  tmp<volVectorField> Ur() const;
128 
129  //- Reynolds number
130  tmp<volScalarField> Re() const;
131 
132  //- Prandtl number
133  tmp<volScalarField> Pr() const;
134 
135  //- Eotvos number
136  tmp<volScalarField> Eo() const;
137 
138  //- Eotvos number based on hydraulic diameter type 1
139  tmp<volScalarField> EoH1() const;
140 
141  //- Eotvos number based on hydraulic diameter type 2
142  tmp<volScalarField> EoH2() const;
143 
144  //- Surface tension coefficient
145  tmp<volScalarField> sigma() const;
146 
147  //- Morton Number
148  tmp<volScalarField> Mo() const;
149 
150  //- Takahashi Number
151  tmp<volScalarField> Ta() const;
152 
153  //- Aspect ratio
154  virtual tmp<volScalarField> E() const;
155 
156  // Access
157 
158  //- Return phase 1
159  inline const phaseModel& phase1() const;
160 
161  //- Return phase 2
162  inline const phaseModel& phase2() const;
163 
164  //- Return true if this phasePair contains the given phase
165  inline bool contains(const phaseModel& phase) const;
166 
167  //- Return the other phase relative to the given phase
168  // Generates a FatalError if this phasePair does not contain
169  // the given phase
170  inline const phaseModel& otherPhase(const phaseModel& phase) const;
171 
172  //- Return the index of the given phase. Generates a FatalError if
173  // this phasePair does not contain the given phase
174  inline label index(const phaseModel& phase) const;
175 
176  //- Return gravitation acceleration
177  inline const uniformDimensionedVectorField& g() const;
178 
179 
180  //- STL const_iterator
181  class const_iterator
182  {
183  // Private data
184 
185  //- Reference to the pair for which this is an iterator
186  const phasePair& pair_;
187 
188  //- Current index
189  label index_;
190 
191  //- Construct an iterator with the given index
192  inline const_iterator(const phasePair&, const label index);
193 
194  public:
195 
196  friend class phasePair;
197 
198  // Constructors
199 
200  //- Construct from pair, moving to its 'begin' position
201  inline explicit const_iterator(const phasePair&);
202 
203 
204  // Access
205 
206  //- Return the current index
207  inline label index() const;
208 
209 
210  // Member operators
211 
212  inline bool operator==(const const_iterator&) const;
213 
214  inline bool operator!=(const const_iterator&) const;
215 
216  inline const phaseModel& operator*() const;
217  inline const phaseModel& operator()() const;
218 
219  inline const phaseModel& otherPhase() const;
220 
221  inline const_iterator& operator++();
222  inline const_iterator operator++(int);
223  };
224 
225 
226  //- const_iterator set to the beginning of the pair
227  inline const_iterator cbegin() const;
228 
229  //- const_iterator set to beyond the end of the pair
230  inline const_iterator cend() const;
231 
232  //- const_iterator set to the beginning of the pair
233  inline const_iterator begin() const;
234 
235  //- const_iterator set to beyond the end of the pair
236  inline const_iterator end() const;
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #include "phasePairI.H"
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #endif
251 
252 // ************************************************************************* //
Foam::phasePair::Pr
tmp< volScalarField > Pr() const
Prandtl number.
Definition: phasePair.C:132
Foam::phaseModel
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:57
Foam::phasePair
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:51
Foam::phasePair::otherName
virtual word otherName() const
Other pair name.
Definition: phasePair.C:100
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::phasePair::const_iterator::operator()
const phaseModel & operator()() const
Definition: phasePairI.H:157
Foam::phasePair::Re
tmp< volScalarField > Re() const
Reynolds number.
Definition: phasePair.C:126
Foam::phasePair::const_iterator
STL const_iterator.
Definition: phasePair.H:180
Foam::phase
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:54
Foam::tmp< volScalarField >
Foam::phasePair::dispersed
virtual const phaseModel & dispersed() const
Dispersed phase.
Definition: phasePair.C:72
Foam::phasePair::Ur
tmp< volVectorField > Ur() const
Relative velocity.
Definition: phasePair.C:120
Foam::phasePair::const_iterator::operator!=
bool operator!=(const const_iterator &) const
Definition: phasePairI.H:134
Foam::phasePair::cbegin
const_iterator cbegin() const
const_iterator set to the beginning of the pair
Definition: phasePairI.H:194
Foam::phasePair::sigma
tmp< volScalarField > sigma() const
Surface tension coefficient.
Definition: phasePair.C:170
Foam::phasePair::index
label index(const phaseModel &phase) const
Return the index of the given phase. Generates a FatalError if.
Definition: phasePairI.H:72
Foam::phasePair::Ta
tmp< volScalarField > Ta() const
Takahashi Number.
Definition: phasePair.C:194
Foam::phasePair::const_iterator::operator++
const_iterator & operator++()
Definition: phasePairI.H:178
Foam::phasePair::g
const uniformDimensionedVectorField & g() const
Return gravitation acceleration.
Definition: phasePairI.H:93
Foam::UniformDimensionedField< vector >
Foam::phasePair::const_iterator::operator*
const phaseModel & operator*() const
Definition: phasePairI.H:143
Foam::phasePair::const_iterator::operator==
bool operator==(const const_iterator &) const
Definition: phasePairI.H:125
Foam::phasePairKey
Definition: phasePairKey.H:59
Foam::phasePair::Eo
tmp< volScalarField > Eo() const
Eotvos number.
Definition: phasePair.C:142
Foam::phasePair::contains
bool contains(const phaseModel &phase) const
Return true if this phasePair contains the given phase.
Definition: phasePairI.H:42
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::phasePair::scalarTable
HashTable< scalar, phasePairKey, phasePairKey::hash > scalarTable
Scalar hash table.
Definition: phasePair.H:65
Foam::phasePairKey::ordered
bool ordered() const
Return the ordered flag.
Definition: phasePairKey.C:60
Foam::phasePair::rho
tmp< volScalarField > rho() const
Average density.
Definition: phasePair.C:108
Foam::HashTable
A HashTable similar to std::unordered_map.
Definition: HashTable.H:105
uniformDimensionedFields.H
phasePairI.H
Foam::phasePair::const_iterator::index
label index() const
Return the current index.
Definition: phasePairI.H:118
Foam::phasePair::~phasePair
virtual ~phasePair()
Destructor.
Definition: phasePair.C:66
Foam::phasePair::cend
const_iterator cend() const
const_iterator set to beyond the end of the pair
Definition: phasePairI.H:200
Foam::phasePair::dictTable
HashTable< dictionary, phasePairKey, phasePairKey::hash > dictTable
Dictionary hash table.
Definition: phasePair.H:61
Foam::phasePair::name
virtual word name() const
Pair name.
Definition: phasePair.C:92
Foam::phasePair::end
const_iterator end() const
const_iterator set to beyond the end of the pair
Definition: phasePairI.H:212
Foam::phasePair::phase2
const phaseModel & phase2() const
Return phase 2.
Definition: phasePairI.H:36
Foam::phasePair::E
virtual tmp< volScalarField > E() const
Aspect ratio.
Definition: phasePair.C:200
Foam::phasePair::magUr
tmp< volScalarField > magUr() const
Relative velocity magnitude.
Definition: phasePair.C:114
Foam::phasePair::Mo
tmp< volScalarField > Mo() const
Morton Number.
Definition: phasePair.C:180
Foam::phasePair::const_iterator::otherPhase
const phaseModel & otherPhase() const
Definition: phasePairI.H:164
Foam::phasePair::phase1
const phaseModel & phase1() const
Return phase 1.
Definition: phasePairI.H:30
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::phasePair::otherPhase
const phaseModel & otherPhase(const phaseModel &phase) const
Return the other phase relative to the given phase.
Definition: phasePairI.H:49
Foam::phasePair::begin
const_iterator begin() const
const_iterator set to the beginning of the pair
Definition: phasePairI.H:206
Foam::phasePair::continuous
virtual const phaseModel & continuous() const
Continuous phase.
Definition: phasePair.C:82
Foam::phasePair::EoH2
tmp< volScalarField > EoH2() const
Eotvos number based on hydraulic diameter type 2.
Definition: phasePair.C:159
Foam::phasePair::EoH1
tmp< volScalarField > EoH1() const
Eotvos number based on hydraulic diameter type 1.
Definition: phasePair.C:148
Foam::phasePair::phasePair
phasePair(const phaseModel &phase1, const phaseModel &phase2, const bool ordered=false)
Construct from two phases and gravity.
Definition: phasePair.C:51