Fully Differentiable Boundary Element Solver for Hydrodynamic Sensitivity Analysis of Wave-Structure Interactions
Kapil Khanala,b, Carlos A. Michelén Ströferb, Matthieu Ancellinc, Maha Hajia
- aCornell University
Ithaca, NY 14850, USA - bSandia National Laboratories
Albuquerque, NM 87123, USA - cEurobios Mews Labs
Paris, France
- 📚 Derivation and discussion of the discrete adjoint method for the boundary integral equations.
- 💻 Review and implementation of a differentiable boundary element solver for marine hydrodynamics in Julia.
- 🌊 Exact gradient calculation for a pair of floating hemispheres with respect to their dimensions, separation distance, and wave environment.
- ⚡ Mechanical power optimization for a pair of wave energy converters using exact gradients.
Fully-differentiable boundary element solver for marine hydrodynamics. This new solver implements both direct and indirect boundary element formulations and uses two green's function expression, Wu et al, and Delhommeau's varying in their accuracy and speed.
⚠️ Note: This package is work in progress 🚧 and a separate public release of the package will be done in the future. This current state of the package contains necessary code to replicate the paper 📄. It will go through a significant change in its API for users in future iterations.
-
📁 .github/workflows
Contains workflow files for automated tasks, such as continuous integration (CI). -
📊 paper
Includes plots and data generated for the paper. -
📜 src
Source code files for theBEM.jl
package, including the main functionality. -
🧪 test
Contains test files and resources to verify the functionality of the source code.
-
Install Julia
Ensure you have Julia installed on your system. You can download it from the JuliaLang website. -
Clone the Repository
Open a terminal and run:git clone https://github.com/symbiotic-engineering/MarineHydro.jl.git cd MarineHydro.jl
-
Install Dependencies
Start Julia from the terminal in the project directory and run the following:using Pkg Pkg.activate(".") Pkg.instantiate()
You may need to configure PyCall. Note: Running
tests/
automatically install capytaine and uses it. -
Configure PyCall
ENV["PYTHON"] = "/path/to/capytaine_env/bin/python" # run 'which python' in your terminal for this
-
Using the BEM Module
Load the module in your Julia session:
using BEM
using PyCall
# import your capytaine mesh
cpt = pyimport("capytaine")
radius = 1.0 #fixed
resolution = (10, 10)
cptmesh = cpt.mesh_sphere(name="sphere", radius=radius, center=(0, 0, 0), resolution=resolution)
cptmesh.keep_immersed_part(inplace=true)
# declare it Julia mesh
mesh = Mesh(cptmesh)
ω = 1.03
ζ = [0,0,1] # HEAVE: will be more verbose in future iteration. define it again even if defined in Capytaine.
F = DiffractionForce(mesh,ω,ζ)
A,B = calculate_radiation_forces(mesh,ζ,ω)
- Differentiability :
For differentiability with respect to mesh dimension, use
paper/MeshGradients_singlebody.jl
Differentiability needs an AD engine: use Zygote
using Zygote
A_w_grad, = Zygote.gradient(w -> calculate_radiation_forces(mesh,ζ,w)[1],ω)