tabulatedHeatTransfer.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) 2011-2016 OpenFOAM Foundation
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 "tabulatedHeatTransfer.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace fv
36 {
37  defineTypeNameAndDebug(tabulatedHeatTransfer, 0);
39  (
40  option,
41  tabulatedHeatTransfer,
42  dictionary
43  );
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
49 
51 Foam::fv::tabulatedHeatTransfer::hTable()
52 {
53  if (!hTable_.valid())
54  {
55  hTable_.reset(new interpolation2DTable<scalar>(coeffs_));
56  }
57 
58  return *hTable_;
59 }
60 
61 
62 const Foam::volScalarField& Foam::fv::tabulatedHeatTransfer::AoV()
63 {
64  if (!AoV_.valid())
65  {
66  AoV_.reset
67  (
68  new volScalarField
69  (
70  IOobject
71  (
72  "AoV",
73  startTimeName_,
74  mesh_,
77  ),
78  mesh_
79  )
80  );
81  }
82 
83  return *AoV_;
84 }
85 
86 
87 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
88 
90 (
91  const word& name,
92  const word& modelType,
93  const dictionary& dict,
94  const fvMesh& mesh
95 )
96 :
98  UName_(coeffs_.lookupOrDefault<word>("U", "U")),
99  UNbrName_(coeffs_.lookupOrDefault<word>("UNbr", "U")),
100  hTable_(),
101  AoV_(),
102  startTimeName_(mesh.time().timeName())
103 {}
104 
105 
106 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
107 
109 {}
110 
111 
112 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
113 
115 {
116  const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName());
117 
118  const volVectorField& UNbr =
119  nbrMesh.lookupObject<volVectorField>(UNbrName_);
120 
121  const scalarField UMagNbr(mag(UNbr));
122 
123  const scalarField UMagNbrMapped(interpolate(UMagNbr));
124 
125  const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
126 
127  scalarField& htcc = htc_.primitiveFieldRef();
128 
129  forAll(htcc, i)
130  {
131  htcc[i] = hTable()(mag(U[i]), UMagNbrMapped[i]);
132  }
133 
134  htcc = htcc*AoV();
135 }
136 
137 
139 {
141  {
142  return true;
143  }
144 
145  return false;
146 }
147 
148 
149 // ************************************************************************* //
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:129
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fv::interRegionHeatTransferModel
Base class for inter region heat exchange. The derived classes must provide the heat transfer coeffis...
Definition: interRegionHeatTransferModel.H:59
tabulatedHeatTransfer.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::fv::tabulatedHeatTransfer::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: tabulatedHeatTransfer.C:138
Foam::interpolation2DTable
2D table interpolation. The data must be in ascending order in both dimensions x and y.
Definition: interpolation2DTable.H:53
Foam::interpolate
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Definition: curveTools.C:75
Foam::Field< scalar >
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::fv::option::coeffs_
dictionary coeffs_
Dictionary containing source coefficients.
Definition: fvOption.H:88
Foam::fv::tabulatedHeatTransfer::tabulatedHeatTransfer
tabulatedHeatTransfer(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from dictionary.
Definition: tabulatedHeatTransfer.C:90
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:434
Foam::fv::tabulatedHeatTransfer::calculateHtc
virtual void calculateHtc()
Calculate the heat transfer coefficient.
Definition: tabulatedHeatTransfer.C:114
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
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
Foam::fv::defineTypeNameAndDebug
defineTypeNameAndDebug(option, 0)
U
U
Definition: pEqn.H:72
Foam::fv::tabulatedHeatTransfer::~tabulatedHeatTransfer
virtual ~tabulatedHeatTransfer()
Destructor.
Definition: tabulatedHeatTransfer.C:108
Foam::fv::addToRunTimeSelectionTable
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::fv::interRegionHeatTransferModel::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: interRegionHeatTransferModel.C:265
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:246
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::IOobject::MUST_READ
Definition: IOobject.H:120