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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 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 \*---------------------------------------------------------------------------*/
27 
28 #include "SinglePhaseMixture.H"
29 
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 
32 template<class CloudType>
34 {
35  if (this->phaseProps().size() == 0)
36  {
38  << "Phase list is empty" << exit(FatalError);
39  }
40  else if (this->phaseProps().size() > 1)
41  {
43  << "Only one phase permitted" << exit(FatalError);
44  }
45 
46  switch (this->phaseProps()[0].phase())
47  {
48  case phaseProperties::GAS:
49  {
50  idGas_ = 0;
51  break;
52  }
53  case phaseProperties::LIQUID:
54  {
55  idLiquid_ = 0;
56  break;
57  }
58  case phaseProperties::SOLID:
59  {
60  idSolid_ = 0;
61  break;
62  }
63  default:
64  {
66  << "Unknown phase enumeration" << abort(FatalError);
67  }
68  }
69 }
70 
71 
72 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
73 
74 template<class CloudType>
76 (
77  const dictionary& dict,
78  CloudType& owner
79 )
80 :
81  CompositionModel<CloudType>(dict, owner, typeName),
82  idGas_(-1),
83  idLiquid_(-1),
84  idSolid_(-1)
85 {
86  constructIds();
87 }
88 
89 
90 template<class CloudType>
92 (
94 )
95 :
97  idGas_(cm.idGas_),
98  idLiquid_(cm.idLiquid_),
99  idSolid_(cm.idSolid_)
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
104 
105 template<class CloudType>
107 {}
108 
109 
110 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111 
112 template<class CloudType>
113 const Foam::scalarField&
115 {
116  return this->phaseProps()[0].Y();
117 }
118 
119 
120 template<class CloudType>
122 {
123  return idGas_;
124 }
125 
126 
127 template<class CloudType>
129 {
130  return idLiquid_;
131 }
132 
133 
134 template<class CloudType>
136 {
137  return idSolid_;
138 }
139 
140 
141 // ************************************************************************* //
Foam::SinglePhaseMixture::~SinglePhaseMixture
virtual ~SinglePhaseMixture()
Destructor.
Definition: SinglePhaseMixture.C:106
Foam::SinglePhaseMixture::SinglePhaseMixture
SinglePhaseMixture(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Definition: SinglePhaseMixture.C:76
Foam::SinglePhaseMixture
Templated parcel single phase, multi-component class.
Definition: SinglePhaseMixture.H:54
Foam::CompositionModel
Templated reacting parcel composition model class Consists of carrier species (via thermo package),...
Definition: ReactingCloud.H:58
Foam::Field< scalar >
Foam::SinglePhaseMixture::idGas
virtual label idGas() const
Gas id.
Definition: SinglePhaseMixture.C:121
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::SinglePhaseMixture::idLiquid
virtual label idLiquid() const
Liquid id.
Definition: SinglePhaseMixture.C:128
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::SinglePhaseMixture::YMixture0
virtual const scalarField & YMixture0() const
Return the list of mixture mass fractions.
Definition: SinglePhaseMixture.C:114
Foam::SinglePhaseMixture::idSolid
virtual label idSolid() const
Solid id.
Definition: SinglePhaseMixture.C:135
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
SinglePhaseMixture.H