alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.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) 2015-2019 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 
27 #include "fvPatchFieldMapper.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace compressible
35 {
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
41 (
42  const fvPatch& p,
43  const DimensionedField<scalar, volMesh>& iF
44 )
45 :
46  alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF),
47  vaporPhaseName_("vapor"),
48  relax_(1.0),
49  fixedDmdt_(0.0),
50  L_(0.0)
51 {}
52 
53 
54 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
55 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
56 (
57  const fvPatch& p,
58  const DimensionedField<scalar, volMesh>& iF,
59  const dictionary& dict
60 )
61 :
62  alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF, dict),
63  vaporPhaseName_(dict.lookup("vaporPhase")),
64  relax_(dict.lookupOrDefault<scalar>("relax", 1.0)),
65  fixedDmdt_(dict.lookupOrDefault<scalar>("fixedDmdt", 0.0)),
66  L_(dict.lookupOrDefault<scalar>("L", 0.0))
67 {}
68 
69 
70 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
71 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
72 (
73  const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& psf,
74  const fvPatch& p,
75  const DimensionedField<scalar, volMesh>& iF,
76  const fvPatchFieldMapper& mapper
77 )
78 :
79  alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField
80  (
81  psf,
82  p,
83  iF,
84  mapper
85  ),
86  fixedDmdt_(psf.fixedDmdt_),
87  L_(psf.L_)
88 {}
89 
90 
91 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
92 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
93 (
94  const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& psf
95 )
96 :
97  alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf),
98  relax_(psf.relax_),
99  fixedDmdt_(psf.fixedDmdt_),
100  L_(psf.L_)
101 {}
102 
103 
104 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
105 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
106 (
107  const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& psf,
108  const DimensionedField<scalar, volMesh>& iF
109 )
110 :
111  alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf, iF),
112  relax_(psf.relax_),
113  fixedDmdt_(psf.fixedDmdt_),
114  L_(psf.L_)
115 {}
116 
117 
118 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 
120 bool alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
121 activePhasePair(const phasePairKey& phasePair) const
122 {
123  if (phasePair == phasePairKey(vaporPhaseName_, internalField().group()))
124  {
125  return true;
126  }
127  else
128  {
129  return false;
130  }
131 }
132 
133 
134 const scalarField& alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
135 dmdt(const phasePairKey& phasePair) const
136 {
137  if (activePhasePair(phasePair))
138  {
139  return dmdt_;
140  }
141  else
142  {
144  << " dmdt requested for invalid phasePair!"
145  << abort(FatalError);
146 
147  return mDotL_;
148  }
149 }
150 
151 
152 const scalarField& alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
153 mDotL(const phasePairKey& phasePair) const
154 {
155  if (activePhasePair(phasePair))
156  {
157  return mDotL_;
158  }
159  else
160  {
162  << " mDotL requested for invalid phasePair!"
163  << abort(FatalError);
164 
165  return mDotL_;
166  }
167 }
168 
169 
170 void alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
171 {
172  if (updated())
173  {
174  return;
175  }
176 
177  dmdt_ = (1 - relax_)*dmdt_ + relax_*fixedDmdt_;
178  mDotL_ = dmdt_*L_;
179 
180  operator==(calcAlphat(*this));
181 
182  fixedValueFvPatchScalarField::updateCoeffs();
183 }
184 
185 
187 (
188  Ostream& os
189 ) const
190 {
192  writeEntry(os, "vaporPhase", vaporPhaseName_);
193  writeEntry(os, "relax", relax_);
194  writeEntry(os, "fixedDmdt", fixedDmdt_);
195  writeEntry(os, "L", L_);
196  writeEntry(os, "dmdt", dmdt_);
197  writeEntry(os, "value", *this);
198 }
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
204 (
206  alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
207 );
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace compressible
213 } // End namespace Foam
214 
215 // ************************************************************************* //
dictionary dict
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
word group() const
Return group (extension part of name)
Definition: IOobject.C:372
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:280
Macros for easy insertion into run-time selection tables.
const Internal & internalField() const
Return a const-reference to the dimensioned internal field.
void write(Ostream &, const label, const dictionary &)
Write with dictionary lookup.
stressControl lookup("compactNormalStress") >> compactNormalStress
fvPatchField< scalar > fvPatchScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
void operator==(const tmp< GeometricField< Type, PatchField, GeoMesh >> &)
volScalarField & p
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.