fixedTrim.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) 2012-2014 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 "fixedTrim.H"
28 #include "unitConversion.H"
29 #include "mathematicalConstants.H"
30 
31 using namespace Foam::constant;
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(fixedTrim, 0);
38 
39  addToRunTimeSelectionTable(trimModel, fixedTrim, dictionary);
40 }
41 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
46 (
47  const fv::rotorDiskSource& rotor,
48  const dictionary& dict
49 )
50 :
51  trimModel(rotor, dict, typeName),
52  thetag_(rotor.cells().size(), 0.0)
53 {
54  read(dict);
55 }
56 
57 
58 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
59 
61 {}
62 
63 
64 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
65 
67 {
69 
70  scalar theta0 = degToRad(readScalar(coeffs_.lookup("theta0")));
71  scalar theta1c = degToRad(readScalar(coeffs_.lookup("theta1c")));
72  scalar theta1s = degToRad(readScalar(coeffs_.lookup("theta1s")));
73 
74  const List<point>& x = rotor_.x();
75  forAll(thetag_, i)
76  {
77  scalar psi = x[i].y();
78  thetag_[i] = theta0 + theta1c*cos(psi) + theta1s*sin(psi);
79  }
80 }
81 
82 
84 {
85  return tmp<scalarField>(thetag_);
86 }
87 
88 
90 (
91  const vectorField& U,
92  vectorField& force
93 )
94 {
95  // do nothing
96 }
97 
98 
100 (
101  const volScalarField rho,
102  const vectorField& U,
103  vectorField& force)
104 {
105  // do nothing
106 }
107 
108 
109 // ************************************************************************* //
mathematicalConstants.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Foam::constant
Collection of constants.
Definition: atomicConstants.C:37
Foam::sin
dimensionedScalar sin(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:255
Foam::read
bool read(const char *, int32_t &)
Definition: int32IO.C:87
fixedTrim.H
unitConversion.H
Unit conversion functions.
Foam::fixedTrim::fixedTrim
fixedTrim(const fv::rotorDiskSource &rotor, const dictionary &dict)
Constructor.
Definition: fixedTrim.C:46
Foam::fv::cellSetOption::cells
const labelList & cells() const
Return const access to the cell set.
Definition: cellSetOptionI.H:73
U
U
Definition: pEqn.H:46
Foam::fixedTrim::correct
virtual void correct(const vectorField &U, vectorField &force)
Correct the model.
Definition: fixedTrim.C:90
Foam::fixedTrim::read
void read(const dictionary &dict)
Read.
Definition: fixedTrim.C:66
Foam::trimModel::read
virtual void read(const dictionary &dict)
Read.
Definition: trimModel.C:61
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fv::rotorDiskSource
Rotor disk source.
Definition: rotorDiskSource.H:126
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::trimModel
Trim model base class.
Definition: trimModel.H:50
rho
rho
Definition: pEqn.H:3
psi
const volScalarField & psi
Definition: setRegionFluidFields.H:13
Foam::readScalar
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
Foam::fixedTrim::~fixedTrim
virtual ~fixedTrim()
Destructor.
Definition: fixedTrim.C:60
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::fixedTrim::thetag
virtual tmp< scalarField > thetag() const
Return the geometric angle of attack [rad].
Definition: fixedTrim.C:83
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::degToRad
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Definition: unitConversion.H:45
Foam::cos
dimensionedScalar cos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:256