Skip to content

Commit

Permalink
Fix matrix-free and solve_nonlinear for new OpenMDAO
Browse files Browse the repository at this point in the history
  • Loading branch information
dingraha committed May 20, 2023
1 parent 25cac40 commit afaeb38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/omjlcomps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode):
raise e from None

self.compute_jacvec_product = MethodType(compute_jacvec_product, self)
# https://github.com/OpenMDAO/OpenMDAO/pull/2802
self.matrix_free = True

def setup_partials(self):
_setup_partials_common(self)
Expand Down Expand Up @@ -187,6 +189,8 @@ def solve_nonlinear(self, inputs, outputs):
raise e from None

self.solve_nonlinear = MethodType(solve_nonlinear, self)
# https://github.com/OpenMDAO/OpenMDAO/pull/2802
self._has_solve_nl = True

if jl.OpenMDAOCore.has_linearize(self._jlcomp):
def linearize(self, inputs, outputs, partials):
Expand Down Expand Up @@ -228,6 +232,8 @@ def apply_linear(self, inputs, outputs, d_inputs, d_outputs, d_residuals, mode):
raise e from None

self.apply_linear = MethodType(apply_linear, self)
# https://github.com/OpenMDAO/OpenMDAO/pull/2802
self.matrix_free = True

if jl.OpenMDAOCore.has_solve_linear(self._jlcomp):
def solve_linear(self, d_outputs, d_residuals, mode):
Expand Down

0 comments on commit afaeb38

Please sign in to comment.