← Back to team overview

dolfin team mailing list archive

Re: Re: DOLFIN-dev Digest, Vol 21, Issue 35

 

You are right, the overhead will be very small. We have the same
pattern in other places and as long as you do a substantial number of
instructions inside the function call, the overhead of an extra
function call is very small and we gain a lot in flexibility.

/Anders


On Tue, Feb 21, 2006 at 12:42:11PM +0100, Vinicius Lobosco wrote:
> 
> I'm new to Fenics, so you should take my comments with lot of criticism. 
> Thinking about Pattern Designs, I think that it is best to have only one type 
> if classes are nearly the same, what seems to be the case here. Depending of 
> the types PDE gets, it should know which specific funcionalities to use. The 
> advantage is that PDE users can work with one interface and can use nonlinear 
> or linear code at runtime. It will be easier to have an evolving code using 
> PDE. I guess that the drawback is that it can get a little slower, but as it 
> is not very deep in the iteration structure, I think that it wouldn't be 
> noticeable the time difference.
> 
> /Vinicius
> 
> 
> > Is it preferable to have objects LinearPDE, NonlinearPDE, etc, or just
> > one type, PDE, which knows (will be told) whether it is linear,
> > nonlinear, time-dependent, etc?
> >
> > Garth
> >
> > On Tue, 2006-02-21 at 11:19 +0100, Johan Hoffman wrote:
> > > Ok, sounds good. We had a similar structure in early versions of DOLFIN
> > > (StatProblem, TranProblem,...), which I think we removed since we wanted
> > > a more flat structure of PDE tools. But now we have the possibility to
> > > automate a lot of features within each class, so I think a resurrection
> > > is motivated.
> > >
> > > /Johan
> > >
> > > > I've added the class NonlinearPDE in src/kernel/nls, which has a very
> > > > similar interface to the class PDE, and has similar functionality for
> > > > solving.
> > > >
> > > > I think that Anders' suggestion to split-up PDE in the same fashion as
> > > > Function is good a good idea. I'm working in it now - at this stage for
> > > > linear and nonlinear PDE's.
> > > >
> > > > Garth
> > > >
> > > > On Fri, 2006-02-10 at 14:14 -0600, Anders Logg wrote:
> > > >> The new PDE class is now in place and takes care of some of the
> > > >> standard stuff you need to do to solve a static linear PDE: define
> > > >> vectors and matrices, assemble bilinear and linear forms, solve linear
> > > >> system and create a Function from the degrees of freedom.
> > > >>
> > > >> Here's the new version of the Poisson demo:
> > > >>
> > > >>   // Set up problem
> > > >>   UnitSquare mesh(16, 16);
> > > >>   Poisson::BilinearForm a;
> > > >>   Poisson::LinearForm L(f);
> > > >>   PDE pde(a, L, mesh, bc);
> > > >>
> > > >>   // Solve
> > > >>   Function u = pde.solve();
> > > >>
> > > >>   // Save function to file
> > > >>   File file("poisson.pvd");
> > > >>   file << u;
> > > >>
> > > >> This works for all linear static PDEs. I imagine that we can use the
> > > >> PDE class to automate the solution of static nonlinear PDEs,
> > > >> time-dependent etc. Depending on the arguments to the constructor
> > > >> (among other things), the PDE class would know what to do to solve the
> > > >> system. A first step would be to integrate Garth's Newton-solver with
> > > >> the PDE class. Perhaps we need to partition it in the same way as the
> > > >> Function class (GenericPDE, StaticLinearPDE etc) so it's easy to
> > > >> plugin a new solver.
> > > >>
> > > >> Note that as an alternative to
> > > >>
> > > >>   Function u = pde.solve();
> > > >>
> > > >> one can do
> > > >>
> > > >>   Function u;
> > > >>   pde.solve(u);
> > > >>
> > > >> which is slightly more efficient (avoids one copy of the vector of
> > > >> degrees of freedom).
> > > >>
> > > >> The PDE class i parametrized and has one parameter "solver", so you
> > > >> can do either
> > > >>
> > > >>   pde.set("solver", "direct"); // default option
> > > >>
> > > >> or
> > > >>
> > > >>   pde.set("solver", "iterative");
> > > >>
> > > >> /Anders
> > > >>
> > > >> _______________________________________________
> > > >> DOLFIN-dev mailing list
> > > >> DOLFIN-dev@xxxxxxxxxx
> > > >> http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> > > >
> > > > _______________________________________________
> > > > DOLFIN-dev mailing list
> > > > DOLFIN-dev@xxxxxxxxxx
> > > > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> > >
> > > _______________________________________________
> > > DOLFIN-dev mailing list
> > > DOLFIN-dev@xxxxxxxxxx
> > > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> 

-- 
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/



References