This page was generated from unit-11.2-bem-Laplace/Laplace_NtD_indirect.ipynb.
11.2.3 Neumann Laplace Indirect Method¶
keys: homogeneous Neumann bvp, hypersingular operator
[1]:
from netgen.occ import *
from ngsolve import *
from ngsolve.webgui import Draw
from ngsolve.bem import *
from ngsolve.solvers import CG
Consider the Neumann boundary value problem
The solution \(u\in H^1(\Omega)\) of the above bvp can be written in the following form (representation forumula)
Let’s carefully apply the Neumann trace \(\gamma_1\) to the representation formula and solve the resulting boundary integral equation for \(m \in H^{\frac12}(\Gamma)\) by discretisation of the following variational formulation:
Define the geometry \(\Omega \subset \mathbb R^3\) and create a mesh:
[2]:
sp = Sphere( (0,0,0), 1)
mesh = Mesh( OCCGeometry(sp).GenerateMesh(maxh=0.3)).Curve(2)
Define the finite element space for \(H^{\frac12}(\Gamma)\) for given geometry :
[3]:
fesH1 = H1(mesh, order=2, definedon=mesh.Boundaries(".*"))
uH1,vH1 = fesH1.TnT()
print ("ndof H1 = ", fesH1.ndof)
ndof H1 = 630
Define the right hand side with given Neumann data \(u_1\):
[4]:
uexa = 1/ sqrt( (x-1)**2 + (y-1)**2 + (z-1)**2 )
graduexa = CF( (uexa.Diff(x), uexa.Diff(y), uexa.Diff(z)) )
n = specialcf.normal(3)
u1exa = graduexa*n
rhs = LinearForm(u1exa*vH1.Trace()*ds(bonus_intorder=3)).Assemble()
The discretisation of the variational formulation leads to a system of linear equations, ie
where \(\mathrm{D}\) is the hypersingular operator and the stabilisation \((\mathrm D + \mathrm{S})\) is regular and symmetric.
[5]:
vH1m1 = LinearForm(vH1*1*ds(bonus_intorder=3)).Assemble()
S = (BaseMatrix(Matrix(vH1m1.vec.Reshape(1))))@(BaseMatrix(Matrix(vH1m1.vec.Reshape(fesH1.ndof))))
[6]:
m = GridFunction(fesH1)
pre = BilinearForm(uH1*vH1*ds).Assemble().mat.Inverse(freedofs=fesH1.FreeDofs())
with TaskManager():
D=LaplaceSL(curl(uH1)*ds)*curl(vH1)*ds
CG(mat = D.mat+S, pre=pre, rhs = rhs.vec, sol=m.vec, tol=1e-8, maxsteps=200, initialize=False, printrates=True)
Draw (m, mesh, draw_vol=False, order=3);
CG iteration 1, residual = 1.092624998882661
CG iteration 2, residual = 0.5729010293389225
CG iteration 3, residual = 0.3431253018753173
CG iteration 4, residual = 0.2303924025968433
CG iteration 5, residual = 0.1784007812931966
CG iteration 6, residual = 0.11050148131747689
CG iteration 7, residual = 0.0704118287952303
CG iteration 8, residual = 0.042459174063530204
CG iteration 9, residual = 0.026947807306562446
CG iteration 10, residual = 0.015528094493477472
CG iteration 11, residual = 0.009046901059635983
CG iteration 12, residual = 0.0049306715705570315
CG iteration 13, residual = 0.0026692450373669687
CG iteration 14, residual = 0.001328909604456398
CG iteration 15, residual = 0.0006491869037722463
CG iteration 16, residual = 0.00030590035747031724
CG iteration 17, residual = 0.0001404871255973791
CG iteration 18, residual = 6.305215386719449e-05
CG iteration 19, residual = 2.7094055093104875e-05
CG iteration 20, residual = 1.1674905025438477e-05
CG iteration 21, residual = 4.609501618642172e-06
CG iteration 22, residual = 1.7634976055456089e-06
CG iteration 23, residual = 6.502119936553798e-07
CG iteration 24, residual = 2.2998515713015338e-07
CG iteration 25, residual = 8.601673743060697e-08
CG iteration 26, residual = 4.116665599243933e-08
CG iteration 27, residual = 3.654195279914447e-08
CG iteration 28, residual = 3.9446866059806005e-08
CG iteration 29, residual = 2.041799529116829e-08
CG iteration 30, residual = 9.034079688950363e-09
Note: the hypersingular operator is implemented as follows
Details for instance in Numerische Näherungsverfahren für elliptische Randwertprobleme, p.127, p.259 (1st edition).
[ ]: