Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
School Fundamentals and practice of finite elements
Roscoff, april, 2017
part 3 : Advanced XLiFE++
E. LunévilleUnité de Mathématiques Appliquées
POEMS, ENSTA ParisTech
eXtended Library
of Finite Elements
in C++
2
Dealing with BEM Coupling FEM-BEM, FEM-IR Dealing with transient problem Dealing with non linear problem XLiFE++ in future
Outline
Advanced XLiFE++
3Advanced XLiFE++
Helmholtz scattering problem
Integral representation formulasHelmholtz kernels
Limits when x goes to (G is singular)
BEM Helmholtz 3D
4
Jump relations ( any Helmholtz solution in )
limit on
Simplest integral equation for the exterior Dirichlet problem
take
(EFIE)
well posed if k is not an eigenvalue of the Dirichlet interior problem
Advanced XLiFE++
BEM Helmholtz 3D
5XLiFE++ introduction
Mesh MS(Sphere(_center=Point(0.,0.,0.), _radius=1., _hsteps=0.1), _triangle, 1,_gmsh);Domain Gamma = MS.domain(0);
Deal with integral equations in XLiFE++ (EFIE, sphere)
• Mesh the unit sphere with triangles
• Define space (Lagrange P0) and unknown
Space V(Gamma, P0,"V");Unknown phi(V0,"phi"); TestFunction psi(phi,"psi");
• Get the Helmholtz kernel
Real k=5;Parameters pars(k,"k"); Function F(f,pars);Kernel G=Hemholtz3dKernel(k);
f is chosen as an incident plane wave
Complex f(const Point& P, Parameters& pars = defaultParameters){
Real k = pars("k");return -exp(i_*k*P(1));
}
GMSH mesh (3018 triangles)
BEM Helmholtz 3D
6
IntegrationMethods collects integration methods to apply • to different parts of a Kernel (_allFunction, _regularPart, _singularPart)• to different configurations of elements
IntegrationMethods ims(_SauterSchwabIM, 4, 0.,_defaultRule, 5, 2.,_defaultRule, 3);
Methods for double integral with singular Kernel (or singular part of Kernel)• _SauterSchwabIM (quadrature) for Kernel with 1/r singularity (Laplace, Helmholtz, Maxwell 3D)• _DuffyIM (quadrature) for Kernel with log r singularity (Laplace, Helmholtz 2D)• _LenoirSalles3dIM (exact for P0-P1) for Laplace3D kernel or singular part of Helmholtz 3D• _LenoirSalles2dIM (exact for P0-P1) for Laplace2D kernel or singular part of Helmholtz 2D
Sauter-Schwab (order 4 on segment) method when elements are adjacent (81 quadrature points)best quadrature rule of order 5 for element at relative distance <=2 (49 quadrature points)else best quadrature rule of order 3 (9 quadrature points)
Advanced XLiFE++
BEM Helmholtz 3D
7
• Define forms and compute matrix (in dense storage) and rhs
Bilinearform a = intg(Gamma, Gamma, phi*G*psi);LinearForm b = intg(Gamma, F*psi);TermMatrix A(a,"A"); TermVector B(b,"B");
Advanced XLiFE++
TermVector X=gmresSolve(A,B);
• Represent solution on the sphere and save it to file "U.vtu"
IntegrationMethods imsh(LenoirSalles3dIR(),_singularPart, theRealMax,QuadratureIM(Gauss_Legendre,4),_regularPart, theRealMax);
TermVector U = integralRepresentation(phi, Gamma, intg(Gamma,G*phi,imsh), X, "SL0");saveToFile("U", U,_vtu);
Use exact integration method (Lenoir-Salles) for singular part and standard quadrature for regular part
• Solve using GMRES
Paraviewcell vizualization (P0)
Paraviewpoint vizualization(filter Cell Data To Point Data)
real part of the scattered field
BEM Helmholtz 3D
8Advanced XLiFE++
Doing BEM in P1, change only the space
Space V(Gamma, P1,"V");real part of the scattered field
P1 computation
Representing the total field on planes(create new mesh, domain and space)
Real c=0;Rectangle Rx(_v1=Point(c,-3.,-3.), _v2=Point(c,3.,-3.),
_v4=Point(c,-3.,3.), _hsteps=0.1);Mesh Px(Rx,_triangle,1,_gmsh);Domain dompx=Px.domain(0);Space Vx(dompx,P1,"Vx"); Unknown ux(Vx,"ux");TermVector Upx = integralRepresentation(ux, dompx,
intg(Gamma,G*phi, imsh), Ut, "Upx");saveToFile("Upx",Upx-TermVector(ux,dompx,F),_vtu);...
Compute the total field on Gamma (gives 0!)
TermVector Ut = U-TermVector(phi,Gamma,F);real part of
the total field
modulus of the total field
BEM Helmholtz 3D
9Advanced XLiFE++
BEM Helmholtz 3DOther standard BEM formulations
(MFIE)
(CFIE)
Bilinearform a = 0.5*intg(Gamma, phi*psi)+ intg(Gamma, Gamma, phi*ndotgradx(G)*psi);
LinearForm b = -intg(Gamma, (_n|ginc)*psi); //ginc : grad of uinc
Bilinearform a = 0.5*intg(Gamma, phi*psi)+ intg(Gamma, Gamma, phi*ndotgradx(G)*psi)+ eta * intg(Gamma, Gamma, phi*G*psi);
LinearForm b = -intg(Gamma, (_n|ginc)*psi) //ginc : grad of uinc+ eta * intg(Gamma, (uinc*psi) ;
10Advanced XLiFE++
BEM Maxwell 3DIndirect EFIE
well posed if k is not an eigenvalue of the Dirichlet interior problem
(Stratton-Chu)
Change the space – use Hdiv conform space
Space RT(Gamma, RT_1, "RT");Unknown U(RT,"U"); TestFunction V(U,"V");
Change forms
BilinearForm a = (1/k) * intg(Gamma,Gamma, div(U)*G*div(V), ims)- k * intg(Gamma,Gamma, (U*G)|V, ims);
TermMatrix A (a,"A");TermVector B(intg(Gamma, fi|V), "B");TermVector X = directSolve(A,B);
ComplexVector Ei(const Point& P, Parameters& pars)
{ RealVector pol(3,0.); pol(1)=1.;Point dir(0.,0.,1.) ;Real k = pars("k");return pol*exp(i_*k * dot(P,dir));}
Data function Ei
11Advanced XLiFE++
BEM Maxwell 3DChange integral representation on planes using Stratton-Chu
IntegrationMethods ims2(_defaultRule,10, 1.,_defaultRule, 5);Unknown ux3(Vx,"ux", 3); // new vector unknown !TermVector E = -(1/k)*integralRepresentation(ux3, dompx, intg(Gamma,grad_x(G)*div(U),ims2), X)
-k *integralRepresentation(ux3, dompx, intg(Gamma,G*U,ims2), X);
use standard quadrature (order 10 if close to Gamma else order 5)
real part of Ex
12Advanced XLiFE++
FEM-IRA drawback of BEM is the computation of singular integralsTo avoid this computation, a method consists in coupling FEM and Integral representation
Helmholtz with Neumann condition
Equivalent problem
13Advanced XLiFE++
FEM-IR
XLiFE++ can deal with such formulation, diffraction by a sphere
Sphere S1(_center=Point(0.,0.,0.), _radius=1., _hsteps=0.1,_side_names="Gamma");
Sphere S2(_center=Point(0.,0.,0.), _radius=1.2, _hsteps=0.12, _domain_name="Omega", _side_names="Sigma");
Mesh mC(S2-S1,_tetrahedron,1,_gmsh);Domain Omega = mC.domain("Omega");Domain Gamma =mC.domain("Gamma"), Sigma =mC.Domain("Sigma");Gamma.setNormalOrientation(outwardsDomain ,Omega);Sigma.setNormalOrientation(outwardsDomain ,Omega);
Sigma
GammaOmega
Space V(Omega, P2, "V");Unknown u(V,"u"); TestFunction v(u,"v");
use standard P2 Lagrange space
BilinearForm a = intg(Omega,grad(u)|grad(v))-(k*k)*intg(Omega,u*v)+eta*intg(Sigma, u*v)+ intg(Sigma, Gamma, u*ndotgrad_x(ndotgrad_y(G))*v)+ eta*intg(Sigma, Gamma, u* ndotgrad_y(G)*v);
TermMatrix A(a,"A");
Bilinear form
be careful with normal orientation and signs in variational form
14Advanced XLiFE++
FEM-IRcompute right hand side using bilinear form and solve
BilinearForm af = intg(Gamma, u*v) + intg(Sigma, Gamma, u*ndotgrad_x(G)*v)+ eta*intg(Sigma, Gamma, u*G*v);
TermMatrix Af(af);Function dnf(dnui, pars); dnf.associateVector(_n);TermVector Dnf(u, Gamma, dnf);TermVector B = Af*Dnf;TermVector X=directSolve(A,B);
Function ui(f,pars); IntegrationMethods imr(_defaultRule,10,1.,_defaultRule, 5);Rectangle Ry(_v1=Point(-3.,0.,-3.), _v2=Point(3.,0.,-3.),
_v4=Point(-3.,0.,3.), _hsteps=0.1);Rectangle Rz(_v1=Point(-3.,-3.,0.), _v2=Point(3.,-3.,0.),
_v4=Point(-3.,3.,0.), _hsteps=0.1);Mesh Py(Ry,_triangle,1,_gmsh), Pyz(Rz,_triangle,1,_gmsh);Pyz.merge(Py); //merge meshesDomain dompyz=Pyz.domain("main domain");Space Vyz(dompyz,P1,"Vyz"); Unknown uyz(Vyz,"uyz");TermVector Upyz = integralRepresentation(uyz, dompyz, intg(Gamma,G*D,imr))
- integralRepresentation(uyz, dompyz, intg(Gamma,ndotgrad_y(G)*X,imr));TermVector Uinc(uyz,dompyz,ui), Ut=Upyz+Uinc;
Do integral representation on plane y=0 and z=0
Complex dnui(const Point& P, Parameters& pa = defaultParameters)
{ Real k = pa("k"), x=P(1);RealVector n = pa.getVector(_n);return -i_*k*exp(i_*k*x)*n(1);}
modulus of the total field
15Advanced XLiFE++
FEM-BEM
Solving a diffraction problem with penetrable obstacle requires FEM computationin the obstacle coupled with a method for solving the exterior problem : many are possible : FEM-DtN, FEM-IR, FEM-BEM, ...
BEM (EFIE)
FEM
Multiple unknowns problemXLiFE++ is designed for this purpose !!!
16Advanced XLiFE++
FEM-BEM
2D example
Disk D1(_center=Point(0.,0.), _radius=1., _hsteps=0.1,_domain_name="Omega",_side_names="Gamma");
Square C(_origin=Point(-4,-4),_length=8,_hsteps=0.1, _domain_name="S");
Mesh mC(C+D1,_triangle,1,_gmsh);Domain Omega = mC.domain("Omega");Domain Gamma =mC.domain("Gamma");Domain S =mC.domain("S");
Space V(Omega, P1, "V"); Unknown u(V,"u"); TestFunction v(u,"v");Space L(Gamma, P0, "L"); Unknown l(L,"l"); TestFunction t(l,"t");
use standard P1 Lagrange space for FEM and P0 Lagrange for BEM
Real k=5; Parameters pars(k,"k");Kernel G=Helmholtz2dKernel(k);Function fk2(k2,pars); Function finc(uinc,pars);IntegrationMethods ims(Duffy,10,0., defaultQuadrature,6,2.,defaultQuadrature,4);BilinearForm a = intg(Omega, grad(u)|grad(v))-intg(Omega, k2*u*v)-*intg(Gamma, l*v)
+ 0.5*intg(Gamma, u*t) - intg(Gamma, Gamma, u*ndotgrad_y(G)*t)+ intg(Gamma, Gamma, l* G*t);
LinearForm b=intg (Gamma, finc *t ) ;
Bilinear form
S
Gamma
17Advanced XLiFE++
FEM-BEM
Solve system ant do integral representation on S
TermMatrix A(a,"A"); TermVector B(b,"B");TermVector X=directSolve(A,B);TermVector Ui=X(u); IntegrationMethods imr(LenoirSalles2dIR(),_singularPart, theRealMax,
QuadratureIM(defaultQuadrature,4),_regularPart, theRealMax);Space VS(S,P1,"VS"); Unknown uS(VS,"uS");TermVector US = integralRepresentation(uS,S,intg(Gamma, ndotgrad_y(G)*Ui, imr))
- integralRepresentation(uS,S,intg(Gamma, G*X(l), imr));TermVector UtS = US + TermVector(uS,S,finc)
real part of the total field modulus of the total field
Example
18Advanced XLiFE++
FEM-BEM : a funny application
Diffracted portrait done for the French Science Fair ("Fête de la Science"2017)• take a picture with a camera• insulate the face and adjust contrast, ...• pixelize and map pixels to sound velocities• compute diffraction by plane waves using FEM-BEM in XLiFE++• visualize the result
19Advanced XLiFE++
What about time dependent problemsXLife ++ deals with all the time dependent problems and none!
no particular stuff related to time dependent problems, standard stuff allows to deal with most.
Solve wave equation in bounded domain using standard leap-frog scheme
Variational form of the leap-frog time discretisation:
Matrix form after spatial discretisation in a FE space Vh
20Advanced XLiFE++
What about time dependent problems
Square sq(_origin=Point(0.,0.), _length=1, _nnodes=70);Mesh mesh2d(sq, triangle, 1, structured);Domain omega=mesh2d.domain("Omega");Space V(omega, P1, "V", true); Unknown u(V, "u"); TestFunction v(u, "v");TermMatrix A(intg(omega, grad(u)|grad(v)),"A"), M(intg(omega, u*v), "M");TermVector G(intg(omega, g*v), "G");TermMatrix L; ldltFactorize(M,L);Real c=1, dt=0.004, dt2=dt*dt, cdt2=c*c*dt2, t=dt;Number nbt=200;TermVectors U(nbt); TermVector zeros(u, omega, 0.); U(1)=zeros; U(2)=zeros;for (Number n=2; n<nbt; n++, t+=dt)
U(n+1)=2.*U(n)-U(n-1)-factSolve(L, cdt2*(A*U(n)) - dt2*h(t)*G);saveToFile("U", U, vtu);
mesh & domain
space & unknowncomputematrices & vectors
initialize time loopallocate a TermVectorsto store states a each tn
time loop, computingstate at tn+1
save all the states
t = 0.16s t = 0.32s t = 0.48s t = 0.64s
21Advanced XLiFE++
What about non linear problemsSame answer as for time dependent problems : XLife ++ deals with all the non linear problems and none!
no particular stuff related to non linear problems, standard stuff allows to deal with some.
Finding some invisible obstacles in a waveguide (work of A.S Bonnet-BenDhia and A. Bera)
In the unperturbed waveguide ( ρ= 0), there are modal solutions
finite number of propagative modes
other are evanescent modes
only two mode, that is a plane wave
22Advanced XLiFE++
What about non linear problems
Assume low frequency regim and incident plane wave
perfect invisibilitynon reflectivity
expression of coefficients
perturbation theory
23Advanced XLiFE++
What about non linear problems
Algorithm
implemented in XLiFE++ with standard stuffmore complex cases have been dealt (T=1 case, two propagative modes)
24XLiFE++ introduction
Invisibility in a waveguide
invisibility of a collection of penetrable obstacles
Simple obstacle inducing no reflection
25XLiFE++ introduction
XLiFE++ in future
To come soon edge and face element on quadrangle and hexahedron (work in progress) Buffa-Christiansen element (work in progress) HMatrix for Maxwell BEM (not working but easy upgrade) tools for DDM (MPI interface)
To come next Fast Multipole Method (interface to FastMMLib) management of gmsh new features in mesh generation wrapper to PETSC-SLEPC (non linear eigenvalue problems)
To come later discontinuous Galerkin HMatrix factorization augmented geometry (CAO) high frequency tools (PTDG)