Loading...
Searching...
No Matches
totalTemperatureFvPatchScalarField.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) 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
38(
39 const fvPatch& p,
41)
42:
43 fixedValueFvPatchScalarField(p, iF),
44 UName_("U"),
45 phiName_("phi"),
46 psiName_("thermo:psi"),
47 gamma_(0.0),
48 T0_(p.size(), Zero)
49{}
50
51
53(
55 const fvPatch& p,
57 const fvPatchFieldMapper& mapper
58)
59:
60 fixedValueFvPatchScalarField(ptf, p, iF, mapper),
61 UName_(ptf.UName_),
62 phiName_(ptf.phiName_),
63 psiName_(ptf.psiName_),
64 gamma_(ptf.gamma_),
65 T0_(ptf.T0_, mapper)
66{}
67
68
70(
71 const fvPatch& p,
73 const dictionary& dict
74)
75:
76 fixedValueFvPatchScalarField(p, iF, dict, IOobjectOption::NO_READ),
77 UName_(dict.getOrDefault<word>("U", "U")),
78 phiName_(dict.getOrDefault<word>("phi", "phi")),
79 psiName_(dict.getOrDefault<word>("psi", "thermo:psi")),
80 gamma_(dict.get<scalar>("gamma")),
81 T0_("T0", dict, p.size())
82{
83 if (!this->readValueEntry(dict))
84 {
86 }
87}
88
89
91(
92 const totalTemperatureFvPatchScalarField& tppsf
93)
94:
95 fixedValueFvPatchScalarField(tppsf),
96 UName_(tppsf.UName_),
97 phiName_(tppsf.phiName_),
98 psiName_(tppsf.psiName_),
99 gamma_(tppsf.gamma_),
100 T0_(tppsf.T0_)
101{}
102
103
105(
108)
109:
110 fixedValueFvPatchScalarField(tppsf, iF),
111 UName_(tppsf.UName_),
112 phiName_(tppsf.phiName_),
113 psiName_(tppsf.psiName_),
114 gamma_(tppsf.gamma_),
115 T0_(tppsf.T0_)
116{}
117
118
119// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
120
122(
123 const fvPatchFieldMapper& m
125{
126 fixedValueFvPatchScalarField::autoMap(m);
127 T0_.autoMap(m);
128}
129
130
132(
133 const fvPatchScalarField& ptf,
134 const labelList& addr
135)
136{
137 fixedValueFvPatchScalarField::rmap(ptf, addr);
138
141
142 T0_.rmap(tiptf.T0_, addr);
143}
144
145
147{
148 if (updated())
149 {
150 return;
151 }
152
153 const auto& Up =
154 patch().lookupPatchField<volVectorField>(UName_);
155
156 const auto& phip =
157 patch().lookupPatchField<surfaceScalarField>(phiName_);
158
159 const auto& psip =
160 patch().lookupPatchField<volScalarField>(psiName_);
161
162 scalar gM1ByG = (gamma_ - 1.0)/gamma_;
163
164 operator==
165 (
166 T0_/(1.0 + 0.5*psip*gM1ByG*(neg(phip))*magSqr(Up))
167 );
168
169 fixedValueFvPatchScalarField::updateCoeffs();
170}
171
172
174{
176 os.writeEntryIfDifferent<word>("U", "U", UName_);
177 os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
178 os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
179 os.writeEntry("gamma", gamma_);
180 T0_.writeEntry("T0", os);
183
184
185// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186
187namespace Foam
188{
190 (
192 totalTemperatureFvPatchScalarField
193 );
194}
195
196// ************************************************************************* //
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...
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
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
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 a total temperature condition.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
totalTemperatureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
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.
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.