Skip to content

Commit c208288

Browse files
committed
changes for robustness
1 parent 5519805 commit c208288

File tree

3 files changed

+146
-225
lines changed

3 files changed

+146
-225
lines changed

biosteam/units/design_tools/MESH.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ def solve_tridiagonal_matrix(a, b, c, d): # Tridiagonal matrix solver
2828
m = a[i] / b[i]
2929
b[inext] -= m * c[i]
3030
d[inext] -= m * d[i]
31-
32-
b[n] = d[n] / b[n]
31+
32+
bn = b[n]
33+
bn[bn < 1e-64] = 1e-64
34+
b[n] = np.exp(np.log(d[n]) - np.log(b[n]))
3335
for i in range(n-1, -1, -1):
3436
b[i] = (d[i] - c[i] * b[i+1]) / b[i]
3537
return b

0 commit comments

Comments
 (0)