pg_wing_rotation
Module Contents
Classes
Rotate the aerodynamic sectional and nodal force vectors from the wind to |
|
Rotate the VLM Geometry from the standard aerodynamic to the wind frame. |
Attributes
- class pg_wing_rotation.RotateFromWindFrame(*args, **kwargs)
Bases:
csdl.CustomExplicitOperationRotate the aerodynamic sectional and nodal force vectors from the wind to the standard aerodynamic frame. This is the reverse operation of the RotateToWindFrame component.
This transformation is given by the following rotation matrix:
F_x_aero | | cosb*cosa, sinb*cosa, -sina | | F_x_wind |F_y_aero | = | -sinb, cosb, 0 | . | F_y_wind |F_z_aero | | cosb*sina, sinb*sina, cosa | | F_z_wind |Where “a” is the angle of attack and “b” is the sideslip angle.
- Parameters
- sec_forces_w_frame[nx-1, ny-1, 3]numpy array
Force vectors on each panel (lattice) in wind frame.
- alphafloat
Angle of attack in degrees.
- betafloat
Sideslip angle in degrees.
- Returns
- sec_forces[nx-1, ny-1, 3]numpy array
Force vectors on each panel (lattice) in aero frame.
- compute(inputs, outputs)
Define outputs as an explicit function of the inputs
Example
```py def compute(self, inputs, outputs):
outputs[‘L’] = 1/2 * inputs[‘Cl’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’] outputs[‘D’] = 1/2 * inputs[‘Cd’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’]
- compute_derivatives(inputs, partials)
User defined method to compute partial derivatives for this operation
Example
```py def compute(self, inputs, outputs):
outputs[‘L’] = 1/2 * inputs[‘Cl’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’] outputs[‘D’] = 1/2 * inputs[‘Cd’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’]
- def compute_derivatives(self, inputs, derivatives):
derivatives[‘L’, ‘Cl’] = 1/2 * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’] derivatives[‘L’, ‘rho’] = 1/2 * inputs[‘Cl’] * inputs[‘V’]**2 * inputs[‘S’] derivatives[‘L’, ‘V’] = inputs[‘Cl’] * inputs[‘rho’] * inputs[‘V’] * inputs[‘S’] derivatives[‘L’, ‘S’] = 1/2 * inputs[‘Cl’] * inputs[‘rho’] * inputs[‘V’]**2
derivatives[‘D’, ‘Cd’] = 1/2 * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’] derivatives[‘D’, ‘rho’] = 1/2 * inputs[‘Cd’] * inputs[‘V’]**2 * inputs[‘S’] derivatives[‘D’, ‘V’] = inputs[‘Cd’] * inputs[‘rho’] * inputs[‘V’] * inputs[‘S’] derivatives[‘D’, ‘S’] = 1/2 * inputs[‘Cd’] * inputs[‘rho’] * inputs[‘V’]**2
- define()
User defined method to define custom operation
Example
def define(self): self.add_input('Cl') self.add_input('Cd') self.add_input('rho') self.add_input('V') self.add_input('S') self.add_output('L') self.add_output('D') # declare derivatives of all outputs wrt all inputs self.declare_derivatives('*', '*'))
- initialize()
User defined method to declare parameter values. Parameters are compile time constants (neither inputs nor outputs to the model) and cannot be updated at runtime. Parameters are intended to make a
CustomOperationsubclass definition generic, and therefore reusable. The example below shows how aCustomOperationsubclass definition uses parameters and how the user can set parameters when constructing the exampleCustomOperationsubclass. Note that the user never instantiates nor inherits directly from theCustomOperationbase class.Example
```py # in this example, we inherit from ExplicitOperation, but # the user can also inherit from ImplicitOperation class Example(ExplicitOperation):
- def initialize(self):
self.parameters.declare(‘in_name’, types=str) self.parameters.declare(‘out_name’, types=str)
- def define(self):
# use parameters declared in
initializein_name = self.parameters[‘in_name’] out_name = self.parameters[‘out_name’]self.add_input(in_name) self.add_output(out_name) self.declare_derivatives(out_name, in_name)
# define run time behavior by defining other methods…
# compile using Simulator imported from back end… sim = Simulator(
- Example(
in_name=’x’, out_name=’y’,
),
)
- class pg_wing_rotation.RotateToWindFrame(*args, **kwargs)
Bases:
csdl.CustomExplicitOperationRotate the VLM Geometry from the standard aerodynamic to the wind frame. In the wind frame the freestream will be along the x-axis.
This transformation is given by the following rotation matrix:
x_wind | | cosb*cosa, -sinb, cosb*sina | | x_aero |y_wind | = | sinb*cosa, cosb, sinb*sina | . | y_aero |z_wind | | -sina, 0, cosa | | z_aero |Where “a” is the angle of attack and “b” is the sideslip angle.
- Parameters
- def_mesh[nx, ny, 3]numpy array
Array defining the nodal coordinates of the lifting surface in aero frame.
- bound_vecs[num_eval_points, 3]numpy array
The vectors representing the bound vortices for each panel in the problem. This array contains points for all lifting surfaces in the problem.
- coll_pts[num_eval_points, 3]numpy array
The xyz coordinates of the collocation points used in the VLM analysis. This array contains points for all lifting surfaces in the problem.
- force_pts[num_eval_points, 3]numpy array
The xyz coordinates of the force points used in the VLM analysis. We evaluate the velocity of the air at these points to get the sectional forces acting on the panel. This includes both the freestream and the induced velocity acting at these points. This array contains points for all lifting surfaces in the problem.
- normals[nx-1, ny-1, 3]numpy array
The normal vector for each panel in aero frame, computed as the cross of the two diagonals from the mesh points.
- rotational_velocities[num_eval_points, 3]numpy array
The rotated freestream velocities at each evaluation point for all lifting surfaces. This array contains points for all lifting surfaces in the problem.
- alphafloat
Angle of attack in degrees.
- betafloat
Sideslip angle in degrees.
- Returns
- def_mesh_w_frame[nx, ny, 3]numpy array
Array defining the nodal coordinates of the lifting surface in wind frame.
- bound_vecs_w_frame[num_eval_points, 3]numpy array
Bound points for the horseshoe vortices in wind frame.
- coll_pts_w_frame[num_eval_points, 3]numpy array
Collocation points on the 3/4 chord line where the flow tangency condition is satisfed in wind frame.
- force_pts_w_frame[num_eval_points, 3]numpy array
Force pts in wind frame.
- normals_w_frame[nx-1, ny-1, 3]numpy array
The normal vector for each panel in wind frame.
- rotational_velocities_w_frame[num_eval_points, 3]numpy array
Velocity component at collecation points due to rotational velocity in wind frame.
- compute(inputs, outputs)
Define outputs as an explicit function of the inputs
Example
```py def compute(self, inputs, outputs):
outputs[‘L’] = 1/2 * inputs[‘Cl’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’] outputs[‘D’] = 1/2 * inputs[‘Cd’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’]
- compute_derivatives(inputs, partials)
User defined method to compute partial derivatives for this operation
Example
```py def compute(self, inputs, outputs):
outputs[‘L’] = 1/2 * inputs[‘Cl’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’] outputs[‘D’] = 1/2 * inputs[‘Cd’] * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’]
- def compute_derivatives(self, inputs, derivatives):
derivatives[‘L’, ‘Cl’] = 1/2 * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’] derivatives[‘L’, ‘rho’] = 1/2 * inputs[‘Cl’] * inputs[‘V’]**2 * inputs[‘S’] derivatives[‘L’, ‘V’] = inputs[‘Cl’] * inputs[‘rho’] * inputs[‘V’] * inputs[‘S’] derivatives[‘L’, ‘S’] = 1/2 * inputs[‘Cl’] * inputs[‘rho’] * inputs[‘V’]**2
derivatives[‘D’, ‘Cd’] = 1/2 * inputs[‘rho’] * inputs[‘V’]**2 * inputs[‘S’] derivatives[‘D’, ‘rho’] = 1/2 * inputs[‘Cd’] * inputs[‘V’]**2 * inputs[‘S’] derivatives[‘D’, ‘V’] = inputs[‘Cd’] * inputs[‘rho’] * inputs[‘V’] * inputs[‘S’] derivatives[‘D’, ‘S’] = 1/2 * inputs[‘Cd’] * inputs[‘rho’] * inputs[‘V’]**2
- define()
User defined method to define custom operation
Example
def define(self): self.add_input('Cl') self.add_input('Cd') self.add_input('rho') self.add_input('V') self.add_input('S') self.add_output('L') self.add_output('D') # declare derivatives of all outputs wrt all inputs self.declare_derivatives('*', '*'))
- initialize()
User defined method to declare parameter values. Parameters are compile time constants (neither inputs nor outputs to the model) and cannot be updated at runtime. Parameters are intended to make a
CustomOperationsubclass definition generic, and therefore reusable. The example below shows how aCustomOperationsubclass definition uses parameters and how the user can set parameters when constructing the exampleCustomOperationsubclass. Note that the user never instantiates nor inherits directly from theCustomOperationbase class.Example
```py # in this example, we inherit from ExplicitOperation, but # the user can also inherit from ImplicitOperation class Example(ExplicitOperation):
- def initialize(self):
self.parameters.declare(‘in_name’, types=str) self.parameters.declare(‘out_name’, types=str)
- def define(self):
# use parameters declared in
initializein_name = self.parameters[‘in_name’] out_name = self.parameters[‘out_name’]self.add_input(in_name) self.add_output(out_name) self.declare_derivatives(out_name, in_name)
# define run time behavior by defining other methods…
# compile using Simulator imported from back end… sim = Simulator(
- Example(
in_name=’x’, out_name=’y’,
),
)
- pg_wing_rotation.k = 4