Skip to content

Commit

Permalink
Changed amplitudes to be complex and have a factor of two
Browse files Browse the repository at this point in the history
- The wave amplitude is now 2*Sw*dw (it was missing the factor 2)
- The tension amplitude is now a complex value which is important to get the correct phase for shared moorings
  • Loading branch information
lucas-carmo committed Aug 2, 2024
1 parent acae461 commit e4e3386
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions moorpy/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,7 @@ def get_dynamic_tension(line,omegas,S_zeta,RAO_A,RAO_B,depth,kbot,cbot,seabed_to
prepend= omegas[0] - (omegas[1]-omegas[0]),
append= omegas[-1] + (omegas[-1]-omegas[-2]))
dw = (dw[1:]+dw[:-1])/2
wave_amps = np.sqrt(S_zeta*dw) #evaluate wave amplitudes of harmonic components from wave spectrum
wave_amps = np.sqrt(2*S_zeta*dw) #evaluate wave amplitudes of harmonic components from wave spectrum

r_dynamic *= wave_amps[:,None,None]
r_total = r_static[None,:,:] + r_dynamic
Expand All @@ -1992,10 +1992,10 @@ def get_dynamic_tension(line,omegas,S_zeta,RAO_A,RAO_B,depth,kbot,cbot,seabed_to
tangents = dr_static/np.linalg.norm(r_static[:-1] - r_static[1:], axis=-1)[:,None]
L_static = np.linalg.norm(dr_static, axis=-1)
dL_dynamic = np.einsum('mni,ni->mn', dr_dynamic, tangents)
eps_segs = np.abs(dL_dynamic)/L_static
eps_segs = dL_dynamic/L_static

T_segs = EA_segs * eps_segs
T_nodes_amp = np.zeros((len(omegas),N))
T_nodes_amp = np.zeros((len(omegas),N), dtype='complex')
T_nodes_amp[:,0] = T_segs[:,0]
T_nodes_amp[:,1:-1] = (T_segs[:,:-1] + T_segs[:,1:])/2
T_nodes_amp[:,-1] = T_segs[:,-1]
Expand All @@ -2004,7 +2004,7 @@ def get_dynamic_tension(line,omegas,S_zeta,RAO_A,RAO_B,depth,kbot,cbot,seabed_to
# S_T[:,1:] = T_e**2/dw[:,None]
# S_T[:,0] = S_T[:,1]

T_nodes_psd = T_nodes_amp**2/dw[:,None]
T_nodes_psd = np.abs(T_nodes_amp)**2/(2*dw[:,None])
T_nodes_std = np.sqrt(np.trapz(T_nodes_psd,omegas,axis=0))


Expand Down

0 comments on commit e4e3386

Please sign in to comment.