utils.py

openaerostruct.geometry.utils.add_chordwise_panels(mesh, num_x, chord_cos_spacing)[source]

Generate a new mesh with multiple chordwise panels.

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface with only the leading and trailing edges defined.

num_xfloat

Desired number of chordwise node points for the final mesh.

chord_cos_spacingfloat

Blending ratio of uniform and cosine spacing in the chordwise direction. A value of 0. corresponds to uniform spacing and a value of 1. corresponds to regular cosine spacing. This increases the number of chordwise node points near the wingtips.

Returns:
new_mesh[nx, ny, 3]numpy array

Nodal mesh defining the final aerodynamic surface with the specified number of chordwise node points.

openaerostruct.geometry.utils.dihedral(mesh, dihedral_angle, symmetry)[source]

Apply dihedral angle. Positive angles up.

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface.

dihedral_anglefloat

Dihedral angle in degrees.

symmetryboolean

Flag set to true if surface is reflected about y=0 plane.

Returns:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the aerodynamic surface with dihedral angle.

openaerostruct.geometry.utils.gen_crm_mesh(num_x, num_y, span_cos_spacing=0.0, chord_cos_spacing=0.0, wing_type='CRM:jig')[source]

Generate Common Research Model wing mesh.

Parameters:
num_xfloat

Desired number of chordwise node points for the final mesh.

num_yfloat

Desired number of chordwise node points for the final mesh.

spanfloat

Total wingspan.

chordfloat

Root chord.

span_cos_spacingfloat (optional)

Blending ratio of uniform and cosine spacing in the spanwise direction. A value of 0. corresponds to uniform spacing and a value of 1. corresponds to regular cosine spacing. This increases the number of spanwise node points near the wingtips.

chord_cos_spacingfloat (optional)

Blending ratio of uniform and cosine spacing in the chordwise direction. A value of 0. corresponds to uniform spacing and a value of 1. corresponds to regular cosine spacing. This increases the number of chordwise node points near the wingtips.

wing_typestring (optional)

Describes the desired CRM shape. Current options are: “CRM:jig” (undeformed jig shape), “CRM:alpha_2.75” (shape from wind tunnel testing at a=2.75 from DPW6)

Returns:
mesh[nx, ny, 3]numpy array

Rectangular nodal mesh defining the final aerodynamic surface with the specified parameters.

etanumpy array

Spanwise locations of the airfoil slices. Later used in the interpolation function to obtain correct twist values at points along the span that are not aligned with these slices.

twistnumpy array

Twist along the span at the spanwise eta locations. We use these twists as training points for interpolation to obtain twist values at arbitrary points along the span.

openaerostruct.geometry.utils.gen_rect_mesh(num_x, num_y, span, chord, span_cos_spacing=0.0, chord_cos_spacing=0.0)[source]

Generate simple rectangular wing mesh.

Parameters:
num_xfloat

Desired number of chordwise node points for the final mesh.

num_yfloat

Desired number of chordwise node points for the final mesh.

spanfloat

Total wingspan.

chordfloat

Root chord.

span_cos_spacingfloat (optional)

Blending ratio of uniform and cosine spacing in the spanwise direction. A value of 0. corresponds to uniform spacing and a value of 1. corresponds to regular cosine spacing. This increases the number of spanwise node points near the wingtips.

chord_cos_spacingfloat (optional)

Blending ratio of uniform and cosine spacing in the chordwise direction. A value of 0. corresponds to uniform spacing and a value of 1. corresponds to regular cosine spacing. This increases the number of chordwise node points near the wingtips.

Returns:
mesh[nx, ny, 3]numpy array

Rectangular nodal mesh defining the final aerodynamic surface with the specified parameters.

openaerostruct.geometry.utils.generate_mesh(input_dict)[source]

Generate an OAS mesh.

Parameters:
input_dictdict

Dictionary containing user-provided parameters for the surface definition. See the following for more information: https://mdolab-openaerostruct.readthedocs-hosted.com/en/latest/user_reference/mesh_surface_dict.html#mesh-dict

Returns:
meshnumpy array

Nodal coordinates defining the mesh. shape = (nx, ny, 3), where nx is the number of chordwise discretization nodes, ny is the number of spanwise discretization nodes. If input_dict[“symmetry”] is True, mesh defines left half of wing.

twistnumpy array, optional

Only for CRM wing (input_dict[“wing_type”] == “CRM”). Twist values at the spanwise locations.

openaerostruct.geometry.utils.generate_vsp_surfaces(vsp_file, symmetry=False, include=None, scale=1.0)[source]

Generate a series of VLM surfaces based on geometries in an OpenVSP model.

Parameters:
vsp_filestr

OpenVSP file to generate meshes from.

symmetrybool

Flag specifying if the full model should be read in (False) or only half (True). Half model only reads in right side surfaces. Defaults to full model.

includelist[str]

List of body names defined in OpenVSP model that should be included in VLM mesh output. Defaults to all bodies found in model.

scale: float

