On Tue, Dec 23, 2008 at 05:02:47PM +0000, Garth N. Wells wrote:
Anders Logg wrote:
On Tue, Dec 23, 2008 at 03:28:44PM +0000, Garth N. Wells wrote:
Anders Logg wrote:
Why is there a pseudo time-stepping algorithm built into
NonlinearPDE::solve?
So that the PDE can be solved with a series of Newton steps and boundary
conditions can functions of pseudo time t.
Will it not converge if we just call the
NewtonSolver directly?
Not always.
ok.
It would be better if the LinearPDE and NonlinearPDE only provided a
layer between the forms and the linear/nonlinear solvers.
If we need a pseudo time-stepping algorith, it can be built into
NewtonSolver, or maybe another class?
I wouldn't put it NewtonSolver. Best to keep NewtonSolver abstract (i.e.
unaware of PDEs) and just let it perform Newton solves. We could create
a class like NonlinearSolver or NonlinearPDESolver.
NonlinearPDESolver would not be consistent with the current LinearPDE
class which is in some sense is a solver for linear PDEs.
Most nonlinear PDEs are sufficiently complex and the solution methods so
diverse that for non-trivial problems I would expect that a user will
implement the solution procedure, and a NonlinearPDE class is not very
useful. Perhaps we could just provide more building blocks to make the
construction of nonlinear solvers easy?
I would be inclined to just remove the NonlinearPDE class and
implement the pseudo time-stepping directly in the demo:
This is what I do in practice all the time, so removing NonlinearPDE is
fine with me.
ok. I'll fix when I get a chance.
while t < T:
A = assemble()
b = assemble()
bc.apply()
newton_solver.solve(...)
f.t = t
bc.t = t
I added a Python class to take care of the time (it's in dolfin_time.py).
t += dt
Wouldn't it be simpler to just use a float? If one defines
f = Function(V, "t*sin(x[0])")
then one may automatically change the variable t by
f.t = t
thanks to some fancy magic Johan cooked up in the new Python Function
class(es).