rotatingPressureInletOutletVelocityFvPatchVectorField.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"
28 #include "surfaceFields.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
34 calcTangentialVelocity()
35 {
36  const scalar t = this->db().time().userTimeValue();
37  const scalar omega = omega_.value(t);
38 
40  (
41  (-omega)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)))
42  );
43 
44  const vectorField n(patch().nf());
45 
46  refValue() = tangentialVelocity - n*(n & tangentialVelocity);
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
54 (
55  const fvPatch& p,
57  const dictionary& dict
58 )
59 :
61  origin_(dict.lookup("origin")),
62  axis_(dict.lookup("axis")),
63  omega_(dict)
64 {
65  calcTangentialVelocity();
66 }
67 
68 
71 (
73  const fvPatch& p,
75  const fvPatchFieldMapper& mapper
76 )
77 :
79  origin_(pvf.origin_),
80  axis_(pvf.axis_),
81  omega_(pvf.omega_)
82 {
83  calcTangentialVelocity();
84 }
85 
86 
89 (
92 )
93 :
95  origin_(pvf.origin_),
96  axis_(pvf.axis_),
97  omega_(pvf.omega_)
98 {
99  calcTangentialVelocity();
100 }
101 
102 
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 
106 (
107  Ostream& os
108 ) const
109 {
111  writeEntry(os, "phi", phiName());
112  writeEntry(os, "origin", origin_);
113  writeEntry(os, "axis", axis_);
114  writeEntry(os, omega_);
115  writeEntry(os, "value", *this);
116 }
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 namespace Foam
122 {
124  (
127  );
128 }
129 
130 // ************************************************************************* //
label n
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...
scalar value(const scalar t) const
Return value for time t.
Definition: omegaI.H:28
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
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
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Velocity inlet/outlet boundary condition for patches where the pressure is specified in some manner,...
const autoPtr< Function1< vector > > & tangentialVelocity() const
Return the tangential velocity Function1.
This velocity inlet/outlet boundary condition is applied to patches in a rotating frame where the pre...
rotatingPressureInletOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
const scalar omega
Namespace for OpenFOAM.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p
Foam::surfaceFields.