A global scale factor from the OpenVSP geometry to incoming VLM mesh geometry. For example, if the OpenVSP model is in inches, and the VLM in meters, scale=0.0254. Defaults to 1.0.

Returns:
surfaceslist[dict]

List of surfaces dictionaries, one (two if symmetry==False) for each body requested in include. This is a relatively empty surface dictionary that contains only basic information about the VLM mesh (i.e. name, symmetry, mesh).

openaerostruct.geometry.utils.getFullMesh(left_mesh=None, right_mesh=None)[source]

For a symmetric wing, OAS only keeps and does computation on the left half. This script mirros the OAS mesh and attaches it to the existing mesh to obtain the full mesh.

Parameters:
left_mesh[nx,ny,3] or right_meshnumpy array

The half mesh to be mirrored.

Returns:
full_mesh[nx,2*ny-1,3]numpy array

The computed full mesh.

openaerostruct.geometry.utils.get_default_geo_dict()[source]

Obtain the default settings for the surface descriptions. Note that these defaults are overwritten based on user input for each surface. Each dictionary describes one surface.

Returns:
defaultsdict

A python dict containing the default surface-level settings.

openaerostruct.geometry.utils.plot3D_meshes(file_name, zero_tol=0)[source]

Reads in multi-surface meshes from a Plot3D mesh file for VLM analysis.

Parameters:
fileNamestr

Plot3D file name to be read in.

zero_tolfloat

If a node location read in the file is below this magnitude we will just make it zero. This is useful for getting rid of noise in the surface that may be due to the meshing tools geometry tolerance.

Returns:
mesh_dictdict

Dictionary holding the mesh of every surface included in the plot3D sorted by surface name.

openaerostruct.geometry.utils.rotate(mesh, theta_y, symmetry, rotate_x=True)[source]

Compute rotation matrices given mesh and rotation angles in degrees.

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface.

theta_y[ny]numpy array

1-D array of rotation angles about y-axis for each wing slice in degrees.

symmetryboolean

Flag set to True if surface is reflected about y=0 plane.

rotate_xboolean

Flag set to True if the user desires the twist variable to always be applied perpendicular to the wing (say, in the case of a winglet).

Returns:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the twisted aerodynamic surface.

openaerostruct.geometry.utils.scale_x(mesh, chord_dist)[source]

Modify the chords along the span of the wing by scaling only the x-coord.

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface.

chord_dist[ny]numpy array

Spanwise distribution of the chord scaler.

Returns:
mesh[nx, ny, 3]numpy array

Nodal mesh with the new chord lengths.

openaerostruct.geometry.utils.shear_x(mesh, xshear)[source]

Shear the wing in the x direction (distributed sweep).

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface.

xshear[ny]numpy array

Distance to translate wing in x direction.

Returns:
mesh[nx, ny, 3]numpy array

Nodal mesh with the new chord lengths.

openaerostruct.geometry.utils.shear_y(mesh, yshear)[source]

Shear the wing in the y direction (distributed span).

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface.

yshear[ny]numpy array

Distance to translate wing in y direction.

Returns:
mesh[nx, ny, 3]numpy array

Nodal mesh with the new span widths.

openaerostruct.geometry.utils.shear_z(mesh, zshear)[source]

Shear the wing in the z direction (distributed dihedral).

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface.

zshear[ny]numpy array

Distance to translate wing in z direction.

Returns:
mesh[nx, ny, 3]numpy array

Nodal mesh with the new chord lengths.

openaerostruct.geometry.utils.stretch(mesh, span, symmetry)[source]

Stretch mesh in spanwise direction to reach specified span.

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface.

spanfloat

Relative stetch ratio in the spanwise direction.

symmetryboolean

Flag set to true if surface is reflected about y=0 plane.

Returns:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the stretched aerodynamic surface.

openaerostruct.geometry.utils.sweep(mesh, sweep_angle, symmetry)[source]

Apply shearing sweep. Positive sweeps back.

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface.

sweep_anglefloat

Shearing sweep angle in degrees.

symmetryboolean

Flag set to true if surface is reflected about y=0 plane.

Returns:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the swept aerodynamic surface.

openaerostruct.geometry.utils.taper(mesh, taper_ratio, symmetry)[source]

Alter the spanwise chord linearly to produce a tapered wing. Note that we apply taper around the quarter-chord line.

Parameters:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the initial aerodynamic surface.

taper_ratiofloat

Taper ratio for the wing; 1 is untapered, 0 goes to a point.

symmetryboolean

Flag set to true if surface is reflected about y=0 plane.

Returns:
mesh[nx, ny, 3]numpy array

Nodal mesh defining the tapered aerodynamic surface.

openaerostruct.geometry.utils.writeMesh(mesh, filename)[source]

Writes the OAS mesh in Tecplot .dat file format, for visualization and debugging purposes.

Parameters:
mesh[nx,ny,3]numpy array

The OAS mesh to be written.

filenamestr

The file name including the .dat extension.

openaerostruct.geometry.utils.write_FFD_file(surface, mx, my)[source]