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 -------------------------------------------------------------------------------
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 \*---------------------------------------------------------------------------*/
27 
28 #include "phaseChangeModel.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace regionModels
35 {
36 namespace surfaceFilmModels
37 {
38 
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 
41 defineTypeNameAndDebug(phaseChangeModel, 0);
42 defineRunTimeSelectionTable(phaseChangeModel, dictionary);
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
46 phaseChangeModel::phaseChangeModel
47 (
49 )
50 :
51  filmSubModelBase(film),
52  latestMassPC_(0.0),
53  totalMassPC_(0.0)
54 {}
55 
56 
57 phaseChangeModel::phaseChangeModel
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 
91  correctModel
92  (
93  dt,
94  availableMass,
95  dMass,
96  dEnergy
97  );
98 
99  latestMassPC_ = sum(dMass.primitiveField());
100  totalMassPC_ += latestMassPC_;
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 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:94
Foam::GeometricField::primitiveField
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Definition: GeometricFieldI.H:53
Foam::regionModels::surfaceFilmModels::phaseChangeModel::info
virtual void info(Ostream &os) const
Provide some feedback.
Definition: phaseChangeModel.C:115
Foam::regionModels::regionModel::time
const Time & time() const
Return the reference to the time database.
Definition: regionModelI.H:40
Foam::sumOp
Definition: ops.H:213
Foam::TimeState::deltaTValue
scalar deltaTValue() const noexcept
Return time step value.
Definition: TimeStateI.H:43
Foam::Field< scalar >
Foam::regionModels::surfaceFilmModels::surfaceFilmRegionModel
Base class for surface film models.
Definition: surfaceFilmRegionModel.H:55
Foam::regionModels::surfaceFilmModels::phaseChangeModel::correct
virtual void correct(const scalar dt, scalarField &availableMass, volScalarField &dMass, volScalarField &dEnergy)
Correct.
Definition: phaseChangeModel.C:79
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::regionModels::surfaceFilmModels::defineRunTimeSelectionTable
defineRunTimeSelectionTable(filmThermoModel, dictionary)
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::indent
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:339
Foam::GeometricField::correctBoundaryConditions
void correctBoundaryConditions()
Correct boundary field.
Definition: GeometricField.C:940
Foam::regionModels::surfaceFilmModels::defineTypeNameAndDebug
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::regionModels::surfaceFilmModels::phaseChangeModel::~phaseChangeModel
virtual ~phaseChangeModel()
Destructor.
Definition: phaseChangeModel.C:72
Foam::regionModels::surfaceFilmModels::phaseChangeModel::latestMassPC_
scalar latestMassPC_
Latest mass transfer due to phase change.
Definition: phaseChangeModel.H:77
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:327
Foam::regionModels::surfaceFilmModels::phaseChangeModel::totalMassPC_
scalar totalMassPC_
Total mass transfer due to phase change.
Definition: phaseChangeModel.H:80
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::regionModels::surfaceFilmModels::filmSubModelBase::filmModel_
surfaceFilmRegionModel & filmModel_
Reference to the film surface film model.
Definition: filmSubModelBase.H:65
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::regionModels::surfaceFilmModels::filmSubModelBase
Base class for surface film sub-models.
Definition: filmSubModelBase.H:56
phaseChangeModel.H