Domain Decomposition for Poisson equation in 1D

by Yi Zhang

It’s not really Poisson equation, just a second order ODE in that sense. But it serves a good example to demonstrate the idea of domain decomposition.

Using Dirichlet-Neumann method, one of the two subdomains gives out Neumann boundary condition and receives Dirichlet boundary data at the interface, and the other one does the opposite. The Mathematica modul would be somthing like this:

DNDecomp:   Main module;
DBCLaplace: linear FEM module for Dirichlet data ua at xa, and ub at xb;
MBCLaplace: linear FEM module for Mixed data ua at xa, and flux db at xb;
(xi,ui):    interface position and data;
theta:      relaxation coefficient to update ui in each iteration.
DNDecomp[xa_, ua_, xb_, ub_, xi_, ui0_, n1_, n2_, iter_, \[Theta]_] :=
Module[{ui, di, x1, u1, x2, u2, h1, h2, sol},
  f[t_] := 2;
  ui = ui0;
  h1 = (xi - xa)/n1; h2 = (xb - xi)/n2;
  sol = {};
    {x2, u2} = DBCLaplace[xi, ui, xb, ub, n2];
    di = (u2[[2]] - u2[[1]])/h2;
    {x1, u1} = MBCLaplace[xa, ua, xi, di, n1];
    ui = \[Theta] u1[[-1]] + (1 - \[Theta]) u2[[1]];
    AppendTo[sol, {{x1, u1}\[Transpose], {x2, u2}\[Transpose]}]},

In above example force function f=2 gives a parabolic exact solution. The effect of the relaxation coefficient \theta is obvious in plots below.

Above: theta=0.7, below: theta=0.5

Below is another example with exact solution u(x)=-x \sin(x).

Iteration = 6, theta = 0.5