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 Foam_functionObjects_thermoCoupleProbes_H
83 #define Foam_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_;
120  //- Thermocouple emissivity
121  scalar epsilon_;
122 
123  //- Name of the velocity field
125 
126  //- Name of the incident radiation field
128 
129  //- Fluid thermo reference
130  const fluidThermo& thermo_;
131 
132  //- ODESolver
135  //- Cached thermocouple temperature
137 
138 
139 private:
140 
141  // Private Member Functions
142 
143  //- Sample/write
144  template<class Type>
145  void writeValues
146  (
147  const word& fieldName,
148  const Field<Type>& values,
149  const scalar timeValue
150  );
151 
152  //- No copy construct
153  thermoCoupleProbes(const thermoCoupleProbes&) = delete;
154 
155  //- No copy assignment
156  void operator=(const thermoCoupleProbes&) = delete;
157 
158 
159 public:
160 
161  //- Runtime type information
162  TypeName("thermoCoupleProbes");
163 
164 
165  // Constructors
166 
167  //- Construct for given objectRegistry and dictionary.
168  // Allow the possibility to load fields from files
170  (
171  const word& name,
172  const Time& runTime,
173  const dictionary& dict,
174  const bool loadFromFiles = false,
175  const bool readFields = true
176  );
177 
178 
179  //- Destructor
180  virtual ~thermoCoupleProbes() = default;
181 
182 
183  // ODE functions (overriding abstract functions in ODE.H)
184 
185  //- Number of ODE's to solve
186  virtual label nEqns() const;
187 
188  virtual void derivatives
189  (
190  const scalar x,
191  const scalarField& y,
192  scalarField& dydx
193  ) const;
194 
195  virtual void jacobian
196  (
197  const scalar t,
198  const scalarField& y,
199  scalarField& dfdt,
200  scalarSquareMatrix& dfdy
201  ) const;
202 
203 
204  // Public Member Functions
205 
206  //- Read
207  virtual bool read(const dictionary&);
208 
209  //- Execute. Evaluates the ODESolver
210  virtual bool execute();
211 
212  //- Sample and write
213  virtual bool write();
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace functionObjects
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #ifdef NoRepository
226 #endif
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
word UName_
Name of the velocity field.
virtual bool write()
Sample and write.
dictionary dict
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:43
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual bool read(const dictionary &)
Read.
autoPtr< ODESolver > odeSolver_
ODESolver.
Set of locations to sample.
Definition: probes.H:158
engineTime & runTime
scalar epsilon_
Thermocouple emissivity.
const fluidThermo & thermo_
Fluid thermo reference.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
const word & name() const noexcept
Return the name of this functionObject.
virtual label nEqns() const
Number of ODE&#39;s to solve.
virtual void derivatives(const scalar x, const scalarField &y, scalarField &dydx) const
Calculate the derivatives in dydx.
virtual bool execute()
Execute. Evaluates the ODESolver.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:164
scalar y
A class for handling words, derived from Foam::string.
Definition: word.H:63
Fundamental fluid thermodynamic properties.
Definition: fluidThermo.H:48
Reads fields from the time directories and adds them to the mesh database for further post-processing...
Definition: readFields.H:151
scalar Cp_
Thermocouple heat capacity.
virtual ~thermoCoupleProbes()=default
Destructor.
scalarField Ttc_
Cached thermocouple temperature.
word radiationFieldName_
Name of the incident radiation field.
Sample probe for temperature using a thermocouple.
virtual void jacobian(const scalar t, const scalarField &y, scalarField &dfdt, scalarSquareMatrix &dfdy) const
Calculate the Jacobian of the system.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
TypeName("thermoCoupleProbes")
Runtime type information.
Namespace for OpenFOAM.