energyJumpFvPatchScalarField.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) 2012-2017 OpenFOAM Foundation
9  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 "fixedJumpFvPatchFields.H"
32 #include "basicThermo.H"
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
37 (
38  const fvPatch& p,
40 )
41 :
42  parent_bctype(p, iF)
43 {}
44 
45 
47 (
48  const this_bctype& ptf,
49  const fvPatch& p,
51  const fvPatchFieldMapper& mapper
52 )
53 :
54  parent_bctype(ptf, p, iF, mapper)
55 {}
56 
57 
59 (
60  const fvPatch& p,
62  const dictionary& dict
63 )
64 :
65  parent_bctype(p, iF)
66 {
67  if (!this->readValueEntry(dict))
68  {
70  }
71 }
72 
73 
75 (
76  const this_bctype& ptf,
77  const DimensionedField<scalar, volMesh>& iF
78 )
79 :
80  parent_bctype(ptf, iF)
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
87 {
88  if (this->updated())
89  {
90  return;
91  }
92 
93  if (this->cyclicPatch().owner())
94  {
95  const basicThermo& thermo = basicThermo::lookupThermo(*this);
96  label patchID = patch().index();
97 
99  const auto& TbPatch =
100  refCast<const fixedJumpFvPatchScalarField>
101  (
103  );
104 
105  auto& Tbp = const_cast<fixedJumpFvPatchScalarField&>(TbPatch);
106 
107  // force update of jump
109 
110  const labelUList& faceCells = this->patch().faceCells();
111 
112  setJump
113  (
114  thermo.he(pp, Tbp+Tbp.jump(), faceCells)
115  - thermo.he(pp, Tbp, faceCells)
116  );
117  }
118 
119  this->parent_bctype::updateCoeffs();
120 }
121 
122 
123 void Foam::energyJumpFvPatchScalarField::write(Ostream& os) const
124 {
125  this->parent_bctype::write(os);
127 }
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 namespace Foam
133 {
135  (
137  energyJumpFvPatchScalarField
138  );
139 }
140 
141 // ************************************************************************* //
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
dictionary dict
virtual void write(Ostream &) const
Write.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
void evaluate(const UPstream::commsTypes commsType=UPstream::defaultCommsType)
Evaluate boundary conditions for each patch field. Uses specified or default comms.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual const volScalarField & T() const
Temperature [K].
Definition: basicThermo.C:619
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
Definition: fvPatchField.H:425
virtual void evaluate(const Pstream::commsTypes commsType)
Evaluate the patch field.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
Definition: UList.H:76
virtual volScalarField & he()=0
Enthalpy/Internal energy [J/kg].
virtual volScalarField & p()
Pressure [Pa].
Definition: basicThermo.C:607
psiReactionThermo & thermo
Definition: createFields.H:28
energyJumpFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
fvPatchField< scalar > fvPatchScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const std::string patch
OpenFOAM patch number as a std::string.
static const basicThermo & lookupThermo(const fvPatchScalarField &pf)
Definition: basicThermo.C:454
volScalarField & p
"buffered" : (MPI_Bsend, MPI_Recv)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.
virtual void updateCoeffs()
Update the coefficients.