Loading...
Searching...
No Matches
inletOutletTotalTemperatureFvPatchScalarField.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) 2017-2020 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 "surfaceFields.H"
34
35// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36
39(
40 const fvPatch& p,
42)
43:
44 inletOutletFvPatchScalarField(p, iF),
45 UName_("U"),
46 psiName_("psi"),
47 gamma_(0.0),
48 T0_(p.size(), Zero)
50 this->refValue() = Zero;
51 this->refGrad() = Zero;
52 this->valueFraction() = 0.0;
53}
54
55
58(
60 const fvPatch& p,
62 const fvPatchFieldMapper& mapper
63)
64:
65 inletOutletFvPatchScalarField(ptf, p, iF, mapper),
66 UName_(ptf.UName_),
67 psiName_(ptf.psiName_),
68 gamma_(ptf.gamma_),
69 T0_(ptf.T0_, mapper)
70{}
71
72
75(
76 const fvPatch& p,
78 const dictionary& dict
79)
80:
81 inletOutletFvPatchScalarField(p, iF),
82 UName_(dict.getOrDefault<word>("U", "U")),
83 psiName_(dict.getOrDefault<word>("psi", "thermo:psi")),
84 gamma_(dict.get<scalar>("gamma")),
85 T0_("T0", dict, p.size())
86{
88
89 this->phiName_ = dict.getOrDefault<word>("phi", "phi");
90
91 this->refValue() = Zero;
92
93 if (!this->readValueEntry(dict))
94 {
96 }
97
98 this->refGrad() = Zero;
99 this->valueFraction() = 0.0;
100}
101
102
105(
106 const inletOutletTotalTemperatureFvPatchScalarField& tppsf
107)
108:
109 inletOutletFvPatchScalarField(tppsf),
110 UName_(tppsf.UName_),
111 psiName_(tppsf.psiName_),
112 gamma_(tppsf.gamma_),
113 T0_(tppsf.T0_)
114{}
115
116
119(
122)
123:
124 inletOutletFvPatchScalarField(tppsf, iF),
125 UName_(tppsf.UName_),
126 psiName_(tppsf.psiName_),
127 gamma_(tppsf.gamma_),
128 T0_(tppsf.T0_)
129{}
130
131
132// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
133
135(
136 const fvPatchFieldMapper& m
138{
139 inletOutletFvPatchScalarField::autoMap(m);
140 T0_.autoMap(m);
141}
142
143
145(
146 const fvPatchScalarField& ptf,
147 const labelList& addr
148)
149{
150 inletOutletFvPatchScalarField::rmap(ptf, addr);
151
154
155 T0_.rmap(tiptf.T0_, addr);
156}
157
158
160{
161 if (updated())
162 {
163 return;
164 }
165
166 const auto& Up =
167 patch().lookupPatchField<volVectorField>(UName_);
168
169 const auto& phip =
170 patch().lookupPatchField<surfaceScalarField>(this->phiName_);
171
172 const auto& psip =
173 patch().lookupPatchField<volScalarField>(psiName_);
174
175 scalar gM1ByG = (gamma_ - 1.0)/gamma_;
176
177 this->refValue() =
178 T0_/(1.0 + 0.5*psip*gM1ByG*(neg(phip))*magSqr(Up));
179 this->valueFraction() = neg(phip);
180
181 inletOutletFvPatchScalarField::updateCoeffs();
182}
183
184
186const
187{
189 os.writeEntryIfDifferent<word>("U", "U", UName_);
190 os.writeEntryIfDifferent<word>("phi", "phi", this->phiName_);
191 os.writeEntryIfDifferent<word>("psi", "psi", psiName_);
192 os.writeEntry("gamma", gamma_);
193 T0_.writeEntry("T0", os);
196
197
198// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199
200namespace Foam
201{
203 (
205 inletOutletTotalTemperatureFvPatchScalarField
206 );
207}
208
209// ************************************************************************* //
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...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
virtual void readDict(const dictionary &dict)
Read dictionary entries.
A FieldMapper for finite-volume patch fields.
virtual void write(Ostream &) const
Write.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual void operator=(const UList< Type > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
This boundary condition provides an outflow condition for total temperature for use with supersonic c...
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.
inletOutletTotalTemperatureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A class for handling words, derived from Foam::string.
Definition word.H:66
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField,...
Namespace for OpenFOAM.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
GeometricField< vector, fvPatchField, volMesh > volVectorField
List< label > labelList
A List of labels.
Definition List.H:62
GeometricField< scalar, fvPatchField, volMesh > volScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
dimensionedScalar neg(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
fvPatchField< scalar > fvPatchScalarField
dictionary dict
Foam::surfaceFields.