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 | Copyright (C) 2011 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 
26 #include "rpm.H"
28 #include "mathematicalConstants.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  namespace SRF
35  {
37 
39  (
40  SRFModel,
41  rpm,
43  );
44  }
45 }
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
49 Foam::SRF::rpm::rpm
50 (
51  const volVectorField& U
52 )
53 :
54  SRFModel(typeName, U),
55  rpm_(readScalar(SRFModelCoeffs_.lookup("rpm")))
56 {
57  // Initialise the angular velocity
58  omega_.value() = axis_*rpm_*constant::mathematical::twoPi/60.0;
59 }
60 
61 
62 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
63 
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
71 {
72  if (SRFModel::read())
73  {
74  // Re-read rpm
75  SRFModelCoeffs_.lookup("rpm") >> rpm_;
76 
77  // Update angular velocity
78  omega_.value() = axis_*rpm_*(constant::mathematical::twoPi/60.0);
79 
80  return true;
81  }
82  else
83  {
84  return false;
85  }
86 }
87 
88 
89 // ************************************************************************* //
~rpm()
Destructor.
Definition: rpm.C:64
bool read()
Read.
Definition: rpm.C:70
defineTypeNameAndDebug(rpm, 0)
Top level model for single rotating frame.
Definition: SRFModel.H:62
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
Info<< "Reading field p\n"<< endl;volScalarField p(IOobject("p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field Urel\n"<< endl;volVectorField Urel(IOobject("Urel", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading/calculating face flux field phi\n"<< 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\n"<< endl;autoPtr< SRF::SRFModel > SRF(SRF::SRFModel::New(Urel))
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
Macros for easy insertion into run-time selection tables.
addToRunTimeSelectionTable(SRFModel, rpm, dictionary)
const scalar twoPi(2 *pi)
Basic SRF model whereby angular velocity is specified in terms of a (global) axis and revolutions-per...
Definition: rpm.H:51
virtual bool read()
Read radiationProperties dictionary.
Definition: SRFModel.C:80