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