FreeFOAM The Cross-Platform CFD Toolkit
SinglePhaseMixture.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
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 "SinglePhaseMixture.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 template<class CloudType>
32 {
33  if (this->phaseProps().size() == 0)
34  {
36  (
37  "void Foam::SinglePhaseMixture<CloudType>::constructIds()"
38  ) << "Phase list is empty" << nl << exit(FatalError);
39  }
40  else if (this->phaseProps().size() > 1)
41  {
43  (
44  "void Foam::SinglePhaseMixture<CloudType>::constructIds()"
45  ) << "Only one phase permitted" << nl << exit(FatalError);
46  }
47 
48  switch (this->phaseProps()[0].phase())
49  {
50  case phaseProperties::GAS:
51  {
52  idGas_ = 0;
53  break;
54  }
55  case phaseProperties::LIQUID:
56  {
57  idLiquid_ = 0;
58  break;
59  }
60  case phaseProperties::SOLID:
61  {
62  idSolid_ = 0;
63  break;
64  }
65  default:
66  {
68  (
69  "void Foam::SinglePhaseMixture<CloudType>::constructIds()"
70  ) << "Unknown phase enumeration" << nl << abort(FatalError);
71  }
72  }
73 }
74 
75 
76 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
77 
78 template<class CloudType>
80 (
81  const dictionary& dict,
82  CloudType& owner
83 )
84 :
85  CompositionModel<CloudType>(dict, owner, typeName),
86  idGas_(-1),
87  idLiquid_(-1),
88  idSolid_(-1)
89 {
90  constructIds();
91 }
92 
93 
94 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
95 
96 template<class CloudType>
98 {}
99 
100 
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102 
103 template<class CloudType>
104 const Foam::scalarField&
106 {
108  (
109  "const Foam::scalarField& "
110  "Foam::SinglePhaseMixture<CloudType>::YGas0() const"
111  );
112  return this->phaseProps()[0].Y();
113 }
114 
115 
116 template<class CloudType>
117 const Foam::scalarField&
119 {
121  (
122  "const Foam::scalarField& "
123  "Foam::SinglePhaseMixture<CloudType>::YLiquid0() const"
124  );
125  return this->phaseProps()[0].Y();
126 }
127 
128 
129 template<class CloudType>
130 const Foam::scalarField&
132 {
134  (
135  "const Foam::scalarField& "
136  "Foam::SinglePhaseMixture<CloudType>::YSolid0() const"
137  );
138  return this->phaseProps()[0].Y();
139 }
140 
141 
142 template<class CloudType>
143 const Foam::scalarField&
145 {
146  return this->phaseProps()[0].Y();
147 }
148 
149 
150 template<class CloudType>
152 {
153  return idGas_;
154 }
155 
156 
157 template<class CloudType>
159 {
160  return idLiquid_;
161 }
162 
163 
164 template<class CloudType>
166 {
167  return idSolid_;
168 }
169 
170 
171 // ************************ vim: set sw=4 sts=4 et: ************************ //
172