alphatPhaseChangeWallFunctionFvPatchScalarField.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-2020 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"
28 #include "volFields.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace compressible
36 {
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
40 defineTypeNameAndDebug(alphatPhaseChangeWallFunctionFvPatchScalarField, 0);
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
46 (
47  const fvPatch& p,
48  const DimensionedField<scalar, volMesh>& iF
49 )
50 :
51  alphatPhaseJayatillekeWallFunctionFvPatchScalarField(p, iF),
52  otherPhaseName_(word::null),
53  relax_(1),
54  dmdtf_(p.size(), 0)
55 {}
56 
57 
60 (
61  const fvPatch& p,
62  const DimensionedField<scalar, volMesh>& iF,
63  const dictionary& dict
64 )
65 :
67  otherPhaseName_(dict.lookup("otherPhase")),
68  relax_(dict.lookupOrDefault<scalar>("relax", 1)),
69  dmdtf_(p.size(), 0)
70 {
71  // Check that otherPhaseName != this phase
72  if (internalField().group() == otherPhaseName_)
73  {
75  << "otherPhase should be the name of the vapor phase that "
76  << "corresponds to the liquid base or vice versa" << nl
77  << "This phase: " << internalField().group() << nl
78  << "otherPhase: " << otherPhaseName_
79  << abort(FatalError);
80  }
81 
82  if (dict.found("dmdtf"))
83  {
84  dmdtf_ = scalarField("dmdtf", dict, p.size());
85  }
86 }
87 
88 
91 (
93  const fvPatch& p,
94  const DimensionedField<scalar, volMesh>& iF,
95  const fvPatchFieldMapper& mapper
96 )
97 :
100  relax_(ptf.relax_),
101  dmdtf_(mapper(ptf.dmdtf_))
102 {}
103 
104 
107 (
109  const DimensionedField<scalar, volMesh>& iF
110 )
111 :
114  relax_(awfpsf.relax_),
115  dmdtf_(awfpsf.dmdtf_)
116 {}
117 
118 
119 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
120 
122 activePhasePair(const phasePairKey& phasePair) const
123 {
124  if (phasePair == phasePairKey(otherPhaseName_, internalField().group()))
125  {
126  return true;
127  }
128  else
129  {
130  return false;
131  }
132 }
133 
134 
135 const scalarField&
137 {
138  return dmdtf_;
139 }
140 
141 
143 dmdtf(const phasePairKey& phasePair) const
144 {
145  if (activePhasePair(phasePair))
146  {
147  return dmdtf_;
148  }
149  else
150  {
152  << " dmdtf requested for invalid phasePair!"
153  << abort(FatalError);
154 
155  return dmdtf_;
156  }
157 }
158 
159 
161 (
162  const fvPatchFieldMapper& m
163 )
164 {
165  alphatPhaseJayatillekeWallFunctionFvPatchScalarField::autoMap(m);
166 
167  m(dmdtf_, dmdtf_);
168 }
169 
170 
172 (
173  const fvPatchScalarField& ptf,
174  const labelList& addr
175 )
176 {
177  alphatPhaseJayatillekeWallFunctionFvPatchScalarField::rmap(ptf, addr);
178 
180  refCast<const alphatPhaseChangeWallFunctionFvPatchScalarField>(ptf);
181 
182  dmdtf_.rmap(tiptf.dmdtf_, addr);
183 }
184 
185 
187 {
189 
190  writeEntry(os, "otherPhase", otherPhaseName_);
191  writeEntry(os, "relax", relax_);
192  writeEntry(os, "dmdtf", dmdtf_);
193 }
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace compressible
199 } // End namespace Foam
200 
201 // ************************************************************************* //
const char *const group
Group name for atomic constants.
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:323
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Macros for easy insertion into run-time selection tables.
stressControl lookup("compactNormalStress") >> compactNormalStress
fvPatchField< scalar > fvPatchScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< label > labelList
A List of labels.
Definition: labelList.H:56
errorManip< error > abort(error &err)
Definition: errorManip.H:131
static const char nl
Definition: Ostream.H:260
defineTypeNameAndDebug(combustionModel, 0)
alphatPhaseChangeWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Definition: Field.C:362
alphatPhaseJayatillekeWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
bool activePhasePair(const phasePairKey &) const
Is there phase change mass transfer for this phasePair.
const scalarField & dmdtf() const
Return the rate of phase-change.
Namespace for OpenFOAM.