inclinedFilmNusseltHeightFvPatchScalarField.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 | Copyright (C) 2012-2015 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 "volFields.H"
28 #include "kinematicSingleLayer.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
35 (
36  const fvPatch& p,
38 )
39 :
40  fixedValueFvPatchScalarField(p, iF),
41  filmRegionName_("surfaceFilmProperties"),
42  GammaMean_(),
43  a_(),
44  omega_()
45 {}
46 
47 
50 (
52  const fvPatch& p,
54  const fvPatchFieldMapper& mapper
55 )
56 :
57  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
58  filmRegionName_(ptf.filmRegionName_),
59  GammaMean_(ptf.GammaMean_().clone().ptr()),
60  a_(ptf.a_().clone().ptr()),
61  omega_(ptf.omega_().clone().ptr())
62 {}
63 
64 
67 (
68  const fvPatch& p,
70  const dictionary& dict
71 )
72 :
73  fixedValueFvPatchScalarField(p, iF),
74  filmRegionName_
75  (
76  dict.lookupOrDefault<word>("filmRegion", "surfaceFilmProperties")
77  ),
78  GammaMean_(DataEntry<scalar>::New("GammaMean", dict)),
79  a_(DataEntry<scalar>::New("a", dict)),
80  omega_(DataEntry<scalar>::New("omega", dict))
81 {
82  fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
83 }
84 
85 
88 (
90 )
91 :
92  fixedValueFvPatchScalarField(wmfrhpsf),
93  filmRegionName_(wmfrhpsf.filmRegionName_),
94  GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()),
95  a_(wmfrhpsf.a_().clone().ptr()),
96  omega_(wmfrhpsf.omega_().clone().ptr())
97 {}
98 
99 
102 (
105 )
106 :
107  fixedValueFvPatchScalarField(wmfrhpsf, iF),
108  filmRegionName_(wmfrhpsf.filmRegionName_),
109  GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()),
110  a_(wmfrhpsf.a_().clone().ptr()),
111  omega_(wmfrhpsf.omega_().clone().ptr())
112 {}
113 
114 
115 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
116 
118 {
119  if (updated())
120  {
121  return;
122  }
123 
124  const label patchI = patch().index();
125 
126  // retrieve the film region from the database
127 
128  const regionModels::regionModel& region =
130 
132  dynamic_cast
133  <
135  >(region);
136 
137  // calculate the vector tangential to the patch
138 
139  // note: normal pointing into the domain
140  const vectorField n(-patch().nf());
141 
142  const scalarField gTan(film.gTan(patchI) & n);
143 
144  if (patch().size() && (max(mag(gTan)) < SMALL))
145  {
147  << "is designed to operate on patches inclined with respect to "
148  << "gravity"
149  << endl;
150  }
151 
152  const volVectorField& nHat = film.nHat();
153 
154  const vectorField nHatp(nHat.boundaryField()[patchI].patchInternalField());
155 
156  vectorField nTan(nHatp ^ n);
157  nTan /= mag(nTan) + ROOTVSMALL;
158 
159  // calculate distance in patch tangential direction
160 
161  const vectorField& Cf = patch().Cf();
162  scalarField d(nTan & Cf);
163 
164  // calculate the wavy film height
165 
166  const scalar t = db().time().timeOutputValue();
167 
168  const scalar GMean = GammaMean_->value(t);
169  const scalar a = a_->value(t);
170  const scalar omega = omega_->value(t);
171 
172  const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d));
173 
174  const volScalarField& mu = film.mu();
175  const scalarField mup(mu.boundaryField()[patchI].patchInternalField());
176 
177  const volScalarField& rho = film.rho();
178  const scalarField rhop(rho.boundaryField()[patchI].patchInternalField());
179 
180  const scalarField Re(max(G, scalar(0.0))/mup);
181 
182  operator==
183  (
184  pow(3.0*sqr(mup/rhop)/(gTan + ROOTVSMALL), 0.333)*pow(Re, 0.333)
185  );
186 
187  fixedValueFvPatchScalarField::updateCoeffs();
188 }
189 
190 
192 (
193  Ostream& os
194 ) const
195 {
197  writeEntryIfDifferent<word>
198  (
199  os,
200  "filmRegion",
201  "surfaceFilmProperties",
202  filmRegionName_
203  );
204  GammaMean_->writeData(os);
205  a_->writeData(os);
206  omega_->writeData(os);
207  writeEntry("value", os);
208 }
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 namespace Foam
214 {
216  (
219  );
220 }
221 
222 
223 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
volFields.H
Foam::inclinedFilmNusseltHeightFvPatchScalarField::inclinedFilmNusseltHeightFvPatchScalarField
inclinedFilmNusseltHeightFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: inclinedFilmNusseltHeightFvPatchScalarField.C:35
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::constant::physicoChemical::mu
const dimensionedScalar mu
Atomic mass unit.
Definition: createFields.H:13
Foam::constant::universal::G
const dimensionedScalar G
Newtonian constant of gravitation.
Foam::sin
dimensionedScalar sin(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:255
Foam::Re
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
Foam::inclinedFilmNusseltHeightFvPatchScalarField::GammaMean_
autoPtr< DataEntry< scalar > > GammaMean_
Mean mass flow rate per unit length [kg/s/m].
Definition: inclinedFilmNusseltHeightFvPatchScalarField.H:62
Foam::regionModels::regionModel::time
const Time & time() const
Return the reference to the time database.
Definition: regionModelI.H:37
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer
Definition: kinematicSingleLayer.H:63
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::constant::mathematical::twoPi
const scalar twoPi(2 *pi)
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::inclinedFilmNusseltHeightFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: inclinedFilmNusseltHeightFvPatchScalarField.C:117
Foam::regionModels::regionModel
Definition: regionModel.H:57
Foam::inclinedFilmNusseltHeightFvPatchScalarField::a_
autoPtr< DataEntry< scalar > > a_
Perturbation amplitude [m].
Definition: inclinedFilmNusseltHeightFvPatchScalarField.H:65
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::inclinedFilmNusseltHeightFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: inclinedFilmNusseltHeightFvPatchScalarField.C:192
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
kinematicSingleLayer.H
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::makePatchTypeField
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
rho
rho
Definition: pEqn.H:3
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
scalarField
volScalarField scalarField(fieldObject, mesh)
Foam::inclinedFilmNusseltHeightFvPatchScalarField::omega_
autoPtr< DataEntry< scalar > > omega_
Perturbation frequency [rad/s/m].
Definition: inclinedFilmNusseltHeightFvPatchScalarField.H:68
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Definition: objectRegistryTemplates.C:165
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::inclinedFilmNusseltHeightFvPatchScalarField
Film height boundary condition for inclined films that imposes a sinusoidal perturbation on top of a ...
Definition: inclinedFilmNusseltHeightFvPatchScalarField.H:52
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::DataEntry
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: DataEntry.H:52
inclinedFilmNusseltHeightFvPatchScalarField.H
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:259
Foam::inclinedFilmNusseltHeightFvPatchScalarField::filmRegionName_
word filmRegionName_
Name of film region.
Definition: inclinedFilmNusseltHeightFvPatchScalarField.H:59
write
Tcoeff write()
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51