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-2019 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 
92 (
93  scalarField& availableMass,
94  scalarField& massToTransfer,
95  scalarField& energyToTransfer
96 )
97 {
98  const thermoSingleLayer& film = filmType<thermoSingleLayer>();
99 
100  scalarField massToTransfer0(massToTransfer.size(), scalar(0));
101  correct(availableMass, massToTransfer0);
102  massToTransfer += massToTransfer0;
103  energyToTransfer += massToTransfer0*film.h();
104 }
105 
107 {
108  scalar transferredMass0 = getModelProperty<scalar>("transferredMass");
109  return transferredMass0 + returnReduce(transferredMass_, sumOp<scalar>());
110 }
111 
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 } // End namespace surfaceFilmModels
116 } // End namespace regionModels
117 } // End namespace Foam
118 
119 // ************************************************************************* //
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
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
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:53
A class for handling words, derived from string.
Definition: word.H:59
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
virtual const volScalarField & h() const
Return the film sensible enthalpy [J/kg].
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineRunTimeSelectionTable(filmMomentumTransportModel, dictionary)
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Thermodynamic form of single-cell layer surface film model.
Namespace for OpenFOAM.