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:
\[ \epsilon u'' = u^3 - u, \quad 0 \leq x \leq 1, \quad u(0) = -1, \quad u(1) = 1. \]
As \(\epsilon \rightarrow 0\), the solution tends toward a step function transition between -1 and 1. By symmetry, \(u'(x) = -u'(1-x).\)
- 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];
- 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];
- 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?