I am solving an implicit system of equations for vector of temperatures 'T' (call it "Temp" component):
residuals['T'] = GL.dot(T)-GR*(T**4)+QS+QI
where "GL, GR, QS, QI" are inputs. Matrix "GL" depends on some design variables of interest (let's call them "var"). Therefore I have to make an explicit component (call it "GLmtxComp") that assembles square "GL" matrix by doing some simple calculations:
def compute(self, inputs, outputs):
GL = self.options['GL_init']
SF = self.options['SF']
nodes = self.options['nodes']
for var in inputs:
idx = nodes[var]
GL[idx] = SF[var]*inputs[var] # updates GL values based on input var
Here only some elements of "GL" are changed (those defined in {nodes} dictionary), other elements are unchanged and take initial values from option "GL_init".
When I run the implicit component alone with raw initial input values, it solves. But as soon as I connect it to my new "GLmtxComp" explicit component that provides the "GL" matrix as input, the linear solver fails with message:
raise RuntimeError(format_singular_csc_error(system, matrix))
RuntimeError: Identical rows or columns found in jacobian in 'temp'. Problem is underdetermined.
I use non linear Newton and linear Direct solver to converge the implicit 'temp' component. If I change to other solvers, I don't get the error message, but the solution does not converge anyway. Interestingly, the error goes away if I set nonlinear Newton solver to solve for sub-systems, but then it does not converge (it diverges quite violently after tens of iterations). So is it related to the "GLmtxComp" explicit component, or is it somehow related to implicit residual partials? I tried to use both finite difference and exact derivatives for "GLmtxComp", but the problem persists. How do I debug this problem? N2 diagram of the group