Newton solver vs. iterating as Newton solver

Asked by B. Emek Abali

hi, where can I find what VariationalProblem(...nonlinear=True...) is really doing, I can follow until the cpp.py where the classes have been defined, but cannot find the .cpp data where the functions are written, my aim to find out is why,

if I use my own Newton iteration procedure, like
...
problem = VariationalProblem(G, F, bcs=bc, ...)
dv = problem.solve()
differ = dv.vector().array()
eps = numpy.linalg.norm(differ, ord=2)
print 'K=%g : after iteration=%d , the L2-Norm of perturbation: %g ' % (mat['K'],iter, eps)
v.vector()[:] += dv.vector()
...

vs. the automatized one
...
problem = VariationalProblem(G, F, bcs=bc, nonlinear=True, ...)
problem.solve(v)
...

they do not have the same convergence tendency, neither the same solution (if both would converge to one)?

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Garth Wells
Solved:
Last query:
Last reply:
Revision history for this message
Best Garth Wells (garth-wells) said :
#1

On 22/12/10 16:10, B. Emek Abali wrote:
> New question #138742 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/138742
>
> hi, where can I find what VariationalProblem(...nonlinear=True...) is really doing, I can follow until the cpp.py where the classes have been defined, but cannot find the .cpp data where the functions are written, my aim to find out is why,
>

Look in dolfin/fem/VariationalProblem.cpp

> if I use my own Newton iteration procedure, like
> ...
> problem = VariationalProblem(G, F, bcs=bc, ...)
> dv = problem.solve()
> differ = dv.vector().array()
> eps = numpy.linalg.norm(differ, ord=2)
> print 'K=%g : after iteration=%d , the L2-Norm of perturbation: %g ' % (mat['K'],iter, eps)
> v.vector()[:] += dv.vector()
> ...
>

The above code doesn't apply non-zero Dirichlet bcs correctly for a
Newton method.

Garth

> vs. the automatized one
> ...
> problem = VariationalProblem(G, F, bcs=bc, nonlinear=True, ...)
> problem.solve(v)
> ...
>
> they do not have the same convergence tendency, neither the same solution (if both would converge to one)?
>

Revision history for this message
B. Emek Abali (bilenemek) said :
#2

Thanks Garth Wells, that solved my question.

Revision history for this message
B. Emek Abali (bilenemek) said :
#3

Thank You Garth Wells, that was exactly the information, now I am changing it to
assemble_system(a, L, bc)

by the way, also thanks to your code in the paper
Phase field model for coupled displacive and diffusive microstructural processes under thermal loading
I am able to construct some updates inside the iteration.

thanks a lot,