fix yaw sign, write output setting and overwrite
@@ -321,6 +321,7 @@ def interp_1st_dim_matrix(A, vec, value):
# interp_1st_dim_matrix(A, vec, 0.6)
+
@generator_interface.generator
class FloatingForces(generator_interface.BaseGenerator):
r"""
@@ -389,6 +390,10 @@ class FloatingForces(generator_interface.BaseGenerator):
settings_default['wave_incidence'] = 0.
settings_description['wave_incidence'] = 'Wave incidence in rad'
+ settings_types['write_output'] = 'bool'
+ settings_default['write_output'] = False
+ settings_description['write_output'] = 'Write forces to an output file'
+
settings_types['folder'] = 'str'
settings_default['folder'] = 'output'
settings_description['folder'] = 'Folder for the output files'
@@ -483,6 +488,7 @@ class FloatingForces(generator_interface.BaseGenerator):
self.floating_data['hydrodynamics']['ab_freq_rads'],
self.settings['wave_freq'])
+ # self.hd_added_mass *= 0.
self.added_mass_in_mass_matrix = self.settings['added_mass_in_mass_matrix']
if self.added_mass_in_mass_matrix:
# Include added mass in structure
@@ -495,6 +501,7 @@ class FloatingForces(generator_interface.BaseGenerator):
self.floating_data['hydrodynamics']['ab_freq_rads'],
self.settings['wave_freq'])
+ # self.hd_damping *= 0.
# Wave forces
self.wave_forces_node = self.floating_data['wave_forces']['node']
xi_matrix2 = interp_1st_dim_matrix(self.floating_data['wave_forces']['xi'],
@@ -531,7 +538,10 @@ class FloatingForces(generator_interface.BaseGenerator):
output['waves'] = waves
fid = h5.File(self.log_filename, 'a')
- group = fid.create_group("ts%d_k%d" % (ts, k))
+ group_name = "ts%d_k%d" % (ts, k)
+ if fid.__contains__(group_name):
+ del fid[group_name]
+ group = fid.create_group(group_name)
for key, value in output.items():
group.create_dataset(key, data=value)
fid.close()
@@ -629,7 +639,8 @@ class FloatingForces(generator_interface.BaseGenerator):
struct_tstep.runtime_generated_forces[self.mooring_node, 3:6] -= np.dot(cbg, force_cl[3:6])
# Yaw moment generated by the mooring system
- yaw = np.array([self.q[data.ts, 3], 0., 0.])
+ # ams: In my cases yaw is measured in the wrong direction
+ yaw = -np.array([self.q[data.ts, 3], 0., 0.])
mooring_yaw = -self.floating_data['mooring']['yaw_spring_stif']*yaw
struct_tstep.runtime_generated_forces[self.mooring_node, 3:6] += np.dot(cbg,
mooring_yaw)
@@ -667,5 +678,6 @@ class FloatingForces(generator_interface.BaseGenerator):
struct_tstep.runtime_generated_forces[self.wave_forces_node, 3:6] += np.dot(cbg, force_coeff*wave_forces_g[3:6])
# Write output
+ if self.settings['write_output']:
self.write_output(data.ts, k, mooring_forces, mooring_yaw, hs_f_g,
hd_f_qdot_g, hd_f_qdotdot_g, hd_correct_grav, wave_forces_g)
