Bembel
Getting Started

How to Compile

You need to install the Eigen3 library, see Eigen's Documentation for help. We do not rely on any other external libraries, except for the standard template library. Thus, having installed Eigen, Bembel should run out of the box. If you want to use Bembel as part of your application, simply add the Bembel/ directory to your includes.

If you want to run the provided examples and tests, you can utilize the provided CMakeLists.txt.

Unix-Based Systems

$ cmake -B build .
$ cmake --build build --config release

There also exist a debug config.

Procedure of the BEM realized in Bembel

The procedure is as follows. Let \(\Omega\in\mathbb{R}^3\) be a bounded domain with Lipschitz boundary \(\Gamma = \partial\Omega\). Bembel provides examples to the Laplace equation

\begin{eqnarray*} -\Delta u &=& 0,\quad \textrm{in}\,\Omega, \\ u &=& g,\quad\textrm{on}\,\Gamma. \end{eqnarray*}

The solution \(u\) can be computed by a single layer potential ansatz

\begin{eqnarray*} u(\mathbf{x}) &=& \tilde{\mathcal{V}}(\rho) = \int_\Gamma \frac{\rho(\mathbf{y})}{4\pi\|\mathbf{x} - \mathbf{y}\|}\,\mathrm{d}\sigma(\mathbf{y}),\quad\mathbf{x}\in\Omega. \end{eqnarray*}

Applying the appropriate trace operator yields the integral equation

\begin{eqnarray*} \mathcal{V}(\rho) &=& f(g) \end{eqnarray*}

where \(f\) is a linear form incorporating the boundary data \(g\). This equation is solved by a Galerkin method to compute the unknown density \(\rho\). See [3] for details.

Example Program

int main() {
using namespace Bembel;
using namespace Eigen;
// import geometry
Geometry geometry("external_geometry_file.dat");
// define ansatz space
AnsatzSpace<Operator> ansatz_space(geometry, refinement_level,
polynomial_degree);
// define linear form
DiscreteLinearForm<DirichletTrace<double>, Operator> disc_lf(ansatz_space);
disc_lf.get_linear_form().set_function(fun);
disc_lf.compute();
// define linear operator
DiscreteOperator<H2Matrix<double>, Operator> disc_op(ansatz_space);
disc_op.get_linear_operator().set_wavenumber(wavenumber);
disc_op.compute();
// iterative solution using Eigen -> rho
// evaluate potential
DiscretePotential<Potential<Operator>, Operator> disc_pot(ansatz_space);
disc_pot.set_cauchy_data(rho);
auto pot = disc_pot.evaluate(gridpoints);
return 0;
}
int main()
Routines for the evalutation of pointwise errors.
Definition: AnsatzSpace.hpp:14

Implement Your Own Operator

The three components LinearOperator \(\mathcal{V}\), LinearForm \(f\) and Potential \(\tilde{\mathcal{V}}\) utilized in this procedure are classes in the Bembel library which follow the same design principle. Main idea is to define traits which fundamentally define the behavior of the class. Whilst the Base class provides a framework, the Operator classes provide contrete implementations of computing the integrals. Details on the three classes are given in Section Curiously Recurring Template Pattern.

If you now write a new problem class as an extension for Bembel, you only have to define the traits. In addition, you have to implement a concrete implementation for computing the integrals.