targetCoeffTrim.H
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) 2012-2014 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::targetCoeffTrim
28 
29 Description
30  Target trim forces/coefficients
31 
32  Solves:
33 
34  c^old + J.d(theta) = c^target
35 
36  Where:
37 
38  n = time level
39  c = coefficient vector (thrust force, roll moment, pitch moment)
40  theta = pitch angle vector (collective, roll, pitch)
41  J = Jacobian [3x3] matrix
42 
43 
44  The trimmed pitch angles are found via solving the above with a
45  Newton-Raphson iterative method. The solver tolerance can be user-input,
46  using the 'tol' entry.
47 
48  If coefficients are requested (useCoeffs = true), the force and moments
49  are normalised using:
50 
51  force
52  c = ---------------------------------
53  alpha*pi*rho*(omega^2)*(radius^4)
54 
55  and
56 
57  moment
58  c = ---------------------------------
59  alpha*pi*rho*(omega^2)*(radius^5)
60 
61  Where:
62 
63  alpha = user-input conversion coefficient (default = 1)
64  rho = desity
65  omega = rotor angulr velocity
66  pi = mathematical pi
67 
68 
69 SourceFiles
70  targetCoeffTrim.C
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef targetCoeffTrim_H
75 #define targetCoeffTrim_H
76 
77 #include "trimModel.H"
78 #include "tensor.H"
79 #include "vector.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class targetCoeffTrim Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class targetCoeffTrim
91 :
92  public trimModel
93 {
94 protected:
95 
96  // Protected data
97 
98  //- Number of iterations between calls to 'correct'
100 
101  //- Flag to indicate whether to solve coeffs (true) or forces (false)
102  bool useCoeffs_;
103 
104  //- Target coefficient vector (thrust force, roll moment, pitch moment)
105  vector target_;
106 
107  //- Pitch angles (collective, roll, pitch) [rad]
108  vector theta_;
109 
110  //- Maximum number of iterations in trim routine
111  label nIter_;
112 
113  //- Convergence tolerance
114  scalar tol_;
115 
116  //- Under-relaxation coefficient
117  scalar relax_;
118 
119  //- Perturbation angle used to determine jacobian
120  scalar dTheta_;
121 
122  //- Coefficient to allow for conversion between US and EU definitions
123  scalar alpha_;
124 
125 
126  // Protected member functions
127 
128  //- Calculate the rotor force and moment coefficients vector
129  template<class RhoFieldType>
131  (
132  const RhoFieldType& rho,
133  const vectorField& U,
134  const scalarField& alphag,
135  vectorField& force
136  ) const;
137 
138  //- Correct the model
139  template<class RhoFieldType>
140  void correctTrim
141  (
142  const RhoFieldType& rho,
143  const vectorField& U,
144  vectorField& force
145  );
146 
147 
148 public:
149 
150  //- Run-time type information
151  TypeName("targetCoeffTrim");
152 
153  //- Constructor
154  targetCoeffTrim(const fv::rotorDiskSource& rotor, const dictionary& dict);
155 
156  //- Destructor
157  virtual ~targetCoeffTrim() = default;
158 
159 
160  // Member Functions
161 
162  //- Read
163  void read(const dictionary& dict);
164 
165  //- Return the geometric angle of attack [rad]
166  virtual tmp<scalarField> thetag() const;
167 
168  //- Correct the model
169  virtual void correct
170  (
171  const vectorField& U,
172  vectorField& force
173  );
174 
175  //- Correct the model for compressible flow
176  virtual void correct
177  (
178  const volScalarField rho,
179  const vectorField& U,
180  vectorField& force
181  );
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
Foam::targetCoeffTrim::nIter_
label nIter_
Maximum number of iterations in trim routine.
Definition: targetCoeffTrim.H:110
Foam::targetCoeffTrim::relax_
scalar relax_
Under-relaxation coefficient.
Definition: targetCoeffTrim.H:116
Foam::targetCoeffTrim::read
void read(const dictionary &dict)
Read.
Definition: targetCoeffTrim.C:218
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::targetCoeffTrim::theta_
vector theta_
Pitch angles (collective, roll, pitch) [rad].
Definition: targetCoeffTrim.H:107
rho
rho
Definition: readInitialConditions.H:96
Foam::targetCoeffTrim::correctTrim
void correctTrim(const RhoFieldType &rho, const vectorField &U, vectorField &force)
Correct the model.
Definition: targetCoeffTrim.C:102
Foam::targetCoeffTrim::calcCoeffs
vector calcCoeffs(const RhoFieldType &rho, const vectorField &U, const scalarField &alphag, vectorField &force) const
Calculate the rotor force and moment coefficients vector.
Foam::targetCoeffTrim::calcFrequency_
label calcFrequency_
Number of iterations between calls to 'correct'.
Definition: targetCoeffTrim.H:98
tensor.H
Foam::targetCoeffTrim::alpha_
scalar alpha_
Coefficient to allow for conversion between US and EU definitions.
Definition: targetCoeffTrim.H:122
Foam::targetCoeffTrim::tol_
scalar tol_
Convergence tolerance.
Definition: targetCoeffTrim.H:113
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::Field< vector >
Foam::targetCoeffTrim::thetag
virtual tmp< scalarField > thetag() const
Return the geometric angle of attack [rad].
Definition: targetCoeffTrim.C:254
Foam::fv::rotorDiskSource
Rotor disk source.
Definition: rotorDiskSource.H:127
Foam::targetCoeffTrim::dTheta_
scalar dTheta_
Perturbation angle used to determine jacobian.
Definition: targetCoeffTrim.H:119
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
trimModel.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::targetCoeffTrim::useCoeffs_
bool useCoeffs_
Flag to indicate whether to solve coeffs (true) or forces (false)
Definition: targetCoeffTrim.H:101
Foam::trimModel
Trim model base class.
Definition: trimModel.H:52
U
U
Definition: pEqn.H:72
Foam::Vector< scalar >
Foam::targetCoeffTrim::target_
vector target_
Target coefficient vector (thrust force, roll moment, pitch moment)
Definition: targetCoeffTrim.H:104
Foam::targetCoeffTrim
Target trim forces/coefficients.
Definition: targetCoeffTrim.H:89
vector.H
Foam::targetCoeffTrim::TypeName
TypeName("targetCoeffTrim")
Run-time type information.
Foam::targetCoeffTrim::targetCoeffTrim
targetCoeffTrim(const fv::rotorDiskSource &rotor, const dictionary &dict)
Constructor.
Definition: targetCoeffTrim.C:196
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::targetCoeffTrim::correct
virtual void correct(const vectorField &U, vectorField &force)
Correct the model.
Definition: targetCoeffTrim.C:272
Foam::targetCoeffTrim::~targetCoeffTrim
virtual ~targetCoeffTrim()=default
Destructor.