Exercise 10.1.5 and 10.2.3

The stationary Allen-Cahn equation is a model of phase changes, such as the change from liquid to solid. In one spatial dimension it can be written as:

ϵu

As \epsilon \rightarrow 0, the solution tends toward a step function transition between -1 and 1. By symmetry, u'(x) = -u'(1-x).

  1. Use shoot function with initial solution estimate (u(0) = -1, u'(0) = 0) to solve the equation for \epsilon = 0.2. Plot the solution.
epsilon = 0.2;
phi = (x, u, du_dx) -> (u^3 - u)/epsilon;
a = eps();  b = 1;

g1(u, du) = u + 1; # u(0) = -1
g2(u, du) = u - 1; # u(1) = 1

x,u,du_dx = FNC.shoot(phi, (a, b), g1, g2, [-1, 0]);
plot(x, u, xaxis = L"x", yaxis = (L"u(x)"), label="epsilon = $epsilon",
           title = "Shooting for phase change", leg=:topleft)

@show du_dx[1] - du_dx[end];
  1. repeat with \epsilon = 0.02
epsilon = 0.02; 

x,u, du_dx = FNC.shoot(phi, (a, b), g1, g2, [-1, 0]);
plot!(x, u, label="epsilon = $epsilon")

@show du_dx[1] - du_dx[end];
  1. repeat with \epsilon = 0.002
epsilon = 0.002; 

x, u, du_dx = FNC.shoot(phi, (a, b), g1, g2, [-1, 0]);
plot!(x, u, label="epsilon = $epsilon")

@show du_dx[1] - du_dx[end];

Try different initializations for u. Do any seem to be valid?

plt = plot(xaxis = L"x", yaxis = L"u(x)",
           title = "Different initial values", leg=:bottomright);

for w0 in -1.0:0.1:0.0
    x,u = FNC.shoot(phi, (a, b), g1, g2, [w0, 0]);
    plot!(x, u, label="u(x) = $w0")
end

plt
plt = plot(xaxis = L"x", yaxis = L"u(x)",
           title = "Different initial values", leg=:topleft);

for w1 in [0.0 0.001 0.0001 eps()]
    x,u = FNC.shoot(phi, (a, b), g1, g2, [-1.0, w1]);
    plot!(x, u, label="u'(x) = $w1")
end

plt