Hi, if anybody got a chance to look into the code, please comment. Thanks. On Aug 13, 2014, at 4:24 PM, Aniruddha Jana <[email protected]> wrote:
> Here are the two codes for FEniCS (demo_cahn-hilliard.py) and FiPy > (spinodal2D.py). I have commented out the file saving part in both the > programs so that we can only compare the computation time. The mesh sizes and > time stepping are also equivalent. I still believe that there is something I > am doing wrong, so please have a careful look. Thanks a lot. > > <demo_cahn-hilliard.py><spinodal2D.py> > On Aug 13, 2014, at 2:32 AM, Jan Blechta <[email protected]> wrote: > >> Could you provide the codes? It would be interesting... >> >> Jan >> >> >> On Tue, 12 Aug 2014 19:59:45 -0400 >> Aniruddha Jana <[email protected]> wrote: >> >>> Thanks for the detailed thoughts, that helps. For the time stepping, >>> I used the same time stepping for FiPy as given in the Fenics C-H >>> demo (a constant increment). I made the two codes as similar as >>> possible from the front end before the comparison. >>> >>> >>> On Aug 12, 2014, at 3:30 PM, Mike Welland <[email protected]> >>> wrote: >>> >>>> One contributing factor could be the difference between finite >>>> element vs. finite volume. In the fenics CH demo, the 4th order >>>> diff eq is split into 2nd order eqs. for reasons discussed under >>>> section 5.1.1. Mixed Form on the doc page. FiPy's demo doesn't >>>> seem to do that (at least as far as I can see). Finite difference >>>> codes also don't need to split. >>>> >>>> Now if that could explain a factor of almost 40 is another matter >>>> entirely. You would have to dig into things like time stepping, >>>> error control, etc. .e.g: It looks like FiPy uses an exponential >>>> time step whereas the fenics version uses a constant. >>>> >>>> Depending on what you want to do ultimately, bear in mind issues >>>> like parallelization, mesh refinement, supported linear backend >>>> (fenics = PETSc, dunno about FiPy) etc. >>>> >>>> Mike >>>> >>>> >>>> On Tue, Aug 12, 2014 at 2:13 PM, Aniruddha Jana <[email protected]> >>>> wrote: I ran with same mesh sizes and for equal time steps. >>>> >>>> On August 12, 2014 1:57:30 PM EDT, Jan Blechta >>>> <[email protected]> wrote: If FyPi Canh-Hilliard example >>>> is this one >>>> http://www.ctcms.nist.gov/fipy/examples/cahnHilliard/generated/examples.cahnHilliard.mesh2DCoupled.html >>>> >>>> >>>> then the reason is very simple: >>>> >>>> # FEniCS >>>> mesh = UnitSquareMesh(96, 96) >>>> >>>> # FiPy >>>> __name__ == "__main__": >>>> nx = ny = 20 >>>> else: >>>> nx = ny = 10 >>>> mesh = Grid2D(nx=nx, ny=ny, dx=0.25, dy=0.25) >>>> >>>> >>>> >>>> Also the function space may be different if FiPy's 'CellVariable' is >>>> something-like piece-wise constants. >>>> >>>> Jan >>>> >>>> >>>> On Tue, 12 Aug 2014 10:42:50 -0400 >>>> Aniruddha Jana <[email protected]> wrote: >>>> >>>> >>>> >>>> Hello, >>>> >>>> I am trying to learn FEniCS, and have been using FiPy so far. I ! >>>> ran >>>> >>>> the Python Cahn-Hilliard example. The program took around 80 >>>> seconds to run in serial, while a FiPy Cahn-Hillard program with >>>> similar size and settings took only 2.72 seconds. I think I am >>>> making some mistake >>>> >>>> >>>> here as I expected FEniCS to be better than FiPy in terms of >>>> speed. >>>> Can somebody please comment on the speed and memory issues, >>>> especially in comparison to FiPy? Since I am trying to learn using >>>> FEniCS, I would appreciate any such comments. >>>> >>>> >>>> >>>> Many thanks, >>>> Aniruddha >>>> >>>> fenics mailing list >>>> [email protected] >>>> http://fenicsproject.org/mailman/listinfo/fenics >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> fenics mailing list >>>> [email protected] >>>> http://fenicsproject.org/mailman/listinfo/fenics >>>> >>>> >>> >> > > _______________________________________________ > fenics mailing list > [email protected] > http://fenicsproject.org/mailman/listinfo/fenics _______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
