lookupProfile.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) 2011-2013 OpenFOAM Foundation
9  Copyright (C) 2020 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 Class
28  Foam::lookupProfile
29 
30 Description
31  Profile model where polar lift and drag coefficients are linearly
32  interpolated from a polar table by using an input angle of attack.
33 
34 Usage
35  Minimal example by using \c constant/fvOptions:
36  rotorDiskSource1
37  {
38  // Mandatory/Optional (inherited) entries
39  ...
40 
41  // Mandatory entries (runtime modifiable)
42  profiles
43  {
44  // Mandatory entries (runtime modifiable)
45  <profile1>
46  {
47  // Mandatory entries (runtime modifiable)
48  type lookup;
49  data
50  (
51  (AOA1 Cd1 Cl2)
52  (AOA2 Cd2 Cl2)
53  ([0] [1] [2])
54  ...
55  (AOAN CdN CdN)
56  );
57  }
58 
59  // Mandatory/Optional (inherited) entries
60  ...
61  }
62  }
63 
64  where the entries mean:
65  \table
66  Property | Description | Type | Reqd | Dflt
67  [0] AOA | Angle of attack | scalar | yes | -
68  [1] Cd | Drag coefficient corresponding to the angle attack <!--
69  --> | scalar | yes | -
70  [2] Cl | Lift coefficient corresponding to the angle attack <!--
71  --> | scalar | yes | -
72  \endtable
73 
74 Note
75  - Angle of attack is internally converted from [deg] to [rad].
76 
77 See also
78  - Foam::fv::rotorDiskSource
79  - Foam::profileModel
80  - Foam::seriesProfile
81 
82 SourceFiles
83  lookupProfile.C
84 
85 \*---------------------------------------------------------------------------*/
86 
87 #ifndef lookupProfile_H
88 #define lookupProfile_H
89 
90 #include "profileModel.H"
91 #include "List.H"
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 namespace Foam
96 {
97 
98 /*---------------------------------------------------------------------------*\
99  Class lookupProfile Declaration
100 \*---------------------------------------------------------------------------*/
101 
102 class lookupProfile
103 :
104  public profileModel
105 {
106 protected:
107 
108  // Protected Data
109 
110  //- List of angle-of-attack values [deg] on input, converted to [rad]
111  List<scalar> AOA_;
112 
113  //- List of drag coefficient values
114  List<scalar> Cd_;
115 
116  //- List of lift coefficient values
117  List<scalar> Cl_;
118 
119 
120  // Protected Member Functions
121 
122  //- Return the interpolation indices and gradient
123  void interpolateWeights
124  (
125  const scalar& xIn,
126  const List<scalar>& values,
127  label& i1,
128  label& i2,
129  scalar& ddx
130  ) const;
131 
132 
133 public:
134 
135  //- Runtime type information
136  TypeName("lookup");
137 
138 
139  // Constructors
140 
141  //- Constructor from dictionary and model name
142  lookupProfile(const dictionary& dict, const word& modelName);
143 
144  //- No copy construct
145  lookupProfile(const lookupProfile&) = delete;
146 
147  //- No copy assignment
148  void operator=(const lookupProfile&) = delete;
149 
150 
151  //- Destructor
152  ~lookupProfile() = default;
153 
154 
155  // Member Functions
156 
157  //- Return the Cd and Cl for a given angle-of-attack
158  virtual void Cdl(const scalar alpha, scalar& Cd, scalar& Cl) const;
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
Foam::lookupProfile::interpolateWeights
void interpolateWeights(const scalar &xIn, const List< scalar > &values, label &i1, label &i2, scalar &ddx) const
Return the interpolation indices and gradient.
Definition: lookupProfile.C:47
List.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::lookupProfile::lookupProfile
lookupProfile(const dictionary &dict, const word &modelName)
Constructor from dictionary and model name.
Definition: lookupProfile.C:96
Foam::HashTableOps::values
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:149
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::lookupProfile::Cd_
List< scalar > Cd_
List of drag coefficient values.
Definition: lookupProfile.H:141
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::lookupProfile::AOA_
List< scalar > AOA_
List of angle-of-attack values [deg] on input, converted to [rad].
Definition: lookupProfile.H:138
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< scalar >
Foam::lookupProfile::Cdl
virtual void Cdl(const scalar alpha, scalar &Cd, scalar &Cl) const
Return the Cd and Cl for a given angle-of-attack.
Definition: lookupProfile.C:141
Foam::lookupProfile
Profile model where polar lift and drag coefficients are linearly interpolated from a polar table by ...
Definition: lookupProfile.H:129
Foam::lookupProfile::TypeName
TypeName("lookup")
Runtime type information.
Foam::lookupProfile::~lookupProfile
~lookupProfile()=default
Destructor.
Foam::lookupProfile::operator=
void operator=(const lookupProfile &)=delete
No copy assignment.
Foam::profileModel
Base class for profile models for handling aerofoil lift and drag polar diagrams.
Definition: profileModel.H:120
profileModel.H
Foam::lookupProfile::Cl_
List< scalar > Cl_
List of lift coefficient values.
Definition: lookupProfile.H:144