Commit 46b2bc96 authored by Sean Leavey's avatar Sean Leavey
Browse files

WIP

parent 5a82645b
Pipeline #357763 failed with stage
in 27 seconds
......@@ -19,4 +19,5 @@
"latex",
"plaintext"
],
"python.formatting.provider": "black",
}
......@@ -165,7 +165,6 @@ class Analysis(metaclass=abc.ABCMeta):
The convergence check results by node, if ``debug`` was set to ``True``,
else ``None``.
"""
# This code only works properly when we're dealing with (n x 1) arrays.
assert x.shape[1] == dx.shape[1] == residuals.shape[1] == 1
......@@ -499,9 +498,9 @@ class OperatingPoint(Analysis):
lu = scipy.sparse.linalg.splu(scipy.sparse.csc_matrix(mna + J))
dx = lu.solve(-residuals)
else:
dx = np.linalg.solve(mna + J, -residuals)
dx = scipy.linalg.solve(mna + J, -residuals)
x += self.damping(dx, n=count)
x += self.damping_factor(dx, n=count) * dx
if not self.circuit.nonlinear:
# The circuit should have converged in a single pass.
......@@ -520,7 +519,7 @@ class OperatingPoint(Analysis):
return is_converged, count, convergence_by_node
def damping(self, dx, n=-1):
def damping_factor(self, dx, n=-1):
"""Calculates the damping coefficient for the Newthon method.
The damping coefficient is choosen as the lowest between:
......@@ -600,7 +599,7 @@ class OperatingPoint(Analysis):
if td_new < td:
td = td_new
return td * dx
return td
class Sweep(Analysis):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment