diff --git a/aviary/docs/user_guide/external_aero.ipynb b/aviary/docs/user_guide/external_aero.ipynb index 2ab8e7981..40936bd6e 100644 --- a/aviary/docs/user_guide/external_aero.ipynb +++ b/aviary/docs/user_guide/external_aero.ipynb @@ -84,6 +84,15 @@ " This component doesn't do anything, except set the drag and lift\n", " polars from the file we read in.\n", " \"\"\"\n", + "\n", + " # Your component will compute CD and CL for a grid of altitudes, machs, and\n", + " # angles of attack, and return them in a multidimensional array as described \n", + " # in the example text.\n", + "\n", + " # Because it would be prohibitive to embed something like a vortex lattice\n", + " # code in this example, we are \"cheating\" here by sending a pre-computed\n", + " # drag polar.\n", + " \n", " outputs['drag_table'] = CD\n", " outputs['lift_table'] = CL\n", " \n", @@ -156,12 +165,18 @@ " the pre-mission part of the Aviary problem. This includes sizing, design,\n", " and other non-mission parameters.\n", " \"\"\"\n", - "\n", - " return ExternalAero(altitude=self.altitude, mach=self.mach, angle_of_attack=self.angle_of_attack)\n", - "\n", - " def mission_outputs(self):\n", - " return [('drag_table', Aircraft.Design.DRAG_POLAR),\n", - " ('lift_table', Aircraft.Design.LIFT_POLAR)]" + " aero_group = om.Group()\n", + " aero = ExternalAero(altitude=self.altitude, mach=self.mach, angle_of_attack=self.angle_of_attack)\n", + " aero_group.add_subsystem(\n", + " 'premission_aero', \n", + " aero,\n", + " promotes_inputs=['*'],\n", + " promotes_outputs=[\n", + " ('drag_table', Aircraft.Design.DRAG_POLAR),\n", + " ('lift_table', Aircraft.Design.LIFT_POLAR)\n", + " ]\n", + " )\n", + " return aero_group" ] }, { @@ -264,7 +279,28 @@ "prob.add_driver(\"SLSQP\")\n", "prob.add_design_variables()\n", "prob.add_objective(objective_type=\"mass\", ref=-1e5)\n", - "prob.setup()" + "prob.setup()\n", + "prob.set_initial_guesses()\n", + "\n", + "prob.run_model()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bc8788ba-9b2b-4b81-8251-32db008d3a60", + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "\n", + "# Make sure we succesfully passed the polar\n", + "from openmdao.utils.assert_utils import assert_near_equal\n", + "om_CD = prob.get_val(Aircraft.Design.DRAG_POLAR)[0, 0, 0]\n", + "assert_near_equal(om_CD, CD[0, 0, 0], 1e-6)" ] } ], @@ -285,7 +321,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.12.3" }, "orphan": true },