1
$\begingroup$

How can we define the initial value for Cahn-Hilliard problem (links) using FEM in MMA?

Complete test code (I am using MIXED formulation for C1 Problem):

Needs["NDSolve`FEM`"]
\[CapitalOmega]=ImplicitRegion[{0<=x<=1,0<=y<=1},{x,y}];
RegionPlot[\[CapitalOmega],PlotRange->{{0,1},{0,1}}]
Mobi = 1.0; lame = 0.01;
op1 = \!\(
\*SubscriptBox[\(\[PartialD]\), \(t\)]\(u[t, x, y]\)\) - Mobi.\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(v[t, x, y]\)\)

op2 = v[t, x, y] - 
  200 u[t, x, y] (1 - 3 u[t, x, y] + 2 u[t, x, y]^2) + lame.\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[t, x, 
     y]\)\(\ \)\)

Subscript[\[CapitalGamma], N1] = 
 NeumannValue[Mobi* lame.u[t, x, y], {0 <= x <= 1, 0 <= y <= 1}]

{nufun, nvfun} = 
  NDSolveValue[{op1 == Subscript[\[CapitalGamma], N1], op2 == 0}, {u, 
    v}, {t, 0, 100}, {x, y} \[Element] \[CapitalOmega]];
$\endgroup$
  • $\begingroup$ There are also other problems in your code: The Dots after Mobi and lame have to be removed and you have not specified boundary conditions for v. $\endgroup$ – Henrik Schumacher Jul 20 '19 at 1:27
  • $\begingroup$ @HenrikSchumacher I have checked the bcs, you may see Eq 5.1 from fenicsproject.org/olddocs/dolfin/1.3.0/python/demo/documented/… $\endgroup$ – ABCDEMMM Jul 20 '19 at 1:33
  • $\begingroup$ Yeah, so you have to specify them also in the call to NDSolve. $\endgroup$ – Henrik Schumacher Jul 20 '19 at 1:36
1
$\begingroup$

This is one of many ways to create "random" initial value conditions:

Ωdisc = ToElementMesh[Ω];
n = Length[Ωdisc["Coordinates"]];
u0 = ElementMeshInterpolation[{Ωdisc}, RandomReal[{-2, 2}, n]];
Plot3D[u0[x, y], {x, y} ∈ Ωdisc]

It might be a good idea to use Ωdisc] also in the call to NDSolveValues instead of Ω.

$\endgroup$
  • $\begingroup$ @Herik Schumacher, this initial value definition not works. $0.625107,0.634007,<42>>, 0.639777,0.627036,0.625157, \ll 3151>>\},\{\text { Automatic }\} ]$ should be a rank 2 tensor of machine-size real numbers. $\endgroup$ – ABCDEMMM Jul 20 '19 at 9:55
  • $\begingroup$ That's probably because this is only an initial condition for u, not for v. $\endgroup$ – Henrik Schumacher Jul 20 '19 at 12:37
  • $\begingroup$ u[0, x, y] == u0[x, y]??? $\endgroup$ – ABCDEMMM Jul 20 '19 at 12:40
  • $\begingroup$ Yes, that's how you should use it. But v needs also initial conditions. And boundary conditions. $\endgroup$ – Henrik Schumacher Jul 20 '19 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.