greyDiffusiveViewFactorFixedValueFvPatchScalarField.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-2017 OpenFOAM Foundation
9 Copyright (C) 2016 OpenCFD Ltd
10-------------------------------------------------------------------------------
11License
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
31#include "fvPatchFieldMapper.H"
32#include "volFields.H"
33#include "radiationModel.H"
34#include "viewFactor.H"
35
36// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37
38Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
39greyDiffusiveViewFactorFixedValueFvPatchScalarField
40(
41 const fvPatch& p,
43)
44:
45 fixedValueFvPatchScalarField(p, iF),
46 qro_()
47{}
48
49
50Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
51greyDiffusiveViewFactorFixedValueFvPatchScalarField
52(
54 const fvPatch& p,
56 const fvPatchFieldMapper& mapper
57)
58:
59 fixedValueFvPatchScalarField(ptf, p, iF, mapper),
60 qro_(ptf.qro_, mapper)
61{}
62
63
64Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
65greyDiffusiveViewFactorFixedValueFvPatchScalarField
66(
67 const fvPatch& p,
69 const dictionary& dict
70)
71:
72 fixedValueFvPatchScalarField(p, iF, dict, false),
73 qro_("qro", dict, p.size())
74{
75 if (dict.found("value"))
76 {
78 (
79 scalarField("value", dict, p.size())
80 );
81
82 }
83 else
84 {
86 }
87}
88
89
90Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
91greyDiffusiveViewFactorFixedValueFvPatchScalarField
92(
94)
95:
96 fixedValueFvPatchScalarField(ptf),
97 qro_(ptf.qro_)
98{}
99
100
101Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
102greyDiffusiveViewFactorFixedValueFvPatchScalarField
103(
106)
107:
108 fixedValueFvPatchScalarField(ptf, iF),
109 qro_(ptf.qro_)
110{}
111
112
113// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114
117(
118 const fvPatchFieldMapper& m
119)
120{
121 fixedValueFvPatchScalarField::autoMap(m);
122 qro_.autoMap(m);
123}
124
125
127(
128 const fvPatchScalarField& ptf,
129 const labelList& addr
130)
131{
132 fixedValueFvPatchScalarField::rmap(ptf, addr);
133
135 refCast<const greyDiffusiveViewFactorFixedValueFvPatchScalarField>(ptf);
136
137 qro_.rmap(mrptf.qro_, addr);
138}
139
140
143{
144 if (this->updated())
145 {
146 return;
147 }
148
149 if (debug)
150 {
151 scalar Q = gSum((*this)*patch().magSf());
152
153 Info<< patch().boundaryMesh().mesh().name() << ':'
154 << patch().name() << ':'
155 << this->internalField().name() << " <- "
156 << " heat transfer rate:" << Q
157 << " wall radiative heat flux "
158 << " min:" << gMin(*this)
159 << " max:" << gMax(*this)
160 << " avg:" << gAverage(*this)
161 << endl;
162 }
163}
164
165
168{
169 tmp<scalarField> tqrt(new scalarField(qro_));
170
171 const viewFactor& radiation =
172 db().lookupObject<viewFactor>("radiationProperties");
173
174 if (radiation.useSolarLoad())
175 {
176 tqrt.ref() += patch().lookupPatchField<volScalarField, scalar>
177 (
178 radiation.primaryFluxName_ + "_" + name(bandI)
179 );
180
181 word qSecName = radiation.relfectedFluxName_ + "_" + name(bandI);
182
183 if (this->db().foundObject<volScalarField>(qSecName))
184 {
185 const volScalarField& qSec =
186 this->db().lookupObject<volScalarField>(qSecName);
187
188 tqrt.ref() += qSec.boundaryField()[patch().index()];
189 }
190 }
191
192 return tqrt;
193}
194
195
197write
198(
199 Ostream& os
200) const
201{
202 fixedValueFvPatchScalarField::write(os);
203 qro_.writeEntry("qro", os);
204}
205
206
207// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208
209namespace Foam
210{
211namespace radiation
212{
214 (
217 );
218}
219}
220
221
222// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Boundary & boundaryField() const
Return const-reference to the boundary field.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionaryI.H:87
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
virtual void operator=(const UList< scalar > &)
Definition: fvPatchField.C:408
friend Ostream & operator(Ostream &, const fvPatchField< scalar > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
This boundary condition provides a grey-diffuse condition for radiative heat flux,...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
tmp< scalarField > qro(label bandI=0) const
Return external + solar load radiative heat flux.
View factor radiation model. The system solved is: C q = b where: Cij = deltaij/Ej - (1/Ej - 1)Fij q ...
Definition: viewFactor.H:80
A class for managing temporary objects.
Definition: tmp.H:65
T & ref() const
Definition: tmpI.H:227
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Definition: fvPatchField.H:676
Namespace for OpenFOAM.
Type gSum(const FieldField< Field, Type > &f)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
Type gAverage(const FieldField< Field, Type > &f)
Type gMin(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Type gMax(const FieldField< Field, Type > &f)
dictionary dict