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-2018 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  checkType();
53 }
54 
55 
56 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
57 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
58 (
59  const fvPatch& p,
60  const DimensionedField<scalar, volMesh>& iF,
61  const dictionary& dict
62 )
63 :
64  alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF, dict),
65  vaporPhaseName_(dict.lookup("vaporPhase")),
66  relax_(dict.lookupOrDefault<scalar>("relax", 1.0)),
67  fixedDmdt_(dict.lookupOrDefault<scalar>("fixedDmdt", 0.0)),
68  L_(dict.lookupOrDefault<scalar>("L", 0.0))
69 {}
70 
71 
72 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
73 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
74 (
75  const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& psf,
76  const fvPatch& p,
77  const DimensionedField<scalar, volMesh>& iF,
78  const fvPatchFieldMapper& mapper
79 )
80 :
81  alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField
82  (
83  psf,
84  p,
85  iF,
86  mapper
87  ),
88  fixedDmdt_(psf.fixedDmdt_),
89  L_(psf.L_)
90 {}
91 
92 
93 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
94 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
95 (
96  const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& psf
97 )
98 :
99  alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf),
100  relax_(psf.relax_),
101  fixedDmdt_(psf.fixedDmdt_),
102  L_(psf.L_)
103 {}
104 
105 
106 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
107 alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
108 (
109  const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& psf,
110  const DimensionedField<scalar, volMesh>& iF
111 )
112 :
113  alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf, iF),
114  relax_(psf.relax_),
115  fixedDmdt_(psf.fixedDmdt_),
116  L_(psf.L_)
117 {}
118 
119 
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 
122 bool alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
123 activePhasePair(const phasePairKey& phasePair) const
124 {
125  if (phasePair == phasePairKey(vaporPhaseName_, internalField().group()))
126  {
127  return true;
128  }
129  else
130  {
131  return false;
132  }
133 }
134 
135 
136 const scalarField& alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
137 dmdt(const phasePairKey& phasePair) const
138 {
139  if (activePhasePair(phasePair))
140  {
141  return dmdt_;
142  }
143  else
144  {
146  << " dmdt requested for invalid phasePair!"
147  << abort(FatalError);
148 
149  return mDotL_;
150  }
151 }
152 
153 
154 const scalarField& alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
155 mDotL(const phasePairKey& phasePair) const
156 {
157  if (activePhasePair(phasePair))
158  {
159  return mDotL_;
160  }
161  else
162  {
164  << " mDotL requested for invalid phasePair!"
165  << abort(FatalError);
166 
167  return mDotL_;
168  }
169 }
170 
171 
172 void alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
173 {
174  if (updated())
175  {
176  return;
177  }
178 
179  dmdt_ = (1 - relax_)*dmdt_ + relax_*fixedDmdt_;
180  mDotL_ = dmdt_*L_;
181 
182  operator==(calcAlphat(*this));
183 
184  fixedValueFvPatchScalarField::updateCoeffs();
185 }
186 
187 
189 (
190  Ostream& os
191 ) const
192 {
194  os.writeKeyword("vaporPhase") << vaporPhaseName_ << token::END_STATEMENT
195  << nl;
196  os.writeKeyword("relax") << relax_ << token::END_STATEMENT << nl;
197  os.writeKeyword("fixedDmdt") << fixedDmdt_ << token::END_STATEMENT << nl;
198  os.writeKeyword("L") << L_ << token::END_STATEMENT << nl;
199  dmdt_.writeEntry("dmdt", os);
200  writeEntry("value", os);
201 }
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
207 (
209  alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
210 );
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace compressible
216 } // End namespace Foam
217 
218 // ************************************************************************* //
dictionary dict
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
void writeEntry(const word &keyword, Ostream &os) const
Write the field as a dictionary entry.
Definition: Field.C:726
word group() const
Return group (extension part of name)
Definition: IOobject.C:379
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:362
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
static const char nl
Definition: Ostream.H:265
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.