Actual source code: example4.edp
 1 /*******************************************************
 2  *  This file is part of the FreeFEM tutorial made by  *
 3  *      Pierre Jolivet <pierre@joliv.et>               *
 4  *                                                     *
 5  *  See https://joliv.et/FreeFem-tutorial for more     *
 6  *                                                     *
 7  *   Description: convergence of DDM on a              *
 8  *                rectangular domain                   *
 9  *******************************************************/
 
11 load "hpddm"
12 macro dimension()2// EOM
13 include "macro_ddm.idp"
 
15 macro grad(u)[dx(u), dy(u)]// EOM
16 func Pk = P1;
 
18 int[int] l = [2, 1, 2, 2];
19 meshN Th = square(10 * getARGV("-global", 40), getARGV("-global", 40), [10.0 * x, y], label = l);
20 fespace Wh(Th, Pk);
21 int[int][int] intersection;
22 real[int] D;
23 build(Th, getARGV("-split", 1), intersection, D, Pk, mpiCommWorld);
 
25 varf vPb(u, v) = intN(Th)(grad(u)' * grad(v)) + intN(Th)(v) + on(1, u = 1.0);
26 matrix<real> Loc = vPb(Wh, Wh, tgv = -1);
27 real[int] rhs = vPb(0, Wh, tgv = -1);
 
29 matrix Neumann = Loc;
30 schwarz A(Loc, intersection, D);
31 set(A, sparams = "-hpddm_schwarz_method ras -hpddm_schwarz_coarse_correction deflated -hpddm_geneo_nu 10");
 
33 if(mpisize > 1 && isSetOption("schwarz_coarse_correction"))
34     AttachCoarseOperator(mpiCommWorld, A, A = Neumann);
 
36 Wh<real> u;
37 u[] = A^-1 * rhs;
38 macro def(i)i// EOM
39 plotMPI(Th, u, Pk, def, real, cmm = "Solution");