Loading...
Searching...
No Matches
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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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 "PhaseChangeModel.H"
29
30// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31
32template<class CloudType>
34enthalpyTransferTypeNames
35{
36 "latentHeat", "enthalpyDifference"
37};
38
39
40// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
41
42template<class CloudType>
45const
46{
47 forAll(enthalpyTransferTypeNames, i)
48 {
49 if (etName == enthalpyTransferTypeNames[i])
50 {
51 return enthalpyTransferType(i);
52 }
53 }
54
56 << "Unknown enthalpyType " << etName << ". Valid selections are:" << nl
57 << enthalpyTransferTypeNames << exit(FatalError);
58
60}
61
62
63// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
64
65template<class CloudType>
67(
68 CloudType& owner
69)
70:
81)
82:
85 dMass_(pcm.dMass_)
86{}
87
88
89template<class CloudType>
91(
92 const dictionary& dict,
93 CloudType& owner,
94 const word& type
95)
96:
98 enthalpyTransfer_
99 (
100 wordToEnthalpyTransfer(this->coeffDict().getWord("enthalpyTransfer"))
101 ),
102 dMass_(0.0)
104
105
106// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
107
108template<class CloudType>
111{
112 return enthalpyTransfer_;
113}
114
115
116template<class CloudType>
118(
119 const label idc,
120 const label idl,
121 const scalar p,
122 const scalar T
123) const
124{
125 return 0.0;
126}
127
128
129template<class CloudType>
131(
132 const scalar p,
133 const scalarField& X
134) const
135{
136 return GREAT;
138
139
140template<class CloudType>
142{
143 return -GREAT;
144}
145
146
147template<class CloudType>
149{
150 dMass_ += dMass;
151}
152
153
154template<class CloudType>
156{
158
159 const scalar mass0 = this->template getBaseProperty<scalar>("mass");
160 const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
161
162 Log_<< " Mass transfer phase change = " << massTotal << nl;
163
164 if (this->writeTime())
165 {
166 this->setBaseProperty("mass", massTotal);
167 dMass_ = 0.0;
168 }
169}
170
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#include "PhaseChangeModelNew.C"
175
176// ************************************************************************* //
Base class for cloud sub-models.
const CloudType & owner() const
Return const access to the owner cloud.
virtual void info()
Write to info.
CloudSubModelBase(CloudType &owner)
Construct null from owner cloud.
virtual bool writeTime() const
Flag to indicate when to write a property.
Templated phase change model class.
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.
const enthalpyTransferType & enthalpyTransfer() const
Return the enthalpy transfer type enumeration.
enthalpyTransferType enthalpyTransfer_
Enthalpy transfer type enumeration.
void addToPhaseChangeMass(const scalar dMass)
Add to phase change mass.
enthalpyTransferType
Enthalpy transfer type.
virtual scalar Tvap(const scalarField &X) const
Return vapourisation temperature.
enthalpyTransferType wordToEnthalpyTransfer(const word &etName) const
Convert word to enthalpy transfer type.
PhaseChangeModel(CloudType &owner)
Construct null from owner.
virtual void info()
Write injection info.
virtual scalar TMax(const scalar p, const scalarField &X) const
Return maximum/limiting temperature.
static const wordList enthalpyTransferTypeNames
Name representations of enthalpy transfer types.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
Type getBaseProperty(const word &entryName, const Type &defaultValue=Type(Zero)) const
Retrieve generic property from the base model.
const dictionary & dict() const
Return const access to the cloud dictionary.
void setBaseProperty(const word &entryName, const Type &value)
Add generic property to the base model.
A class for handling words, derived from Foam::string.
Definition word.H:66
volScalarField & p
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
return returnReduce(nRefine-oldNRefine, sumOp< label >())
#define Log_
Report write to Foam::Info if the class log switch is true.
List< word > wordList
List of word.
Definition fileName.H:60
DSMCCloud< dsmcParcel > CloudType
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299