mixedUnburntEnthalpyFvPatchScalarField.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) 2011-2025 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 "fieldMapper.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
35 (
36  const fvPatch& p,
38 )
39 :
40  mixedFvPatchScalarField(p, iF)
41 {
42  valueFraction() = scalar(0);
43  refValue() = scalar(0);
44  refGrad() = scalar(0);
45 }
46 
47 
50 (
51  const fvPatch& p,
53  const dictionary& dict
54 )
55 :
56  mixedFvPatchScalarField(p, iF, dict)
57 {}
58 
59 
62 (
64  const fvPatch& p,
66  const fieldMapper& mapper
67 )
68 :
69  mixedFvPatchScalarField(ptf, p, iF, mapper, false)
70 {
71  map(ptf, mapper);
72 }
73 
74 
77 (
80 )
81 :
82  mixedFvPatchScalarField(tppsf, iF)
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
89 (
91  const fieldMapper& mapper
92 )
93 {
94  // Unmapped faces are considered zero-gradient/adiabatic
95  // until they are corrected later
96  mapper(*this, ptf, [&](){ return patchInternalField(); });
97  mapper(refValue(), ptf.refValue(), [&](){ return patchInternalField(); });
98  mapper(refGrad(), ptf.refGrad(), scalar(0));
99  mapper(valueFraction(), ptf.valueFraction(), scalar(0));
100 }
101 
102 
104 (
105  const fvPatchScalarField& ptf,
106  const fieldMapper& mapper
107 )
108 {
109  map(refCast<const mixedUnburntEnthalpyFvPatchScalarField>(ptf), mapper);
110 }
111 
112 
114 {
115  if (updated())
116  {
117  return;
118  }
119 
121  db().lookupObject<psiuMulticomponentThermo>
122  (
123  physicalProperties::typeName
124  );
125 
126  const label patchi = patch().index();
127 
128  mixedFvPatchScalarField& Tw = refCast<mixedFvPatchScalarField>
129  (
130  const_cast<fvPatchScalarField&>(thermo.Tu().boundaryField()[patchi])
131  );
132 
133  Tw.evaluate();
134 
135  valueFraction() = Tw.valueFraction();
136  refValue() = thermo.heu(Tw.refValue(), patchi);
137  refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad()
138  + patch().deltaCoeffs()*
139  (
140  thermo.heu(Tw, patchi)
141  - thermo.heu(Tw, patch().faceCells())
142  );
143 
144  mixedFvPatchScalarField::updateCoeffs();
145 }
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 namespace Foam
151 {
153  (
156  );
157 }
158 
159 // ************************************************************************* //
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...
virtual const volScalarField & Cp() const =0
Heat capacity at constant pressure [J/kg/K].
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
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:91
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
mixedUnburntEnthalpyFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
void map(const mixedUnburntEnthalpyFvPatchScalarField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
Base-class for combustion fluid thermodynamic properties based on compressibility.
label patchi
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
makeNullConstructablePatchTypeField(fvPatchVectorField, noSlipFvPatchVectorField)
dictionary dict
volScalarField & p
fluidMulticomponentThermo & thermo
Definition: createFields.H:31