1010import openmdao .api as om
1111import numpy as np
1212
13- from mphys import Multipoint
14- from mphys .scenario_aerodynamic import ScenarioAerodynamic
13+ from mphys . core import Multipoint , MPhysVariables
14+ from mphys .scenarios import ScenarioAerodynamic
1515from pygeo .mphys import OM_DVGEOCOMP
1616
1717from openaerostruct .geometry .utils import generate_vsp_surfaces
@@ -31,6 +31,7 @@ def setup(self):
3131 "S_ref_type" : "wetted" , # how we compute the wing area,
3232 # can be 'wetted' or 'projected'
3333 "twist_cp" : np .zeros (3 ), # Define twist using 3 B-spline cp's
34+ "ref_axis_pos" : 0.25 , # Define the reference axis position. 0 is the leading edge, 1 is the trailing edge.
3435 # Aerodynamic performance of the lifting surface at
3536 # an angle of attack of 0 (alpha=0).
3637 # These CL0 and CD0 values are added to the CL and CD
@@ -61,12 +62,12 @@ def setup(self):
6162 re = 1e6
6263
6364 dvs = self .add_subsystem ("dvs" , om .IndepVarComp (), promotes = ["*" ])
64- dvs .add_output ("aoa" , val = aoa , units = "deg" )
65- dvs .add_output ("yaw" , val = beta , units = "deg" )
65+ dvs .add_output (MPhysVariables . Aerodynamics . FlowConditions . ANGLE_OF_ATTACK , val = aoa , units = "deg" )
66+ dvs .add_output (MPhysVariables . Aerodynamics . FlowConditions . YAW_ANGLE , val = beta , units = "deg" )
6667 dvs .add_output ("rho" , val = rho , units = "kg/m**3" )
67- dvs .add_output ("mach" , mach )
68+ dvs .add_output (MPhysVariables . Aerodynamics . FlowConditions . MACH_NUMBER , mach )
6869 dvs .add_output ("v" , vel , units = "m/s" )
69- dvs .add_output ("reynolds" , re , units = "1/m" )
70+ dvs .add_output (MPhysVariables . Aerodynamics . FlowConditions . REYNOLDS_NUMBER , re , units = "1/m" )
7071 dvs .add_output ("cg" , val = np .zeros ((3 )), units = "m" )
7172
7273 # Create mphys builder for aero solver
@@ -82,11 +83,25 @@ def setup(self):
8283 self .geometry .nom_add_discipline_coords ("aero" )
8384
8485 self .mphys_add_scenario ("cruise" , ScenarioAerodynamic (aero_builder = aero_builder ))
85- self .connect ("mesh.x_aero0" , "geometry.x_aero_in" )
86- self .connect ("geometry.x_aero0" , "cruise.x_aero" )
86+ self .connect (
87+ f"mesh.{ MPhysVariables .Aerodynamics .Surface .COORDINATES } " ,
88+ f"geometry.{ MPhysVariables .Aerodynamics .Geometry .COORDINATES_INPUT } " ,
89+ )
90+ self .connect (
91+ f"geometry.{ MPhysVariables .Aerodynamics .Geometry .COORDINATES_OUTPUT } " ,
92+ f"cruise.{ MPhysVariables .Aerodynamics .Surface .COORDINATES } " ,
93+ )
8794
8895 # Connect dv ivc's to solver
89- for dv in ["aoa" , "yaw" , "rho" , "mach" , "v" , "reynolds" , "cg" ]:
96+ for dv in [
97+ MPhysVariables .Aerodynamics .FlowConditions .ANGLE_OF_ATTACK ,
98+ MPhysVariables .Aerodynamics .FlowConditions .YAW_ANGLE ,
99+ MPhysVariables .Aerodynamics .FlowConditions .MACH_NUMBER ,
100+ MPhysVariables .Aerodynamics .FlowConditions .REYNOLDS_NUMBER ,
101+ "rho" ,
102+ "v" ,
103+ "cg" ,
104+ ]:
90105 self .connect (dv , f"cruise.{ dv } " )
91106
92107 def configure (self ):
@@ -119,7 +134,7 @@ def configure(self):
119134prob .setup ()
120135
121136# Create a n^2 diagram for user to view model connections
122- om .n2 (prob )
137+ # om.n2(prob)
123138prob .run_model ()
124139prob .run_driver ()
125140# Write optimized geometry to vsp file
0 commit comments