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-2013 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  GammaMean_(),
42  a_(),
43  omega_()
44 {}
45 
46 
49 (
51  const fvPatch& p,
53  const fvPatchFieldMapper& mapper
54 )
55 :
56  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
57  GammaMean_(ptf.GammaMean_().clone().ptr()),
58  a_(ptf.a_().clone().ptr()),
59  omega_(ptf.omega_().clone().ptr())
60 {}
61 
62 
65 (
66  const fvPatch& p,
68  const dictionary& dict
69 )
70 :
71  fixedValueFvPatchScalarField(p, iF),
72  GammaMean_(DataEntry<scalar>::New("GammaMean", dict)),
73  a_(DataEntry<scalar>::New("a", dict)),
74  omega_(DataEntry<scalar>::New("omega", dict))
75 {
76  fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
77 }
78 
79 
82 (
84 )
85 :
86  fixedValueFvPatchScalarField(wmfrhpsf),
87  GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()),
88  a_(wmfrhpsf.a_().clone().ptr()),
89  omega_(wmfrhpsf.omega_().clone().ptr())
90 {}
91 
92 
95 (
98 )
99 :
100  fixedValueFvPatchScalarField(wmfrhpsf, iF),
101  GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()),
102  a_(wmfrhpsf.a_().clone().ptr()),
103  omega_(wmfrhpsf.omega_().clone().ptr())
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
110 {
111  if (updated())
112  {
113  return;
114  }
115 
116  const label patchI = patch().index();
117 
118  // retrieve the film region from the database
119 
120  const regionModels::regionModel& region =
122  (
123  "surfaceFilmProperties"
124  );
125 
127  dynamic_cast
128  <
130  >(region);
131 
132  // calculate the vector tangential to the patch
133 
134  // note: normal pointing into the domain
135  const vectorField n(-patch().nf());
136 
137  // TODO: currently re-evaluating the entire gTan field to return this patch
138  const scalarField gTan(film.gTan()().boundaryField()[patchI] & n);
139 
140  if (patch().size() && (max(mag(gTan)) < SMALL))
141  {
142  WarningIn
143  (
144  "void Foam::inclinedFilmNusseltHeightFvPatchScalarField::"
145  "updateCoeffs()"
146  )
147  << "Tangential gravity component is zero. This boundary condition "
148  << "is designed to operate on patches inclined with respect to "
149  << "gravity"
150  << endl;
151  }
152 
153  const volVectorField& nHat = film.nHat();
154 
155  const vectorField nHatp(nHat.boundaryField()[patchI].patchInternalField());
156 
157  vectorField nTan(nHatp ^ n);
158  nTan /= mag(nTan) + ROOTVSMALL;
159 
160  // calculate distance in patch tangential direction
161 
162  const vectorField& Cf = patch().Cf();
163  scalarField d(nTan & Cf);
164 
165  // calculate the wavy film height
166 
167  const scalar t = db().time().timeOutputValue();
168 
169  const scalar GMean = GammaMean_->value(t);
170  const scalar a = a_->value(t);
171  const scalar omega = omega_->value(t);
172 
173  const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d));
174 
175  const volScalarField& mu = film.mu();
176  const scalarField mup(mu.boundaryField()[patchI].patchInternalField());
177 
178  const volScalarField& rho = film.rho();
179  const scalarField rhop(rho.boundaryField()[patchI].patchInternalField());
180 
181  const scalarField Re(max(G, scalar(0.0))/mup);
182 
183  operator==
184  (
185  pow(3.0*sqr(mup/rhop)/(gTan + ROOTVSMALL), 0.333)*pow(Re, 0.333)
186  );
187 
188  fixedValueFvPatchScalarField::updateCoeffs();
189 }
190 
191 
193 (
194  Ostream& os
195 ) const
196 {
198  GammaMean_->writeData(os);
199  a_->writeData(os);
200  omega_->writeData(os);
201  writeEntry("value", os);
202 }
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 namespace Foam
208 {
210  (
213  );
214 }
215 
216 
217 // ************************************************************************* //
const dimensionedScalar mu
Atomic mass unit.
Definition: createFields.H:13
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensioned< scalar > mag(const dimensioned< Type > &)
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
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::fvPatchFieldMapper.
const Time & time() const
Return the reference to the time database.
Definition: regionModelI.H:37
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
runTime write()
label n
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
#define WarningIn(functionName)
Report a warning using Foam::Warning.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Macros for easy insertion into run-time selection tables.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Film height boundary condition for inclined films that imposes a sinusoidal perturbation on top of a ...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
makePatchTypeField(fvPatchVectorField, SRFFreestreamVelocityFvPatchVectorField)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
volScalarField scalarField(fieldObject, mesh)
virtual label size() const
Return size.
Definition: fvPatch.H:161
inclinedFilmNusseltHeightFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: DataEntry.H:52
const scalar twoPi(2 *pi)
const dimensionedScalar G
Newtonian constant of gravitation.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
dimensionedScalar sin(const dimensionedScalar &ds)