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-2016 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  << "Unknown enthalpyType " << etName << ". Valid selections are:" << nl
61  << enthalpyTransferTypeNames << exit(FatalError);
62 
63  return enthalpyTransferType(0);
64 }
65 
66 
67 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
68 
69 template<class CloudType>
71 (
72  CloudType& owner
73 )
74 :
76  enthalpyTransfer_(etLatentHeat),
77  dMass_(0.0)
78 {}
79 
80 
81 template<class CloudType>
83 (
85 )
86 :
88  enthalpyTransfer_(pcm.enthalpyTransfer_),
89  dMass_(pcm.dMass_)
90 {}
91 
92 
93 template<class CloudType>
95 (
96  const dictionary& dict,
97  CloudType& owner,
98  const word& type
99 )
100 :
101  CloudSubModelBase<CloudType>(owner, dict, typeName, type),
102  enthalpyTransfer_
103  (
104  wordToEnthalpyTransfer(this->coeffDict().lookup("enthalpyTransfer"))
105  ),
106  dMass_(0.0)
107 {}
108 
109 
110 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
111 
112 template<class CloudType>
114 {}
115 
116 
117 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 
119 template<class CloudType>
122 {
123  return enthalpyTransfer_;
124 }
125 
126 
127 template<class CloudType>
129 (
130  const label idc,
131  const label idl,
132  const scalar p,
133  const scalar T
134 ) const
135 {
136  return 0.0;
137 }
138 
139 
140 template<class CloudType>
142 (
143  const scalar p,
144  const scalarField& X
145 ) const
146 {
147  return GREAT;
148 }
149 
150 
151 template<class CloudType>
153 {
154  return -GREAT;
155 }
156 
157 
158 template<class CloudType>
160 {
161  dMass_ += dMass;
162 }
163 
164 
165 template<class CloudType>
167 {
168  const scalar mass0 = this->template getBaseProperty<scalar>("mass");
169  const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
170 
171  Info<< " Mass transfer phase change = " << massTotal << nl;
172 
173  if (this->writeTime())
174  {
175  this->setBaseProperty("mass", massTotal);
176  dMass_ = 0.0;
177  }
178 }
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #include "PhaseChangeModelNew.C"
184 
185 // ************************************************************************* //
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
static const Foam::wordList enthalpyTransferTypeNames
Name representations of enthalpy transfer types.
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
Templated phase change model class.
Definition: ReactingCloud.H:55
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
virtual scalar TMax(const scalar p, const scalarField &X) const
Return maximum/limiting temperature.
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
const enthalpyTransferType & enthalpyTransfer() const
Return the enthalpy transfer type enumeration.
Base class for cloud sub-models.
void addToPhaseChangeMass(const scalar dMass)
Add to phase change mass.
virtual ~PhaseChangeModel()
Destructor.
PhaseChangeModel(CloudType &owner)
Construct null from owner.
virtual scalar dh(const label idc, const label idl, const scalar p, const scalar T) const
Return the enthalpy per unit mass.
stressControl lookup("compactNormalStress") >> compactNormalStress
scalar dMass_
Mass of lagrangian phase converted.
A class for handling words, derived from string.
Definition: word.H:59
virtual void info(Ostream &os)
Write injection info to stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
static const char nl
Definition: Ostream.H:262
virtual scalar Tvap(const scalarField &X) const
Return vapourisation temperature.
enthalpyTransferType enthalpyTransfer_
Enthalpy transfer type enumeration.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:461
messageStream Info
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
enthalpyTransferType
Enthalpy transfer type.
enthalpyTransferType wordToEnthalpyTransfer(const word &etName) const
Convert word to enthalpy transfer type.