transferModel.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) 2017-2021 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 "transferModel.H"
27 #include "thermoSingleLayer.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace regionModels
34 {
35 namespace surfaceFilmModels
36 {
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
40 defineTypeNameAndDebug(transferModel, 0);
41 defineRunTimeSelectionTable(transferModel, dictionary);
42 
43 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
44 
45 void transferModel::addToTransferredMass(const scalar dMass)
46 {
47  transferredMass_ += dMass;
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
54 :
55  filmSubModelBase(film),
56  transferredMass_(0.0)
57 {}
58 
59 
61 (
62  const word& modelType,
64  const dictionary& dict
65 )
66 :
67  filmSubModelBase(film, dict, typeName, modelType),
68  transferredMass_(0)
69 {}
70 
71 
72 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
73 
75 {}
76 
77 
78 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
79 
81 {
82  if (writeTime())
83  {
84  scalar transferredMass0 = getModelProperty<scalar>("transferredMass");
85  transferredMass0 += returnReduce(transferredMass_, sumOp<scalar>());
86  setModelProperty<scalar>("transferredMass", transferredMass0);
87  transferredMass_ = 0.0;
88  }
89 }
90 
91 
93 {
94  scalar transferredMass0 = getModelProperty<scalar>("transferredMass");
95  return transferredMass0 + returnReduce(transferredMass_, sumOp<scalar>());
96 }
97 
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 } // End namespace surfaceFilmModels
102 } // End namespace regionModels
103 } // End namespace Foam
104 
105 // ************************************************************************* //
filmSubModelBase(surfaceFilmRegionModel &film)
Construct null.
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 dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const surfaceFilmRegionModel & film() const
Return const access to the film surface film model.
virtual bool writeTime() const
Flag to indicate when to write a property.
virtual scalar transferredMassTotal() const
Return the total mass transferred.
Definition: transferModel.C:92
transferModel(surfaceFilmRegionModel &film)
Construct for film.
Definition: transferModel.C:53
A class for handling words, derived from string.
Definition: word.H:59
defineRunTimeSelectionTable(ejectionModel, dictionary)
void addToTransferredMass(const scalar dMass)
Add to transferred mass.
Definition: transferModel.C:45
const word & modelType() const
Return const access to the sub-model type.
Definition: subModelBase.C:122
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Namespace for OpenFOAM.