Hi Daniel,

Thank you very much! The code runs for me as well: fantastic!

I have to admit that the distinction between cell and face variables remains a 
bit obscure to me… The cell variable X_var is the composition of the system I 
am modelling. Then "G" in d2G is the Gibbs free energy (called f here 
https://www.ctcms.nist.gov/fipy/examples/cahnHilliard/generated/examples.cahnHilliard.mesh2DCoupled.html#module-examples.cahnHilliard.mesh2DCoupled
 
<https://www.ctcms.nist.gov/fipy/examples/cahnHilliard/generated/examples.cahnHilliard.mesh2DCoupled.html#module-examples.cahnHilliard.mesh2DCoupled>),
 which is itself a function of the composition X_var (the spline function).
I don’t know if these info are more useful to figure out if d2G should be cell 
or face variable? As I understood it, because I want to solve for X_var, this 
should be a cell variable and nothing else.

By higher dimension do you also mean 2D? I know 2D requires a lot of changes, 
but I thought 2D required only a change of grid. In any case, 2D is not my top 
priority at the moment.

Thank you again very much for your help!
Clara


> On 12 Jan 2018, at 12:04, Daniel Wheeler <daniel.wheel...@gmail.com> wrote:
> 
> Hi Clara,
> 
> The following changes made it run for me. I turned d2G into a face
> variable and K into a variable that is updated in the sweep loop. I
> also removed redefining the equation. FiPy's designed so you only need
> to to create the equation once. I'm not sure what the values of d2G
> correspond to. Which spatial location do they correspond to? Faces or
> Cells. I'm assuming faces since there are 1001 of them. Also, this
> might need to be adjusted for higher dimensions.
> 
> Cheers,
> 
> Daniel
> 
> ~~~~
> $ git diff
> diff --git a/Spinodal_fipy_FeNi_varT_runs_DEBUG.py
> b/Spinodal_fipy_FeNi_varT_runs_DEBUG.py
> index 715e79b..a82387e 100644
> --- a/Spinodal_fipy_FeNi_varT_runs_DEBUG.py
> +++ b/Spinodal_fipy_FeNi_varT_runs_DEBUG.py
> @@ -289,20 +289,21 @@ def
> Get_spline_Chebnodes(X,N,T0,R,RefFe,RefNi,L0ex,L1ex,L2ex,Tmag,Bmag,p_fcc,A_f
>     return d2G
> 
> 
> +
> ## THIS IS WHERE I WOULD LIKE TO HAVE A FIPY VARIABLE TYPE FOR d2G.
> d2G = 
> Get_spline_Chebnodes(Xf,100,T0,R,RefFe,RefNi,L0ex,L1ex,L2ex,Tmag,Bmag,p_fcc,A_fcc,Nv,Na)*1.0e-9
> -
> +d2G_var = FaceVariable(mesh=mesh, value=d2G)
> 
> ## Initial diffusion coefficient
> -Diff = Mob*d2G
> +Diff = Mob*d2G_var
> 
> 
> ## Initial gradient energy (depending on the interfacial energy we want)
> K = 2.0*kappa[id_mean_spino]
> -
> +K_var = Variable(K)
> 
> ## Initial equation
> -eq = TransientTerm(coeff=1.) == DiffusionTerm(Diff) -
> DiffusionTerm(coeff=(Mob, K))
> +eq = TransientTerm(coeff=1.) == DiffusionTerm(Diff) -
> DiffusionTerm(coeff=(Mob, K_var))
> 
> 
> plt.figure(figsize=(8,6))
> @@ -390,16 +391,16 @@ while time < duration:
>     Mob = M[step_T][id_mean_T]
> 
>     d2G = 
> Get_spline_Chebnodes(Xf,100,T_spino[step_T],R,RefFe,RefNi,L0ex,L1ex,L2ex,Tmag,Bmag,p_fcc,A_fcc,Nv,Na)*1.0e-9
> -
> -    Diff = Mob*d2G
> +    d2G_var[:] = d2G
> 
>     K = 2.0*kappa[step_T]
> +    K_var.setValue(K)
>     print 'Mob, Diff, K'
>     print Mob, Diff, K
>     print 'MAX CONCENTRATION'
>     print max(X_var)
> 
> -    eq = TransientTerm(coeff=1.) == DiffusionTerm(Diff) -
> DiffusionTerm(coeff=(Mob, K))
> +
> 
> 
> print datetime.now() - startTime
> (END)
> ~~~~
> 
> On Thu, Jan 11, 2018 at 2:35 PM, Clara Maurel <cmau...@mit.edu> wrote:
>> Hi Daniel,
>> 
>> Thank you for taking the time to look at this! My main code calls several
>> text files and subroutine. I attach everything that is needed to run the
>> code:
> 
> -- 
> Daniel Wheeler
> _______________________________________________
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to