Skip to content

Commit

Permalink
fixed solve_matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
lkelvinm committed Aug 16, 2018
1 parent dfc54a2 commit 0a38fd5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
1 change: 0 additions & 1 deletion openaerostruct/aerodynamics/solve_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def solve_nonlinear(self, inputs, outputs):

def linearize(self, inputs, outputs, partials):
system_size = self.system_size

self.lu = lu_factor(inputs['mtx'])

partials['circulations', 'circulations'] = inputs['mtx'].flatten()
Expand Down
22 changes: 21 additions & 1 deletion openaerostruct/aerodynamics/tests/test_solve_matrix.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import unittest
import numpy as np

from openmdao.api import Group, IndepVarComp

from openaerostruct.aerodynamics.solve_matrix import SolveMatrix
from openaerostruct.utils.testing import run_test, get_default_surfaces
Expand All @@ -9,9 +12,26 @@ class Test(unittest.TestCase):
def test(self):
surfaces = get_default_surfaces()

group = Group()
comp = SolveMatrix(surfaces=surfaces)

indep_var_comp = IndepVarComp()

system_size = 0
for surface in surfaces:
nx = surface['num_x']
ny = surface['num_y']
system_size += (nx - 1) * (ny - 1)


indep_var_comp.add_output('rhs', val=np.ones((system_size)), units='m/s')
indep_var_comp.add_output('mtx', val=np.identity((system_size)), units='1/m')

group.add_subsystem('indep_var_comp', indep_var_comp, promotes=['*'])
group.add_subsystem('solve_matrix', comp, promotes=['*'])


run_test(self, comp)
run_test(self, group)


if __name__ == '__main__':
Expand Down

0 comments on commit 0a38fd5

Please sign in to comment.