filmPyrolysisTemperatureCoupledFvPatchScalarField.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 | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 #include "surfaceFields.H"
29 #include "pyrolysisModel.H"
30 #include "surfaceFilmModel.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
36 (
37  const fvPatch& p,
39 )
40 :
41  fixedValueFvPatchScalarField(p, iF),
42  filmRegionName_("surfaceFilmProperties"),
43  pyrolysisRegionName_("pyrolysisProperties"),
44  phiName_("phi"),
45  rhoName_("rho")
46 {}
47 
48 
51 (
53  const fvPatch& p,
55  const fvPatchFieldMapper& mapper
56 )
57 :
58  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
59  filmRegionName_(ptf.filmRegionName_),
60  pyrolysisRegionName_(ptf.pyrolysisRegionName_),
61  phiName_(ptf.phiName_),
62  rhoName_(ptf.rhoName_)
63 {}
64 
65 
68 (
69  const fvPatch& p,
71  const dictionary& dict
72 )
73 :
74  fixedValueFvPatchScalarField(p, iF),
75  filmRegionName_
76  (
77  dict.lookupOrDefault<word>("filmRegion", "surfaceFilmProperties")
78  ),
79  pyrolysisRegionName_
80  (
81  dict.lookupOrDefault<word>("pyrolysisRegion", "pyrolysisProperties")
82  ),
83  phiName_(dict.lookupOrDefault<word>("phi", "phi")),
84  rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
85 {
86  fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
87 }
88 
89 
92 (
94 )
95 :
96  fixedValueFvPatchScalarField(fptpsf),
97  filmRegionName_(fptpsf.filmRegionName_),
98  pyrolysisRegionName_(fptpsf.pyrolysisRegionName_),
99  phiName_(fptpsf.phiName_),
100  rhoName_(fptpsf.rhoName_)
101 {}
102 
103 
106 (
109 )
110 :
111  fixedValueFvPatchScalarField(fptpsf, iF),
112  filmRegionName_(fptpsf.filmRegionName_),
113  pyrolysisRegionName_(fptpsf.pyrolysisRegionName_),
114  phiName_(fptpsf.phiName_),
115  rhoName_(fptpsf.rhoName_)
116 {}
117 
118 
119 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
120 
122 {
123  if (updated())
124  {
125  return;
126  }
127 
130 
131  // Since we're inside initEvaluate/evaluate there might be processor
132  // comms underway. Change the tag we use.
133  int oldTag = UPstream::msgType();
134  UPstream::msgType() = oldTag+1;
135 
136  bool filmOk = db().time().foundObject<filmModelType>(filmRegionName_);
137 
138 
139  bool pyrOk = db().time().foundObject<pyrModelType>(pyrolysisRegionName_);
140 
141  if (!filmOk || !pyrOk)
142  {
143  // do nothing on construction - film model doesn't exist yet
144  return;
145  }
146 
147  scalarField& Tp = *this;
148 
149  const label patchI = patch().index();
150 
151  // Retrieve film model
152  const filmModelType& filmModel =
153  db().time().lookupObject<filmModelType>(filmRegionName_);
154 
155  const label filmPatchI = filmModel.regionPatchID(patchI);
156 
157  scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchI];
158  filmModel.toPrimary(filmPatchI, alphaFilm);
159 
160  scalarField TFilm = filmModel.Ts().boundaryField()[filmPatchI];
161  filmModel.toPrimary(filmPatchI, TFilm);
162 
163  // Retrieve pyrolysis model
164  const pyrModelType& pyrModel =
165  db().time().lookupObject<pyrModelType>(pyrolysisRegionName_);
166 
167  const label pyrPatchI = pyrModel.regionPatchID(patchI);
168 
169  scalarField TPyr = pyrModel.T().boundaryField()[pyrPatchI];
170  pyrModel.toPrimary(pyrPatchI, TPyr);
171 
172 
173  // Evaluate temperature
174  Tp = alphaFilm*TFilm + (1.0 - alphaFilm)*TPyr;
175 
176  // Restore tag
177  UPstream::msgType() = oldTag;
178 
179  fixedValueFvPatchScalarField::updateCoeffs();
180 }
181 
182 
184 (
185  Ostream& os
186 ) const
187 {
189  writeEntryIfDifferent<word>
190  (
191  os,
192  "filmRegion",
193  "surfaceFilmProperties",
194  filmRegionName_
195  );
196  writeEntryIfDifferent<word>
197  (
198  os,
199  "pyrolysisRegion",
200  "pyrolysisProperties",
201  pyrolysisRegionName_
202  );
203  writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
204  writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
205  writeEntry("value", os);
206 }
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 namespace Foam
212 {
214  (
217  );
218 }
219 
220 
221 // ************************************************************************* //
Foam::regionModels::pyrolysisModels::pyrolysisModel
Base class for pyrolysis models.
Definition: pyrolysisModel.H:60
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Foam::fvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:349
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::rhoName_
word rhoName_
Name of density field.
Definition: filmPyrolysisTemperatureCoupledFvPatchScalarField.H:82
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: filmPyrolysisTemperatureCoupledFvPatchScalarField.C:184
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::filmPyrolysisTemperatureCoupledFvPatchScalarField
filmPyrolysisTemperatureCoupledFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: filmPyrolysisTemperatureCoupledFvPatchScalarField.C:36
surfaceFields.H
Foam::surfaceFields.
pyrolysisModel.H
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Field::T
tmp< Field< Type > > T() const
Return the field transpose (only defined for second rank tensors)
Definition: Field.C:691
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::phiName_
word phiName_
Name of flux field.
Definition: filmPyrolysisTemperatureCoupledFvPatchScalarField.H:79
surfaceFilmModel.H
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
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::makePatchTypeField
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: filmPyrolysisTemperatureCoupledFvPatchScalarField.C:121
Foam::UPstream::msgType
static int & msgType()
Message tag of standard messages.
Definition: UPstream.H:452
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField
This boundary condition is designed to be used in conjunction with surface film and pyrolysis modelli...
Definition: filmPyrolysisTemperatureCoupledFvPatchScalarField.H:66
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::pyrolysisRegionName_
const word pyrolysisRegionName_
Name of pyrolysis region.
Definition: filmPyrolysisTemperatureCoupledFvPatchScalarField.H:76
scalarField
volScalarField scalarField(fieldObject, mesh)
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::filmRegionName_
const word filmRegionName_
Name of film region.
Definition: filmPyrolysisTemperatureCoupledFvPatchScalarField.H:73
filmPyrolysisTemperatureCoupledFvPatchScalarField.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::regionModels::surfaceFilmModels::surfaceFilmModel
Base class for surface film models.
Definition: surfaceFilmModel.H:61
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51