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-2017 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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31
32namespace Foam
33{
34namespace regionModels
35{
36namespace surfaceFilmModels
37{
38
39// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40
43
44// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45
47(
49)
50:
51 filmSubModelBase(film),
52 latestMassPC_(0.0),
53 totalMassPC_(0.0)
54{}
55
56
58(
59 const word& modelType,
61 const dictionary& dict
62)
63:
64 filmSubModelBase(film, dict, typeName, modelType),
65 latestMassPC_(0.0),
66 totalMassPC_(0.0)
67{}
68
69
70// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
71
73{}
74
75
76// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
77
79(
80 const scalar dt,
81 scalarField& availableMass,
82 volScalarField& dMass,
83 volScalarField& dEnergy
84)
85{
86 if (!active())
87 {
88 return;
89 }
90
92 (
93 dt,
94 availableMass,
95 dMass,
96 dEnergy
97 );
98
101
102 availableMass -= dMass;
104
105 if (writeTime())
106 {
107 scalar phaseChangeMass = getModelProperty<scalar>("phaseChangeMass");
108 phaseChangeMass += returnReduce(totalMassPC_, sumOp<scalar>());
109 setModelProperty<scalar>("phaseChangeMass", phaseChangeMass);
110 totalMassPC_ = 0.0;
111 }
112}
113
114
116{
117 const scalar massPCRate =
120
121 scalar phaseChangeMass = getModelProperty<scalar>("phaseChangeMass");
122 phaseChangeMass += returnReduce(totalMassPC_, sumOp<scalar>());
123
124 os << indent << "mass phase change = " << phaseChangeMass << nl
125 << indent << "vapourisation rate = " << massPCRate << nl;
126}
127
128
129// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130
131} // End namespace surfaceFilmModels
132} // End namespace regionModels
133} // End namespace Foam
134
135// ************************************************************************* //
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
void correctBoundaryConditions()
Correct boundary field.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
scalar deltaTValue() const noexcept
Return time step value.
Definition: TimeStateI.H:43
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
InfoProxy< ensightCells > info() const
Return info proxy.
Definition: ensightCells.H:254
const Time & time() const
Return the reference to the time database.
Definition: regionModelI.H:40
Base class for surface film sub-models.
surfaceFilmRegionModel & filmModel_
Reference to the film surface film model.
virtual bool writeTime() const
Flag to indicate when to write a property.
Base class for surface film phase change models.
scalar totalMassPC_
Total mass transfer due to phase change.
virtual void correctModel(const scalar dt, scalarField &availableMass, scalarField &dMass, scalarField &dEnergy)=0
Correct.
scalar latestMassPC_
Latest mass transfer due to phase change.
virtual bool active() const
Return the model 'active' status - default active = true.
Definition: subModelBase.C:157
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:342
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict