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-2017 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 namespace regionModels
33 {
34 namespace surfaceFilmModels
35 {
36 
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 
39 defineTypeNameAndDebug(phaseChangeModel, 0);
40 defineRunTimeSelectionTable(phaseChangeModel, dictionary);
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
44 phaseChangeModel::phaseChangeModel
45 (
46  surfaceFilmModel& film
47 )
48 :
49  filmSubModelBase(film),
50  latestMassPC_(0.0),
51  totalMassPC_(0.0)
52 {}
53 
54 
55 phaseChangeModel::phaseChangeModel
56 (
57  const word& modelType,
58  surfaceFilmModel& film,
59  const dictionary& dict
60 )
61 :
62  filmSubModelBase(film, dict, typeName, modelType),
63  latestMassPC_(0.0),
64  totalMassPC_(0.0)
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
69 
71 {}
72 
73 
74 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
75 
77 (
78  const scalar dt,
79  scalarField& availableMass,
80  volScalarField& dMass,
81  volScalarField& dEnergy
82 )
83 {
84  if (!active())
85  {
86  return;
87  }
88 
90  (
91  dt,
92  availableMass,
93  dMass,
94  dEnergy
95  );
96 
97  latestMassPC_ = sum(dMass.primitiveField());
99 
100  availableMass -= dMass;
102 
103  if (writeTime())
104  {
105  scalar phaseChangeMass = getModelProperty<scalar>("phaseChangeMass");
106  phaseChangeMass += returnReduce(totalMassPC_, sumOp<scalar>());
107  setModelProperty<scalar>("phaseChangeMass", phaseChangeMass);
108  totalMassPC_ = 0.0;
109  }
110 }
111 
112 
114 {
115  const scalar massPCRate =
118 
119  scalar phaseChangeMass = getModelProperty<scalar>("phaseChangeMass");
120  phaseChangeMass += returnReduce(totalMassPC_, sumOp<scalar>());
121 
122  os << indent << "mass phase change = " << phaseChangeMass << nl
123  << indent << "vapourisation rate = " << massPCRate << nl;
124 }
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // end namespace surfaceFilmModels
130 } // end namespace regionModels
131 } // end namespace Foam
132 
133 // ************************************************************************* //
dictionary dict
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:223
virtual void info(Ostream &os) const
Provide some feedback.
scalar latestMassPC_
Latest mass transfer due to phase change.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
const Time & time() const
Return the reference to the time database.
Definition: regionModelI.H:37
surfaceFilmModel & filmModel_
Reference to the film surface film model.
scalar totalMassPC_
Total mass transfer due to phase change.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
virtual bool writeTime() const
Flag to indicate when to write a property.
virtual void correctModel(const scalar dt, scalarField &availableMass, scalarField &dMass, scalarField &dEnergy)=0
Correct.
A class for handling words, derived from string.
Definition: word.H:59
scalar deltaTValue() const
Return time step value.
Definition: TimeStateI.H:41
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
defineRunTimeSelectionTable(filmThermoModel, dictionary)
void correctBoundaryConditions()
Correct boundary field.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual void correct(const scalar dt, scalarField &availableMass, volScalarField &dMass, volScalarField &dEnergy)
Correct.
virtual bool active() const
Return the model &#39;active&#39; status - default active = true.
Definition: subModelBase.C:154
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Namespace for OpenFOAM.