energyFvScalarFieldSource.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) 2023-2025 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 
28 #include "fvSource.H"
29 #include "volFields.H"
30 #include "basicThermo.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
36 (
38 )
39 :
40  fvScalarFieldSource(iF)
41 {}
42 
43 
45 (
47  const dictionary& dict
48 )
49 :
50  fvScalarFieldSource(iF, dict)
51 {}
52 
53 
55 (
56  const energyFvScalarFieldSource& field,
58 )
59 :
60  fvScalarFieldSource(field, iF)
61 {}
62 
63 
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 
67 {}
68 
69 
70 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
71 
74 (
75  const fvSource& model,
77 ) const
78 {
80  const fvScalarFieldSource& Ts = thermo.T().sources()[model.name()];
81 
82  if (isA<energyCalculatedTemperatureFvScalarFieldSource>(Ts))
83  {
84  return
85  refCast<const energyCalculatedTemperatureFvScalarFieldSource>(Ts)
86  .sourceHeValue(model, source);
87  }
88  else
89  {
90  return thermo.he(Ts.sourceValue(model, source), model, source);
91  }
92 }
93 
94 
97 (
98  const fvSource& model,
99  const scalarField& source,
100  const labelUList& cells
101 ) const
102 {
104  const fvScalarFieldSource& Ts = thermo.T().sources()[model.name()];
105 
106  if (isA<energyCalculatedTemperatureFvScalarFieldSource>(Ts))
107  {
108  return
109  refCast<const energyCalculatedTemperatureFvScalarFieldSource>(Ts)
110  .sourceHeValue(model, source, cells);
111  }
112  else
113  {
114  const scalarField T(Ts.sourceValue(model, source, cells));
115  return thermo.he(T, model, source, cells);
116  }
117 }
118 
119 
122 (
123  const fvSource& model,
125 ) const
126 {
128  const fvScalarFieldSource& Ts = thermo.T().sources()[model.name()];
129 
130  return Ts.internalCoeff(model, source);
131 }
132 
133 
136 (
137  const fvSource& model,
138  const scalarField& source,
139  const labelUList& cells
140 ) const
141 {
143  const fvScalarFieldSource& Ts = thermo.T().sources()[model.name()];
144 
145  return Ts.internalCoeff(model, source, cells);
146 }
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 namespace Foam
152 {
154  (
155  fvScalarFieldSource,
157  );
158 }
159 
160 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Sources & sources() const
Return const-reference to the sources.
Base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:78
static const basicThermo & lookupThermo(const FieldType &f)
Lookup the thermo associated with the given field.
virtual const volScalarField & T() const =0
Temperature [K].
virtual const volScalarField & he() const =0
Enthalpy/Internal energy [J/kg].
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
This source condition provides a value for the energy derived from the corresponding condition for th...
energyFvScalarFieldSource(const DimensionedField< scalar, volMesh > &)
Construct from internal field.
virtual tmp< DimensionedField< scalar, volMesh > > sourceValue(const fvSource &model, const DimensionedField< scalar, volMesh > &source) const
Return the source value.
virtual tmp< DimensionedField< scalar, volMesh > > internalCoeff(const fvSource &model, const DimensionedField< scalar, volMesh > &source) const
Return the internal coefficient.
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
Base class for finite volume sources.
Definition: fvSource.H:52
A class for managing temporary objects.
Definition: tmp.H:55
const cellShapeList & cells
Namespace for OpenFOAM.
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
makeNullConstructableTypeFieldSource(fvScalarFieldSource, energyFvScalarFieldSource)
dictionary dict
fluidMulticomponentThermo & thermo
Definition: createFields.H:31