energyJumpFvPatchScalarField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2024 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 "basicThermo.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const fvPatch& p,
36 )
37 :
38  jumpCyclicFvPatchScalarField(p, iF),
39  jump_(p.size(), Zero)
40 {
41  evaluateNoUpdateCoeffs();
42 }
43 
44 
46 (
47  const fvPatch& p,
49  const dictionary& dict
50 )
51 :
52  jumpCyclicFvPatchScalarField(p, iF, dict),
53  jump_("jump", iF.dimensions(), dict, p.size())
54 {
55  evaluateNoUpdateCoeffs();
56 }
57 
58 
60 (
62  const fvPatch& p,
64  const fieldMapper& mapper
65 )
66 :
67  jumpCyclicFvPatchScalarField(ptf, p, iF, mapper),
68  jump_(mapper(ptf.jump_))
69 {}
70 
71 
73 (
76 )
77 :
78  jumpCyclicFvPatchScalarField(ptf, iF),
79  jump_(ptf.jump_)
80 {}
81 
82 
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84 
86 {
87  return jump_;
88 }
89 
90 
92 (
93  const fvPatchScalarField& ptf,
94  const fieldMapper& mapper
95 )
96 {
97  jumpCyclicFvPatchScalarField::map(ptf, mapper);
98 
99  const energyJumpFvPatchScalarField& tiptf =
100  refCast<const energyJumpFvPatchScalarField>(ptf);
101 
102  mapper(jump_, tiptf.jump_);
103 }
104 
105 
107 (
108  const fvPatchScalarField& ptf
109 )
110 {
111  jumpCyclicFvPatchScalarField::reset(ptf);
112 
113  const energyJumpFvPatchScalarField& tiptf =
114  refCast<const energyJumpFvPatchScalarField>(ptf);
115 
116  jump_.reset(tiptf.jump_);
117 }
118 
119 
121 {
122  if (this->updated())
123  {
124  return;
125  }
126 
128 
129  jumpCyclicFvPatchScalarField& Tp =
130  const_cast<jumpCyclicFvPatchScalarField&>
131  (
132  refCast<const jumpCyclicFvPatchScalarField>
133  (
134  thermo.T().boundaryField()[patch().index()]
135  )
136  );
137 
138  // Force update of the jump
139  Tp.updateCoeffs();
140 
141  // Convert the temperature jump to an energy jump
142  jump_ = thermo.he(Tp.jump(), patch().faceCells());
143 
144  jumpCyclicFvPatchScalarField::updateCoeffs();
145 }
146 
147 
149 {
151 
152  writeEntry(os, "jump", jump_);
153 }
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 namespace Foam
159 {
161  (
164  );
165 }
166 
167 
168 // ************************************************************************* //
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:57
Base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:78
static const basicThermo & lookupThermo(const FieldType &f)
Lookup the thermo associated with the given field.
virtual const volScalarField & T() const =0
Temperature [K].
virtual const volScalarField & he() const =0
Enthalpy/Internal energy [J/kg].
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
This boundary condition provides an energy jump condition, using the cyclic condition as a base....
virtual tmp< scalarField > jump() const
Return the "jump".
virtual void write(Ostream &) const
Write.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
virtual void updateCoeffs()
Update the coefficients.
virtual void map(const fvPatchScalarField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
energyJumpFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:229
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
Definition: dimensionSets.C:96
makeNullConstructablePatchTypeField(fvPatchVectorField, noSlipFvPatchVectorField)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dictionary dict
volScalarField & p
fluidMulticomponentThermo & thermo
Definition: createFields.H:31