[petsc-dev] KSP monitor
Nathan Collier
nathaniel.collier at gmail.com
Tue Apr 26 06:50:58 CDT 2011
Good day,
I am solving a linear problem using finite elements with PETSC and I
want to look at the H1 norm of my true error as a function of KSP
iterations. I registered my own monitor function with KSP which looks
something like the last function in this example:
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/src/ksp/ksp/examples/tutorials/ex9.c.html
where I get the current state of the solution vector using
KSPBuildSolution(kps,PETSC_NULL,&U)
Then I use U to compute the H1 norm. As per the documentation I do not
Destroy U after. When I have this monitor function registered, my H1
norm diverges while the KSP residual converges. Also, I compute the
final H1 norm (outside of the monitor) and it is divergent, which
matches the last iteration. If I remove my monitor function, things
work well.
What am I screwing up? How can I access the current solution vector in
a KSP monitor? Do I need to use a vector that I create from a DA since
my FEM matrix assembly is based in DAs?
Thanks,
NAte
--
Nathan Collier
Postdoctoral Researcher
King Abdullah University of Science and Technology (KAUST)
nathaniel.collier at gmail.com
nathaniel.collier at kaust.edu.sa
More information about the petsc-dev
mailing list