ubAverage.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) 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 "ubAverage.H"
27 #include "XiFluid.H"
28 #include "ubRhoThermo.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace functionObjects
36 {
38 
40  (
42  ubAverage,
44  );
45 }
46 }
47 
48 
49 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
50 
51 bool Foam::functionObjects::ubAverage::calc()
52 {
53  if (foundObject<solvers::XiFluid>(solver::typeName))
54  {
55  const solvers::XiFluid& XiFluid
56  (
57  lookupObject<solvers::XiFluid>(solver::typeName)
58  );
59 
60  const ubRhoThermo& ubThermo = XiFluid.thermo;
61 
62  const word fuName
63  (
65  );
66 
67  const word fbName
68  (
70  );
71 
72  if
73  (
74  foundObject<volScalarField>(fuName)
75  && foundObject<volScalarField>(fbName)
76  )
77  {
78  const volScalarField& fu = lookupObject<volScalarField>(fuName);
79  const volScalarField& fb = lookupObject<volScalarField>(fbName);
80 
81  store
82  (
84  ubThermo.alphau()*fu + ubThermo.alphab()*fb
85  );
86 
87  return true;
88  }
89  else
90  {
91  return false;
92  }
93  }
94  else
95  {
96  return false;
97  }
98 }
99 
100 
101 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
102 
104 (
105  const word& name,
106  const Time& runTime,
107  const dictionary& dict
108 )
109 :
110  fieldExpression(name, runTime, dict, typeName)
111 {}
112 
113 
114 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
115 
117 {}
118 
119 
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 
123 {
124  return
125  {
128  };
129 }
130 
131 
132 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
static word groupName(Name name, const word &group)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base-class for Time/database functionObjects.
word resultName_
Name of result field.
const word fieldName_
Name of field to process.
ObjectType & store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
Calculates and writes the unburnt, burnt gas phase average of a field.
Definition: ubAverage.H:57
ubAverage(const word &name, const Time &runTime, const dictionary &dict)
Construct for given objectRegistry and dictionary.
Definition: ubAverage.C:104
virtual wordList fields() const
Return the unburnt and burnt gas fields required.
Definition: ubAverage.C:122
virtual ~ubAverage()
Destructor.
Definition: ubAverage.C:116
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
static const word burntPhaseName
Definition: ubRhoThermo.H:79
static const word unburntPhaseName
Definition: ubRhoThermo.H:78
A class for handling words, derived from string.
Definition: word.H:63
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, fvModel, dictionary)
Namespace for OpenFOAM.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:62
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict