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) 2011-2015 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 "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" << exit(FatalError);
39  }
40  else if (this->phaseProps().size() > 1)
41  {
43  (
44  "void Foam::SinglePhaseMixture<CloudType>::constructIds()"
45  ) << "Only one phase permitted" << 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" << 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 template<class CloudType>
96 (
98 )
99 :
101  idGas_(cm.idGas_),
102  idLiquid_(cm.idLiquid_),
103  idSolid_(cm.idSolid_)
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
108 
109 template<class CloudType>
111 {}
112 
113 
114 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115 
116 template<class CloudType>
117 const Foam::scalarField&
119 {
120  return this->phaseProps()[0].Y();
121 }
122 
123 
124 template<class CloudType>
126 {
127  return idGas_;
128 }
129 
130 
131 template<class CloudType>
133 {
134  return idLiquid_;
135 }
136 
137 
138 template<class CloudType>
140 {
141  return idSolid_;
142 }
143 
144 
145 // ************************************************************************* //
virtual label idGas() const
Gas id.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
SinglePhaseMixture(const dictionary &dict, CloudType &owner)
Construct from dictionary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dictionary dict
virtual label idLiquid() const
Liquid id.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
virtual const scalarField & YMixture0() const
Return the list of mixture mass fractions.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
virtual ~SinglePhaseMixture()
Destructor.
error FatalError
Templated reacting parcel composition model class Consists of carrier species (via thermo package)...
Definition: ReactingCloud.H:52
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
virtual label idSolid() const
Solid id.
Templated parcel single phase, multi-component class.