Python implementation of a 3D frequency–domain Boundary Element Method (BEM) to simulate linear wave interaction with submerged (impermeable and perforated) structures using quadratic (high-order) elements.
The code is designed for research in:
- Wave–structure interaction
- Coastal protection structures
- Artificial reefs
- OWC wave energy converter devices
The code computes hydrodynamic quantities such as:
- Velocity potential and fluxes
- Reflection, transmission and energy dissipation coefficients
- Wave forces
This repository is intended for research and educational use in coastal and ocean engineering. It includes a complete solver, utilities, and step-by-step examples.
Wave interaction with a random layout of submerged perforated cylinders simulated using the 3D BEM (Medina Rodriguez et al., 2026).
The following peer-reviewed publications use or are directly related to this 3D Boundary Element Method.
Medina Rodríguez, A.A., Huang, Z., R3D Consortium (2026)
Wave Scattering and Energy Reduction by a Patch of Idealized Coral-Growing Units.
In: Coastal Dynamics 2025, Coastal Research Library, Vol. 41, Springer.
https://doi.org/10.1007/978-3-032-15473-6_85
Medina Rodríguez, A.A., Trivedi, K., Koley, S., Oderiz Martinez, I., Mendoza, E., Posada Vanegas, G., Silva, R. (2023)
Improved hydrodynamic performance of an OWC device based on a Helmholtz resonator.
Energy, Volume 273, 127299.
https://doi.org/10.1016/j.energy.2023.127299
Medina Rodríguez, A.A., Silva Casarín, R., Blanco Ilzarbe, J.M. (2022)
A 3D boundary element method for analysing the hydrodynamic performance of a land-fixed oscillating water column device.
Engineering Analysis with Boundary Elements, Volume 138, pp. 407-422.
https://doi.org/10.1016/j.enganabound.2022.02.014
- 3D frequency-domain Boundary Element Method
- Higher-order elements discretisation for improved accuracy
- Constant and linear elements examples for comparison
- Multi-domain capability (for porous structures or large domains)
- Porous and impermeable boundary condition
- Radiation and scattering problems
- Hydrodynamic force computation
- Energy flux for reflection and transmission analysis
- Oblique wave incidence
- Mesh generation with Gmsh via .geo scripts or the Python API, with ready-to-use examples provided
- Fully reproducible examples
The workflow followed in all provided examples is:
- Define the fluid domain and generate the mesh using Gmsh
- Extract mesh and geometric characteristics
- Assemble and compute influence matrices
- Apply boundary conditions
- Post-process and analyse results
The Cartesian coordinate system is adopted and the origin is assumed at the undisturbed free surface water level. Waves propagate and approach the structures from the left in the
is assumed.
In this expression,
Under the previous assumptions, the 3D Laplace equation governs the flow field:
The linearity of the problem allows decomposition of the velocity potential as
where
The incident velocity potential is
where
At the still water level, the linearized free-surface condition is
where
The seabed and wave flume walls are assumed impermeable. Therefore,
Bottom boundary:
Back wall:
At the far field, the Sommerfeld radiation condition is applied:
Continuity of potential and flux is enforced at the interface of Domain 0 and Domain 1 (
The gradient operator is
The minus sign indicates that the outgoing flux from one subdomain equals the incoming flux in the adjacent domain because outward normals are opposite.
git clone https://github.com/AyrtonAMedinaR/Boundary_Element_Method.git
cd Boundary_Element_Methodpython -m venv bem_env
bem_env\Scripts\activate # Windows
pip install -r requirements.txt
Dependencies Main packages:
- numpy
- scipy
- matplotlib
- gmsh (Python API)
You must install Gmsh separately:
https://gmsh.info
Make sure the Gmsh Python module works:
import gmsh
General utilities used by the solver:
- Mesh processing
- Boundary identification
- Internal field evaluation
- Hydrodynamic forces
- Energy flux computation
- Free surface visualization
For quadratic elements
BEM_UTILS/
BEM utilities specific to constant elements
BEM_UTILS_CONSTANT/
BEM utilities specific to linear elements
BEM_UTILS_LINEAR/
Implements all boundary conditions:
- Free surface
- Far-field radiation
- Scattering conditions
- Oblique wave incidence
- Interface coupling (multi-domain)
- Porous boundary formulation
Quadratic and linear element version:
BOUNDARY_CONDITIONS/
Constant-element version:
BOUNDARY_CONDITIONS_CONSTANT/
Main influence matrices:
- G and H matrices
- Numerical integration
- Fundamental solutions
The influence matrix functions implemented in this repository are based on the formulations presented in Domínguez (1993). The original implementation was provided in FORTRAN (for Elastodynamics applications), which has been both reformulated and simplified in Python for this work.
Domínguez, J. (1993). Boundary Elements in Dynamics: Computational Engineering. WIT Press.
MATRICES/
Constant elements
MATRICES_CONSTANT/
Linear elements
MATRICES_LINEAR/
The repository includes complete step-by-step examples that serve as examples and validation cases.
Single and multi-domain wave propagation in an empty wave flume or basin. Normal and oblique wave propagation can be considered.
Example_01_empty_wave_flume/
Outputs:
- Free surface elevation
- Reflection/transmission coefficients
Single-domain wave propagation over a submerged semi-circular obstacle. Includes automated mesh generation using the Gmsh Python API.
Example_02_submerged_semi_circle_obstacle/
Outputs:
- Reflection/transmission coefficients
- Hydrodynamic forces
- Free surface elevation
- Internal points calculation
Multi-domain wave propagation over a submerged semi-circular obstacle.
Example_03_multi_domain_submerged_semi_circle_obstacle/
Outputs:
- Reflection/transmission coefficients
- Hydrodynamic forces
- Free surface elevation
- Internal points calculation
Multi-domain wave propagation over a submerged porous semi-circular obstacle.
Example_04_multi_domain_porous_semi_circle_obstacle/
Outputs:
- Reflection/transmission coefficients
- Hydrodynamic forces
Single-domain wave propagation over a submerged porous semi-circular obstacle. Includes automated mesh generation using the Gmsh Python API.
Example_05_porous_semi_circle_obstacle/
Outputs:
- Reflection/transmission coefficients
- Hydrodynamic forces
Single-domain wave propagation over a submerged porous/impermeable half-sphere obstacle. Includes automated mesh generation using the Gmsh Python API.
Example_06_half_sphere_reef/
Outputs:
- Hydrodynamic forces
- Free surface elevation
Single-domain wave propagation over submerged impermeable cylindrical obstacles. Includes automated mesh generation using the Gmsh Python API.
Example_07_array_submerged_structures/
Outputs:
- Reflection/transmission coefficients
- Hydrodynamic forces
- Free surface elevation
Multi-domain wave propagation over submerged porous cylindrical obstacles. Includes automated mesh generation using the Gmsh Python API.
Example_08_array_porous_structures/
Outputs:
- Reflection/transmission coefficients
- Hydrodynamic forces
- Free surface elevation
Multi-domain wave interaction with a Thick-Wall Cylindrical Oscillating Water Column (OWC). Includes automated mesh generation using the Gmsh Python API.
Example_09_Cylindrical_OWC_device/
Outputs:
- Reflection/transmission coefficients
- Hydrodynamic performance quantities
Multi-domain wave interaction with a Thin-Wall Cylindrical Oscillating Water Column (OWC). Includes automated mesh generation using the Gmsh Python API.
Example_10_Thin_cylindrical_OWC_device/
Outputs:
- Reflection/transmission coefficients
- Hydrodynamic performance quantities
Comparison between discretization approaches.
Example_empty_wave_flume_CONSTANT_ELEMENTS/
Example_empty_wave_flume_LINEAR_ELEMENTS/
- Open any tutorial folder.
- Launch the Jupyter notebook.
- Run the notebook step-by-step.
Each tutorial contains:
- Mesh generation/loading
- Solver execution
- Post-processing and plots
If you use this repository in academic work, please cite both the implementation and the original formulation source:
-
A. A. Medina Rodríguez (2026). 3D Boundary Element Method for Linear Water Waves. GitHub Repository: https://github.com/AyrtonAMedinaR/Boundary_Element_Method
-
Domínguez, J. (1993). Boundary Elements in Dynamics: Computational Engineering (Illustrated ed.). WIT Press.
International Series on Computational Engineering / Topics in Engineering.
ISBN: 978-1853122583.
Any contributions you make are greatly appreciated.
Distributed under the MIT License. See LICENSE for more information.
Ayrton Medina Email | GitHub | Google Scholar | ResearchGate
Project Link: https://github.com/AyrtonAMedinaR/Boundary_Element_Method