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 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 {
39  defineTypeNameAndDebug(heatTransferCoeff, 0);
40  addToRunTimeSelectionTable(functionObject, heatTransferCoeff, dictionary);
41 }
42 }
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
47 {
49 
50  htcModelPtr_->calc(htc);
51 
52  return true;
53 }
54 
55 
56 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57 
58 Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
59 (
60  const word& name,
61  const Time& runTime,
62  const dictionary& dict
63 )
64 :
66  htcModelPtr_()
67 {
68  read(dict);
69 
70  setResultName(typeName, name + ":htc:" + htcModelPtr_->type());
71 
72  volScalarField* heatTransferCoeffPtr
73  (
74  new volScalarField
75  (
76  IOobject
77  (
78  resultName_,
79  mesh_.time().timeName(),
80  mesh_,
83  ),
84  mesh_,
86  )
87  );
88 
89  mesh_.objectRegistry::store(heatTransferCoeffPtr);
90 }
91 
92 
93 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
94 
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 
102 {
104  {
105  htcModelPtr_ = heatTransferCoeffModel::New(dict, mesh_, fieldName_);
106 
107  htcModelPtr_->read(dict);
108 
109  return true;
110  }
111 
112  return false;
113 }
114 
115 
116 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
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:104
Foam::functionObjects::heatTransferCoeff::read
virtual bool read(const dictionary &)
Read the heatTransferCoeff data.
Definition: heatTransferCoeff.C:101
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::functionObjects::heatTransferCoeff::~heatTransferCoeff
virtual ~heatTransferCoeff()
Destructor.
Definition: heatTransferCoeff.C:95
Foam::read
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:108
Foam::functionObjects::fieldExpression::read
virtual bool read(const dictionary &dict)
Read the fieldExpression data.
Definition: fieldExpression.C:91
Foam::functionObjects::addToRunTimeSelectionTable
addToRunTimeSelectionTable(functionObject, add, dictionary)
Foam::dimArea
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:60
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::heatTransferCoeffModel::New
static autoPtr< heatTransferCoeffModel > New(const dictionary &dict, const fvMesh &mesh, const word &TName)
Return a reference to the selected heat transfer coefficient model.
Definition: heatTransferCoeffModelNew.C:35
Foam::functionObjects::heatTransferCoeff::calc
virtual bool calc()
Calculate the heat transfer coefficient field and return true.
Definition: heatTransferCoeff.C:46
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
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:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
heatTransferCoeff.H
heatTransferCoeffModel.H
Foam::objectRegistry::lookupObjectRef
Type & lookupObjectRef(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:478
Foam::functionObjects::defineTypeNameAndDebug
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
Foam::functionObjects::fieldExpression
Base class for field expression function objects.
Definition: fieldExpression.H:60
Foam::functionObjects::fvMeshFunctionObject::mesh_
const fvMesh & mesh_
Reference to the fvMesh.
Definition: fvMeshFunctionObject.H:73
dictionary.H
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:55
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::functionObjects::fieldExpression::resultName_
word resultName_
Name of result field.
Definition: fieldExpression.H:72