def mean_surge_force(w, depth, radius, RAOs, N=10, deep_water=False): """Mean surge force on a surging and pitching cylinder From Drake2011. """ g = 9.81 k = w**2 / g # XXX deep water ka = k * radius kd = k * depth # This is the part of the force which depends on the incoming waves hankel_term = lambda n, ka: 1 - ((hankel1d(n, ka) * hankel2d(n - 1, ka)) / (hankel2d(n, ka) * hankel1d(n - 1, ka))) terms = np.nansum([hankel_term(n, ka) for n in range(1, N)], axis=0) if deep_water: incoming_part = 1 * terms else: incoming_part = (1 + (2 * kd / sinh(2 * kd))) * terms # This is the part which depends on the first-order motion hankel_term2 = (hankel2d(0, ka) / hankel1d(0, ka) + hankel2d(2, ka) / hankel1d(2, ka)) if deep_water: motion_part = 2j * ( (RAOs[:, 0] - (RAOs[:, 4] / k)) * hankel_term2 / hankel2d(1, ka)) else: motion_part = 2j * ((RAOs[:, 4] * (1 - cosh(kd)) / k + RAOs[:, 0] * sinh(kd)) / (cosh(kd) * hankel2d(1, ka)) * hankel_term2) return 0.5 / ka * np.real(incoming_part + motion_part)
def first_order_excitation(k, draft, radius, water_depth): """Returns F/(rho g a^2 A) -- from Drake, but adapted by me to integrate down to the draft depth only (not to the seabed)""" ka = k * radius kd = k * draft kh = k * water_depth # XXX check this! f1 = -1j * (jn(1, ka) - jnd(1, ka) * hankel2(1, ka) / hankel2d(1, ka)) #f1 = -1j * (jn(1, ka) - jnd(1, ka) * hankel1(1, ka) / hankel1d(1, ka)) M = (kd * sinh(kh - kd) + cosh(kh - kd) - cosh(kh)) / (k * cosh(kh)) F = (-sinh(kh - kd) + sinh(kh)) / cosh(kh) X = np.zeros(M.shape + (6, ), dtype=np.complex) X[..., 0] = (-2 * pi / ka) * f1 * F X[..., 4] = (-2 * pi / ka) * f1 * M return X
def excitation_force(w, draft, radius, water_depth): """Excitation force on cylinder using Drake's first_order_excitation""" k = w**2 / 9.81 ka = k * radius kd = k * draft kh = k * water_depth rho = 1025 g = 9.81 # XXX check this! f1 = -1j * (jn(1, ka) - jnd(1, ka) * hankel2(1, ka) / hankel2d(1, ka)) #f1 = -1j * (jn(1, ka) - jnd(1, ka) * hankel1(1, ka) / hankel1d(1, ka)) M = (kd * sinh(kh - kd) + cosh(kh - kd) - cosh(kh)) / (k**2 * cosh(kh)) F = (-sinh(kh - kd) + sinh(kh)) / (k * cosh(kh)) zs = zeros_like(F, dtype=np.complex) X = np.c_[F, zs, zs, zs, M, zs] X *= (-rho * g * pi * radius) * 2 * f1[:, newaxis] return X