fvSource.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-2026 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 "fvSource.H"
27 #include "fvMesh.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
34 }
35 
36 
37 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
38 
40 (
41  const word& name,
42  const dimensionSet& dims,
43  const scalarField& field,
44  const bool print
45 )
46 {
47  if (!print) return;
48 
49  Info<< indent << "min/average/max " << name
50  << " = " << gMin(field) << '/' << gAverage(field) << '/' << gMax(field)
51  << ' ' << dims << endl;
52 }
53 
54 
56 (
57  const word& name,
59  const bool print
60 )
61 {
62  infoField(name, field.dimensions(), field.primitiveField(), print);
63 }
64 
65 
67 (
69  const bool print
70 )
71 {
72  infoField(field.name(), field, print);
73 }
74 
75 
76 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
77 
79 (
80  const word& name,
81  const word& modelType,
82  const fvMesh& mesh,
83  const dictionary& dict
84 )
85 :
86  fvModel(name, modelType, mesh, dict)
87 {}
88 
89 
90 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91 
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
99 {
100  return wordList::null();
101 }
102 
103 
104 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet & dimensions() const
Return dimensions.
const PrimitiveField< Type > & primitiveField() const
Return a const-reference to the primitive field.
const word & name() const
Return name.
Definition: IOobject.H:307
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Dimension set for the base types.
Definition: dimensionSet.H:125
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
Finite volume model abstract base class.
Definition: fvModel.H:60
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
Base class for finite volume sources.
Definition: fvSource.H:53
static void infoField(const word &name, const dimensionSet &dims, const scalarField &field, const bool print=true)
Print min/average/max information for a given field.
Definition: fvSource.C:40
virtual ~fvSource()
Destructor.
Definition: fvSource.C:92
virtual wordList addSupFields() const final
Return the list of fields for which the fvModel adds source term.
Definition: fvSource.C:98
fvSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
Definition: fvSource.C:79
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
Type gMin(const UList< Type > &f, const label comm)
Type gAverage(const UList< Type > &f, const label comm)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
messageStream Info
Type gMax(const UList< Type > &f, const label comm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:243
dictionary dict