1 /*---------------------------------------------------------------------------* \
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
28 #include "SRFVelocityFvPatchVectorField.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(SRFModel, 0);
37 defineRunTimeSelectionTable(SRFModel, dictionary);
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 Foam::SRF::SRFModel::SRFModel
47 const volVectorField& Urel
55 Urel.time().constant(),
63 axis_(lookup("axis")),
64 SRFModelCoeffs_(subDict(type + "Coeffs")),
65 omega_(dimensionedVector("omega", dimless/dimTime, vector::zero))
72 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74 Foam::SRF::SRFModel::~SRFModel()
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 bool Foam::SRF::SRFModel::read()
82 if (regIOobject::read())
85 SRFModelCoeffs_.lookup("axis") >> axis_;
88 // Re-read sub-model coeffs
89 SRFModelCoeffs_ = subDict(type() + "Coeffs");
100 const Foam::vector& Foam::SRF::SRFModel::axis() const
106 const Foam::dimensionedVector& Foam::SRF::SRFModel::omega() const
112 Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh> >
113 Foam::SRF::SRFModel::Fcoriolis() const
115 return tmp<DimensionedField<vector, volMesh> >
117 new DimensionedField<vector, volMesh>
122 mesh_.time().timeName(),
133 Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh> >
134 Foam::SRF::SRFModel::Fcentrifugal() const
136 return tmp<DimensionedField<vector, volMesh> >
138 new DimensionedField<vector, volMesh>
143 mesh_.time().timeName(),
148 omega_ ^ (omega_ ^ mesh_.C())
154 Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh> >
155 Foam::SRF::SRFModel::Su() const
157 return Fcoriolis() + Fcentrifugal();
161 Foam::vectorField Foam::SRF::SRFModel::velocity
163 const vectorField& positions
166 return omega_.value() ^ (positions - axis_*(axis_ & positions));
170 Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::U() const
172 return tmp<volVectorField>
179 mesh_.time().timeName(),
184 omega_ ^ (mesh_.C() - axis_*(axis_ & mesh_.C()))
190 Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::Uabs() const
192 const volVectorField Usrf = U();
194 tmp<volVectorField> tUabs
201 mesh_.time().timeName(),
211 // Add SRF contribution to internal field
212 tUabs().internalField() += Urel_.internalField();
214 // Add Urel boundary contributions
215 const volVectorField::GeometricBoundaryField& bvf = Urel_.boundaryField();
219 if (isA<SRFVelocityFvPatchVectorField>(bvf[i]))
221 // Only include relative contributions from
222 // SRFVelocityFvPatchVectorField's
223 const SRFVelocityFvPatchVectorField& UrelPatch =
224 refCast<const SRFVelocityFvPatchVectorField>(bvf[i]);
225 if (UrelPatch.relative())
227 tUabs().boundaryField()[i] += Urel_.boundaryField()[i];
232 tUabs().boundaryField()[i] += Urel_.boundaryField()[i];
240 // ************************************************************************* //