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  << "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->outputTime())
174  {
175  this->setBaseProperty("mass", massTotal);
176  dMass_ = 0.0;
177  }
178 }
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #include "PhaseChangeModelNew.C"
184 
185 // ************************************************************************* //
Foam::PhaseChangeModel< CloudType >
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::PhaseChangeModel::enthalpyTransfer_
enthalpyTransferType enthalpyTransfer_
Enthalpy transfer type enumeration.
Definition: PhaseChangeModel.H:77
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:86
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::PhaseChangeModel::dMass_
scalar dMass_
Mass of lagrangian phase converted.
Definition: PhaseChangeModel.H:83
Foam::CloudSubModelBase
Base class for cloud sub-models.
Definition: CloudSubModelBase.H:49
Foam::PhaseChangeModel::PhaseChangeModel
PhaseChangeModel(CloudType &owner)
Construct null from owner.
Definition: PhaseChangeModel.C:71
PhaseChangeModel.H
Foam::PhaseChangeModel::info
virtual void info(Ostream &os)
Write injection info to stream.
Definition: PhaseChangeModel.C:166
Foam::PhaseChangeModel::dh
virtual scalar dh(const label idc, const label idl, const scalar p, const scalar T) const
Return the enthalpy per unit mass.
Definition: PhaseChangeModel.C:129
Foam::label
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
Foam::PhaseChangeModel::enthalpyTransferType
enthalpyTransferType
Enthalpy transfer type.
Definition: PhaseChangeModel.H:62
PhaseChangeModelNew.C
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::PhaseChangeModel::enthalpyTransferTypeNames
static const Foam::wordList enthalpyTransferTypeNames
Name representations of enthalpy transfer types.
Definition: PhaseChangeModel.H:69
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::PhaseChangeModel::wordToEnthalpyTransfer
enthalpyTransferType wordToEnthalpyTransfer(const word &etName) const
Convert word to enthalpy transfer type.
Definition: PhaseChangeModel.C:48
Foam::PhaseChangeModel::~PhaseChangeModel
virtual ~PhaseChangeModel()
Destructor.
Definition: PhaseChangeModel.C:113
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
T
const volScalarField & T
Definition: createFields.H:25
Foam::sumOp
Definition: ops.H:162
Foam::PhaseChangeModel::TMax
virtual scalar TMax(const scalar p, const scalarField &X) const
Return maximum/limiting temperature.
Definition: PhaseChangeModel.C:142
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::PhaseChangeModel::Tvap
virtual scalar Tvap(const scalarField &X) const
Return vapourisation temperature.
Definition: PhaseChangeModel.C:152
Foam::PhaseChangeModel::enthalpyTransfer
const enthalpyTransferType & enthalpyTransfer() const
Return the enthalpy transfer type enumeration.
Definition: PhaseChangeModel.C:121
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::PhaseChangeModel::addToPhaseChangeMass
void addToPhaseChangeMass(const scalar dMass)
Add to phase change mass.
Definition: PhaseChangeModel.C:159
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress