Hi guys
I propose to add the attached patch to trunk. It adds an integer
storing the convergence reason returned by the PETSc nonlinear solver,
closely analogous to the existing convergence boolean flag, which is
somewhat meager. Without this, the convergence reason is lost right
after solving, without allowing the user to find out about it inside
their programs (because SNESDestroy(_snes) is called immediately, i.e.
before solve() finishes).
You may argue that the -snes_converged_reason command line option
readily prints the desired information. That's right, but in some
cases it is desirable to know INSIDE the C++ program, not just on
stdout, at least it is in mine. :-) In the PETSs linear solver (KSP)
this information is implemented, just not in the nonlinear one (SNES).
What do you think?
Roman
Index: include/solvers/nonlinear_solver.h
===================================================================
--- include/solvers/nonlinear_solver.h (revision 4200)
+++ include/solvers/nonlinear_solver.h (working copy)
@@ -206,6 +206,12 @@
*/
bool converged;
+ /**
+ * After a call to solve this will reflect the reason code for
+ * convergence/divergence.
+ */
+ int converged_reason;
+
protected:
/**
* A reference to the system we are solving.
Index: src/solvers/petsc_nonlinear_solver.C
===================================================================
--- src/solvers/petsc_nonlinear_solver.C (revision 4200)
+++ src/solvers/petsc_nonlinear_solver.C (working copy)
@@ -342,6 +342,7 @@
//Based on Petsc 2.3.3 documentation all diverged reasons are negative
this->converged = reason >= 0;
+ this->converged_reason = reason;
this->clear();
------------------------------------------------------------------------------
Index, Search & Analyze Logs and other IT data in Real-Time with Splunk
Collect, index and harness all the fast moving IT data generated by your
applications, servers and devices whether physical, virtual or in the cloud.
Deliver compliance at lower cost and gain new business insights.
Free Software Download: http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel