Mesh from Cahn-Hillard?


I am currently working through the Cahn-Hillard-example and my interested peaked!
As I understand it, the equations models phase separation, so it can be used to procedural generate configurations with two phases.
So would like to now if we could:

  1. take the solution at a certain time step,
  2. declare i.e. a solid and liquid phase based on the solution function (something like )
  3. solve a fluid-flow on the whole domain?

For the record I am not so much interested in a complete solution, because I like to challenge my self, but rather interested how the software specific concepts of FENICS could be used to do this. If nobody dislikes this idea I would also like to use this post to link informations, code and resources to this challenge, and hopefully at one point post the complete solution.

The first partial solution for this problem seems to be found in this useful post:
Identifying subdomains from level set function on fenicsx
From what I understand we can use a “conditional” to identfy the subdomains.
The other suggestion of meshing the boundary seems not possible, since we do not know the the analytic solution.
To reduce the error we can do 2 things:

  • increase the number of elements
  • (recommended in the post) increase order of elements
    Therefor we have to rewite the tutorial to account for higher order elements load a certain example and use the conditional to identify the subdomains