Skip to content

Commit afcc73f

Browse files
authored
Added dict key validation & updated documentation (#417)
* chord-related fixes * for black * fixing RTD config * added key validation for mesh_dict * added key validation for surface dict * removed unused keys from the tests * updated surface dict doc page * flake8 * fixed docs * typo
1 parent f2f974f commit afcc73f

23 files changed

Lines changed: 218 additions & 27 deletions

.readthedocs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ python:
1313
path: .
1414
extra_requirements:
1515
- docs
16-
system_packages: true

openaerostruct/docs/user_reference/mesh_surface_dict.rst

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,42 @@ The surface dict will be provided to Groups, including ``Geometry``, ``AeroPoint
8787
- 3D ndarray
8888
- m
8989
- ``x, y, z`` coordinates of the mesh vertices, can be created by ``generate_mesh``.
90+
* - span
91+
- 10.0
92+
- m
93+
- Wing span.
94+
* - taper
95+
- 0.5
96+
-
97+
- Wing taper ratio.
98+
* - sweep
99+
- 10.0
100+
- deg
101+
- Wing sweep angle.
102+
* - dihedral
103+
- 5.0
104+
- deg
105+
- Wing dihedral.
90106
* - twist_cp
91107
- np.array([0, 5])
92108
- deg
93109
- B-spline control points for twist distribution. Array convention is ``[wing tip, ..., root]`` in symmetry cases, and ``[tip, ..., root, ... tip]`` when ``symmetry = False``.
94110
* - chord_cp
95111
- np.array([0.1, 5])
112+
-
113+
- B-spline control points for chord distribution. This is a chord scaler applied to the initial mesh, not the chord value [m] itself. Array convention is the same as ``twist_cp``.
114+
* - xshear_cp
115+
- np.array([0.1, 0.2])
116+
- m
117+
- B-spline control points for the x-wise shear deformation of the wing.
118+
* - yshear_cp
119+
- np.array([0.1, 0.2])
120+
- m
121+
- B-spline control points for the y-wise shear deformation of the wing.
122+
* - zshear_cp
123+
- np.array([0.1, 0.2])
96124
- m
97-
- B-spline control points for chord distribution. Array convention is the same than ``twist_cp``.
125+
- B-spline control points for the z-wise shear deformation of the wing.
98126
* - ref_axis_pos
99127
- 0.25
100128
-
@@ -240,6 +268,10 @@ The surface dict will be provided to Groups, including ``Geometry``, ``AeroPoint
240268
- 0.12
241269
-
242270
- Thickness-over-chord ratio of airfoil provided for the wingbox cross-section.
271+
* - strength_factor _for_upper_skin
272+
- 1.0
273+
-
274+
- A factor to adjust the yield strength of the upper skin relative to the lower skin.
243275
* - data_x_upper
244276
- 1D ndarray
245277
-
@@ -257,5 +289,21 @@ The surface dict will be provided to Groups, including ``Geometry``, ``AeroPoint
257289
-
258290
- ``y`` coordinates of the wingbox cross-section's lower surface
259291

292+
.. list-table:: FFD parameters
293+
:widths: 20 20 5 55
294+
:header-rows: 1
295+
296+
* - Key
297+
- Example value
298+
- Units
299+
- Description
300+
* - mx
301+
- 2
302+
-
303+
- Number of the FFD control points in the x direction.
304+
* - my
305+
- 2
306+
-
307+
- Number of the FFD control points in the y direction.
260308
..
261309
TODO: list default values (if any), and whethre each key is required or optional.

openaerostruct/examples/drag_polar_ground_effect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def compute_drag_polar_ground_effect(Mach, alphas, heights, surfaces, trimmed=Fa
138138
"wing_type": "rect",
139139
"symmetry": True,
140140
"span": 12.0,
141-
"chord": 1,
141+
"root_chord": 1,
142142
"span_cos_spacing": 1.0,
143143
"chord_cos_spacing": 0.0,
144144
}

openaerostruct/examples/rectangular_wing/drag_polar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"wing_type": "rect",
3838
"symmetry": True,
3939
"span": 10.0,
40-
"chord": 1,
40+
"root_chord": 1,
4141
"span_cos_spacing": 1.0,
4242
"chord_cos_spacing": 1.0,
4343
}

