0

With OpenMDAO 3.25, I am trying to run the om.DOEDriver with om.UniformGenerator on a model which contains a group with a Newton NL solver with the linear DirectSolver solver, similar to that discussed here:

cycle1 = self.add_subsystem('cycle1', om.Group(), promotes_inputs=['T','Ch','Cg','M_Fm'],
                            promotes_outputs=['Ba','eta_avg','Cm','T_m_avg'])    

        
cycle1.add_subsystem('Equilibrium', Equilibrium(input_data=d, opt_data=a), promotes_inputs=['Ch','Cg','Fm','Ft','M_Fm'],
                            promotes_outputs=['eta_avg']) 
        
cycle1.add_subsystem('Aero', Aero(input_data=d, opt_data=a), promotes_inputs=['eta_avg'],
                            promotes_outputs=['Ba','Ft'])                    
                             
cycle1.add_subsystem('Mooring', Mooring(input_data=d, opt_data=a), promotes_inputs=['eta_avg','T'],
                            promotes_outputs=['Cm','T_m_avg','Fm']) 
        
cycle1.nonlinear_solver = om.NewtonSolver()
cycle1.linear_solver = om.DirectSolver()
cycle1.nonlinear_solver.options['iprint'] = 2
cycle1.nonlinear_solver.options['maxiter'] = 100
cycle1.nonlinear_solver.options['solve_subsystems'] = True
cycle1.nonlinear_solver.options['err_on_non_converge'] = False
cycle1.nonlinear_solver.options['reraise_child_analysiserror'] = True 

The Equilibrium component aims to drive the residual to zero:

def apply_nonlinear(self, inputs, outputs, residuals):
      t = inputs['Ft']
      Fm = inputs['Fm']
      Ch = inputs['Ch']
      Cg = inputs['Cg']
      M_Fm = inputs['M_Fm'][0]
      eta_avg = outputs['eta_avg']
      
residuals['eta_avg'] = np.matmul((Ch + Cg), eta_avg) - (Ft + Fm - [0, 0, -9.81*M_Fm, 0,0,0])

For the first few points of the DOE it all runs ok, but then I am running into issues when the NL solver fails at one of the points with RuntimeError: Factor is exactly singular. After that, DOE driver proceeds to next points, but the NL driver outputs the same error for each subsequent point (and this is not caused by the physics of the problem: no matter what points I'm computing after this error is first raised, they all fail with the same error).

Could you help me understand why that happens, please?

Kasia
  • 105
  • 6

1 Answers1

0

This sounds like some kind of bug in the newton solver. I suggest you try to reduce this down to a very simple example case, possibly by writing a toy component that has a single residual that you can easily make singular or not based on the value of an input. Then you can try to set up a run script that triggers the singular matrix error, runs the model, change the value so its not singular, and run it again.

Then submit this as a bug to the OpenMDAO project by creation an issue there.

Justin Gray
  • 5,605
  • 1
  • 11
  • 16