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 | no |
50  alpha | Name of thermal diffusivity field | no |
51  alphaAni | Name of non-isotropic alpha | no |
52  kappaValue | Function1 supplying kappa | no |
53  alphaValue | Function1 supplying alpha | no |
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)
131  const word kappaName_;
132 
133  //- Name of the non-Isotropic alpha (default: Anialpha)
134  const word alphaAniName_;
135 
136  //- Name of thermal diffusivity
137  const word alphaName_;
138 
139  //- Function1 for kappa
141 
142  //- Function1 for alpha
144 
145 
146 public:
147 
148  // Constructors
149 
150  //- Construct from patch and K name
152  (
153  const fvPatch& patch,
154  const word& calculationMethod,
155  const word& kappaName,
156  const word& alphaAniName,
157  const word& alphaName
158  );
159 
160  //- Construct from patch and dictionary
162  (
163  const fvPatch& patch,
164  const dictionary& dict
165  );
166 
167  //- Construct from patch and temperatureCoupledBase
169  (
170  const fvPatch& patch,
172  );
173 
174  //- Construct as copy
176  (
178  );
179 
180 
181  //- Destructor
182  virtual ~temperatureCoupledBase() = default;
183 
184 
185  // Member functions
186 
187  //- Method to obtain K
188  word KMethod() const
189  {
190  return KMethodTypeNames_[method_];
191  }
192 
193  //- Name of thermal conductivity field
194  const word& kappaName() const
195  {
196  return kappaName_;
197  }
198 
199  //- Name of thermal diffusivity field
200  const word& alphaName() const
201  {
202  return alphaName_;
203  }
204 
205  //- Map (and resize as needed) from self given a mapping object
206  virtual void autoMap
207  (
208  const fvPatchFieldMapper&
209  ) = 0;
210 
211  //- Reverse map the given fvPatchField onto this fvPatchField
212  virtual void rmap
213  (
214  const fvPatchField<scalar>&,
215  const labelList&
216  ) = 0;
217 
218  //- Given patch temperature calculate corresponding K field
219  virtual tmp<scalarField> kappa(const scalarField& Tp) const;
220 
221  //- Given patch temperature calculate corresponding alphaEff field
222  virtual tmp<scalarField> alpha(const scalarField& Tp) const;
223 
224  //- Write
225  void write(Ostream& os) const;
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
Foam::temperatureCoupledBase::~temperatureCoupledBase
virtual ~temperatureCoupledBase()=default
Destructor.
Foam::fvPatchField< scalar >
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::temperatureCoupledBase::mtDirectionalSolidThermo
Definition: temperatureCoupledBase.H:146
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::Enum< KMethodType >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::temperatureCoupledBase::alphaAniName_
const word alphaAniName_
Name of the non-Isotropic alpha (default: Anialpha)
Definition: temperatureCoupledBase.H:168
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
scalarField.H
PatchFunction1.H
Foam::temperatureCoupledBase::kappaFunction1_
autoPtr< PatchFunction1< scalar > > kappaFunction1_
Function1 for kappa.
Definition: temperatureCoupledBase.H:174
Foam::temperatureCoupledBase
Common functions used in temperature coupled boundaries.
Definition: temperatureCoupledBase.H:135
Foam::temperatureCoupledBase::KMethodTypeNames_
static const Enum< KMethodType > KMethodTypeNames_
Definition: temperatureCoupledBase.H:156
Foam::temperatureCoupledBase::alphaFunction1_
autoPtr< PatchFunction1< scalar > > alphaFunction1_
Function1 for alpha.
Definition: temperatureCoupledBase.H:177
fvPatchFieldMapper.H
Foam::temperatureCoupledBase::mtSolidThermo
Definition: temperatureCoupledBase.H:145
Foam::temperatureCoupledBase::autoMap
virtual void autoMap(const fvPatchFieldMapper &)=0
Map (and resize as needed) from self given a mapping object.
Definition: temperatureCoupledBase.C:172
Foam::temperatureCoupledBase::mtLookup
Definition: temperatureCoupledBase.H:147
Foam::temperatureCoupledBase::method_
const KMethodType method_
How to get K.
Definition: temperatureCoupledBase.H:162
Foam::Field< scalar >
Foam::temperatureCoupledBase::KMethodType
KMethodType
Type of supplied Kappa.
Definition: temperatureCoupledBase.H:142
Foam::temperatureCoupledBase::patch_
const fvPatch & patch_
Underlying patch.
Definition: temperatureCoupledBase.H:159
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::temperatureCoupledBase::mtFluidThermo
Definition: temperatureCoupledBase.H:144
Foam::temperatureCoupledBase::alpha
virtual tmp< scalarField > alpha(const scalarField &Tp) const
Given patch temperature calculate corresponding alphaEff field.
Definition: temperatureCoupledBase.C:363
Foam::temperatureCoupledBase::kappaName
const word & kappaName() const
Name of thermal conductivity field.
Definition: temperatureCoupledBase.H:228
Foam::temperatureCoupledBase::mtFunction
Definition: temperatureCoupledBase.H:148
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::temperatureCoupledBase::KMethod
word KMethod() const
Method to obtain K.
Definition: temperatureCoupledBase.H:222
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::temperatureCoupledBase::alphaName_
const word alphaName_
Name of thermal diffusivity.
Definition: temperatureCoupledBase.H:171
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::temperatureCoupledBase::rmap
virtual void rmap(const fvPatchField< scalar > &, const labelList &)=0
Reverse map the given fvPatchField onto this fvPatchField.
Definition: temperatureCoupledBase.C:188
Foam::temperatureCoupledBase::kappaName_
const word kappaName_
Name of thermal conductivity field (if looked up from database)
Definition: temperatureCoupledBase.H:165
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::temperatureCoupledBase::alphaName
const word & alphaName() const
Name of thermal diffusivity field.
Definition: temperatureCoupledBase.H:234
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::List< label >
Foam::temperatureCoupledBase::kappa
virtual tmp< scalarField > kappa(const scalarField &Tp) const
Given patch temperature calculate corresponding K field.
Definition: temperatureCoupledBase.C:210
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
fvPatch.H
Foam::temperatureCoupledBase::write
void write(Ostream &os) const
Write.
Definition: temperatureCoupledBase.C:512
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::temperatureCoupledBase::temperatureCoupledBase
temperatureCoupledBase(const fvPatch &patch, const word &calculationMethod, const word &kappaName, const word &alphaAniName, const word &alphaName)
Construct from patch and K name.
Definition: temperatureCoupledBase.C:54
Enum.H