This page was generated from unit-11.2-bem-Laplace/Laplace_DtN_indirect.ipynb.
11.2.1 Dirichlet Laplace Indirect MethodΒΆ
keys: homogeneous Dirichlet bvp, single layer potential, ACA
[1]:
from netgen.occ import *
from ngsolve import *
from ngsolve.webgui import Draw
from ngsolve.bem import *
from ngsolve import Projector, Preconditioner
from ngsolve.krylovspace import CG
We consider the Dirichlet boundary value problem
Let us choose the following ansatz for the solution \(u\in H^1(\Omega)\) (indirect ansatz)
and solve for the density \(j\in H^{-\frac12}(\Gamma)\) by the boundary element method, i.e. the numerical solution of the 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(4)
Create test and trial function finite element spaces for \(H^{-\frac12}(\Gamma)\) according to the given mesh:
[3]:
fesL2 = SurfaceL2(mesh, order=4, dual_mapping=True)
u,v = fesL2.TnT()
Define Dirichlet data \(u_0\) and compute the right hand side vector:
[4]:
u0 = 1/ sqrt( (x-1)**2 + (y-1)**2 + (z-1)**2 )
rhs = LinearForm (u0*v.Trace()*ds(bonus_intorder=3)).Assemble()
The discretisation of the above variational formulation leads to a system of linear equations, ie
where \(\mathrm{V}\) is the single layer potential operator. \(\mathrm V\) is regular and symmetric.
Demo 1: Assemble the single layer operator \(V\) as dense matrix and solve for unknwon density \(j\):
[5]:
j = GridFunction(fesL2)
pre = BilinearForm(u*v*ds, diagonal=True).Assemble().mat.Inverse()
with TaskManager():
V = LaplaceSL(u*ds)*v*ds
CG(mat = V.mat, pre=pre, rhs = rhs.vec, sol=j.vec, tol=1e-8, maxsteps=200, initialize=False, printrates=True)
CG iteration 1, residual = 2.185606954637756
CG iteration 2, residual = 0.5510990298799289
CG iteration 3, residual = 0.1311274119071578
CG iteration 4, residual = 0.031078921186610795
CG iteration 5, residual = 0.007372481854760204
CG iteration 6, residual = 0.0017929371818866317
CG iteration 7, residual = 0.0005259807039890563
CG iteration 8, residual = 0.00025807835613462317
CG iteration 9, residual = 0.00028309244528881475
CG iteration 10, residual = 0.0001168908382398229
CG iteration 11, residual = 0.00021403973074203076
CG iteration 12, residual = 4.528310252534253e-05
CG iteration 13, residual = 4.801538897445079e-05
CG iteration 14, residual = 2.7825894731614928e-05
CG iteration 15, residual = 1.4630501769576542e-05
CG iteration 16, residual = 1.478423286130117e-05
CG iteration 17, residual = 9.772736442040624e-06
CG iteration 18, residual = 6.079659304560182e-06
CG iteration 19, residual = 1.4659689608468e-05
CG iteration 20, residual = 3.3028909656398736e-06
CG iteration 21, residual = 2.96969986595016e-06
CG iteration 22, residual = 3.49290448160833e-06
CG iteration 23, residual = 2.5938240781099503e-06
CG iteration 24, residual = 1.2605880258207685e-06
CG iteration 25, residual = 7.882707254387471e-07
CG iteration 26, residual = 1.4680554050896037e-06
CG iteration 27, residual = 5.877609834975623e-07
CG iteration 28, residual = 4.4334741435854253e-07
CG iteration 29, residual = 5.853287234690148e-07
CG iteration 30, residual = 3.5109270883717235e-07
CG iteration 31, residual = 1.779456677932216e-07
CG iteration 32, residual = 1.5344988673859153e-07
CG iteration 33, residual = 2.2023826733264083e-07
CG iteration 34, residual = 1.261744749945294e-07
CG iteration 35, residual = 8.73531653312927e-08
CG iteration 36, residual = 7.029042728547554e-08
CG iteration 37, residual = 9.921995013355431e-08
CG iteration 38, residual = 3.434519261760218e-08
CG iteration 39, residual = 4.056713639432034e-08
CG iteration 40, residual = 5.64770279012486e-08
CG iteration 41, residual = 1.8556089008067876e-08
[6]:
Draw (j, order=3);
Notes:
For details on the analysis of boundary integral equations derived from elliptic partial differential equations, see for instance Strongly Elliptic Systems and Boundary Integral Equations.
The integration of singular pairings is done as proposed in Randelementmethoden
The adaptive cross approximation is done as proposed in Hierarchical Matrices.
[ ]: