rpm.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9  Copyright (C) 2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "rpm.H"
31 #include "unitConversion.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  namespace SRF
38  {
40 
42  (
43  SRFModel,
44  rpm,
46  );
47  }
48 }
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
52 Foam::SRF::rpm::rpm(const volVectorField& U)
53 :
54  SRFModel(typeName, U),
55  rpm_(SRFModelCoeffs_.get<scalar>("rpm"))
56 {
57  // The angular velocity
58  omega_.value() = axis_*rpmToRads(rpm_);
59 }
60 
61 
62 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63 
65 {
66  if (SRFModel::read())
67  {
68  SRFModelCoeffs_.readEntry("rpm", rpm_);
69 
70  omega_.value() = axis_*rpmToRads(rpm_);
71 
72  return true;
73  }
74 
75  return false;
76 }
77 
78 
79 // ************************************************************************* //
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
const Type & value() const noexcept
Return const reference to value.
defineTypeNameAndDebug(rpm, 0)
addToRunTimeSelectionTable(SRFModel, rpm, dictionary)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
constexpr scalar rpmToRads(const scalar rpm) noexcept
Conversion from revolutions/minute to radians/sec.
Unit conversion functions.
Macros for easy insertion into run-time selection tables.
dimensionedVector omega_
Angular velocity of the frame (rad/s)
Definition: SRFModel.H:98
bool read()
Read coefficients.
Definition: rpm.C:57
virtual bool read()
Read radiationProperties dictionary.
Definition: SRFModel.C:72
Basic SRF model whereby angular velocity is specified in terms of a (global) axis and revolutions-per...
Definition: rpm.H:50
vector axis_
Axis of rotation, a direction vector which passes through the origin.
Definition: SRFModel.H:88
U
Definition: pEqn.H:72
Info<< "Reading field p\"<< endl;volScalarField p(IOobject("p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field Urel\"<< endl;volVectorField Urel(IOobject("Urel", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading/calculating face flux field phi\"<< endl;surfaceScalarField phi(IOobject("phi", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), linearInterpolate(Urel) &mesh.Sf());label pRefCell=0;scalar pRefValue=0.0;setRefCell(p, pimple.dict(), pRefCell, pRefValue);mesh.setFluxRequired(p.name());Info<< "Creating SRF model\"<< endl;autoPtr< SRF::SRFModel > SRF(SRF::SRFModel::New(Urel))
Top level model for single rotating frame.
Definition: SRFModel.H:61
Namespace for OpenFOAM.