thermoCoupleProbes.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::functionObjects::thermoCoupleProbes
28 
29 Group
30  grpUtilitiesFunctionObjects
31 
32 Description
33  Sample probe for temperature using a thermocouple.
34 
35  Uses the correlation:
36 
37  \f[
38  Nu = 2.0 + \left(0.4 Re^{0.5} + 0.06 Re^{2/3}\right)*Pr^{0.4}
39  \f]
40 
41 Usage
42  Example of function object specification:
43  \verbatim
44  probes
45  {
46  type thermoCoupleProbes;
47  libs (utilityFunctionObjects);
48  writeControl timeStep;
49  writeInterval 1;
50 
51  solver rodas23;
52  absTol 1e-12;
53  relTol 1e-8;
54 
55  interpolationScheme cellPoint;
56 
57  // thermocouple properties
58  rho 8908;
59  Cp 440;
60  d 1e-3;
61  epsilon 0.85;
62 
63  radiationField G;
64 
65  probeLocations
66  (
67  (0.5 0.5 0.5)
68  );
69  fields
70  (
71  T
72  );
73  }
74  \endverbatim
75 
76 
77 SourceFiles
78  thermoCoupleProbes.C
79 
80 \*---------------------------------------------------------------------------*/
81 
82 #ifndef functionObjects_thermoCoupleProbes_H
83 #define functionObjects_thermoCoupleProbes_H
84 
85 #include "probes.H"
86 #include "ODESystem.H"
87 #include "ODESolver.H"
88 #include "basicThermo.H"
89 #include "fluidThermo.H"
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 namespace Foam
94 {
95 namespace functionObjects
96 {
97 
98 /*---------------------------------------------------------------------------*\
99  Class thermoCoupleProbes Declaration
100 \*---------------------------------------------------------------------------*/
101 
102 class thermoCoupleProbes
103 :
104  public probes,
105  public ODESystem
106 {
107 protected:
108 
109  // Protected data
110 
111  //- Thermocouple density
112  scalar rho_;
113 
114  //- Thermocouple heat capacity
115  scalar Cp_;
116 
117  //- Thermocouple diameter
118  scalar d_;
119 
120  //- Thermocouple emissivity
121  scalar epsilon_;
122 
123  //- Name of the velocity field
124  word UName_;
125 
126  //- Name of the incident radiation field
128 
129  //- Fluid thermo reference
130  const fluidThermo& thermo_;
131 
132  //- ODESolver
134 
135  //- Cached thermocouple temperature
137 
138 
139  // Protected Member Functions
140 
141  //- Sample and write a particular volume field
142  template<class Type>
143  void sampleAndWrite
144  (
146  );
147 
148 
149 private:
150 
151  //- No copy construct
152  thermoCoupleProbes(const thermoCoupleProbes&) = delete;
153 
154  //- No copy assignment
155  void operator=(const thermoCoupleProbes&) = delete;
156 
157 
158 public:
159 
160  //- Runtime type information
161  TypeName("thermoCoupleProbes");
162 
163 
164  // Constructors
165 
166  //- Construct for given objectRegistry and dictionary.
167  // Allow the possibility to load fields from files
169  (
170  const word& name,
171  const Time& runTime,
172  const dictionary& dict,
173  const bool loadFromFiles = false,
174  const bool readFields = true
175  );
176 
177 
178  //- Destructor
179  virtual ~thermoCoupleProbes();
180 
181 
182  // ODE functions (overriding abstract functions in ODE.H)
183 
184  //- Number of ODE's to solve
185  virtual label nEqns() const;
186 
187  virtual void derivatives
188  (
189  const scalar x,
190  const scalarField& y,
191  scalarField& dydx
192  ) const;
193 
194  virtual void jacobian
195  (
196  const scalar t,
197  const scalarField& y,
198  scalarField& dfdt,
199  scalarSquareMatrix& dfdy
200  ) const;
201 
202 
203  // Public Member Functions
204 
205  //- Sample and write
206  virtual bool write();
207 
208  //- Execute, currently does nothing
209  virtual bool execute();
210 
211  //- Read
212  virtual bool read(const dictionary&);
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace functionObjects
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #ifdef NoRepository
225 #endif
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
basicThermo.H
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::functionObjects::thermoCoupleProbes::derivatives
virtual void derivatives(const scalar x, const scalarField &y, scalarField &dydx) const
Calculate the derivatives in dydx.
Definition: thermoCoupleProbes.C:102
fluidThermo.H
Foam::fluidThermo
Fundamental fluid thermodynamic properties.
Definition: fluidThermo.H:52
Foam::functionObjects::thermoCoupleProbes::nEqns
virtual label nEqns() const
Number of ODE's to solve.
Definition: thermoCoupleProbes.C:95
ODESystem.H
Foam::functionObjects::thermoCoupleProbes::execute
virtual bool execute()
Execute, currently does nothing.
Definition: thermoCoupleProbes.C:185
probes.H
Foam::Field< scalar >
Foam::functionObjects::thermoCoupleProbes::~thermoCoupleProbes
virtual ~thermoCoupleProbes()
Destructor.
Definition: thermoCoupleProbes.C:91
Foam::functionObjects::thermoCoupleProbes::UName_
word UName_
Name of the velocity field.
Definition: thermoCoupleProbes.H:123
Foam::functionObjects::thermoCoupleProbes::write
virtual bool write()
Sample and write.
Definition: thermoCoupleProbes.C:169
Foam::probes
Set of locations to sample.
Definition: probes.H:110
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::functionObjects::thermoCoupleProbes::Cp_
scalar Cp_
Thermocouple heat capacity.
Definition: thermoCoupleProbes.H:114
ODESolver.H
Foam::functionObjects::thermoCoupleProbes::epsilon_
scalar epsilon_
Thermocouple emissivity.
Definition: thermoCoupleProbes.H:120
Foam::functionObjects::thermoCoupleProbes::TypeName
TypeName("thermoCoupleProbes")
Runtime type information.
Foam::functionObjects::thermoCoupleProbes::sampleAndWrite
void sampleAndWrite(const GeometricField< Type, fvPatchField, volMesh > &)
Sample and write a particular volume field.
Definition: thermoCoupleProbesTemplates.C:32
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::thermoCoupleProbes
Sample probe for temperature using a thermocouple.
Definition: thermoCoupleProbes.H:101
Foam::functionObjects::thermoCoupleProbes::thermo_
const fluidThermo & thermo_
Fluid thermo reference.
Definition: thermoCoupleProbes.H:129
Foam::functionObjects::thermoCoupleProbes::odeSolver_
autoPtr< ODESolver > odeSolver_
ODESolver.
Definition: thermoCoupleProbes.H:132
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::SquareMatrix< scalar >
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::ODESystem
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:49
Foam::functionObjects::thermoCoupleProbes::d_
scalar d_
Thermocouple diameter.
Definition: thermoCoupleProbes.H:117
Foam::functionObjects::readFields
Reads fields from the time directories and adds them to the mesh database for further post-processing...
Definition: readFields.H:155
Foam::functionObjects::thermoCoupleProbes::radiationFieldName_
word radiationFieldName_
Name of the incident radiation field.
Definition: thermoCoupleProbes.H:126
x
x
Definition: LISASMDCalcMethod2.H:52
thermoCoupleProbesTemplates.C
Foam::functionObjects::thermoCoupleProbes::rho_
scalar rho_
Thermocouple density.
Definition: thermoCoupleProbes.H:111
Foam::functionObjects::thermoCoupleProbes::jacobian
virtual void jacobian(const scalar t, const scalarField &y, scalarField &dfdt, scalarSquareMatrix &dfdy) const
Calculate the Jacobian of the system.
Definition: thermoCoupleProbes.C:148
Foam::functionObjects::thermoCoupleProbes::read
virtual bool read(const dictionary &)
Read.
Definition: thermoCoupleProbes.C:199
Foam::GeometricField< Type, fvPatchField, volMesh >
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Foam::functionObjects::thermoCoupleProbes::Ttc_
scalarField Ttc_
Cached thermocouple temperature.
Definition: thermoCoupleProbes.H:135