// Discussion: // // This script implements the Schwarz method. // In this example, the domain is decomposed into two subdomains, // with overlap. // // Location: // // http://people.sc.fsu.edu/~jburkardt/freefem_src/schwarz_overlap/schwarz_overlap.edp // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 03 February 2016 // // Author: // // Frederic Hecht // // Reference: // // Frederic Hecht, // Freefem++, // Third Edition, version 3.22 // cout << "\n"; cout << "schwarz_overlap\n"; cout << " FreeFem++ version\n"; cout << " The Schwarz method of domain decomposition is used, replacing\n"; cout << " the problem domain by two overlapping subdomains.\n"; // // Region labels. // int inner = 2; int outer = 1; // // Define the border. // border a ( t = 1, 2 ) { x = t; y = 0; label = outer; }; border b ( t = 0, 1 ) { x = 2; y = t; label = outer; }; border c ( t = 2, 0 ) { x = t; y = 1; label = outer; }; border d ( t = 1, 0 ) { x = 1-t; y = t; label = inner; }; border e ( t = 0, pi/2 ) { x = cos ( t ); y = sin ( t ); label = inner; }; border e1 ( t = pi/2, 2*pi ) { x = cos ( t ); y = sin ( t ); label = outer; }; int n = 4; mesh Th1 = buildmesh ( a ( 5 * n ) + b ( 5 * n ) + c ( 10 * n ) + d ( 5 * n ) ); mesh Th2 = buildmesh ( e ( 5 * n ) + e1 ( 25 * n ) ); // // Plot the mesh. // plot ( Th1, Th2, wait = true, ps = "schwarz_overlap_mesh.eps" ); // // Define the finite element spaces. // int i = 0; fespace Vh1 ( Th1, P1 ); Vh1 u1 = 0.0; Vh1 v1; fespace Vh2 ( Th2, P1 ); Vh2 u2 = 0.0; Vh2 v2; problem pb1 ( u1, v1, init = i, solver = Cholesky ) = int2d ( Th1 ) ( dx ( u1 ) * dx ( v1 ) + dy ( u1 ) * dy ( v1 ) ) + int2d ( Th1 ) ( -v1 ) + on ( inner, u1 = u2 ) + on ( outer, u1 = 0.0 ); problem pb2 ( u2, v2, init = i, solver = Cholesky ) = int2d ( Th2 ) ( dx ( u2 ) * dx ( v2 ) + dy ( u2 ) * dy ( v2 ) ) + int2d ( Th2 ) ( -v2 ) + on ( inner, u2 = u1 ) + on ( outer, u2 = 0.0 ) ; for ( i = 0; i < 10; i++ ) { pb1; pb2; plot ( u1, u2, wait = true ); }; plot ( u1, u2, ps = "schwarz_overlap_u.eps" ); // // Terminate. // cout << "\n"; cout << "schwarz_overlap:\n"; cout << " Normal end of execution.\n"; exit ( 0 );