mathematical methods for engineering the boundary element ...alonso/didattica/w... · ana alonso...
TRANSCRIPT
Mathematical methods for engineeringThe boundary element method - Collocation
Ana Alonso
University of Trento
Trento Winter School on Numerical MethodsFebruary 20th- March 3rd, 2017
Ana Alonso Mathematical methods for engineering
Introduction and notationGiven z ∈ Rd with d = 2 or 3I K (·, z) denotes the fundamental solution of the Laplace
equation:−∆K = δz .
K (x, z) =
12π log 1
|x−z| if x ∈ R2
14π
1|x−z| if x ∈ R3 .
Let us consider Ω ⊂ Rd .
I T (·, z) denotes the normal derivative of K (·, z):
T (·, z) := ∇K (·, z) · n ,being n the unit outward normal vector on ∂Ω =: Γ.For x ∈ Γ we have
T (x, z) =
−1
2π(x−z)·n(x)|x−z|2 if Ω ⊂ R2
− 14π
(x−z)·n(x)|x−z|3 if Ω ⊂ R3 .
Ana Alonso Mathematical methods for engineering
Basic integral equations
−∆u = 0 in Ωu = ϕ in ΓD∂u∂n = g on ΓN .
Internal points: z ∈ Ω
u(z) +
∫Γ
u(x)T (x, z) ds(x)−∫
Γ
∂u
∂n(x)K (x, z) ds(x) = 0 .
Boundary points: z ∈ Γ (regular boundary)
1
2u(z) +
∫Γ
u(x)T (x, z) ds(x)−∫
Γ
∂u
∂n(x)K (x, z) ds(x) = 0 .
Ana Alonso Mathematical methods for engineering
Boundary element methods
I The approximate solution is piecewise-polynomial.
u ≈ uN q =∂u
∂n≈ qN .
I Also the domain Ω is approximated by a polyhedral domainΩh,
I hence the boundary Γ is approximated by Γh = ∂Ωh.
Ωh
Ω
Ana Alonso Mathematical methods for engineering
Collocation: constant elements
I The boundary of Ω is assumed to be polygonal divided in Nelements.
I Both u and q := ∂u∂n are approximated using piecewise
constant functions: uN , qN .
I The unknowns are the values at the mid-element node, xj ,j = 1, . . . ,N.
uN(x) =N∑j=1
uN(xj)χj(x)
qN(x) =N∑j=1
qN(xj)χj(x)xi
Pi
Pi+1
Ωh
Ω
Ana Alonso Mathematical methods for engineering
Collocation: constant elementsBoundary points: z ∈ Γ
1
2u(z)− 1
2π
∫Γ
(x− z) · n(x)
|x− z|2u(x) ds(x)− 1
2π
∫Γ
log1
|x− z|∂u
∂n(x) ds(x) = 0 .
In particular for i = 1, . . . ,N
1
2u(xi )−
1
2π
∫Γ
(x− xi ) · n(x)
|x− xi|2u(x) ds(x)− 1
2π
∫Γ
log1
|x− xi|∂u
∂n(x) ds(x) = 0 .
Now we replace
u(x) ≈ uN(x) =N∑j=1
uN(xj)χj(x) ,
q(x ≈ qN(x) =N∑j=1
qN(xj)χj(x) .
Ana Alonso Mathematical methods for engineering
Collocation: constant elements
For i = 1, . . . ,N
1
2uN(xi )−
1
2π
N∑j=1
uN(xj)
∫Γj
(x− xi ) · n(x)
|x− xi |2ds(x)
− 1
2π
N∑j=1
qN(xj)
∫Γj
log1
|x− xi |ds(x) = 0
Let us set
Ti,j := − 1
2π
∫Γj
(x− xi ) · n(x)
|x− xi |2ds(x) Ki,j :=
1
2π
∫Γj
log1
|x− xi |ds(x)
uj = uN(xj) qj = qN(xj)
1
2ui +
N∑j=1
Ti,juj −N∑j=1
Ki,jqj = 0
Ana Alonso Mathematical methods for engineering
Collocation: constant elements
Ti ,j := − 1
2π
∫Γj
(x− xi ) · nj|x− xi |2
ds(x) Ki ,j :=1
2π
∫Γj
log1
|x− xi |ds(x)
I For the case i 6= j integrals Ki ,j and Ti ,j can be calculatedusing, for instance, Gauss quadrature rules.
I For i = j the presence on the singularity requires a moreaccurate integration.For the particular case of constant elements Ki ,i and Ti ,i canbe computed analytically.Notice that if x ∈ Γi then (x− xi ) · ni = 0 hence Ti ,i = 0.
Ana Alonso Mathematical methods for engineering
Evaluation of integrals
Ki ,i =1
2π
∫Γi
log1
|x− xi |ds(x) =
1
2π
Li2
∫ 1
−1log
1
|r Li/2|dr
x = Pi1− r
2+ Pi+1
1 + r
2xi =
Pi + Pi+1
2
where Li = |Pi+1 − Pi | is the length of Γi .
I Clearly if i = N we replace Pi+1 with P1.
By integration by parts
∫ 1
0log
(rLi2
)dr = log
Li2− 1 .
Ki ,i =Li2π
(1− log
Li2
).
Ana Alonso Mathematical methods for engineering
Gauss quadrature rules
∫ 1
−1f (r) dr ≈
K∑k=1
ωk f (rk)
It is a quadrature rule constructed to yield an exact result forpolynomials of degree 2K − 1 or less.For instance, in the four points rule the points are
±√
1
7(3− 2
√6/5) with weight
18 +√
30
36
±√
1
7(3 + 2
√6/5) with weight
18−√
30
36.
∫ΓjF (x) ds(x) =
Lj2
∫ 1−1 F
(Pj
1−r2 + Pj+1
1+r2
)dr
≈ Lj2
∑4k=1 ωkF
(Pj
1−rk2 + Pj+1
1+rk2
).
Ana Alonso Mathematical methods for engineering
Gauss quadrature rules
Ti,j := − 1
2π
∫Γj
(x− xi ) · nj
|x− xi |2ds(x) ≈ Lj
4π
4∑k=1
ωkT (Pj1− rk
2+ Pj+1
1 + rk2
, xi )
Ki,j :=1
2π
∫Γj
log1
|x− xi |ds(x) ≈ Lj
4π
4∑k=1
ωkK(Pj1− rk
2+ Pj+1
1 + rk2
, xi )
function [t,k]=gqcon(P1,P2,z)
r=[-0.8611363116 -0.3399810436 0.3399810436 0.8611363116];
w=[0.3478548451 0.6521451549 0.6521451549 0.3478548451];
L=norm(P2-P1);
n=[0 1; -1 0]*(P2-P1)/L;
for i=1:4
s=P1*(1-r(k))/2+P2*(1+r(k))/2;
T(k)=-(s-z)*n/norm(s-z)^2;
K(k)=-log(norm(s-z));
end
t=L/(4*pi)*w*T’;
k=L/(4*pi)*w*K’;
P1 = Pj P2 = Pj+1 z = xi
Ana Alonso Mathematical methods for engineering
Constant elements - Boundary data
1
2ui +
N∑j=1
Ti ,juj −N∑j=1
Ki ,jqj = 0
−∆u = 0 in Ωu = ϕ in ΓD∂u∂n = g on ΓN
I If ΓD = ∂Ω the vector u = (uj)Nj=1 is given and the unknowns
are the component of the vector q = (qj)Nj=1.
I On the other hand if ΓN = ∂Ω then the vector q = (qj)Nj=1 is
given and the unknowns are the component of the vectoru = (uj)
Nj=1 (but matrix 1
2 I + T is singular!)
I In general N1 values of u corresponding to ΓD and N2 valuesof q corresponding to ΓN are known with N1 + N2 = N.
Ana Alonso Mathematical methods for engineering
Dirichlet problem
Kq =
(1
2I + T
)ϕ
−∆u = 0 in Ωu = ϕ on Γ
function q=bemconD(coor,u)
N=size(coor,2);
T=zeros(N); K=zeros(N);
coor=[coor coor(:,1)];
L=zeros(N,1);
for i=1:N, L(i)=norm(coor(:,i+1)-coor(:,i)); end
Kdiag=L/(2*pi).*(1-log(L/2));
for i=1:N
x=0.5*(coor(:,i)+coor(:,i+1));
for j=1:N
if j~=i
[t,k]=gqcon(coor(:,j),coor(:,j+1),x);
T(i,j)=t; K(i,j)=k;
end
end
end
K=K+diag(Kdiag);
b=(1/2*eye(N)+T)*u;
q=K\b;
Ana Alonso Mathematical methods for engineering
Dirichlet problem
Input: the geometry and the boundary conditions.
Output: the solution of the linear system.
I The geometry is given by a 2× N matrix with the coordinatesof the points Pj that define the elements.
I The boundary conditions are given in a column vectorcontaining the values of ϕ at each collocation point.
I The solution is saved in a column vector.
Ana Alonso Mathematical methods for engineering
Example
−∆u = 0 in Ω = x ∈ R2 : |x| < 1u = 2x1 + 3x2 on ∂Ω
N=input(’Number of subintervals: ’);
x=cos(2*pi*(1:N)/N);
y=sin(2*pi*(1:N)/N);
coor=[x;y];
coorc=[coor coor(:,1)];
pm=(coorc(:,1:end-1)+coorc(:,2:end))/2;
u=2*pm(1,:)+3*pm(2,:);
qapp=bemconD(coor,u’);
Notice that in this example ∂u∂n = u!
q=u’;
errq=max(abs(q-qapp))
Ana Alonso Mathematical methods for engineering
The solution at internal points
u(z) +
∫Γ
u(x)T (x, z) ds(x)−∫
Γ
∂u
∂n(x)K (x, z) ds(x) = 0
u(z) ≈N∑j=1
[qj
∫Γj
K (x, z) ds(x)− uj
∫Γj
T (x, z) ds(x)
]
Input: the geometry Γ, the discrete functions on Γ uN and qN , andthe internal points z where we want to compute the value of thesolution.
Output: the (approximated) value of the solution at the giveninternal points u(z).
The integrals∫
ΓjT (x, z) ds(x) and
∫ΓjK (x, z) ds(x) are
approximated using Gauss quadrature.
Ana Alonso Mathematical methods for engineering
The solution at internal points
function val=SolIntcon(coor,sol,points)
m=size(points,2);
N=size(coor,2);
coor=[coor,coor(:,1)];
val=zeros(1,m);
for i=1:m
Q=points(:,i);
for j=1:N
[t,k]=gqcon(coor(:,j),coor(:,j+1),Q);
val(i)=val(i)-t*sol(j,1)+k*sol(j,2);
end
end
I The geometry is given by a 2× N matrix with the coordinates of thepoints Pj that define the elements.
I sol is a m × 2 matrix. The first column contains the coefficients ui andthe second on the coefficients qi .
I The internal points are given in a 2×m matrix being m the number ofinternal point where we will compute the solution.
Ana Alonso Mathematical methods for engineering
Example −∆u = 0 in Ω = x ∈ R2 : |x| < 1u = 2x1 + 3x2 on ∂Ω
N=input(’Number of subintervals: ’);
x=cos(2*pi*(1:N)/N);
y=sin(2*pi*(1:N)/N);
coor=[x;y];
coorc=[coor coor(:,1)];
pm=(coorc(:,1:end-1)+coorc(:,2:end))/2;
u=2*pm(1,:)+3*pm(2,:);
qapp=bemconD(coor,u’);
q=u’;
errq=max(abs(q-qapp))
solD=[u’,qapp];
points=[-1/2 0 1/2 0 0; 0 0 0 -1/2 1/2];
IntD=SolIntcon(coor,solD,points)
exact=2*points(1,:)+3*points(2,:)
Ana Alonso Mathematical methods for engineering
Exercise 1
Let us set Ω =x ∈ R2 : (x1 − 1)2 + (x2 − 1)2 < 1
.
Approximate the solution of the Dirichlet boundary value problem−∆u = 0 in Ω
u = log(x21 + x2
2 ) on ∂Ω
Ana Alonso Mathematical methods for engineering
Neumann problem
(1
2I + T
)u = Kg
∆u = 0 in Ω∂u∂n = g on Γ
I Necessary condition for the existence of solution is∫Γ g ds = 0.
I The solution is not unique because if u is a solution thenu + c is also a solution for all c ∈ R.
I In the discrete problem we choose the solution withuN(x1) = 0, namely we eliminate the first equation and thefirst unknown of the linear system.
Ana Alonso Mathematical methods for engineering
Example
I Modify function bemconD in order to writte a functionbemconN that implements the boundary element method usingcollocation and piecewise constant approximation, for theLaplace equation with Neumann boundary conditions.
I Approximates a solution of the Neumann boundary valueproblem
−∆u = 0 in Ω = x ∈ R2 : |x| < 1∂u∂n = 2x1 + 3x2 on ∂Ω
Ana Alonso Mathematical methods for engineering
Exercise 2
Approximate a solution of the Neumann boundary value problem
−∆u = 0 in Ω = (−1, 1)× (−1, 1)
∂u∂n =
−3 on (−1, 1)× −12 on 1 × (−1, 1)3 on (−1, 1)× 1−2 on −1 × (−1, 1) .
(Exact solution: u(x) = 2x1 + 3x2.)
Ana Alonso Mathematical methods for engineering
Mixed problem
1
2ui +
N∑j=1
Ti ,juj −N∑j=1
Ki ,jqj = 0
−∆u = 0 in Ωu = ϕ in ΓD∂u∂n = g on ΓN
The key point is to rearrange the coefficients uj and qj in order towrite the linear system as:
Ax = b
where x is the vector of unknowns (u on ΓN , q on ΓD)and b is adata vector obtained multiplying the corresponding coefficient bythe known values of u or q.
Ana Alonso Mathematical methods for engineering
Mixed problem
B =1
2I + T Bu− Kq = 0 Ax = b
for i=1:N
for j=1:N
if u(j) is unknown
A(i,j)=B(i,j)
b(i)=b(i)+K(i,j)*q(j)
else
A(i,j)=-K(i,j)
b(i)=b(i)-B(i,j)*u(j)
end
end
end
Ana Alonso Mathematical methods for engineering
Linear elements
I The approximate solutions uN and qN are piecewise-linear.
I uN will be continuous while qN can be discontinuous in cornerpoints
Γj =
Pj
1− r
2+ Pj+1
1 + r
2: r ∈ [−1, 1]
.
If j = N then “j + 1 = 1”.
Pn
n
PP
j−1
j
j+1
j−1
j
uqq
jjj−+
uN|Γj= uN(Pj)N1(r) + uN(Pj+1)N2(r)
qN|Γj= q+
N (Pj)N1(r) + q−N (Pj+1)N2(r)
N1(r) = 1−r2 , N2(r) = 1+r
2 , with r ∈ [−1, 1].
Ana Alonso Mathematical methods for engineering
Linear elements
Corner points: z ∈ Γ
C (z)u(z) +
∫Γ
u(x)T (x, z) ds(x)−∫
Γ
∂u
∂n(x)K (x, z) ds(x) = 0
C (z) ≡ free term ≡ α(z)
2π. α
z(z) Ω
Ana Alonso Mathematical methods for engineering
Linear elements
C (Pi )uN(Pi )+
∫∂Ω
uN(x)T (x,Pi ) ds(x)−∫∂Ω
qN(x)K (x,Pi ) ds(x) = 0
∫ΓjuN(x)T (x,Pi ) ds(x) =
ujLj2
∫ 1−1 N1(r)T (PjN1(r) + Pj+1N2(r),Pi ) dr
+uj+1Lj2
∫ 1−1 N2(r)T (PjN1(r) + Pj+1N2(r),Pi ) dr
For k = 1, 2
Ak(i , j) :=Lj2
∫ 1
−1Nk(r)T (PjN1(r) + Pj+1N2(r),Pi ) dr
Ana Alonso Mathematical methods for engineering
Linear elements
Analogously∫ΓjqN(x)K (x,Pi ) =
q+j
Lj2
∫ 1−1 N1(r)K (PjN1(r) + Pj+1N2(r),Pi ) dr
+q−j+1Lj2
∫ 1−1 N2(r)K (PjN1(r) + Pj+1N2(r),Pi ) dr
For k = 1, 2
Bk(i , j) :=Lj2
∫ 1
−1Nk(r)K (PjN1(r) + Pj+1N2(r),Pi ) dr
C (Pi )ui+N∑j=1
[ujA1(i , j) + uj+1A2(i , j)] =N∑j=1
[q+j B1(i , j) + q−j+1B2(i , j)
]
Ana Alonso Mathematical methods for engineering
Linear elements
C (Pi )ui+N∑j=1
[A1(i , j)uj + A2(i , j)us ] =N∑j=1
[B1(i , j)q+
j + B2(i , j)q−s
]
s = s(j) =
j + 1 if j = 1, . . . ,N − 11 if j = N
for i=1:Nfor j=1:N
compute A1(i , j), A2(i , j), B1(i , j), B2(i , j).For each one of this four coefficients
if it multiplies an unknown then the coefficient is added to thecorresponding entry of the matrix (ai,j or ai,s),
if it multiplies a data the product is added to the right hand term.
Ana Alonso Mathematical methods for engineering
Boundary conditions
1. Neumann - Neumann conditionuj unknown, q−j given, q+
j given.
2. Dirichlet - Neumann conditionuj given, q−j unknown, q+
j given.
3. Neumann - Dirichlet conditionuj given, q−j given, q+
j unknown.
4. Dirichlet - Dirichlet condition (regular point)uj given, q−j unknown, q+
j unknown.
but q−j = q+j
5. Dirichlet - Dirichlet condition (non regular point)uj given, q−j unknown, q+
j unknown.
and q−j 6= q+j The gradient approach
Ana Alonso Mathematical methods for engineering
The gradient approach
q−j = ∇u(Pj) · nj−1
q+j = ∇u(Pj) · nj
∇u(Pj) = |∇u(Pj)|e(Pj)
Pn
n
PP
j−1
j
j+1
j−1
j
uqq
jjj−+
Assuming linear evolution along the ele-ments adjacent to the corner in Pj a linearuj(P) can be calculated.
I e(Pj) is approximated using ∇uj (thatis a constant vector).
e(Pj) ∇uj|∇uj |
I |∇u(Pj)| is the unknown vj .
q−j vj∇uj|∇uj |
· nj−1 q+j vj
∇uj|∇uj |
· nj .
Ana Alonso Mathematical methods for engineering
Evaluation of the coefficients
I If Pi 6∈ Γj Gauss quadratureI If Pi ∈ Γj
Ak(i , j) = 0 for k = 1, 2 because ∀P ∈ Γj (P− Pi ) · n = 0 .Bk(i , j) are improper integrals that can be computed exactly.
B1(j , j) = −Lj2
∫ 1−1
12π
1−r2 log
∣∣Pj1−r
2 + Pj+11+r
2 − Pj
∣∣ dr= −Lj
2
∫ 1−1
12π
1−r2 log
∣∣(Pj+1 − Pj)1+r
2
∣∣ dr(1+r
2 = s , dr = 2 ds , 1−r2 = 1− s
)= − Lj
2π
∫ 10 (1− s) log(Ljs) ds =
Lj2π
(34 −
12 log Lj
)
Ana Alonso Mathematical methods for engineering
Evaluation of the coefficients
B1(j , j) =Lj2π
(34 −
12 log Lj
)B2(j , j) =
Lj2π
(14 −
12 log Lj
)B1(j + 1, j) =
Lj2π
(14 −
12 log Lj
)B2(j + 1, j) =
Lj2π
(34 −
12 log Lj
)I Free terms: for a constant solution u = M
C (Pi )M +N∑j=1
[A1(i , j)M + A2(i , j)M
]= 0
C (Pi ) = −N∑j=1
[A1(i , j) + A2(i , j)
]Ana Alonso Mathematical methods for engineering
Input data
The geometry and the boundary conditions.
I The geometry is given by a 2× N matrix with the coordinatesof the points Pj that define the elements (as in the case ofconstant elements).
I The type of boundary conditions is given in a vector with Ncomponents. Each entry is an integer from 1 to 5.
I The boundary data are given in a matrix 3× N matrix. Thefirst line contains the values of u, the second one q− and thelast one q+.Notice that in this matrix there are unknowns coefficients.The same matrix is used to save the solution, filling theunknowns coefficients
Ana Alonso Mathematical methods for engineering
The solution at internal points
u(z) ≈ 1
2π
∫∂Ω
uN(x)(x− z) · n(x)
|x− z|2ds(x)− 1
2π
∫∂Ω
qN(x) log |x− z| ds(x)
The integrals are calculated using Gauss quadrature.
function s=SolIntlin(coor,sol,data)
K=length(data);
N=length(coor);
s=zeros(1,K);
for i=1:K
Q=data(:,i);
for j=1:N-1
[a1,a2, b1,b2]=gqlin(coor(:,j),coor(:,j+1),Q);
s(i)=s(i)-a1*sol(1,j)-a2*sol(1,j+1)+b1*sol(3,j)+b2*sol(2,j+1);
end
[a1,a2, b1,b2]=gqlin(coor(:,N),coor(:,1),Q);
s(i)=s(i)-a1*sol(1,N)-a2*sol(1,1)+b1*sol(3,N)+b2*sol(2,1);
end
Ana Alonso Mathematical methods for engineering
gqlin
function [a1,a2,b1,b2]=gqlin(P1,P2,Q)
r=[-0.8611363116 -0.3399810436 0.3399810436 0.8611363116];
w=[0.3478548451 0.6521451549 0.6521451549 0.3478548451];
l=norm(P2-P1);
n=[0 1; -1 0]*(P2-P1)/l;
for i=1:4
x=P1*(1-r(i))/2+P2*(1+r(i))/2;
A1(i)=(1-r(i))*(x-Q)’*n/norm(x-Q)^2;
A2(i)=(1+r(i))*(x-Q)’*n/norm(x-Q)^2;
B1(i)=(1-r(i))*log(norm(x-Q));
B2(i)=(1+r(i))*log(norm(x-Q));
end
a1=-l/(8*pi)*w*A1’;
a2=-l/(8*pi)*w*A2’;
b1=-l/(8*pi)*w*B1’;
b2=-l/(8*pi)*w*B2’;
Ana Alonso Mathematical methods for engineering
Example
The following script uses function bemlin for the approximation ofthe solution of the Dirichlet boundary value problem
−∆u = 0 in Ω
u = log(x21 + x2
2 ) on ∂Ω
being Ω =x ∈ R2 : (x1 − 1)2 + (x2 − 1)2 < 1
.
Ana Alonso Mathematical methods for engineering
Example
N=input(’Number of subintervals: ’);
x=cos(2*pi*(1:N)/N);
y=sin(2*pi*(1:N)/N);
coor=[x;y]+1;
u=log(coor(1,:).^2+coor(2,:).^2);
q=2*(1-(coor(1,:)+coor(2,:))./(coor(1,:).^2+coor(2,:).^2));
bccode=4*ones(1,N);
bcdata=zeros(3,N);
bcdata(1,:)=u;
solD=bemlin(coor,bccode,bcdata);
errq=max(abs(q-solD(3,:)))
points=[1 1/2 1 3/2 3/2; 1/2 1 1 1 3/2];
IntvalD=SolIntlin(coor,solD,points)
solex=log(points(1,:).^2+points(2,:).^2)
Ana Alonso Mathematical methods for engineering
Exercises
Using linear boundary elements approximate the solution of the followingboundary value problems:
1.
−∆u = 0 in Ω∂u∂n = 2
(1− x1+x2
x21 +x2
2
)on ∂Ω ,
being Ω =x ∈ R2 : (x1 − 1)2 + (x2 − 1)2 < 1
.
2.
−∆u = 0 in Ω = (−1, 1)× (−1, 1)u = 2x1 + 3x2 on ∂Ω .
3.
−∆u = 0 in Ω = (−1, 1)× (−1, 1)∂u∂n = −3 on (−1, 1)× −1u = 2 + 3x2 on 1 × (−1, 1)∂u∂n = 3 on (−1, 1)× 1u = −2 + 3x2 on −1 × (−1, 1) .
Ana Alonso Mathematical methods for engineering