Loading...
Searching...
No Matches
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
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;
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
166 autoPtr<Function1<scalar>> Tref_;
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&,
181 const DimensionedField<scalar, volMesh>&
182 );
183
184 //- Construct from patch, internal field and dictionary
186 (
187 const fvPatch&,
188 const DimensionedField<scalar, volMesh>&,
189 const dictionary&
190 );
191
192 //- Construct by mapping given
193 // externalCoupledTemperatureMixedFvPatchScalarField onto a new patch
195 (
197 const fvPatch&,
198 const DimensionedField<scalar, volMesh>&,
199 const fvPatchFieldMapper&
200 );
201
202 //- Construct as copy
204 (
206 );
207
208 //- Construct as copy setting internal field reference
210 (
212 const DimensionedField<scalar, volMesh>&
213 );
214
215 //- Return a clone
216 virtual tmp<fvPatchField<scalar>> clone() const
217 {
218 return fvPatchField<scalar>::Clone(*this);
219 }
220
221 //- Clone with an internal field reference
222 virtual tmp<fvPatchField<scalar>> clone
223 (
224 const DimensionedField<scalar, volMesh>& iF
225 ) const
226 {
227 return fvPatchField<scalar>::Clone(*this, iF);
228 }
229
230
231 //- Destructor
232 virtual ~externalCoupledTemperatureMixedFvPatchScalarField() = default;
233
234
235 // Member Functions
236
237 //- Write header
238 virtual void writeHeader(Ostream& os) const;
239
240 //- Write data
241 virtual void writeData(Ostream& os) const;
242
243 //- Read data
244 virtual void readData(Istream& is);
245
246 //- Write
247 virtual void write(Ostream& os) const;
248};
249
250
251// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252
253} // End namespace Foam
254
255// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256
257#endif
258
259// ************************************************************************* //
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Clone with an internal field reference.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
virtual ~externalCoupledTemperatureMixedFvPatchScalarField()=default
Destructor.
externalCoupledTemperatureMixedFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
TypeName("externalCoupledTemperature")
Runtime type information.
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68
const bool writeData(pdfDictionary.get< bool >("writeData"))