phaseInterfaceI.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) 2021-2022 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 \*---------------------------------------------------------------------------*/
25 
26 #include "phaseInterface.H"
27 
28 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
31 {
32  return phase1_;
33 }
34 
35 
37 {
38  return phase2_;
39 }
40 
41 
42 inline bool Foam::phaseInterface::contains(const phaseModel& phase) const
43 {
44  return &phase1_ == &phase || & phase2_ == &phase;
45 }
46 
47 
49 (
50  const phaseModel& phase
51 ) const
52 {
53  if (&phase1_ == &phase)
54  {
55  return phase2_;
56  }
57  else if (&phase2_ == &phase)
58  {
59  return phase1_;
60  }
61  else
62  {
64  << "this phaseInterface does not contain phase " << phase.name()
65  << exit(FatalError);
66 
67  return phase;
68  }
69 }
70 
71 
73 {
74  if (&phase1_ == &phase)
75  {
76  return 0;
77  }
78  else if (&phase2_ == &phase)
79  {
80  return 1;
81  }
82  else
83  {
85  << "this phaseInterface does not contain phase " << phase.name()
86  << exit(FatalError);
87 
88  return -1;
89  }
90 }
91 
92 
94 {
95  return phase1().fluid();
96 }
97 
98 
100 {
101  return phase1().mesh();
102 }
103 
104 
107 {
108  return g_;
109 }
110 
111 
112 // * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
113 
114 inline Foam::phaseInterface::const_iterator::const_iterator
115 (
116  const phaseInterface& pair,
117  const label index
118 )
119 :
120  pair_(pair),
121  index_(index)
122 {}
123 
124 
125 inline Foam::phaseInterface::const_iterator::const_iterator
126 (
127  const phaseInterface& pair
128 )
129 :
130  const_iterator(pair, 0)
131 {}
132 
133 
135 {
136  return index_;
137 }
138 
139 
140 inline bool Foam::phaseInterface::const_iterator::operator==
141 (
142  const const_iterator& iter
143 ) const
144 {
145  return (this->index_ == iter.index_);
146 }
147 
148 
149 inline bool Foam::phaseInterface::const_iterator::operator!=
150 (
151  const const_iterator& iter
152 ) const
153 {
154  return !(this->operator==(iter));
155 }
156 
157 
158 inline const Foam::phaseModel&
160 {
161  if (index_ == 0)
162  {
163  return pair_.phase1_;
164  }
165  else
166  {
167  return pair_.phase2_;
168  }
169 }
170 
171 
172 inline const Foam::phaseModel&
174 {
175  return operator*();
176 }
177 
178 
179 inline const Foam::phaseModel&
181 {
182  if (index_ == 0)
183  {
184  return pair_.phase2_;
185  }
186  else
187  {
188  return pair_.phase1_;
189  }
190 }
191 
192 
195 {
196  index_++;
197  return *this;
198 }
199 
200 
203 {
204  const_iterator old = *this;
205  this->operator++();
206  return old;
207 }
208 
209 
211 {
212  return const_iterator(*this);
213 }
214 
215 
217 {
218  return const_iterator(*this, 2);
219 }
220 
221 
223 {
224  return const_iterator(*this);
225 }
226 
227 
229 {
230  return const_iterator(*this, 2);
231 }
232 
233 
234 // ************************************************************************* //
tmp< fvMatrix< Type > > operator*(const volScalarField::Internal &, const fvMatrix< Type > &)
const uniformDimensionedVectorField & g() const
Return gravitational acceleration.
const fvMesh & mesh() const
Return the mesh.
const_iterator begin() const
const_iterator set to the beginning of the pair
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
label index() const
Return the current index.
const_iterator cend() const
const_iterator set to beyond the end of the pair
const word & name() const
Definition: phaseModel.H:110
const phaseModel & phase1() const
Return phase 1.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
const phaseModel & operator()() const
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:68
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
const Mesh & mesh() const
Return mesh.
const phaseModel & otherPhase() const
const phaseModel & phase2() const
Return phase 2.
const phaseSystem & fluid() const
Return the phase system.
bool contains(const phaseModel &phase) const
Return true if this phaseInterface contains the given phase.
const phaseSystem & fluid() const
Return the system to which this phase belongs.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
label index(const phaseModel &phase) const
Return the index of the given phase. Generates a FatalError if.
const phaseModel & operator*() const
const_iterator cbegin() const
const_iterator set to the beginning of the pair
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:53
const_iterator end() const
const_iterator set to beyond the end of the pair
const phaseModel & otherPhase(const phaseModel &phase) const
Return the other phase relative to the given phase.