phaseChangeModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 
45 (
47 )
48 :
49  filmSubModelBase(film),
50  latestMassPC_(0.0),
51  totalMassPC_(0.0)
52 {}
53 
54 
56 (
57  const word& modelType,
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 {
85  (
86  dt,
87  availableMass,
88  dMass,
89  dEnergy
90  );
91 
92  latestMassPC_ = sum(dMass.primitiveField());
94 
95  availableMass -= dMass;
97 
98  if (writeTime())
99  {
100  scalar phaseChangeMass = getModelProperty<scalar>("phaseChangeMass");
101  phaseChangeMass += returnReduce(totalMassPC_, sumOp<scalar>());
102  setModelProperty<scalar>("phaseChangeMass", phaseChangeMass);
103  totalMassPC_ = 0.0;
104  }
105 }
106 
107 
109 {
110  const scalar massPCRate =
113 
114  scalar phaseChangeMass = getModelProperty<scalar>("phaseChangeMass");
115  phaseChangeMass += returnReduce(totalMassPC_, sumOp<scalar>());
116 
117  os << indent << "mass phase change = " << phaseChangeMass << nl
118  << indent << "vapourisation rate = " << massPCRate << nl;
119 }
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // end namespace surfaceFilmModels
125 } // end namespace regionModels
126 } // end namespace Foam
127 
128 // ************************************************************************* //
dictionary dict
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221
virtual void info(Ostream &os) const
Provide some feedback.
scalar latestMassPC_
Latest mass transfer due to phase change.
Base class for surface film sub-models.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
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
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.
phaseChangeModel(surfaceFilmRegionModel &film)
Construct null.
A class for handling words, derived from string.
Definition: word.H:59
scalar deltaTValue() const
Return time step value.
Definition: TimeStateI.H:34
defineRunTimeSelectionTable(ejectionModel, dictionary)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static const char nl
Definition: Ostream.H:260
void correctBoundaryConditions()
Correct boundary field.
surfaceFilmRegionModel & filmModel_
Reference to the film surface film model.
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.
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Namespace for OpenFOAM.