Skip to content

Commit

Permalink
changed interpolant of aerodynamic coefficients (#221)
Browse files Browse the repository at this point in the history
* changed interpolant of aerodynamic coefficients in commercial aircraft example to lagrange3

* removed some test skippings, cleaned up some deprecation issues
  • Loading branch information
robfalck committed Sep 13, 2019
1 parent 43d87c6 commit 501d8c0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def setup(self):

if MBI is None:
self.add_subsystem(name='aero_coef_comp',
subsys=AeroCoefComp(vec_size=n, extrapolate=True),
subsys=AeroCoefComp(vec_size=n, extrapolate=True,
method='lagrange3'),
promotes_inputs=['mach', 'alpha', 'alt', 'eta'],
promotes_outputs=['CL', 'CD', 'CM'])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_aero_coefs(self):

prob = om.Problem(model=om.Group())

prob.model.add_subsystem(name='aero', subsys=AeroCoefComp(vec_size=nn, method='scipy_quintic'))
prob.model.add_subsystem(name='aero', subsys=AeroCoefComp(vec_size=nn, method='lagrange3'))

ivc = prob.model.add_subsystem(name='ivc', subsys=om.IndepVarComp(), promotes_outputs=['*'])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,12 @@ def setUpClass(cls):

cls.p.run_model()

@unittest.skip('temporaryily skipped until CT is worked out analytically')
def test_results(self):

assert_rel_error(self,
self.p['propulsion.tsfc'],
2 * 8.951e-6 * 9.80665 * np.ones(self.n))

print(self.p['propulsion.tau'])

# assert_rel_error(self,
# self.p['propulsion.tau'],
# np.linspace(0, 1.0, self.n))
#
# assert_rel_error(self,
# self.p['propulsion.dXdt:mass_fuel'],
# np.linspace(0, -1.02E6 * 2 * 8.951E-6, self.n))

def test_partials(self):
cpd = self.p.check_partials(method='cs', out_stream=None)
assert_check_partials(cpd)
10 changes: 5 additions & 5 deletions dymos/examples/hyper_sensitive/test/test_hyper_sensitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,27 @@ def test_partials(self):
cpd = p.check_partials(method='fd', compact_print=True, out_stream=None)

def test_hyper_sensitive_radau(self):
p = self.make_problem(transcription=Radau, optimizer='SNOPT')
p = self.make_problem(transcription=Radau, optimizer='SLSQP')
p.run_driver()
ui, uf, J = self.solution()

assert_rel_error(self,
p.get_val('traj.phase0.timeseries.controls:u')[0],
ui,
tolerance=1e-2)
tolerance=1e-1)

assert_rel_error(self,
p.get_val('traj.phase0.timeseries.controls:u')[-1],
uf,
tolerance=1e-2)
tolerance=1e-1)

assert_rel_error(self,
p.get_val('traj.phase0.timeseries.states:xL')[-1],
J,
tolerance=1e-2)
tolerance=1e-1)

def test_hyper_sensitive_gauss_lobatto(self):
p = self.make_problem(transcription=GaussLobatto, optimizer='SNOPT')
p = self.make_problem(transcription=GaussLobatto, optimizer='SLSQP')
p.run_driver()

ui, uf, J = self.solution()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ def test_state_interp_comp_lobatto(self):
xdot2 = f_v(t)

ax[0].plot(t, x1, 'b-', label='$x$')
ax[0].plot(t, xdot1, 'b--', label='$\dot{x}$')
ax[0].plot(t, xdot1, 'b--', label=r'$\dot{x}$')
ax[0].plot(t_disc, p['state_disc:x'], 'bo', label='$X_d:x$')
ax[0].plot(t_col, p['state_interp_comp.state_col:x'], 'bv', label='$X_c:x$')
ax[0].plot(t_col, p['state_interp_comp.staterate_col:x'], marker='v', color='None',
mec='b', label='$Xdot_c:x$')

ax[1].plot(t, x2, 'r-', label='$v$')
ax[1].plot(t, xdot2, 'r--', label='$\dot{v}$')
ax[1].plot(t, xdot2, 'r--', label=r'$\dot{v}$')
ax[1].plot(t_disc, p['state_disc:v'], 'ro', label='$X_d:v$')
ax[1].plot(t_col, p['state_interp_comp.state_col:v'], 'rv', label='$X_c:v$')
ax[1].plot(t_col, p['state_interp_comp.staterate_col:v'], marker='v', color='None',
Expand Down Expand Up @@ -226,14 +226,14 @@ def test_state_interp_comp_lobatto_vectorized(self):
xdot2 = f_v(t)

ax[0].plot(t, x1, 'b-', label='$x$')
ax[0].plot(t, xdot1, 'b--', label='$\dot{x}$')
ax[0].plot(t, xdot1, 'b--', label='r$\dot{x}$')
ax[0].plot(t_disc, p['state_disc:pos'][:, 0], 'bo', label='$X_d:pos$')
ax[0].plot(t_col, p['state_interp_comp.state_col:pos'][:, 0], 'bv', label='$X_c:pos$')
ax[0].plot(t_col, p['state_interp_comp.staterate_col:pos'][:, 0], marker='v',
color='None', mec='b', label='$Xdot_c:pos$')

ax[1].plot(t, x2, 'r-', label='$v$')
ax[1].plot(t, xdot2, 'r--', label='$\dot{v}$')
ax[1].plot(t, xdot2, 'r--', label='r$\dot{v}$')
ax[1].plot(t_disc, p['state_disc:pos'][:, 1], 'ro', label='$X_d:vel$')
ax[1].plot(t_col, p['state_interp_comp.state_col:pos'][:, 1], 'rv', label='$X_c:vel$')
ax[1].plot(t_col, p['state_interp_comp.staterate_col:pos'][:, 1], marker='v',
Expand Down

0 comments on commit 501d8c0

Please sign in to comment.