heatTransferCoeff.C
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) 2017-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 \*---------------------------------------------------------------------------*/
27 
28 #include "heatTransferCoeff.H"
29 #include "dictionary.H"
30 #include "heatTransferCoeffModel.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace functionObjects
38 {
41 }
42 }
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
47 {
49 
50  htcModelPtr_->calc(htc, htcModelPtr_->q());
51 
52  htc *= L_/kappa_;
53 
54  return true;
55 }
56 
57 
58 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
59 
61 (
62  const word& name,
63  const Time& runTime,
64  const dictionary& dict
65 )
66 :
68  L_(1),
69  kappa_(1),
70  htcModelPtr_(nullptr)
71 {
72  read(dict);
73 
74  setResultName(typeName, "htc:" + htcModelPtr_->type());
75 
76  auto* heatTransferCoeffPtr =
77  new volScalarField
78  (
79  IOobject
80  (
82  mesh_.time().timeName(),
83  mesh_,
86  ),
87  mesh_,
89  );
90 
91  mesh_.objectRegistry::store(heatTransferCoeffPtr);
92 }
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
98 {
100  {
101  return false;
102  }
103 
104  L_ = dict.getCheckOrDefault<scalar>("L", 1, scalarMinMax::ge(0));
105  kappa_ =
106  dict.getCheckOrDefault<scalar>("kappa", 1, scalarMinMax::ge(SMALL));
107  htcModelPtr_ = heatTransferCoeffModel::New(dict, mesh_, fieldName_);
108 
109  htcModelPtr_->read(dict);
110 
111  return true;
112 }
113 
114 
115 // ************************************************************************* //
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:191
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:165
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:63
Foam::Zero
static constexpr const zero Zero
Definition: zero.H:131
Foam::read
bool read(const char *buf, int32_t &val)
Definition: int32.H:125
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:773
Foam::functionObjects::fieldExpression::read
virtual bool read(const dictionary &dict)
Definition: fieldExpression.C:86
Foam::functionObjects::heatTransferCoeff::read
virtual bool read(const dictionary &dict)
Definition: heatTransferCoeff.C:90
Foam::functionObject
Abstract base-class for Time/database function objects.
Definition: functionObject.H:329
Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
heatTransferCoeff()=delete
Foam::dimArea
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:57
Foam::functionObjects::fieldExpression::setResultName
void setResultName(const word &typeName, const word &defaultArg)
Definition: fieldExpression.C:39
Foam::heatTransferCoeffModel::New
static autoPtr< heatTransferCoeffModel > New(const dictionary &dict, const fvMesh &mesh, const word &TName)
Definition: heatTransferCoeffModelNew.C:28
Foam::functionObjects::heatTransferCoeff::calc
virtual bool calc()
Definition: heatTransferCoeff.C:39
Foam::functionObjects::heatTransferCoeff
Computes the heat transfer coefficient [W/(m2 K)] as a volScalarField for a given set of patches.
Definition: heatTransferCoeff.H:234
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:53
Foam::dimPower
const dimensionSet dimPower
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:119
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:36
Foam
Definition: atmBoundaryLayer.C:26
heatTransferCoeff.H
heatTransferCoeffModel.H
Foam::objectRegistry::lookupObjectRef
Type & lookupObjectRef(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:471
Foam::functionObjects::fieldExpression
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
Definition: fieldExpression.H:116
Foam::functionObjects::addToRunTimeSelectionTable
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
Foam::MinMax::ge
static MinMax< T > ge(const T &minVal)
Definition: MinMaxI.H:24
Foam::functionObjects::fvMeshFunctionObject::mesh_
const fvMesh & mesh_
Definition: fvMeshFunctionObject.H:69
dictionary.H
Foam::functionObjects::defineTypeNameAndDebug
defineTypeNameAndDebug(ObukhovLength, 0)
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:52
Foam::name
word name(const expressions::valueTypeCode typeCode)
Definition: exprTraits.C:52
Foam::fvMesh::time
const Time & time() const
Definition: fvMesh.H:276
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:49
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:184
Foam::functionObjects::fieldExpression::resultName_
word resultName_
Definition: fieldExpression.H:128