zeroDimensionalMassSource.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) 2021-2024 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 
27 #include "fvCellSet.H"
28 #include "basicThermo.H"
30 
31 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace fv
36 {
39 }
40 }
41 
42 
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
44 
45 void Foam::fv::zeroDimensionalMassSource::readCoeffs()
46 {
47  zeroDimensionalMassFlowRate_.reset
48  (
50  (
51  "massFlowRate",
52  mesh().time().userUnits(),
54  coeffs()
55  ).ptr()
56  );
57 }
58 
59 
60 Foam::scalar Foam::fv::zeroDimensionalMassSource::massFlowRate() const
61 {
62  return zeroDimensionalMassFlowRate_->value(mesh().time().value());
63 }
64 
65 
66 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
67 
69 (
70  const word& name,
71  const word& modelType,
72  const fvMesh& mesh,
73  const dictionary& dict
74 )
75 :
76  zeroDimensionalMassSourceBase(name, modelType, mesh, dict),
77  zeroDimensionalMassFlowRate_()
78 {
79  readCoeffs();
80 }
81 
82 
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84 
86 {
88  {
89  readCoeffs();
90  return true;
91  }
92  else
93  {
94  return false;
95  }
96 }
97 
98 
99 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
static autoPtr< Function1< scalar > > New(const word &name, const Function1s::unitConversions &units, const dictionary &dict)
Select from dictionary.
Definition: Function1New.C:32
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Finite volume model abstract base class.
Definition: fvModel.H:59
const dictionary & coeffs() const
Return dictionary.
Definition: fvModelI.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
virtual bool read(const dictionary &dict)
Read source dictionary.
Base class for zero-dimensional mass source models.
This fvModel applies a mass source to the continuity equation and to all field equations,...
virtual bool read(const dictionary &dict)
Read source dictionary.
zeroDimensionalMassSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
A class for handling words, derived from string.
Definition: word.H:62
addToRunTimeSelectionTable(fvConstraint, bound, dictionary)
defineTypeNameAndDebug(bound, 0)
Namespace for OpenFOAM.
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
const dimensionSet dimTime
const dimensionSet dimMass
labelList fv(nPoints)
dictionary dict