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-2018 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 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 namespace regionModels
33 {
34 namespace surfaceFilmModels
35 {
36 
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 
39 defineTypeNameAndDebug(transferModel, 0);
40 defineRunTimeSelectionTable(transferModel, dictionary);
41 
42 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
43 
44 void transferModel::addToTransferredMass(const scalar dMass)
45 {
46  transferredMass_ += dMass;
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 :
54  filmSubModelBase(film),
55  transferredMass_(0.0)
56 {}
57 
58 
60 (
61  const word& modelType,
63  const dictionary& dict
64 )
65 :
66  filmSubModelBase(film, dict, typeName, modelType),
67  transferredMass_(0)
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
72 
74 {}
75 
76 
77 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
78 
80 {
81  if (writeTime())
82  {
83  scalar transferredMass0 = getModelProperty<scalar>("transferredMass");
84  transferredMass0 += returnReduce(transferredMass_, sumOp<scalar>());
85  setModelProperty<scalar>("transferredMass", transferredMass0);
86  transferredMass_ = 0.0;
87  }
88 }
89 
91 (
92  scalarField& availableMass,
93  scalarField& massToTransfer,
94  scalarField& energyToTransfer
95 )
96 {
97  scalarField massToTransfer0(massToTransfer.size(), scalar(0));
98  correct(availableMass, massToTransfer0);
99  massToTransfer += massToTransfer0;
100  energyToTransfer += massToTransfer0*film().hs();
101 }
102 
104 {
105  scalar transferredMass0 = getModelProperty<scalar>("transferredMass");
106  return transferredMass0 + returnReduce(transferredMass_, sumOp<scalar>());
107 }
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace surfaceFilmModels
113 } // End namespace regionModels
114 } // End namespace Foam
115 
116 // ************************************************************************* //
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:158
virtual const volScalarField & hs() const =0
Return the film surface temperature [J/kg].
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
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.
transferModel(surfaceFilmRegionModel &film)
Construct for film.
Definition: transferModel.C:52
A class for handling words, derived from string.
Definition: word.H:59
void addToTransferredMass(const scalar dMass)
Add to transferred mass.
Definition: transferModel.C:44
const word & modelType() const
Return const access to the sub-model type.
Definition: subModelBase.C:122
defineRunTimeSelectionTable(filmThermoModel, dictionary)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Namespace for OpenFOAM.