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  Copyright (C) 2020 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 \*---------------------------------------------------------------------------*/
28 
29 #include "variableHeatTransfer.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace fv
38 {
39  defineTypeNameAndDebug(variableHeatTransfer, 0);
41  (
42  option,
43  variableHeatTransfer,
44  dictionary
45  );
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 (
54  const word& name,
55  const word& modelType,
56  const dictionary& dict,
57  const fvMesh& mesh
58 )
59 :
61  UNbrName_(coeffs_.getOrDefault<word>("UNbr", "U")),
62  a_(0),
63  b_(0),
64  c_(0),
65  ds_(0),
66  Pr_(0),
67  AoV_()
68 {
69  if (master_)
70  {
71  coeffs_.readEntry("a", a_);
72  coeffs_.readEntry("b", b_);
73  coeffs_.readEntry("c", c_);
74  coeffs_.readEntry("ds", ds_);
75  coeffs_.readEntry("Pr", Pr_);
76 
77  AoV_.reset
78  (
79  new volScalarField
80  (
81  IOobject
82  (
83  "AoV",
84  mesh_.time().timeName(),
85  mesh_,
86  IOobject::MUST_READ,
87  IOobject::AUTO_WRITE
88  ),
89  mesh_
90  )
91  );
92  }
93 }
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
99 {
100  const fvMesh& nbrMesh =
102 
103  const compressible::turbulenceModel& nbrTurb =
105  (
107  );
108 
109  const fluidThermo& nbrThermo =
111 
112  const volVectorField& UNbr =
113  nbrMesh.lookupObject<volVectorField>(UNbrName_);
114 
115  const volScalarField ReNbr(mag(UNbr)*ds_*nbrThermo.rho()/nbrTurb.mut());
116 
117  const volScalarField NuNbr(a_*pow(ReNbr, b_)*pow(Pr_, c_));
118 
119  const scalarField htcNbr(NuNbr*nbrTurb.kappaEff()/ds_);
120 
121  const scalarField htcNbrMapped(interpolate(htcNbr));
122 
123  htc_.primitiveFieldRef() = htcNbrMapped * AoV_();
124 }
125 
126 
128 {
130  {
131  coeffs_.readIfPresent("UNbr", UNbrName_);
132 
133  coeffs_.readIfPresent("a", a_);
134  coeffs_.readIfPresent("b", b_);
135  coeffs_.readIfPresent("c", c_);
136  coeffs_.readIfPresent("ds", ds_);
137  coeffs_.readIfPresent("Pr", Pr_);
138 
139  return true;
140  }
141 
142  return false;
143 }
144 
145 
146 // ************************************************************************* //
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:98
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:53
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:766
fv
labelList fv(nPoints)
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:266
Foam::fv::variableHeatTransfer::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: variableHeatTransfer.C:127
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:248
Foam::fv::defineTypeNameAndDebug
defineTypeNameAndDebug(atmAmbientTurbSource, 0)
Foam::fv::addToRunTimeSelectionTable
addToRunTimeSelectionTable(option, atmAmbientTurbSource, dictionary)
Foam::GeometricField< scalar, fvPatchField, volMesh >
turbulentFluidThermoModel.H