I am trying to simulate the Cahn-Hilliard equation using Python, but the 2 fluids aren't separating into big blobs, as desired, under any conditions. I'm setting up (what I think is) an orthogonal mesh with uniform concentration values of 0.5 plus random noise values within ±0.05. $\gamma = 0.5$. $D$ = 50. Time steps of 1 'second'. Total time of 10 'seconds'.
The first image shows the state at $t$ = 1s. The second image shows it at $t$ = 2s, after which the system ceases to evolve. When zoomed in, Image 2 looks a bit like what I expected but its too fine; I'm hoping for bigger clumps as in Expecting:
After 1 s:
After 2 s:
Expecting:
To find the second derivative I am using (for $\frac{d^2}{dx^2}$):
mesh_out[y][x] = mesh_in[y][x+2]) - (2 * mesh_in[y][x]) + mesh_in[y][x-2]
After each time step if the concentration at a point is greater than 1 is set it back to 1. Likewise, if it's less than -1 I set it to -1.
I have tried messing about with values of the time step, $D$, $\gamma$, initial concentration but they seem to make no difference. I am not using any interpolation - should I be? (If so can you point me to any relevant information?) Otherwise, I'm not sure why this isn't producing the results I'm after. My suspicion is that I should be using interpolation but my not sure why this would make a difference. Do I need an energy minimising function of some sort? I've seen people mentioning the Gibbs free energy, for example. Any help/suggestions would be appreciated.
I haven't posted any code as I don't know which bits will be helpful.