alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.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) 2015-2019 OpenFOAM Foundation
9  Copyright (C) 2020 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 
30 #include "fvPatchFieldMapper.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace compressible
38 {
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
44 (
45  const fvPatch& p,
47 )
48 :
50  vaporPhaseName_("vapor"),
51  relax_(1.0),
52  fixedDmdt_(0.0),
53  L_(0.0)
54 {
55  checkType();
56 }
57 
58 
61 (
62  const fvPatch& p,
64  const dictionary& dict
65 )
66 :
68  vaporPhaseName_(dict.lookup("vaporPhase")),
69  relax_(dict.getOrDefault<scalar>("relax", 1)),
70  fixedDmdt_(dict.getOrDefault<scalar>("fixedDmdt", 0)),
71  L_(dict.getOrDefault<scalar>("L", 0))
72 {}
73 
74 
77 (
79  const fvPatch& p,
81  const fvPatchFieldMapper& mapper
82 )
83 :
85  (
86  psf,
87  p,
88  iF,
89  mapper
90  ),
91  fixedDmdt_(psf.fixedDmdt_),
92  L_(psf.L_)
93 {}
94 
95 
98 (
100 )
101 :
103  relax_(psf.relax_),
104  fixedDmdt_(psf.fixedDmdt_),
105  L_(psf.L_)
106 {}
107 
108 
111 (
114 )
115 :
117  relax_(psf.relax_),
118  fixedDmdt_(psf.fixedDmdt_),
119  L_(psf.L_)
120 {}
121 
122 
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
124 
127 {
128  if (phasePair == phasePairKey(vaporPhaseName_, internalField().group()))
129  {
130  return true;
131  }
132  else
133  {
134  return false;
135  }
136 }
137 
138 
141 {
143  {
144  return dmdt_;
145  }
146  else
147  {
149  << " dmdt requested for invalid phasePair!"
150  << abort(FatalError);
151 
152  return mDotL_;
153  }
154 }
155 
156 
159 {
161  {
162  return mDotL_;
163  }
164  else
165  {
167  << " mDotL requested for invalid phasePair!"
168  << abort(FatalError);
169 
170  return mDotL_;
171  }
172 }
173 
174 
176 {
177  if (updated())
178  {
179  return;
180  }
181 
182  dmdt_ = (1 - relax_)*dmdt_ + relax_*fixedDmdt_;
183  mDotL_ = dmdt_*L_;
184 
185  operator==(calcAlphat(*this));
186 
187  fixedValueFvPatchScalarField::updateCoeffs();
188 }
189 
190 
192 (
193  Ostream& os
194 ) const
195 {
197  os.writeEntry("vaporPhase", vaporPhaseName_);
198  os.writeEntry("relax", relax_);
199  os.writeEntry("fixedDmdt", fixedDmdt_);
200  os.writeEntry("L", L_);
201  dmdt_.writeEntry("dmdt", os);
202  writeEntry("value", os);
203 }
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
209 (
212 );
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace compressible
218 } // End namespace Foam
219 
220 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::fvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:364
Foam::phasePair
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:53
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::compressible::alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::calcAlphat
tmp< scalarField > calcAlphat(const scalarField &prevAlphat) const
Update turbulent thermal diffusivity.
Definition: alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.C:121
Foam::compressible::alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
A simple alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField with a fixed volumetric phase-cha...
Definition: alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H:57
Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField::mDotL
virtual const scalarField & mDotL() const
Return the enthalpy source due to phase-change.
Definition: alphatPhaseChangeWallFunctionFvPatchScalarField.H:131
Foam::constant::atomic::group
constexpr const char *const group
Group name for atomic constants.
Definition: atomicConstants.H:52
Foam::compressible::alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField
This boundary condition provides a thermal wall function for turbulent thermal diffusivity (usuallyal...
Definition: alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.H:103
Foam::compressible::alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::activePhasePair
virtual bool activePhasePair(const phasePairKey &) const
Is there phase change mass transfer for this phasePair.
Definition: alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C:126
Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField::dmdt_
scalarField dmdt_
Rate of phase-change.
Definition: alphatPhaseChangeWallFunctionFvPatchScalarField.H:66
fvPatchFieldMapper.H
Foam::compressible::alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C:192
Foam::compressible::makePatchTypeField
makePatchTypeField(fvPatchScalarField, alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField)
alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H
Foam::Field< scalar >
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::phasePairKey
Definition: phasePairKey.H:57
compressible
bool compressible
Definition: pEqn.H:2
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField::mDotL_
scalarField mDotL_
Latent heat of the phase-change.
Definition: alphatPhaseChangeWallFunctionFvPatchScalarField.H:69
Foam::compressible::alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C:175
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
Foam::compressible::alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C:44
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField::dmdt
virtual const scalarField & dmdt() const
Return the rate of phase-change.
Definition: alphatPhaseChangeWallFunctionFvPatchScalarField.H:125
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54