externalCoupledTemperatureMixedFvPatchScalarField.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) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2018-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::externalCoupledTemperatureMixedFvPatchScalarField
29
30Group
31 grpCoupledBoundaryConditions
32
33Description
34 This boundary condition provides a temperatue interface to an external
35 application.
36
37 Values are transferred as plain text files, where OpenFOAM data are
38 written as follows:
39
40 \verbatim
41 # Patch: <patch name>
42 <magSf1> <value1> <qDot1> <htc1>
43 <magSf2> <value2> <qDot2> <htc2>
44 <magSf3> <value3> <qDot3> <htc2>
45 ...
46 <magSfN> <valueN> <qDotN> <htcN>
47 \endverbatim
48
49 and received as the constituent pieces of the `mixed' condition, i.e.
50
51 \verbatim
52 # Patch: <patch name>
53 <value1> <gradient1> <valueFracion1>
54 <value2> <gradient2> <valueFracion2>
55 <value3> <gradient3> <valueFracion3>
56 ...
57 <valueN> <gradientN> <valueFracionN>
58 \endverbatim
59
60 Data is sent/received as a single file for all patches from the directory
61
62 \verbatim
63 $FOAM_CASE/<commsDir>
64 \endverbatim
65
66 At start-up, the boundary creates a lock file, i.e..
67
68 \verbatim
69 OpenFOAM.lock
70 \endverbatim
71
72 ... to signal the external source to wait. During the boundary condition
73 update, boundary values are written to file, e.g.
74
75 \verbatim
76 <fileName>.out
77 \endverbatim
78
79 The lock file is then removed, instructing the external source to take
80 control of the program execution. When ready, the external program
81 should create the return values, e.g. to file
82
83 \verbatim
84 <fileName>.in
85 \endverbatim
86
87 ... and then reinstate the lock file. The boundary condition will then
88 read the return values, and pass program execution back to OpenFOAM.
89
90 To be used in combination with the functionObjects::externalCoupled
91 functionObject.
92
93Usage
94 \table
95 Property | Description | Required | Default
96 outputTemperature | Output temperature: fluid/wall | yes |
97 htcRefTemperature | Fluid temperature for htc: cell/user | no | cell
98 Tref | Reference temperature [K] for htc | conditional |
99 \endtable
100
101 The user-specified reference temperature Tref is specified as
102 a Foam::Function1 of time but spatially uniform.
103
104SeeAlso
105 externalCoupledFunctionObject
106 mixedFvPatchField
107 externalCoupledMixedFvPatchField
108
109SourceFiles
110 externalCoupledTemperatureMixedFvPatchScalarField.C
111
112\*---------------------------------------------------------------------------*/
113
114#ifndef externalCoupledTemperatureMixedFvPatchScalarField_H
115#define externalCoupledTemperatureMixedFvPatchScalarField_H
116
118#include "Function1.H"
119#include "Enum.H"
120
121// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122
123namespace Foam
124{
125
126/*---------------------------------------------------------------------------*\
127 Class externalCoupledTemperatureMixedFvPatchScalarField Declaration
128\*---------------------------------------------------------------------------*/
129
130class externalCoupledTemperatureMixedFvPatchScalarField
131:
132 public externalCoupledMixedFvPatchField<scalar>
133{
134 // Data Types
135
136 //- Location for the output temperature
137 enum outputTemperatureType
138 {
139 FLUID,
140 WALL
141 };
142
143 //- Names for outputTemperatureType
144 static const Enum<outputTemperatureType> outputTemperatureNames;
145
146 //- Reference temperature type for HTC calculation
147 enum refTemperatureType
148 {
149 CELL,
150 USER
151 };
152
153 //- Names for refTemperatureType
154 static const Enum<refTemperatureType> refTemperatureNames;
155
156
157 // Private Data
158
159 //- Location for the output temperature
160 enum outputTemperatureType outTempType_;
161
162 //- Reference temperature type for HTC calculation
163 enum refTemperatureType refTempType_;
164
165 //- User-specified reference temperature for HTC calculation
167
168
169public:
170
171 //- Runtime type information
172 TypeName("externalCoupledTemperature");
173
174
175 // Constructors
176
177 //- Construct from patch and internal field
179 (
180 const fvPatch&,
182 );
183
184 //- Construct from patch, internal field and dictionary
186 (
187 const fvPatch&,
189 const dictionary&
190 );
192 //- Construct by mapping given
193 // externalCoupledTemperatureMixedFvPatchScalarField onto a new patch
195 (
197 const fvPatch&,
199 const fvPatchFieldMapper&
200 );
201
202 //- Construct as copy
204 (
206 );
207
208 //- Construct and return a clone
209 virtual tmp<fvPatchField<scalar>> clone() const
210 {
212 (
214 );
215 }
216
217 //- Construct as copy setting internal field reference
219 (
222 );
223
224 //- Construct and return a clone setting internal field reference
226 (
228 ) const
229 {
231 (
233 (
234 *this,
235 iF
236 )
237 );
238 }
239
240
241 //- Destructor
243
245 // Member Functions
246
247 //- Write header
248 virtual void writeHeader(Ostream& os) const;
249
250 //- Write data
251 virtual void writeData(Ostream& os) const;
252
253 //- Read data
254 virtual void readData(Istream& is);
255
256 //- Write
257 virtual void write(Ostream& os) const;
258};
259
260
261// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262
263} // End namespace Foam
264
265// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266
267#endif
268
269// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Extends the mixed boundary condition with serialisation functions.
This boundary condition provides a temperatue interface to an external application.
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual tmp< fvPatchField< scalar > > clone() const
Construct and return a clone.
virtual ~externalCoupledTemperatureMixedFvPatchScalarField()=default
Destructor.
TypeName("externalCoupledTemperature")
Runtime type information.
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
A class for managing temporary objects.
Definition: tmp.H:65
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73