A Python-based Boundary Element Library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


PyBEM2D: A Python-based Boundary Element Library

Bin Wang (binwang.0213@gmail.com), Craft and Hawkins Department of Petroleum Engineering, Louisiana State University, Baton Rouge, US

Yin Feng, Department of Petroleum Engineering, Univeristy of Louisiana at Lafayette, Lafayette, US

PyBEM2D is a open source boundary element library for two dimensional geometries. It is designed for academic users to quickly learn and test various BEM's techniques under the framework of Python. With the modular code structure and easy-to-use interfaces to PyBEM2D, it is easy to get started and added more features for academic users.

Currently available features include:

  • Easy-to-use python interface for BEM meshing and post-processing
  • Anistropic Potential problem
  • Point collocation method for BEM discretization
  • Support for constant,linear and quadratic element types
  • Support for discontinous element to treat corner and boundary conditions issue
  • Support internal point and line sources (traces)
  • Near singular, singular integration is calculated by exact integration

Special feature:

  • Multi-domain problem is solved by parallel domain decomposition method [Wang et al, 2018]

PyBEM2D is currently support for 64-bit Windows and Linux platforms, several Jupyter-Notebook examples are provided

Solving A potential porblem in PyBEM2D

After downloading and unzipping the current repository, navigate to the library directory and run a simple example contained in Example/LSU_Traces.ipynb:

from Lib.BEM_Solver.BEM_2D import *
from Lib.Domain_Decomposition.Coupling_Main import *


#1.Build Mesh
Boundary_vert=[(0.0, 0.0), (1.0, 0.0), (1.0, 0.75), (0.0, 0.75)] #Anti-clock wise for internal domain

L=[((0.1, 0.15), (0.1, 0.6)),((0.1, 0.15), (0.3, 0.15))]
U= [((0.72,0.6),(0.72,0.14)),((0.72,0.14),(0.92,0.14)),((0.92,0.14),(0.92,0.6))]
Points= [((0.195,0.35),(0.205,0.35)),
element_esize=0.2 #Edge mesh is important to overall mass balance
element_tszie=0.1 #Trace mesh size


#2.Set Boundary condition

#3. Solve and plot


If you make use of PyBEM2D please reference appropriately. The algorithmic developments behind PyBEM2D have been the subject of a number of publications, beginning with my graduate research at the University of Louisiana at Lafayette:

[1] -B. Wang, Y. Feng, S. Pieraccini, S. Scialò, and C. Fidelibus (2018), Iterative coupling of boundary element method with domain decomposition, IJNME. doi: https://doi.org/10.1002/nme.5943

[2] - Wang, B., Feng, Y., Du, J., et al. (2017) An Embedded Grid-Free Approach for Near Wellbore Streamline Simulation. doi:10.2118/SPE-182614-MS https://www.researchgate.net/publication/313665682_An_Embedded_Grid-Free_Approach_for_Near_Wellbore_Streamline_Simulation


This code is released under the terms of the BSD license, and thus free for commercial and research use. Feel free to use the code into your own project with a PROPER REFERENCE.