← Back to team overview

dolfin team mailing list archive

Re: [Question #105304]: have trouble to understand cahn-hilliard demo code

 

I believe this is the paper describing the methods used in the demo.

http://dx.doi.org/10.1016/j.jcp.2006.03.010

The split is done to separate the equations based on the Mixed Space.
This comes from the UFL specification so the manual there could give
you more information.  It is written this way so that a and L can be
automatically linearized for the Newton-Raphson method.

The CahnHillardEquation class is a NonlinearProblem.  This is the
simple way to use Newton-Raphson method that is coded in dolfin.  In
this style you need to specify the application of F and its jacobian
J.  The easiest way to do that is to define a form and have UFL/FFC
generate the derivatives for you.  The newon solver will reconstruct F
and J as it needs to for the Newton-Raphson method.

I hope that helps.

-- Andy


On Tue, Mar 23, 2010 at 10:53 AM, cutejeff
<question105304@xxxxxxxxxxxxxxxxxxxxx> wrote:
> New question #105304 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/105304
>
> There is a demo code under src/demo/pde/cahn-hilliard/ to solve the Cahn-Hilliard equation, which is a fourth-order nonlinear time-dependent problem. Since my problem is also nonlinear initial value problem, I want to follow this code as an example.
> I have gone through the nonlinear and time-dependent prob parts in the tutorial.  But I still have trouble to understand the approach the author did. He seems to split the original eqn into 2 eqns. Does anybody know the original eqn and the derivations?
>
> I also have trouble to understand the following code:
> dk, dc = split(du)
>
> class CahnHilliardEquation(NonlinearProblem):
>    def __init__(self, a, L):
>        NonlinearProblem.__init__(self)
>        self.L = L
>        self.a = a
>        self.reset_sparsity = True
>    def F(self, b, x):
>        assemble(self.L, tensor=b)
>    def J(self, A, x):
>        assemble(self.a, tensor=A, reset_sparsity=self.reset_sparsity)
>        self.reset_sparsity = False
>
> They haven't been covered in the tutorial. Are there any other documents to learn these?
> Any help will be appreciated.
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp
>



Follow ups

References