def test_Froude_Krylov(): from capytaine.bem.airy_waves import froude_krylov_force from capytaine.bodies.predefined.spheres import Sphere from capytaine.bem.problems_and_results import DiffractionProblem sphere = Sphere(radius=1.0, ntheta=3, nphi=12, clever=True, clip_free_surface=True) sphere.add_translation_dof(direction=(0, 0, 1), name="Heave") problem = DiffractionProblem(body=sphere, omega=1.0, sea_bottom=-np.infty) assert np.isclose(froude_krylov_force(problem)['Heave'], 27596, rtol=1e-3) problem = DiffractionProblem(body=sphere, omega=2.0, sea_bottom=-np.infty) assert np.isclose(froude_krylov_force(problem)['Heave'], 22491, rtol=1e-3) problem = DiffractionProblem(body=sphere, omega=1.0, sea_bottom=-10.0) assert np.isclose(froude_krylov_force(problem)['Heave'], 27610, rtol=1e-3)
def records(self): params = self.problem._asdict() FK = froude_krylov_force(self.problem) return [dict(**params, influenced_dof=dof, diffraction_force=self.forces[dof], Froude_Krylov_force=FK[dof]) for dof in self.influenced_dofs]
def records(self): from capytaine.bem.airy_waves import froude_krylov_force FK = froude_krylov_force(self.problem) return [ dict(self.settings_dict, influenced_dof=dof, diffraction_force=self.forces[dof], Froude_Krylov_force=FK[dof]) for dof in self.influenced_dofs ]
sea_bottom=-depth, omega=omega, radiating_dof='Heave') diff_solution = solver.solve(diff_problem) rad_solution = solver.solve(rad_problem) # Read mesh properties faces_centers = body.mesh.faces_centers faces_normals = body.mesh.faces_normals faces_areas = body.mesh.faces_areas from capytaine.bem.airy_waves import airy_waves_potential, airy_waves_velocity, froude_krylov_force # Computation from the diffraction solution (Capytaine) FK = froude_krylov_force(diff_problem)['Heave'] diff_force = diff_solution.forces['Heave'] # Get potentials phi_inc = airy_waves_potential(faces_centers, diff_problem) v_inc = airy_waves_velocity(faces_centers, diff_problem) phi_rad = rad_solution.potential # Indirect computation from the radiation solution, via the Haskind relation integrand = -(phi_inc * faces_normals[:, 2] - phi_rad * np.diag(v_inc @ faces_normals.T)) F_hask = 1j * omega * rho * np.sum(integrand * faces_areas) # Direct integration of the potentials diff_force_recomputed = -1j * omega * rho * np.sum( diff_solution.potential * faces_areas * faces_normals[:, 2])