PhaseChangeModel.H
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-2016 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 Class
27  Foam::PhaseChangeModel
28 
29 Group
30  grpLagrangianIntermediatePhaseChangeSubModels
31 
32 Description
33  Templated phase change model class
34 
35 SourceFiles
36  PhaseChangeModel.C
37  PhaseChangeModelNew.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef PhaseChangeModel_H
42 #define PhaseChangeModel_H
43 
44 #include "IOdictionary.H"
45 #include "autoPtr.H"
46 #include "runTimeSelectionTables.H"
47 #include "CloudSubModelBase.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class PhaseChangeModel Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class CloudType>
59 class PhaseChangeModel
60 :
61  public CloudSubModelBase<CloudType>
62 {
63 public:
64 
65  // Public Enumerations
66 
67  //- Enthalpy transfer type
69  {
72  };
73 
74  //- Name representations of enthalpy transfer types
76 
77 
78 protected:
79 
80  // Protected data
81 
82  //- Enthalpy transfer type enumeration
84 
85 
86  // Counters
87 
88  //- Mass of lagrangian phase converted
89  scalar dMass_;
90 
91 
92  // Protected Member Functions
93 
94  //- Convert word to enthalpy transfer type
96 
97  //- Sherwood number
98  scalar Sh() const;
99 
100 
101 public:
102 
103  //- Runtime type information
104  TypeName("phaseChangeModel");
105 
106  //- Declare runtime constructor selection table
108  (
109  autoPtr,
111  dictionary,
112  (
113  const dictionary& dict,
114  CloudType& owner
115  ),
116  (dict, owner)
117  );
118 
119 
120  // Constructors
121 
122  //- Construct null from owner
123  PhaseChangeModel(CloudType& owner);
124 
125  //- Construct from dictionary
127  (
128  const dictionary& dict,
129  CloudType& owner,
130  const word& type
131  );
132 
133  //- Construct copy
135 
136  //- Construct and return a clone
137  virtual autoPtr<PhaseChangeModel<CloudType>> clone() const = 0;
138 
139 
140  //- Destructor
141  virtual ~PhaseChangeModel() = default;
142 
143 
144  //- Selector
146  (
147  const dictionary& dict,
148  CloudType& owner
149  );
150 
151 
152  // Access
153 
154  //- Return the enthalpy transfer type enumeration
155  const enthalpyTransferType& enthalpyTransfer() const;
156 
157 
158  // Member Functions
159 
160  //- Update model
161  virtual void calculate
162  (
163  const scalar dt,
164  const label celli,
165  const scalar Re,
166  const scalar Pr,
167  const scalar d,
168  const scalar nu,
169  const scalar T,
170  const scalar Ts,
171  const scalar pc,
172  const scalar Tc,
173  const scalarField& X,
174  scalarField& dMassPC
175  ) const = 0;
176 
177  //- Return the enthalpy per unit mass
178  virtual scalar dh
179  (
180  const label idc,
181  const label idl,
182  const scalar p,
183  const scalar T
184  ) const;
185 
186  //- Return vapourisation temperature
187  virtual scalar Tvap(const scalarField& X) const;
188 
189  //- Return maximum/limiting temperature
190  virtual scalar TMax(const scalar p, const scalarField& X) const;
191 
192  //- Add to phase change mass
193  void addToPhaseChangeMass(const scalar dMass);
194 
195 
196  // I-O
197 
198  //- Write injection info to stream
199  virtual void info(Ostream& os);
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #define makePhaseChangeModel(CloudType) \
210  \
211  typedef Foam::CloudType::reactingCloudType reactingCloudType; \
212  defineNamedTemplateTypeNameAndDebug \
213  ( \
214  Foam::PhaseChangeModel<reactingCloudType>, \
215  0 \
216  ); \
217  namespace Foam \
218  { \
219  defineTemplateRunTimeSelectionTable \
220  ( \
221  PhaseChangeModel<reactingCloudType>, \
222  dictionary \
223  ); \
224  }
225 
226 
227 #define makePhaseChangeModelType(SS, CloudType) \
228  \
229  typedef Foam::CloudType::reactingCloudType reactingCloudType; \
230  defineNamedTemplateTypeNameAndDebug(Foam::SS<reactingCloudType>, 0); \
231  \
232  Foam::PhaseChangeModel<reactingCloudType>:: \
233  adddictionaryConstructorToTable<Foam::SS<reactingCloudType>> \
234  add##SS##CloudType##reactingCloudType##ConstructorToTable_;
235 
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #ifdef NoRepository
240  #include "PhaseChangeModel.C"
241 #endif
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #endif
246 
247 // ************************************************************************* //
Foam::PhaseChangeModel::New
static autoPtr< PhaseChangeModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
Definition: PhaseChangeModelNew.C:36
Foam::PhaseChangeModel
Templated phase change model class.
Definition: ReactingCloud.H:61
Foam::PhaseChangeModel::~PhaseChangeModel
virtual ~PhaseChangeModel()=default
Destructor.
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::PhaseChangeModel::etEnthalpyDifference
Definition: PhaseChangeModel.H:70
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::PhaseChangeModel::enthalpyTransfer_
enthalpyTransferType enthalpyTransfer_
Enthalpy transfer type enumeration.
Definition: PhaseChangeModel.H:82
Foam::PhaseChangeModel::dMass_
scalar dMass_
Mass of lagrangian phase converted.
Definition: PhaseChangeModel.H:88
PhaseChangeModel.C
Foam::PhaseChangeModel::PhaseChangeModel
PhaseChangeModel(CloudType &owner)
Construct null from owner.
Definition: PhaseChangeModel.C:67
Foam::PhaseChangeModel::info
virtual void info(Ostream &os)
Write injection info to stream.
Definition: PhaseChangeModel.C:155
Foam::PhaseChangeModel::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, PhaseChangeModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
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:118
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:62
Foam::PhaseChangeModel< Foam::ReactingCloud< Foam::DSMCCloud > >::enthalpyTransferType
enthalpyTransferType
Enthalpy transfer type.
Definition: PhaseChangeModel.H:67
Foam::PhaseChangeModel::TypeName
TypeName("phaseChangeModel")
Runtime type information.
Foam::Field< scalar >
CloudSubModelBase.H
Foam::PhaseChangeModel::calculate
virtual void calculate(const scalar dt, const label celli, const scalar Re, const scalar Pr, const scalar d, const scalar nu, const scalar T, const scalar Ts, const scalar pc, const scalar Tc, const scalarField &X, scalarField &dMassPC) const =0
Update model.
Pr
dimensionedScalar Pr("Pr", dimless, laminarTransport)
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::PhaseChangeModel::etLatentHeat
Definition: PhaseChangeModel.H:69
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::PhaseChangeModel::enthalpyTransferTypeNames
static const wordList enthalpyTransferTypeNames
Name representations of enthalpy transfer types.
Definition: PhaseChangeModel.H:74
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::PhaseChangeModel::Sh
scalar Sh() const
Sherwood number.
Foam::PhaseChangeModel::wordToEnthalpyTransfer
enthalpyTransferType wordToEnthalpyTransfer(const word &etName) const
Convert word to enthalpy transfer type.
Definition: PhaseChangeModel.C:44
IOdictionary.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::PhaseChangeModel::TMax
virtual scalar TMax(const scalar p, const scalarField &X) const
Return maximum/limiting temperature.
Definition: PhaseChangeModel.C:131
Foam::List< word >
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::Re
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
Foam::PhaseChangeModel::Tvap
virtual scalar Tvap(const scalarField &X) const
Return vapourisation temperature.
Definition: PhaseChangeModel.C:141
Foam::PhaseChangeModel::enthalpyTransfer
const enthalpyTransferType & enthalpyTransfer() const
Return the enthalpy transfer type enumeration.
Definition: PhaseChangeModel.C:110
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::PhaseChangeModel::clone
virtual autoPtr< PhaseChangeModel< CloudType > > clone() const =0
Construct and return a clone.
Foam::PhaseChangeModel::addToPhaseChangeMass
void addToPhaseChangeMass(const scalar dMass)
Add to phase change mass.
Definition: PhaseChangeModel.C:148
autoPtr.H