inclinedFilmNusseltInletVelocityFvPatchVectorField.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  fixedValueFvPatchVectorField(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  fixedValueFvPatchVectorField(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  fixedValueFvPatchVectorField(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  fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
83 }
84 
85 
88 (
90 )
91 :
92  fixedValueFvPatchVectorField(fmfrpvf),
93  filmRegionName_(fmfrpvf.filmRegionName_),
94  GammaMean_(fmfrpvf.GammaMean_().clone().ptr()),
95  a_(fmfrpvf.a_().clone().ptr()),
96  omega_(fmfrpvf.omega_().clone().ptr())
97 {}
98 
99 
102 (
105 )
106 :
107  fixedValueFvPatchVectorField(fmfrpvf, iF),
108  filmRegionName_(fmfrpvf.filmRegionName_),
109  GammaMean_(fmfrpvf.GammaMean_().clone().ptr()),
110  a_(fmfrpvf.a_().clone().ptr()),
111  omega_(fmfrpvf.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  // note: normal pointing into the domain
139  const vectorField n(-patch().nf());
140 
141  const scalarField gTan(film.gTan(patchI) & n);
142 
143  if (patch().size() && (max(mag(gTan)) < SMALL))
144  {
146  << "is designed to operate on patches inclined with respect to "
147  << "gravity"
148  << endl;
149  }
150 
151  const volVectorField& nHat = film.nHat();
152 
153  const vectorField nHatp(nHat.boundaryField()[patchI].patchInternalField());
154 
155  vectorField nTan(nHatp ^ n);
156  nTan /= mag(nTan) + ROOTVSMALL;
157 
158  // calculate distance in patch tangential direction
159 
160  const vectorField& Cf = patch().Cf();
161  scalarField d(nTan & Cf);
162 
163  // calculate the wavy film height
164 
165  const scalar t = db().time().timeOutputValue();
166 
167  const scalar GMean = GammaMean_->value(t);
168  const scalar a = a_->value(t);
169  const scalar omega = omega_->value(t);
170 
171  const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d));
172 
173  const volScalarField& mu = film.mu();
174  const scalarField mup(mu.boundaryField()[patchI].patchInternalField());
175 
176  const volScalarField& rho = film.rho();
177  const scalarField rhop(rho.boundaryField()[patchI].patchInternalField());
178 
179  const scalarField Re(max(G, scalar(0.0))/mup);
180 
181  operator==(n*pow(gTan*mup/(3.0*rhop), 0.333)*pow(Re, 0.666));
182 
183  fixedValueFvPatchVectorField::updateCoeffs();
184 }
185 
186 
188 (
189  Ostream& os
190 ) const
191 {
193  writeEntryIfDifferent<word>
194  (
195  os,
196  "filmRegion",
197  "surfaceFilmProperties",
198  filmRegionName_
199  );
200  GammaMean_->writeData(os);
201  a_->writeData(os);
202  omega_->writeData(os);
203  writeEntry("value", os);
204 }
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 namespace Foam
210 {
212  (
215  );
216 }
217 
218 
219 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::GammaMean_
autoPtr< DataEntry< scalar > > GammaMean_
Mean mass flow rate per unit length [kg/s/m].
Definition: inclinedFilmNusseltInletVelocityFvPatchVectorField.H:62
volFields.H
Foam::fvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:349
Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: inclinedFilmNusseltInletVelocityFvPatchVectorField.C:188
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::omega_
autoPtr< DataEntry< scalar > > omega_
Perturbation frequency [rad/s/m].
Definition: inclinedFilmNusseltInletVelocityFvPatchVectorField.H:68
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::inclinedFilmNusseltInletVelocityFvPatchVectorField::a_
autoPtr< DataEntry< scalar > > a_
Perturbation amplitude [m].
Definition: inclinedFilmNusseltInletVelocityFvPatchVectorField.H:65
Foam::sin
dimensionedScalar sin(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:255
Foam::Re
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: inclinedFilmNusseltInletVelocityFvPatchVectorField.C:117
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::operator==
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
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::regionModels::regionModel
Definition: regionModel.H:57
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::inclinedFilmNusseltInletVelocityFvPatchVectorField::inclinedFilmNusseltInletVelocityFvPatchVectorField
inclinedFilmNusseltInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: inclinedFilmNusseltInletVelocityFvPatchVectorField.C:35
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
vectorField
volVectorField vectorField(fieldObject, mesh)
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField
Film velocity boundary condition for inclined films that imposes a sinusoidal perturbation on top of ...
Definition: inclinedFilmNusseltInletVelocityFvPatchVectorField.H:52
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::inclinedFilmNusseltInletVelocityFvPatchVectorField::filmRegionName_
word filmRegionName_
Name of film region.
Definition: inclinedFilmNusseltInletVelocityFvPatchVectorField.H:59
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::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::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
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:259
inclinedFilmNusseltInletVelocityFvPatchVectorField.H
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51