cylindricalInletVelocityFvPatchVectorField.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) 2011-2023 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"
29 #include "fvPatchFieldMapper.H"
30 #include "surfaceFields.H"
31 #include "mathematicalConstants.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
37 (
38  const fvPatch& p,
40  const dictionary& dict
41 )
42 :
44  origin_(dict.lookup("origin")),
45  axis_(dict.lookup("axis")),
46  axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
47  radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
48  rpm_(Function1<scalar>::New("rpm", dict))
49 {}
50 
51 
54 (
56  const fvPatch& p,
58  const fvPatchFieldMapper& mapper
59 )
60 :
61  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
62  origin_(ptf.origin_),
63  axis_(ptf.axis_),
64  axialVelocity_(ptf.axialVelocity_, false),
65  radialVelocity_(ptf.radialVelocity_, false),
66  rpm_(ptf.rpm_, false)
67 {}
68 
69 
72 (
75 )
76 :
78  origin_(ptf.origin_),
79  axis_(ptf.axis_),
80  axialVelocity_(ptf.axialVelocity_, false),
81  radialVelocity_(ptf.radialVelocity_, false),
82  rpm_(ptf.rpm_, false)
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
89 {
90  if (updated())
91  {
92  return;
93  }
94 
95  const scalar t = this->db().time().userTimeValue();
96  const scalar axialVelocity = axialVelocity_->value(t);
97  const scalar radialVelocity = radialVelocity_->value(t);
98  const scalar rpm = rpm_->value(t);
99 
100  const vector axisHat = axis_/mag(axis_);
101 
102  const vectorField r(patch().Cf() - origin_);
103  const vectorField d(r - (axisHat & r)*axisHat);
104 
105  tmp<vectorField> tangVel
106  (
107  (rpm*constant::mathematical::pi/30.0)*(axisHat) ^ d
108  );
109 
110  operator==(tangVel + axisHat*axialVelocity + radialVelocity*d/mag(d));
111 
113 }
114 
115 
117 {
119  writeEntry(os, "origin", origin_);
120  writeEntry(os, "axis", axis_);
121  writeEntry(os, axialVelocity_());
122  writeEntry(os, radialVelocity_());
123  writeEntry(os, rpm_());
124  writeEntry(os, "value", *this);
125 }
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 namespace Foam
131 {
133  (
136  );
137 }
138 
139 
140 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Run-time selectable general function of one variable.
Definition: Function1.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
This boundary condition describes an inlet vector boundary condition in cylindrical co-ordinates give...
cylindricalInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:231
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:204
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
Namespace for OpenFOAM.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dimensioned< scalar > mag(const dimensioned< Type > &)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p
Foam::surfaceFields.