openaerostruct/examples/rectangular_wing/mphys_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def setup(self):
1717
"wing_type": "rect",
1818
"symmetry": True,
1919
"span": 10.0,
20-
"chord": 1,
20+
"root_chord": 1,
2121
"span_cos_spacing": 1.0,
2222
"chord_cos_spacing": 1.0,
2323
}

openaerostruct/examples/rectangular_wing/opt_chord.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"wing_type": "rect",
4040
"symmetry": True,
4141
"span": 10.0,
42-
"chord": 1,
42+
"root_chord": 1,
4343
"span_cos_spacing": 1.0,
4444
"chord_cos_spacing": 1.0,
4545
}
@@ -105,8 +105,9 @@
105105
prob.driver.options["debug_print"] = ["nl_cons", "objs", "desvars"]
106106

107107
# Setup problem and add design variables, constraint, and objective
108+
# wing.chord_cp is the chord scaling applied to the initial mesh
108109
prob.model.add_design_var("alpha", lower=-10.0, upper=15.0)
109-
prob.model.add_design_var("wing.chord_cp", lower=1e-3, upper=5.0)
110+
prob.model.add_design_var("wing.chord_cp", lower=1e-3, upper=5.0, units=None)
110111
prob.model.add_constraint(point_name + ".wing_perf.CL", equals=0.5)
111112
prob.model.add_constraint(point_name + ".wing.S_ref", equals=10.0)
112113
prob.model.add_objective(point_name + ".wing_perf.CD", scaler=1e4)

openaerostruct/examples/rectangular_wing/opt_twist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"wing_type": "rect",
3939
"symmetry": True,
4040
"span": 10.0,
41-
"chord": 1,
41+
"root_chord": 1,
4242
"span_cos_spacing": 1.0,
4343
"chord_cos_spacing": 1.0,
4444
}

openaerostruct/examples/rectangular_wing/run_rect_wing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"wing_type": "rect",
3737
"symmetry": True,
3838
"span": 10.0,
39-
"chord": 1,
39+
"root_chord": 1,
4040
"span_cos_spacing": 1.0,
4141
"chord_cos_spacing": 1.0,
4242
}

openaerostruct/examples/rectangular_wing/run_roll.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"wing_type": "rect",
3838
"symmetry": False,
3939
"span": 9.0,
40-
"chord": 1,
40+
"root_chord": 1,
4141
"span_cos_spacing": 1.0,
4242
"chord_cos_spacing": 1.0,
4343
}

openaerostruct/geometry/geometry_group.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22

33
import openmdao.api as om
4+
from openaerostruct.utils.check_surface_dict import check_surface_dict_keys
45

56

67
class Geometry(om.Group):
@@ -23,6 +24,9 @@ def initialize(self):
2324
def setup(self):
2425
surface = self.options["surface"]
2526

27+
# key validation of the surface dict
28+
check_surface_dict_keys(surface)
29+
2630
# Get the surface name and create a group to contain components
2731
# only for this surface
2832
ny = surface["mesh"].shape[1]
@@ -91,10 +95,10 @@ def setup(self):
9195
promotes_inputs=["chord_cp"],
9296
promotes_outputs=["chord"],
9397
)
94-
comp.add_spline(y_cp_name="chord_cp", y_interp_name="chord", y_units="m")
98+
comp.add_spline(y_cp_name="chord_cp", y_interp_name="chord", y_units=None)
9599
bsp_inputs.append("chord")
96100
if surface.get("chord_cp_dv", True):
97-
self.set_input_defaults("chord_cp", val=surface["chord_cp"], units="m")
101+
self.set_input_defaults("chord_cp", val=surface["chord_cp"], units=None)
98102

99103
if "t_over_c_cp" in surface.keys():
100104
n_cp = len(surface["t_over_c_cp"])

0 commit comments

Comments
 (0)