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 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 {
76  const fvScalarFieldSource& Ts = thermo.T().sources()[source.name()];
77 
78  if (isA<energyCalculatedTemperatureFvScalarFieldSource>(Ts))
79  {
80  return
81  refCast<const energyCalculatedTemperatureFvScalarFieldSource>(Ts)
82  .sourceHeValue(source);
83  }
84  else
85  {
86  return thermo.he(Ts.sourceValue(source), source);
87  }
88 }
89 
90 
93 {
95  const fvScalarFieldSource& Ts = thermo.T().sources()[source.name()];
96 
97  return Ts.internalCoeff(source);
98 }
99 
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
106  (
107  fvScalarFieldSource,
109  );
110 }
111 
112 // ************************************************************************* //
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 keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
This source condition provides a value for the energy derived from the corresponding condition for th...
virtual tmp< scalarField > internalCoeff(const fvSource &) const
Return the internal coefficient.
virtual tmp< scalarField > sourceValue(const fvSource &) const
Return the source value.
energyFvScalarFieldSource(const DimensionedField< scalar, volMesh > &)
Construct from internal field.
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
Base class for finite volume sources.
Definition: fvSource.H:52
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
makeNullConstructableTypeFieldSource(fvScalarFieldSource, energyFvScalarFieldSource)
dictionary dict
fluidMulticomponentThermo & thermo
Definition: createFields.H:31