> On Jun 27, 2016, at 6:44 PM, Abhilash Mathews <amath...@uwo.ca> wrote:
> 
> Fair enough, thank you for the clarification. I've updated the code 
> accordingly:


> When coupling the equations, should it be done separately for the partial 
> derivatives with respect to time and z (i.e. eq1, eq2, and eq3 are coupled 
> together, and eq4 and eq5 are coupled together since E1 or E2 is not updated 
> as N1, P1, and P2 are over the time steps)? 

You should couple all of the equations together, if you can. eq4 and eq5 are 
quasistatic, but the values of P1, P2, E1, and E2 are used in eq1, eq2, and 
eq3, so you want everything updating implicitly together.

> 
> Also, with the current code, the variables do not appear to be evolving.

This code is mixing up timesteps and sweeps. 

> while res > 1e-10:
>     res = eq.sweep(dt=dt)
>     N1.updateOld()
>     P1.updateOld()
>     P2.updateOld()
>     E1.updateOld()
>     E2.updateOld()
>     print E1, E2


Sweeping is about achieving convergence on the non-linear elements of your 
equations at a given timestep. Once converged, you can then advance to the next 
timestep (using .updateOld()). You need two nested loops to achieve this. See 
the example at the end of:

  
http://www.ctcms.nist.gov/fipy/documentation/FAQ.html#iterations-timesteps-and-sweeps-oh-my

There are no TransientTerms for E1 and E2, so they should not be declared with 
`hasOld=True` and you should not call .updateOld() on them. This shouldn't be 
harmful, but in my experience it is sometimes.


> I am using a 2D mesh grid for both the temporal and spatial domain considered 
> as I would eventually like to see how N1, P1, P2, E1, and E2 vary both on z 
> and t, but is this the correct approach? It seems as though it might not be 
> appropriately handled by the CentralDifferenceConvectionTerm when doing so. 

FiPy's meshes are purely spatial. They would not do the right thing if one of 
the dimensions is time. You would need to build up a separate 2D array if you 
want to visualize a sequence of time steps as a single image.


_______________________________________________
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