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
