temperatureCoupledBase.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019,2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::temperatureCoupledBase
29 
30 Description
31  Common functions used in temperature coupled boundaries.
32 
33  The thermal conductivity \c kappa may be obtained by the following methods:
34  - 'lookup' : lookup volScalarField (or volSymmTensorField) with name
35  defined by 'kappa'
36  - 'fluidThermo' : use fluidThermo and default
37  compressible::turbulenceModel to calculate kappa
38  - 'solidThermo' : use solidThermo kappa()
39  - 'directionalSolidThermo': uses look up for volSymmTensorField for
40  transformed kappa vector. Field name definable in 'alphaAni',
41  named 'Anialpha' in solid solver by default
42  - 'function' : kappa, alpha directly specified as Function1
43  - 'phaseSystem' : used for multiphase thermos
44 
45  \par Keywords provided by this class:
46  \table
47  Property | Description | Required | Default
48  kappaMethod | Thermal conductivity method | yes |
49  kappa | Name of thermal conductivity field | partly |
50  alpha | Name of thermal diffusivity field | partly |
51  alphaAni | Name of non-isotropic alpha | partly |
52  kappaValue | Function1 supplying kappa | partly |
53  alphaValue | Function1 supplying alpha | partly |
54  \endtable
55 
56 Usage
57  \verbatim
58  nonIsotropicWall
59  {
60  ...
61  kappaMethod directionalSolidThermo;
62  alphaAni Anialpha;
63  ...
64  }
65  \endverbatim
66 
67  \verbatim
68  specifiedWall
69  {
70  ...
71  kappaMethod function;
72  kappaFunction constant 1.0;
73  alphaFunction constant 100.0;
74  ...
75  }
76  \endverbatim
77 
78 SourceFiles
79  temperatureCoupledBase.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef temperatureCoupledBase_H
84 #define temperatureCoupledBase_H
85 
86 #include "scalarField.H"
87 #include "Enum.H"
88 #include "fvPatch.H"
89 #include "PatchFunction1.H"
90 #include "fvPatchFieldMapper.H"
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 namespace Foam
95 {
96 
97 /*---------------------------------------------------------------------------*\
98  Class temperatureCoupledBase Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 class temperatureCoupledBase
102 {
103 public:
104 
105  // Public Enumerations
106 
107  //- Type of supplied Kappa
108  enum KMethodType
109  {
113  mtLookup,
114  mtFunction
115  };
116 
117 
118 protected:
119 
120  // Protected Data
121 
122  static const Enum<KMethodType> KMethodTypeNames_;
123 
124  //- Underlying patch
125  const fvPatch& patch_;
126 
127  //- How to get K
128  const KMethodType method_;
129 
130  //- Name of thermal conductivity field (if looked up from database)
132 
133  //- Name of thermal diffusivity
134  const word alphaName_;
135 
136  //- Name of the non-isotropic alpha (for directional solidThermo)
137  const word alphaAniName_;
138 
139  //- Function1 for kappa
141 
142  //- Function1 for alpha
146 public:
147 
148  // Constructors
149 
150  //- Default construct from patch, using fluidThermo (default)
151  //- or specified method
152  explicit temperatureCoupledBase
153  (
154  const fvPatch& patch,
155  const KMethodType method = KMethodType::mtFluidThermo
156  );
157 
158  //- Construct from patch, method type and field names
160  (
161  const fvPatch& patch,
162  const KMethodType method,
163  const word& kappaName,
164  const word& alphaName,
165  const word& alphaAniName
166  );
167 
168  //- Construct from patch and dictionary
170  (
171  const fvPatch& patch,
172  const dictionary& dict
173  );
175  //- Construct from patch and temperatureCoupledBase
177  (
178  const fvPatch& patch,
180  );
181 
182  //- Copy construct
185 
186  //- Destructor
187  virtual ~temperatureCoupledBase() = default;
188 
190  // Member Functions
191 
192  //- Method to obtain K
193  word KMethod() const
194  {
195  return KMethodTypeNames_[method_];
196  }
197 
198  //- Name of thermal conductivity field
199  const word& kappaName() const noexcept
200  {
201  return kappaName_;
202  }
203 
204  //- Name of thermal diffusivity field
205  const word& alphaName() const noexcept
206  {
207  return alphaName_;
208  }
209 
210  //- Map (and resize as needed) from self given a mapping object
211  virtual void autoMap
212  (
213  const fvPatchFieldMapper&
214  ) = 0;
215 
216  //- Reverse map the given fvPatchField onto this fvPatchField
217  virtual void rmap
218  (
219  const fvPatchField<scalar>&,
220  const labelList&
221  ) = 0;
222 
223  //- Given patch temperature calculate corresponding K field
224  virtual tmp<scalarField> kappa(const scalarField& Tp) const;
225 
226  //- Given patch temperature calculate corresponding alphaEff field
227  virtual tmp<scalarField> alpha(const scalarField& Tp) const;
228 
229  //- Write
230  void write(Ostream& os) const;
231 };
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 } // End namespace Foam
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #endif
241 
242 // ************************************************************************* //
dictionary dict
const fvPatch & patch_
Underlying patch.
const word alphaName_
Name of thermal diffusivity.
word KMethod() const
Method to obtain K.
const word kappaName_
Name of thermal conductivity field (if looked up from database)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
autoPtr< PatchFunction1< scalar > > alphaFunction1_
Function1 for alpha.
KMethodType
Type of supplied Kappa.
virtual tmp< scalarField > kappa(const scalarField &Tp) const
Given patch temperature calculate corresponding K field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual tmp< scalarField > alpha(const scalarField &Tp) const
Given patch temperature calculate corresponding alphaEff field.
virtual void rmap(const fvPatchField< scalar > &, const labelList &)=0
Reverse map the given fvPatchField onto this fvPatchField.
virtual ~temperatureCoupledBase()=default
Destructor.
virtual void autoMap(const fvPatchFieldMapper &)=0
Map (and resize as needed) from self given a mapping object.
void write(Ostream &os) const
Write.
autoPtr< PatchFunction1< scalar > > kappaFunction1_
Function1 for kappa.
const word & alphaName() const noexcept
Name of thermal diffusivity field.
A class for handling words, derived from Foam::string.
Definition: word.H:63
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
temperatureCoupledBase(const fvPatch &patch, const KMethodType method=KMethodType::mtFluidThermo)
Default construct from patch, using fluidThermo (default) or specified method.
const direction noexcept
Definition: Scalar.H:258
const word alphaAniName_
Name of the non-isotropic alpha (for directional solidThermo)
OBJstream os(runTime.globalPath()/outputName)
const KMethodType method_
How to get K.
Common functions used in temperature coupled boundaries.
const word & kappaName() const noexcept
Name of thermal conductivity field.
const std::string patch
OpenFOAM patch number as a std::string.
static const Enum< KMethodType > KMethodTypeNames_
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
List< label > labelList
A List of labels.
Definition: List.H:62
Namespace for OpenFOAM.