Clone BEM++ source code in your folder with lib source codes
cd your-folder
git clone git@bitbucket.org:bemppsolutions/bempp.git
Got to the cloned folder and build C/C++ core of BEM++
cd ./bempp/
mkdir build
cd ./build
cmake ..
make -j4
The last command runs build process and parallel it in 4 threads.
Remember first-kind integral equation $$ \int_{\partial \Omega} \frac{q(y)}{\Vert x - y \Vert} dy = f(x), \quad x \in \partial \Omega. $$ and list steps required to solve it numerically.
In [1]:
import bempp.api
import numpy as np
grid = bempp.api.shapes.regular_sphere(3)
grid.plot()
Q: what means argument of the function?
Plot the following objects
In [2]:
space = bempp.api.function_space(grid, "DP", 0)
What mean these arguments?
Study degrees of freedom for different types and order of function spaces.
In [3]:
import numpy as np
def fun(x, normal, domain_index, result):
result[0] = np.exp(1j * x[0])
grid_fun = bempp.api.GridFunction(space, fun=fun)
grid_fun.plot()
In [4]:
slp = bempp.api.operators.boundary.laplace.single_layer(space, space,
space)
scaled_operator = 1.5 * slp
sum_operator = slp + slp
squared_operator = slp * slp
In [5]:
slp_discrete = slp.weak_form()
print("Shape of the matrix: {0}".format(slp_discrete.shape))
print("Type of the matrix: {0}".format(slp_discrete.dtype))
x = np.random.rand(slp_discrete.shape[1])
y = slp_discrete * x
But to get it we need to do the following steps:
Find weak form of operator:
discrete_op = A.weak_form()
Compute projection of the right-hand side onto the dual-to-range:
p = f.projections(dual_to_range)
sol_fun = bempp.api.GridFunction(A.domain, coefficients=x)
Now let's see how it works for particular problem...