Skip to content

Commit

Permalink
Code change to comply with Numpy 2.1.3
Browse files Browse the repository at this point in the history
It seems that np.linalg.solve() changed between Numpy 1.26.4 and Numpy 2.1.3 so that a part of the code related to the lumped mass approach stopped working. I'm not sure in which exact version that changed, but the new code should work with both.
  • Loading branch information
lucas-carmo committed Nov 11, 2024
1 parent 4d0fd2c commit 29ce25d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion moorpy/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,10 @@ def get_dynamic_tension(line,omegas,S_zeta,RAO_A,RAO_B,depth,kbot,cbot,seabed_to
F_B = np.einsum('nij,njk->ni',-H[:,3:-3,-3:],RAO_B[:,:,None])
F = F_A + F_B

X[:,3:-3] = np.linalg.solve(H[:,3:-3,3:-3],F)
# Solve for each frequency
for i in range(H.shape[0]):
X[i, 3:-3] = np.linalg.solve(H[i, 3:-3, 3:-3], F[i])

S_Xd[:] = np.abs(1j*omegas[:,None]*X)**2*S_zeta[:,None]
sigma_Xd[:] = np.sqrt(np.trapz(S_Xd,omegas,axis=0))
r_dynamic[:] = X.reshape(X.shape[0],int(X.shape[1]/3),3)
Expand Down

0 comments on commit 29ce25d

Please sign in to comment.