Loading...
Searching...
No Matches
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
36namespace surfaceFilmModels
37{
38
39// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40
41defineTypeNameAndDebug(phaseChangeModel, 0);
43
44// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45
46phaseChangeModel::phaseChangeModel
47(
49)
52 latestMassPC_(0.0),
53 totalMassPC_(0.0)
54{}
55
56
57phaseChangeModel::phaseChangeModel
58(
59 const word& modelType,
61 const dictionary& dict
62)
63:
64 filmSubModelBase(film, dict, typeName, modelType),
67{}
68
69
70// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
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");
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 noexcept
Return a const-reference to the internal field values.
void correctBoundaryConditions()
Correct boundary field.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
scalar deltaTValue() const noexcept
Return time step value.
Definition TimeStateI.H:49
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const Time & time() const noexcept
Return the reference to the time database.
const surfaceFilmRegionModel & film() const
Return const access to the film surface film model.
surfaceFilmRegionModel & filmModel_
Reference to the film surface film model.
virtual bool writeTime() const
Flag to indicate when to write a property.
filmSubModelBase(surfaceFilmRegionModel &film)
Construct null.
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.
virtual void correct(const scalar dt, scalarField &availableMass, volScalarField &dMass, volScalarField &dEnergy)
Correct.
virtual void info(Ostream &os) const
Provide some feedback.
scalar latestMassPC_
Latest mass transfer due to phase change.
bool getModelProperty(const word &entryName, Type &value) const
Retrieve generic property from the sub-model.
const dictionary & dict() const
Return const access to the cloud dictionary.
const word & modelType() const
Return const access to the sub-model type.
virtual bool active() const
Return the model 'active' status - default active = true.
void setModelProperty(const word &entryName, const Type &value)
Add generic property to the sub-model.
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & indent(Ostream &os)
Indent stream.
Definition Ostream.H:481
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict