I am currently working through the examples in the fipy documentation and am trying to adapt the examples.cahnHilliard.mesh2DCoupled
to perform some simulations. The link is : https://www.ctcms.nist.gov/fipy/examples/cahnHilliard/generated/examples.cahnHilliard.mesh2DCoupled.html
It seems that the example code declares an eq3
and a dfdphi_
and does not use these equations anywhere else, even in the solution.
From the documentation:
>>> D = a = epsilon = 1.
>>> dfdphi = a**2 * phi * (1 - phi) * (1 - 2 * phi)
>>> dfdphi_ = a**2 * (1 - phi) * (1 - 2 * phi)
>>> d2fdphi2 = a**2 * (1 - 6 * phi * (1 - phi))
>>> eq1 = (TransientTerm(var=phi) == DiffusionTerm(coeff=D, var=psi))
>>> eq2 = (ImplicitSourceTerm(coeff=1., var=psi)
... == ImplicitSourceTerm(coeff=d2fdphi2, var=phi) - d2fdphi2 * phi + dfdphi
... - DiffusionTerm(coeff=epsilon**2, var=phi))
>>> eq3 = (ImplicitSourceTerm(coeff=1., var=psi)
... == ImplicitSourceTerm(coeff=dfdphi_, var=phi)
... - DiffusionTerm(coeff=epsilon**2, var=phi))
>>> eq = eq1 & eq2
and in the solution block:
>>> while elapsed < duration:
... dt = min(100, numerix.exp(dexp))
... elapsed += dt
... dexp += 0.01
... eq.solve(dt=dt)
... if __name__ == "__main__":
... viewer.plot()
I would appreciate any insight regarding what the eq3
and dfdphi_
terms do. And as an extension to that, how does the solver know to use the old values of $\phi$ to evaluate the linearised form after taylor expression since the solver block does not seem to account for this.