SinglePhaseMixture.C
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-2018 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  << "Phase list is empty" << exit(FatalError);
37  }
38  else if (this->phaseProps().size() > 1)
39  {
41  << "Only one phase permitted" << exit(FatalError);
42  }
43 
44  switch (this->phaseProps()[0].phase())
45  {
46  case phaseProperties::GAS:
47  {
48  idGas_ = 0;
49  break;
50  }
51  case phaseProperties::LIQUID:
52  {
53  idLiquid_ = 0;
54  break;
55  }
56  case phaseProperties::SOLID:
57  {
58  idSolid_ = 0;
59  break;
60  }
61  default:
62  {
64  << "Unknown phase enumeration" << abort(FatalError);
65  }
66  }
67 }
68 
69 
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 
72 template<class CloudType>
74 (
75  const dictionary& dict,
76  CloudType& owner
77 )
78 :
79  CompositionModel<CloudType>(dict, owner, typeName),
80  idGas_(-1),
81  idLiquid_(-1),
82  idSolid_(-1)
83 {
84  constructIds();
85 }
86 
87 
88 template<class CloudType>
90 (
92 )
93 :
95  idGas_(cm.idGas_),
96  idLiquid_(cm.idLiquid_),
97  idSolid_(cm.idSolid_)
98 {}
99 
100 
101 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
102 
103 template<class CloudType>
105 {}
106 
107 
108 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109 
110 template<class CloudType>
111 const Foam::scalarField&
113 {
114  return this->phaseProps()[0].Y();
115 }
116 
117 
118 template<class CloudType>
120 {
121  return idGas_;
122 }
123 
124 
125 template<class CloudType>
127 {
128  return idLiquid_;
129 }
130 
131 
132 template<class CloudType>
134 {
135  return idSolid_;
136 }
137 
138 
139 // ************************************************************************* //
virtual label idLiquid() const
Liquid id.
dictionary dict
virtual const scalarField & YMixture0() const
Return the list of mixture mass fractions.
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
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
virtual ~SinglePhaseMixture()
Destructor.
SinglePhaseMixture(const dictionary &dict, CloudType &owner)
Construct from dictionary.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
virtual label idSolid() const
Solid id.
Templated parcel single phase, multi-component class.
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:69