Scilab Tools For PDE's: Application To Time-Reversal: Outlines
Scilab Tools For PDE's: Application To Time-Reversal: Outlines
Outlines
1. introduction
2. sparse linear algebra tools
3. finite element tools
4. time-reversal in a 2D acoustic waveguide
5. conclusion
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 1
Introduction
our goals:
• design a pde’s toolbox for 2D (space) simulations such that:
- it may be easy to use;
- it may be adaptable;
- it may be well integrated in scilab.
• improve some scilab sparse matrix operations (this is necessary to deal
with high discretisations).
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 2
sparse matrix algebra 1: an interface onto a good sparse solver
We have developped a Scilab interface onto the umfpack v4-x sparse linear solver
(Tim Davis). Freely available (SCISPT toolbox) at the url:
http://www.iecn.u-nancy.fr/∼pincon/scilab/scilab.html.
x = umfpack(A,"\",b)
LUp = umf lufact(A)
main features:
x = umf lusolve(LUp, b [,A])
umf ludel([LUp])
A small benchmark (done on a Latitude D400 Dell laptop, umfpack using an ATLAS BLAS library)
Clearly these results show that it is time for Scilab to change its sparse
solver !
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 3
sparse matrix algebra 2: improvement of some sparse operations
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 4
sparse matrix extraction: B = A(ii, jj)
• When a row has many elements it is interesting to use a dichtomic search onto
the column indices in place of a linear search (feature added in the scilab core);
• When the indexing domain is very large (for instance A is 20000 × 20000 and
ii = 1 : 10000, jj = 10001 : 20000) and A have a low element density (that is A
is a normal sparse matrix !) then the usual algorithm don’t perform well. But it is
possible to invert the search that is to do a loop on the sparse matrix elements and
test if they are in the extraction region. We have written a new insertion code based
on this idea.
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 5
finite elements tools 1: boundary description and domain
discretisation
Some remarks:
• For numerical experiments with pde’s control problems it is important to be
able to locate some regions (2D subdomain or 1D curve or even points) where a
specific action (like a feedback) will be applied;
• From a first simulation it may be useful to be able to refine the mesh where
needed.
• Scilab for the description (tlist) and the discretisation of the boundaries (and
also “internal boundaries”)
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 6
boundary description and domain discretisation: how it works
• A boundary is described from elementary border pieces:
S = Seg(P1,P2, bdy_marker)
A = Arc(C, theta1, theta2, orientation, bdy_marker)
Ci = Circle(C, r, orientation, bdy_marker)
U = Ufunc(t1, t2, x_expr, y_expr, bdy_marker)
Sp = Spline(Pts, bdy_marker)
CSp= CSpline(Pts, bdy_marker)
• In fact the boundary is formed from one exterior closed contour and eventually with
one or several interior closed contour(s). The function MakeContour take several (or
only one) element border pieces and build a closed contour.
CC = MakeContour(S1, S2, S3, S4)
• The interior constrained curves (which are not part of the boundary) must be
described only from elementary border pieces.
• The boundary (with the eventually interior constrained curves) is discretised with:
[PtB, EdB, MarkEdB, ne] = BoundaryDiscretisation(h, CCext, CCint1,.., Ebp1, Ebp2, ...)
• From the boundary edges (and also internal edges), the triangulation is got with:
[P, T, markT, E, T2T] = triangulate(PtB, EdB [, ne, Region]);
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 7
boundary description and domain discretisation: an example
Γ1 P3
P2
Γ1 R0
"internal curve"
Γ−2
P1 Γ4
"control region"
Γ−1
Γ2
R 1 Γ 3
P4 Γ4
Γ1
P5 P6
Γ1
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 8
the scilab script
P1 = [0;1]; P2 = [0;2]; P3 = [2;2]; P4 = -P1; P5 = -P2; P6 = [2;-2];
C = [0;0]; C1 = [1.3;1]; C2 = [1.3;-1]; h = 0.15; r = 0.4;
S1 = Seg(P3,P2,1);
S2 = Seg(P2,P1,1);
A1 = Arc(C,1, -%pi/2, %pi/2, -1, 2);
S3 = Seg(P4,P5,1);
S4 = Seg(P5,P6,1);
T = Ufunc(-%pi/2,%pi/2, "x=2+0.5*cos(t)", "y=2*sin(t)", 3);
Ce = MakeContour(S1,S2,A1,S3,S4,T);
Ci1 = MakeContour(Circle(C1,r,-1,4));
Ci2 = MakeContour(Circle(C2,r,-1,4));
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 9
the resulting mesh
a mesh
boundary 1
2 boundary 2
boundary 3
boundary 4
internal boundary 1
internal boundary 2
region 0
region 1
number of triangles 1066
number of vertices 594
min triangle quality 0.830
0
mean triangle quality 0.943
max triangle quality 1.000
-2
0 1.2498288 2.4996576
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 10
finite elements tools 2: mesh refinement
To refine the mesh one have to give an area constraint for each triangle:
[Pn, Tn, markTn, EdBn, MarkEdBn, En, T2Tn] = refine_mesh(P, T, markT, area_cstr, EdB, MarkEdB);
boundary 1
boundary 2
boundary 3
boundary 4
internal boundary 1
internal boundary 2
region 0
region 1
number of triangles 3068
number of vertices 1655
min triangle quality 0.797
mean triangle quality 0.947
max triangle quality 1.000
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 11
finite elements tools 3: f.e.m. matrices and vector
Considering
a problem of the form:
−∇ · (K(x, y) × ∇u) + V (x, y) · ∇u + c(x, y)u = f (x, y) in Ω
(K(x, y) × ∇u).n = g(x, y) on ΓN
u = h(x, y) on ΓD
discretized with the classic f.e.m.. Each matrix can be computed with:
sp = SparsePattern(E, np)
...................... with matrix type:
cM = build_values_per_triangle(P, T, MarkT, dimM, ... "stiffness"
mkr1, fM1, mkr2, fM2, ...) "tensor_stiffness"
M = assemb_fem_matrix( matrix_type, P, T, sp, cM); "mass"
...................... "advection"
A = M + others matrices
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 12
an application: time-reversal in a 2D acoustic waveguide
The main idea is to use the reversibility of the wave equation in a non dissipative
medium to back-propagate signals to the sources that emitted them.
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 13
the D.O.R.T. method
1/ the TRM first emits an acoustic wave and measures the diffracted field.
2/ the measured field is then reversed and reemitted by the TRM which also
measures the new diffracted field.
If one works with time-harmonic waves (UT (x, t) = Re(uT (x)e−iωt)) the reversing
operation corresponds to a conjugation, that is, if S is the operator corresponding to
the first step then:
T = S̄S
Under some assumptions (small scatterers, ...), it has been shown experimentally and
mathematically proved (not currently for waveguides but only for free space) that:
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 14
the mathematical model
uD
uI
The scattering matrix XI XD
satisfies: XD = SXI
SPARSE FULL
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 15
some details on the implementation
Final steps:
• T = S̄S;
• then compute the eigenelements of T
• check the expected focusing properties.
Remarks:
2π
1/ the experimental setting imposes: a << λ = << d. Since the Helmholtz
k
fem approximation requires 10 points per wavelength, the mesh size must be very
small;
2/ to compute the matrix S the use of a fast solver is crucial;
3/ our fast insertion algorithm (full inside sparse) is very useful here to take into
account the TBC.
Our numerical test: uses the values, a1 = 0.13, a2 = 0.1, λ = 1, d = 5.2, L = 5.
This gives 11 propagative modes for the wave guide. With h = 0.02, we got 229114
triangles, 115084 vertices, the different timings being:
0.6 s (bdy description) 1.56 s (triangulation)
3.6 s (mesh optim) 3.7 s (matrix build)
1.9 s (TBC) 16.8 s (factorisation)
12 s (computing of S)
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 16
eigenvalues of the time reversal operator
⊕ ⊕ ⊕ ⊕ ⊕ ⊕
0.0044 h
⊕
⊕ ⊕
⊕ ⊕
⊕ ⊕
⊕ ⊕
⊕ ⊕
0
0.02 0.022 0.025 0.03 0.04 0.05
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 17
acoustic fields associated to the 4 first eigenvectors
module of the total field associated with vp1 module of the total field associated with vp2
module of the total field associated with vp3 module of the total field associated with vp4
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 18
Conclusion
For instance, at the beginning (and in the paper !) we have used 2 TRM but the
focalisation results are not clear . . . and it stays many things to experience with one TRM !
Remarks:
1/ We think to complete progressively our pde’s toolbox and make a first public
release at the end of this year. You will find it at the url:
http://www.iecn.u-nancy.fr/∼pincon/scilab/scilab.html
2/ Our code for sparse insertion and extraction will be soon integrated in Scilab.
3/ We hope that the umfpack solver will replace the scilab ’s one.
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 19
the mathematical model
• the use of time-harmonic waves
uT (x, t) = Re(u(x)e−iωt) simplifies x2
Γ∝
the wave equation into the Helmholtz
equation: ∆uT + k 2uT = 0, k = ω/c Ω∝
d
(uT = uI + uD being the total field); Γo Γo
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 20
the mathematical model (continued)
- Scilab tools for PDE’S - 2004 CCA/ISIC/CACSD - Scilab/Scicos: an Open Source Environnement for CACSD - 21