← Back to team overview

dolfin team mailing list archive

Simplified solution process

 

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



Follow ups