wallHeatFluxWriter.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  Copyright : (C) 2012 Symscape
3  Website : www.symscape.com
4 -------------------------------------------------------------------------------
5 License
6  This file is part of OpenFOAM.
7 
8  OpenFOAM is free software: you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
14  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16  for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
20 
21 \*---------------------------------------------------------------------------*/
22 
23 #include "wallHeatFluxWriter.H"
24 #include "fvCFD.H"
25 #include "dictionary.H"
26 #include "Time.H"
27 #include "wallFvPatch.H"
32 
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
39  const word wallHeatFluxWriter::FIELD_NAME("wallHeatFlux");
40 }
41 
42 
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
44 
47  bool & foundField) const
48 {
49  typedef incompressible::turbulenceModel iTModel;
50  typedef compressible::turbulenceModel cTModel;
51 
53  {
54  const iTModel& tModel
56  const singlePhaseTransportModel & transport =
57  static_cast<const singlePhaseTransportModel &>(tModel.transport());
58  dimensionedScalar Pr(transport.lookup("Pr"));
59  dimensionedScalar Cp0(transport.lookup("Cp"));
60 
61  return Cp0 * (tModel.nu()/Pr + obr.lookupObject<volScalarField>("alphat"));
62  }
63  else if (obr.foundObject<cTModel>(turbulenceModel::propertiesName))
64  {
65  const cTModel& tModel
67 
68  return tModel.kappaEff();
69  }
70 
71  foundField = false;
72  return volScalarField::null();
73 }
74 
75 
76 
77 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
78 
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
87 {
88  const fvMesh& mesh = refCast<const fvMesh>(obr);
89 
90  bool foundField = true;
91  word hName;
92  tmp<volScalarField> thtc = htc(obr, foundField);
93 
94 
95  volScalarField wallHeatFlux
96  (
97  IOobject
98  (
99  FIELD_NAME,
100  obr.time().timeName(),
101  mesh,
104  ),
105  mesh,
107  (
108  FIELD_NAME,
109  dimensionSet(1, 0, -3, 0, 0, 0, 0), // W.m-2
110  0.
111  )
112  );
113 
114 
115  if (foundField) {
116  const volScalarField & T = obr.lookupObject<volScalarField>("T");
117 
118  surfaceScalarField heatFlux
119  (
121  );
122 
123  const surfaceScalarField::GeometricBoundaryField& patchHeatFlux =
124  heatFlux.boundaryField();
125 
126  const fvPatchList& patches = mesh.boundary();
127 
129  wallHeatFlux.boundaryField();
130 
132  {
133  const fvPatch& currPatch = patches[patchi];
134 
135  if (isA<wallFvPatch>(currPatch))
136  {
137  scalarField & whfp = wHeatFluxb[patchi];
138  whfp = patchHeatFlux[patchi];
139  writeStatistics(whfp, currPatch.name(), FIELD_NAME);
140  }
141  }
142  }
143 
144  wallHeatFlux.write();
145  }
146 
147 
148 // ************************************************************************* //
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
singlePhaseTransportModel.H
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:117
Foam::fvc::interpolate
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &vf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Definition: surfaceInterpolate.C:110
turbulentTransportModel.H
Foam::turbulenceModel::propertiesName
static const word propertiesName
Default name of the turbulence properties dictionary.
Definition: turbulenceModel.H:97
wallFvPatch.H
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
Foam::wallHeatFluxWriter::write
virtual void write(const objectRegistry &obr)
Write derived field.
Definition: wallHeatFluxWriter.C:86
Foam::singlePhaseTransportModel
A simple single-phase transport model based on viscosityModel.
Definition: singlePhaseTransportModel.H:55
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:116
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::wallHeatFluxWriter::htc
tmp< volScalarField > htc(const objectRegistry &obr, bool &foundField) const
Return heat transfer coefficient.
Definition: wallHeatFluxWriter.C:46
Foam::fvPatch::name
const word & name() const
Return name.
Definition: fvPatch.H:149
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::wallHeatFluxWriter
Write wallHeatFlux field.
Definition: wallHeatFluxWriter.H:49
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::derivedFieldWriter
Basis for writers used in derivedFields e.g., wallShearStressWriter.
Definition: derivedFieldWriter.H:49
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Pr
dimensionedScalar Pr("Pr", dimless, laminarTransport)
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:550
Foam::objectRegistry::foundObject
bool foundObject(const word &name) const
Is the named Type found?
Definition: objectRegistryTemplates.C:142
Foam::ThermalDiffusivity
Templated wrapper class to provide compressible turbulence models thermal diffusivity based thermal t...
Definition: ThermalDiffusivity.H:48
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
wallHeatFluxWriter.H
patchi
label patchi
Definition: getPatchFieldScalar.H:1
dictionary.H
fvCFD.H
Foam::IncompressibleTurbulenceModel
Templated abstract base class for single-phase incompressible turbulence models.
Definition: IncompressibleTurbulenceModel.H:52
patches
patches[0]
Definition: createSingleCellMesh.H:36
Foam::wallHeatFluxWriter::wallHeatFluxWriter
wallHeatFluxWriter(const dictionary &dict)
Definition: wallHeatFluxWriter.C:79
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Definition: objectRegistryTemplates.C:165
Foam::GeometricField::null
static const GeometricField< Type, PatchField, GeoMesh > & null()
Return a null geometric field.
Definition: GeometricFieldI.H:30
Foam::wallHeatFluxWriter::FIELD_NAME
static const word FIELD_NAME
Field file name.
Definition: wallHeatFluxWriter.H:63
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::GeometricField::GeometricBoundaryField
Definition: GeometricField.H:105
turbulentFluidThermoModel.H