[cig-commits] r18857 - short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems

brad at geodynamics.org brad at geodynamics.org
Fri Aug 26 12:44:47 PDT 2011


Author: brad
Date: 2011-08-26 12:44:47 -0700 (Fri, 26 Aug 2011)
New Revision: 18857

Modified:
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverNonlinear.cc
Log:
Temporary fix to nonlinear solver line search to keep lambda in proper range.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverNonlinear.cc	2011-08-26 18:07:09 UTC (rev 18856)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverNonlinear.cc	2011-08-26 19:44:47 UTC (rev 18857)
@@ -390,7 +390,24 @@
     if (a == 0.0) {
       lambdatemp = -initslope/(2.0*b);
     } else {
+
+      // MATT: Check this
+      // 
+      // Temporary fix by Brad to keep lambda in proper
+      // range. Necessary due to underflow and overflow of a, b, c,
+      // and d.
+#if 0 
       lambdatemp = (-b + sqrt(d))/(3.0*a);
+#else
+      if ((-b + sqrt(d) > 0.0 && a > 0.0) ||
+	  (-b + sqrt(d) < 0.0 && a < 0.0)) {
+	lambdatemp = (-b + sqrt(d))/(3.0*a);
+      } else {
+	lambdatemp = 0.05*lambda;
+      } // else
+#endif   
+
+ 
     } // if/else
     lambdaprev = lambda;
     gnormprev  = *gnorm;
@@ -400,6 +417,9 @@
       lambda = .1*lambda;
     else
       lambda = lambdatemp;
+
+
+
     ierr  = VecWAXPY(w,-lambda,y,x);CHKERRQ(ierr);
     if (snes->nfuncs >= snes->max_funcs) {
       ierr = PetscInfo1(snes,"Exceeded maximum function evaluations, "



More information about the CIG-COMMITS mailing list