inclinedFilmNusseltInletVelocityFvPatchVectorField.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) 2012-2019 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  GammaMean_(),
42  a_(),
43  omega_()
44 {}
45 
46 
49 (
51  const fvPatch& p,
53  const fvPatchFieldMapper& mapper
54 )
55 :
56  fixedValueFvPatchVectorField(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  fixedValueFvPatchVectorField(p, iF, dict),
72  GammaMean_(Function1<scalar>::New("GammaMean", dict)),
73  a_(Function1<scalar>::New("a", dict)),
74  omega_(Function1<scalar>::New("omega", dict))
75 {}
76 
77 
80 (
82 )
83 :
84  fixedValueFvPatchVectorField(fmfrpvf),
85  GammaMean_(fmfrpvf.GammaMean_().clone().ptr()),
86  a_(fmfrpvf.a_().clone().ptr()),
87  omega_(fmfrpvf.omega_().clone().ptr())
88 {}
89 
90 
93 (
96 )
97 :
98  fixedValueFvPatchVectorField(fmfrpvf, iF),
99  GammaMean_(fmfrpvf.GammaMean_().clone().ptr()),
100  a_(fmfrpvf.a_().clone().ptr()),
101  omega_(fmfrpvf.omega_().clone().ptr())
102 {}
103 
104 
105 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 
108 {
109  if (updated())
110  {
111  return;
112  }
113 
114  const label patchi = patch().index();
115 
116  // retrieve the film region from the database
117 
118  const regionModels::regionModel& region =
120  (
121  "surfaceFilmProperties"
122  );
123 
125  dynamic_cast
126  <
128  >(region);
129 
130  // calculate the vector tangential to the patch
131  // note: normal pointing into the domain
132  const vectorField n(-patch().nf());
133 
134  // TODO: currently re-evaluating the entire gTan field to return this patch
135  const scalarField gTan(film.gTan()().boundaryField()[patchi] & n);
136 
137  if (patch().size() && (max(mag(gTan)) < small))
138  {
140  << "is designed to operate on patches inclined with respect to "
141  << "gravity"
142  << endl;
143  }
144 
145  const volVectorField& nHat = film.nHat();
146 
147  const vectorField nHatp(nHat.boundaryField()[patchi].patchInternalField());
148 
149  vectorField nTan(nHatp ^ n);
150  nTan /= mag(nTan) + rootVSmall;
151 
152  // calculate distance in patch tangential direction
153 
154  const vectorField& Cf = patch().Cf();
155  scalarField d(nTan & Cf);
156 
157  // calculate the wavy film height
158 
159  const scalar t = db().time().timeOutputValue();
160 
161  const scalar GMean = GammaMean_->value(t);
162  const scalar a = a_->value(t);
163  const scalar omega = omega_->value(t);
164 
165  const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d));
166 
167  const volScalarField& mu = film.mu();
168  const scalarField mup(mu.boundaryField()[patchi].patchInternalField());
169 
170  const volScalarField& rho = film.rho();
171  const scalarField rhop(rho.boundaryField()[patchi].patchInternalField());
172 
173  const scalarField Re(max(G, scalar(0))/mup);
174 
175  operator==(n*pow(gTan*mup/(3*rhop), 1.0/3.0)*pow(Re, 2.0/3.0));
176 
177  fixedValueFvPatchVectorField::updateCoeffs();
178 }
179 
180 
182 (
183  Ostream& os
184 ) const
185 {
187  writeEntry(os, GammaMean_());
188  writeEntry(os, a_());
189  writeEntry(os, omega_());
190  writeEntry(os, "value", *this);
191 }
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 namespace Foam
197 {
199  (
202  );
203 }
204 
205 
206 // ************************************************************************* //
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:53
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
Kinematic form of single-cell layer surface film model.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const Boundary & boundaryField() const
Return const-reference to the boundary field.
const dimensionedScalar G
Newtonian constant of gravitation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
inclinedFilmNusseltInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
const Time & time() const
Return the reference to the time database.
Definition: regionModelI.H:37
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:280
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Macros for easy insertion into run-time selection tables.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Foam::fvPatchFieldMapper.
const scalar twoPi(2 *pi)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
dimensionedScalar sin(const dimensionedScalar &ds)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
const dimensionedScalar mu
Atomic mass unit.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
label patchi
#define WarningInFunction
Report a warning using Foam::Warning.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
label n
Base class for region models.
Definition: regionModel.H:57
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
Film velocity boundary condition for inclined films that imposes a sinusoidal perturbation on top of ...
Namespace for OpenFOAM.