variableHeatTransfer.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 "variableHeatTransfer.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace fv
37 {
38  defineTypeNameAndDebug(variableHeatTransfer, 0);
40  (
41  option,
42  variableHeatTransfer,
43  dictionary
44  );
45 }
46 }
47 
48 
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 
52 (
53  const word& name,
54  const word& modelType,
55  const dictionary& dict,
56  const fvMesh& mesh
57 )
58 :
60  UNbrName_(coeffs_.lookupOrDefault<word>("UNbr", "U")),
61  a_(0),
62  b_(0),
63  c_(0),
64  ds_(0),
65  Pr_(0),
66  AoV_()
67 {
68  if (master_)
69  {
70  coeffs_.readEntry("a", a_);
71  coeffs_.readEntry("b", b_);
72  coeffs_.readEntry("c", c_);
73  coeffs_.readEntry("ds", ds_);
74  coeffs_.readEntry("Pr", Pr_);
75 
76  AoV_.reset
77  (
78  new volScalarField
79  (
80  IOobject
81  (
82  "AoV",
83  mesh_.time().timeName(),
84  mesh_,
85  IOobject::MUST_READ,
86  IOobject::AUTO_WRITE
87  ),
88  mesh_
89  )
90  );
91  }
92 }
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
98 {
99  const fvMesh& nbrMesh =
101 
102  const compressible::turbulenceModel& nbrTurb =
104  (
106  );
107 
108  const fluidThermo& nbrThermo =
110 
111  const volVectorField& UNbr =
112  nbrMesh.lookupObject<volVectorField>(UNbrName_);
113 
114  const volScalarField ReNbr(mag(UNbr)*ds_*nbrThermo.rho()/nbrTurb.mut());
115 
116  const volScalarField NuNbr(a_*pow(ReNbr, b_)*pow(Pr_, c_));
117 
118  const scalarField htcNbr(NuNbr*nbrTurb.kappaEff()/ds_);
119 
120  const scalarField htcNbrMapped(interpolate(htcNbr));
121 
122  htc_.primitiveFieldRef() = htcNbrMapped * AoV_();
123 }
124 
125 
127 {
129  {
130  coeffs_.readIfPresent("UNbr", UNbrName_);
131 
132  coeffs_.readIfPresent("a", a_);
133  coeffs_.readIfPresent("b", b_);
134  coeffs_.readIfPresent("c", c_);
135  coeffs_.readIfPresent("ds", ds_);
136  coeffs_.readIfPresent("Pr", Pr_);
137 
138  return true;
139  }
140 
141  return false;
142 }
143 
144 
145 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::fv::interRegionHeatTransferModel::nbrRegionName
const word & nbrRegionName() const
Return const access to the neighbour region name.
Definition: interRegionHeatTransferModelI.H:31
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
Foam::turbulenceModel::propertiesName
static const word propertiesName
Default name of the turbulence properties dictionary.
Definition: turbulenceModel.H:100
Foam::fluidThermo
Fundamental fluid thermodynamic properties.
Definition: fluidThermo.H:52
variableHeatTransfer.H
Foam::fv::option::mesh_
const fvMesh & mesh_
Reference to the mesh database.
Definition: fvOption.H:82
Foam::Field< scalar >
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::fv::variableHeatTransfer::calculateHtc
virtual void calculateHtc()
Calculate the heat transfer coefficient.
Definition: variableHeatTransfer.C:97
Foam::fv::interRegionHeatTransferModel::interpolate
tmp< Field< Type > > interpolate(const interRegionHeatTransferModel &nbrModel, const Field< Type > &field) const
Interpolate field with nbrModel specified.
Foam::fv::variableHeatTransfer::variableHeatTransfer
variableHeatTransfer(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from dictionary.
Definition: variableHeatTransfer.C:52
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:434
Foam::fv::interRegionHeatTransferModel::htc_
volScalarField htc_
Heat transfer coefficient [W/m2/k] times area/volume [1/m].
Definition: interRegionHeatTransferModel.H:83
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::dictionary::dictName
word dictName() const
The local dictionary name (final part of scoped name)
Definition: dictionary.H:458
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
Foam::GeometricField::primitiveFieldRef
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
Definition: GeometricField.C:735
fv
labelList fv(nPoints)
Foam::fv::defineTypeNameAndDebug
defineTypeNameAndDebug(option, 0)
Foam::fv::addToRunTimeSelectionTable
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
Foam::ThermalDiffusivity
Templated wrapper class to provide compressible turbulence models thermal diffusivity based thermal t...
Definition: phaseCompressibleTurbulenceModelFwd.H:47
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::fv::variableHeatTransfer::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: variableHeatTransfer.C:126
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:246
Foam::GeometricField< scalar, fvPatchField, volMesh >
turbulentFluidThermoModel.H