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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
30 #include "fvPatchFieldMapper.H"
31 #include "volFields.H"
32 #include "surfaceFields.H"
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
37 (
38  const fvPatch& p,
40 )
41 :
42  fixedValueFvPatchScalarField(p, iF),
43  UName_("U"),
44  phiName_("phi"),
45  psiName_("thermo:psi"),
46  gamma_(0.0),
47  T0_(p.size(), Zero)
48 {}
49 
50 
52 (
54  const fvPatch& p,
56  const fvPatchFieldMapper& mapper
57 )
58 :
59  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
60  UName_(ptf.UName_),
61  phiName_(ptf.phiName_),
62  psiName_(ptf.psiName_),
63  gamma_(ptf.gamma_),
64  T0_(ptf.T0_, mapper)
65 {}
66 
67 
69 (
70  const fvPatch& p,
72  const dictionary& dict
73 )
74 :
75  fixedValueFvPatchScalarField(p, iF, dict, false),
76  UName_(dict.lookupOrDefault<word>("U", "U")),
77  phiName_(dict.lookupOrDefault<word>("phi", "phi")),
78  psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
79  gamma_(dict.get<scalar>("gamma")),
80  T0_("T0", dict, p.size())
81 {
82  if (dict.found("value"))
83  {
85  (
86  scalarField("value", dict, p.size())
87  );
88  }
89  else
90  {
92  }
93 }
94 
95 
97 (
99 )
100 :
101  fixedValueFvPatchScalarField(tppsf),
102  UName_(tppsf.UName_),
103  phiName_(tppsf.phiName_),
104  psiName_(tppsf.psiName_),
105  gamma_(tppsf.gamma_),
106  T0_(tppsf.T0_)
107 {}
108 
109 
111 (
114 )
115 :
116  fixedValueFvPatchScalarField(tppsf, iF),
117  UName_(tppsf.UName_),
118  phiName_(tppsf.phiName_),
119  psiName_(tppsf.psiName_),
120  gamma_(tppsf.gamma_),
121  T0_(tppsf.T0_)
122 {}
123 
124 
125 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
126 
128 (
129  const fvPatchFieldMapper& m
130 )
131 {
132  fixedValueFvPatchScalarField::autoMap(m);
133  T0_.autoMap(m);
134 }
135 
136 
138 (
139  const fvPatchScalarField& ptf,
140  const labelList& addr
141 )
142 {
143  fixedValueFvPatchScalarField::rmap(ptf, addr);
144 
146  refCast<const totalTemperatureFvPatchScalarField>(ptf);
147 
148  T0_.rmap(tiptf.T0_, addr);
149 }
150 
151 
153 {
154  if (updated())
155  {
156  return;
157  }
158 
159  const fvPatchVectorField& Up =
160  patch().lookupPatchField<volVectorField, vector>(UName_);
161 
162  const fvsPatchField<scalar>& phip =
163  patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
164 
165  const fvPatchField<scalar>& psip =
166  patch().lookupPatchField<volScalarField, scalar>(psiName_);
167 
168  scalar gM1ByG = (gamma_ - 1.0)/gamma_;
169 
170  operator==
171  (
172  T0_/(1.0 + 0.5*psip*gM1ByG*(1.0 - pos0(phip))*magSqr(Up))
173  );
174 
175  fixedValueFvPatchScalarField::updateCoeffs();
176 }
177 
178 
180 {
182  os.writeEntryIfDifferent<word>("U", "U", UName_);
183  os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
184  os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
185  os.writeEntry("gamma", gamma_);
186  T0_.writeEntry("T0", os);
187  writeEntry("value", os);
188 }
189 
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 namespace Foam
194 {
196  (
199  );
200 }
201 
202 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:50
Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
totalTemperatureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: totalTemperatureFvPatchScalarField.C:37
volFields.H
Foam::fvPatchField< scalar >::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:364
Foam::Ostream::writeEntryIfDifferent
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Definition: Ostream.H:231
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::fvsPatchField
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:68
surfaceFields.H
Foam::surfaceFields.
fvPatchFieldMapper.H
Foam::pos0
dimensionedScalar pos0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:188
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::totalTemperatureFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: totalTemperatureFvPatchScalarField.C:128
Foam::totalTemperatureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: totalTemperatureFvPatchScalarField.C:179
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::totalTemperatureFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: totalTemperatureFvPatchScalarField.C:138
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
totalTemperatureFvPatchScalarField.H
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:60
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::List< label >
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:219
Foam::totalTemperatureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: totalTemperatureFvPatchScalarField.C:152
Foam::totalTemperatureFvPatchScalarField
This boundary condition provides a total temperature condition.
Definition: totalTemperatureFvPatchScalarField.H:106
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54