include force_coeff
@@ -388,6 +388,9 @@ def compute_equiv_hd_added_mass(f, q):
- Non-diagonal non-zero terms: (1,5) and (2,4). Zero-indexed
"""
+ if (q == 0).all():
+ return np.zeros((6,6))
+
q_mat = np.array([[q[0], 0, 0, 0, 0, 0],
[0, q[1], 0, 0, q[5], 0],
[0, q[2], 0, 0, 0, q[4]],
@@ -768,6 +771,7 @@ class FloatingForces(generator_interface.BaseGenerator):
# Hydrostatic model
hs_f_g = self.buoy_F0 - np.dot(self.buoy_rest_mat, self.q[data.ts, :])
+ if not force_coeff == 0.:
hd_f_qdot_g = -np.dot(self.floating_data['hydrodynamics']['additional_damping'], self.qdot[data.ts, :])
if self.settings['method_matrices_freq'] == 'constant':
@@ -780,7 +784,7 @@ class FloatingForces(generator_interface.BaseGenerator):
hd_f_qdotdot_g = response_freq_dep_matrix(self.hd_added_mass, self.ab_freq_rads, self.qdotdot, data.ts, self.settings['dt'])
# Compute the equivalent added mass matrix
- equiv_hd_added_mass = compute_equiv_hd_added_mass(f, q)
+ equiv_hd_added_mass = compute_equiv_hd_added_mass(hd_f_qdotdot_g, self.qdotdot[data.ts, :])
# Update added mass in the beam
if self.added_mass_in_mass_matrix:
@@ -815,6 +819,10 @@ class FloatingForces(generator_interface.BaseGenerator):
# self.hd_added_mass)
# data.structure.generate_fortran()
# # self.hd_added_mass *= 0.
+ else:
+ hd_f_qdot_g = np.zeros((6))
+ hd_f_qdotdot_g = np.zeros((6))
+ hd_correct_grav = np.zeros((6))
ielem, inode_in_elem = data.structure.node_master_elem[self.buoyancy_node]
cab = algebra.crv2rotation(struct_tstep.psi[ielem, inode_in_elem])
