1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """The elements for the aerodynamic group"""
23 from mbdyn.references import NONE_REF, NODE_REF
24 from mbdyn.common import MANAGER, get_mbdyn_name
25
26 from mbdyn.elements_base import CommonElement, ElementWithNode
27
28 AERODYNAMIC_CLASS = {}
29
31 """The MBDyn aerodynamic beam. This object is currently
32 not in use, it needs to be reviewed.
33 """
34
35 - def __init__(self, name="Aerodynamic beam"):
36 CommonElement.__init__(self, name)
37 self.ref = NONE_REF
38 self.mbdyn_type = "aerodynamic beam"
39 self.class_key = "AerodynamicBeam"
40 self.group_key = "AERODYNAMIC"
41
42 self.beam = None
43 self.mbdyn_beam = None
44 self.rotor = None
45 self.mbdyn_rotor = None
46 self.arg_names = ["label", "beam", "rotor",
47 "offset1", "orientation_matrix1",
48 "offset2", "orientation_matrix2",
49 "offset3", "orientation_matrix3"]
50
51
52 self.control_data_with_values = [("aerodynamic elements",
53 "+1 # %s" % self.name)]
54 self.chord_dist = []
55 self.twist_dist = []
56 self.airfoil_desc = []
57 self.mbdyn_airfoil_data = []
58
60 """Set the first relative surface offset"""
61 if kargs.has_key("ref"):
62 if kargs["ref"] == "node":
63 kargs["ref"] = NODE_REF
64 MANAGER.add_vector(self, "offset1", args, kargs)
65
69
71 """Set the second relative surface offset"""
72 if kargs.has_key("ref"):
73 if kargs["ref"] == "node":
74 kargs["ref"] = NODE_REF
75 MANAGER.add_vector(self, "offset2", args, kargs)
76
80
82 """Set the third relative surface offset"""
83 if kargs.has_key("ref"):
84 if kargs["ref"] == "node":
85 kargs["ref"] = NODE_REF
86 MANAGER.add_vector(self, "offset3", args, kargs)
87
91
93 """Attach the aerodynamic beam to a structural one"""
94 self.beam = beam
95
97 """Attach the aerodynamic beam to a rotor"""
98 self.rotor = rotor
99
101 """Set the MBDyn labels for writing the input file"""
102 self.mbdyn_beam = self.beam.mbdyn_label
103 rotor_label = self.rotor.mbdyn_label.value
104 import copy
105 self.mbdyn_rotor = copy.copy(self.rotor.mbdyn_label)
106 self.mbdyn_rotor.set_value("rotor, " + str(rotor_label))
107
109 """Enter the chord shape function type"""
110 MANAGER.add_argument(self, "chord_shape_function", keyword, com)
111
113 """Set the twist shape function"""
114 MANAGER.add_argument(self, "twist_shape_function", keyword, com)
115
117 """Add a chord distribution to the aerodynamic beam"""
118 self.chord_dist.append((radius, chord))
119
121 """Add a twist distribution"""
122 self.twist_dist.append((radius, twist))
123
124 - def add_airfoil(self, filename, radius_limit, com=None):
125 """Add an airfoil contained in a filename"""
126 self.airfoil_desc.append((filename, radius_limit, com))
127
129 """Set the value of the shape position"""
130 MANAGER.add_argument(self, "shape_position_value", value, com,
131 mbdyn_value = "const, %s" % str(value))
132
134 """The the velocity of the shape"""
135 MANAGER.add_argument(self, "shape_velocity_value", value, com,
136 mbdyn_value = "const, %s" % str(value))
137
139 """Set the number of integration points"""
140 MANAGER.add_argument(self, "aero_integration_points", value, com)
141
149
151 """Set the chord on the beam"""
152 self.arg_names += ["chord_shape_function", "chord_nb"]
153 MANAGER.add_argument(self, "chord_nb", len(self.chord_dist))
154 for i, (radius, chord) in enumerate(self.chord_dist):
155 arg_name = "chord %01d" % (i+1)
156 self.arg_names += [arg_name]
157 mbdyn_value = "%s, %s" % (str(radius), str(chord))
158 MANAGER.add_argument(self, arg_name, (radius, chord),
159 mbdyn_value=mbdyn_value)
160
162 """Set the shape values for MBDyn"""
163 self.arg_names += ["shape_position_value", "shape_velocity_value"]
164
166 """Set the twist on the beam"""
167 self.arg_names += ["twist_shape_function", "twist_nb"]
168 MANAGER.add_argument(self, "twist_nb", len(self.twist_dist))
169 for i, (radius, twist) in enumerate(self.twist_dist):
170 arg_name = "twist %01d" % (i+1)
171 self.arg_names += [arg_name]
172 mbdyn_value = "%s, %s" % (str(radius), str(twist))
173 MANAGER.add_argument(self, arg_name, (radius, twist),
174 mbdyn_value=mbdyn_value)
175
177 """Set the airfoil headers"""
178 self.arg_names += ["aero_integration_points"]
179 arg_name = "aero_type"
180 self.arg_names += [arg_name]
181 MANAGER.add_argument(self, arg_name, ("c81", "multiple"),
182 mbdyn_value="c81, multiple")
183
185 """Set the airgoil filename with their labels"""
186 arg_name = "airfoil_nb"
187 self.arg_names += [arg_name]
188 MANAGER.add_argument(self, arg_name, len(self.airfoil_desc))
189 for i, (filename, radius_limit, com) in enumerate(self.airfoil_desc):
190 indice = i+1
191
192 arg_name = "aero_profile%i" % indice
193 mbdyn_value = 'c81 data: %i, "%s";' % (indice, filename)
194 MANAGER.add_argument(self, arg_name, filename, com,
195 mbdyn_value=mbdyn_value)
196 mbdyn_inst = getattr(self, get_mbdyn_name(arg_name))
197 self.mbdyn_airfoil_data.append(mbdyn_inst.get_line(separator=""))
198
199 arg_name = "airfoil%i" % indice
200 self.arg_names += [arg_name]
201 mbdyn_value = "%i, %s" % (indice, radius_limit)
202 MANAGER.add_argument(self, arg_name, (filename, radius_limit),
203 com,
204 mbdyn_value)
205
206
207 AERODYNAMIC_CLASS["AerodynamicBeam"] = AerodynamicBeam
208
209
210 -class Rotor(ElementWithNode):
211 """Used to associate the aerodynamic elements. The rotor element
212 is able to compute the induced velocity at an arbitrary point of
213 the rotor disk. Finally this element is not currently used.
214 """
215
217 ElementWithNode.__init__(self, name)
218 self.mbdyn_type = "rotor"
219 self.class_key = "Rotor"
220 self.mbdyn_group = "ROTOR"
221
222 self.craft_node = None
223 self.mbdyn_craft_node = None
224 self.rotor_node = None
225 self.mbdyn_rotor_node = None
226 self.arg_names += ["craft_node", "rotor_node",
227 "induced_velocity_model",
228 "reference_omega", "reference_radius"]
229
231 """Not relevant in that case because two nodes are used:
232 the craft and rotor nodes.
233 Use L{set_craft_node} and L{set_rotor_node} instead."""
234 print self.attach_to_node.__doc__
235
237 """Set the craft node of the rotor"""
238 MANAGER.add_argument(self, "craft_node", node, com)
239
243
245 """Set the induced velocity model: uniform, glauert or mangler"""
246 arg_name = "induced_velocity_model"
247 MANAGER.add_argument(self, arg_name, keyword, com,
248 "induced velocity, %s" % keyword)
249
251 """To decide whether to inhibit or not the induced velocity
252 computation if the rotor speed is very low, in [rad/s]"""
253 MANAGER.add_argument(self, "reference_omega", value, com)
254
256 """Used in the adimensionalization of the rotor related parameters,
257 in [m]."""
258 MANAGER.add_argument(self, "reference_radius", value, com)
259
261 """Set the label for the MBDyn input file of the craft and rotor
262 nodes"""
263 self.mbdyn_craft_node = self.craft_node.mbdyn_label
264 self.mbdyn_rotor_node = self.rotor_node.mbdyn_label
265