PhaseChangeModel.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 "PhaseChangeModel.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 template<class CloudType>
33 (
34  IStringStream
35  (
36  "("
37  "latentHeat "
38  "enthalpyDifference"
39  ")"
40  )()
41 );
42 
43 
44 // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
45 
46 template<class CloudType>
49 const
50 {
51  forAll(enthalpyTransferTypeNames, i)
52  {
53  if (etName == enthalpyTransferTypeNames[i])
54  {
55  return enthalpyTransferType(i);
56  }
57  }
58 
60  (
61  "PhaseChangeModel<CloudType>::enthalpyTransferType"
62  "PhaseChangeModel<CloudType>::wordToEnthalpyTransfer(const word&) const"
63  ) << "Unknown enthalpyType " << etName << ". Valid selections are:" << nl
64  << enthalpyTransferTypeNames << exit(FatalError);
65 
66  return enthalpyTransferType(0);
67 }
68 
69 
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 
72 template<class CloudType>
74 (
75  CloudType& owner
76 )
77 :
79  enthalpyTransfer_(etLatentHeat),
80  dMass_(0.0)
81 {}
82 
83 
84 template<class CloudType>
86 (
88 )
89 :
91  enthalpyTransfer_(pcm.enthalpyTransfer_),
92  dMass_(pcm.dMass_)
93 {}
94 
95 
96 template<class CloudType>
98 (
99  const dictionary& dict,
100  CloudType& owner,
101  const word& type
102 )
103 :
104  CloudSubModelBase<CloudType>(owner, dict, typeName, type),
105  enthalpyTransfer_
106  (
107  wordToEnthalpyTransfer(this->coeffDict().lookup("enthalpyTransfer"))
108  ),
109  dMass_(0.0)
110 {}
111 
112 
113 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
114 
115 template<class CloudType>
117 {}
118 
119 
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 
122 template<class CloudType>
125 {
126  return enthalpyTransfer_;
127 }
128 
129 
130 template<class CloudType>
132 (
133  const label idc,
134  const label idl,
135  const scalar p,
136  const scalar T
137 ) const
138 {
139  return 0.0;
140 }
141 
142 
143 template<class CloudType>
145 (
146  const scalar p,
147  const scalarField& X
148 ) const
149 {
150  return GREAT;
151 }
152 
153 
154 template<class CloudType>
156 {
157  return -GREAT;
158 }
159 
160 
161 template<class CloudType>
163 {
164  dMass_ += dMass;
165 }
166 
167 
168 template<class CloudType>
170 {
171  const scalar mass0 = this->template getBaseProperty<scalar>("mass");
172  const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
173 
174  Info<< " Mass transfer phase change = " << massTotal << nl;
175 
176  if (this->outputTime())
177  {
178  this->setBaseProperty("mass", massTotal);
179  dMass_ = 0.0;
180  }
181 }
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #include "PhaseChangeModelNew.C"
187 
188 // ************************************************************************* //
PhaseChangeModel(CloudType &owner)
Construct null from owner.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
scalar dMass_
Mass of lagrangian phase converted.
virtual scalar dh(const label idc, const label idl, const scalar p, const scalar T) const
Return the enthalpy per unit mass.
A class for handling words, derived from string.
Definition: word.H:59
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
messageStream Info
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Templated phase change model class.
Definition: ReactingCloud.H:55
enthalpyTransferType
Enthalpy transfer type.
virtual scalar TMax(const scalar p, const scalarField &X) const
Return maximum/limiting temperature.
virtual ~PhaseChangeModel()
Destructor.
dictionary dict
static const char nl
Definition: Ostream.H:260
stressControl lookup("compactNormalStress") >> compactNormalStress
virtual void info(Ostream &os)
Write injection info to stream.
#define forAll(list, i)
Definition: UList.H:421
enthalpyTransferType wordToEnthalpyTransfer(const word &etName) const
Convert word to enthalpy transfer type.
static const Foam::wordList enthalpyTransferTypeNames
Name representations of enthalpy transfer types.
void addToPhaseChangeMass(const scalar dMass)
Add to phase change mass.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:589
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
error FatalError
Base class for cloud sub-models.
virtual scalar Tvap(const scalarField &X) const
Return vapourisation temperature.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
enthalpyTransferType enthalpyTransfer_
Enthalpy transfer type enumeration.
const enthalpyTransferType & enthalpyTransfer() const
Return the enthalpy transfer type enumeration.