ejectionModel.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-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 "ejectionModel.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 namespace regionModels
33 {
34 namespace surfaceFilmModels
35 {
36 
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 
39 defineTypeNameAndDebug(ejectionModel, 0);
40 defineRunTimeSelectionTable(ejectionModel, dictionary);
41 
42 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
43 
44 void ejectionModel::addToEjectedMass(const scalar dMass)
45 {
46  ejectedMass_ += dMass;
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 :
54  filmSubModelBase(film),
55  ejectedMass_(0.0)
56 {}
57 
58 
60 (
61  const word& modelType,
63  const dictionary& dict
64 )
65 :
66  filmSubModelBase(film, dict, typeName, modelType),
67  ejectedMass_(0.0)
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
72 
74 {}
75 
76 
77 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
78 
80 {
81  if (writeTime())
82  {
83  scalar ejectedMass0 = getModelProperty<scalar>("ejectedMass");
84  ejectedMass0 += returnReduce(ejectedMass_, sumOp<scalar>());
85  setModelProperty<scalar>("ejectedMass", ejectedMass0);
86  ejectedMass_ = 0.0;
87  }
88 }
89 
90 
92 {
93  scalar ejectedMass0 = getModelProperty<scalar>("ejectedMass");
94  return ejectedMass0 + returnReduce(ejectedMass_, 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: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.
A class for handling words, derived from string.
Definition: word.H:59
virtual scalar ejectedMassTotal() const
Return the total mass ejected.
Definition: ejectionModel.C:91
defineRunTimeSelectionTable(ejectionModel, dictionary)
void addToEjectedMass(const scalar dMass)
Add to ejected mass.
Definition: ejectionModel.C:44
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)
ejectionModel(surfaceFilmRegionModel &film)
Construct null.
Definition: ejectionModel.C:52
Namespace for OpenFOAM.