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 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
46 phaseChangeModel::phaseChangeModel
47 (
49 )
50 :
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 
92  (
93  dt,
94  availableMass,
95  dMass,
96  dEnergy
97  );
98 
99  latestMassPC_ = sum(dMass.primitiveField());
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 
115 void phaseChangeModel::info(Ostream& os) const
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::subModelBase::active
virtual bool active() const
Definition: subModelBase.C:150
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:63
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:88
Foam::GeometricField::primitiveField
const Internal::FieldType & primitiveField() const
Definition: GeometricFieldI.H:46
Foam::regionModels::surfaceFilmModels::filmSubModelBase::writeTime
virtual bool writeTime() const
Definition: filmSubModelBase.C:91
Foam::regionModels::surfaceFilmModels::phaseChangeModel::info
virtual void info(Ostream &os) const
Definition: phaseChangeModel.C:108
Foam::regionModels::regionModel::time
const Time & time() const
Definition: regionModelI.H:33
Foam::sumOp
Definition: ops.H:207
Foam::TimeState::deltaTValue
scalar deltaTValue() const noexcept
Definition: TimeStateI.H:36
Foam::Field
Generic templated field type.
Definition: Field.H:59
Foam::regionModels::surfaceFilmModels::surfaceFilmRegionModel
Base class for surface film models.
Definition: surfaceFilmRegionModel.H:51
Foam::regionModels::surfaceFilmModels::phaseChangeModel::correct
virtual void correct(const scalar dt, scalarField &availableMass, volScalarField &dMass, volScalarField &dEnergy)
Definition: phaseChangeModel.C:72
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:119
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Definition: atmBoundaryLayer.C:26
Foam::indent
Ostream & indent(Ostream &os)
Definition: Ostream.H:343
Foam::GeometricField::correctBoundaryConditions
void correctBoundaryConditions()
Definition: GeometricField.C:933
Foam::regionModels::surfaceFilmModels::defineTypeNameAndDebug
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Foam::nl
constexpr char nl
Definition: Ostream.H:424
Foam::regionModels::surfaceFilmModels::phaseChangeModel::correctModel
virtual void correctModel(const scalar dt, scalarField &availableMass, scalarField &dMass, scalarField &dEnergy)=0
Foam::regionModels::surfaceFilmModels::phaseChangeModel::~phaseChangeModel
virtual ~phaseChangeModel()
Definition: phaseChangeModel.C:65
Foam::regionModels::surfaceFilmModels::phaseChangeModel::latestMassPC_
scalar latestMassPC_
Definition: phaseChangeModel.H:73
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:320
Foam::regionModels::surfaceFilmModels::phaseChangeModel::totalMassPC_
scalar totalMassPC_
Definition: phaseChangeModel.H:76
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:52
Foam::regionModels::surfaceFilmModels::filmSubModelBase::filmModel_
surfaceFilmRegionModel & filmModel_
Definition: filmSubModelBase.H:61
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:49
Foam::regionModels::surfaceFilmModels::filmSubModelBase
Base class for surface film sub-models.
Definition: filmSubModelBase.H:52
phaseChangeModel.H
Foam::regionModels::surfaceFilmModels::phaseChangeModel
Base class for surface film phase change models.
Definition: phaseChangeModel.H:53