[cig-commits] r20793 - short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/problems

brad at geodynamics.org brad at geodynamics.org
Fri Sep 28 12:56:44 PDT 2012


Author: brad
Date: 2012-09-28 12:56:44 -0700 (Fri, 28 Sep 2012)
New Revision: 20793

Modified:
   short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/problems/SolverNonlinear.cc
Log:
Set default line search type to customized bt, but allow user to override.

Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/problems/SolverNonlinear.cc	2012-09-28 18:06:37 UTC (rev 20792)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/problems/SolverNonlinear.cc	2012-09-28 19:56:44 UTC (rev 20793)
@@ -103,13 +103,15 @@
   err = SNESSetJacobian(_snes, jacobian.matrix(), _jacobianPC, reformJacobian, (void*) formulation);
   CHECK_PETSC_ERROR(err);
 
-  err = SNESSetFromOptions(_snes); CHECK_PETSC_ERROR(err);
-  err = SNESSetComputeInitialGuess(_snes, initialGuess, (void*) formulation); CHECK_PETSC_ERROR(err);
+  // Set default line search type to SNESSHELL and use our custom line search
   PetscSNESLineSearch ls;
+  err = SNESGetSNESLineSearch(_snes, &ls);CHECK_PETSC_ERROR(err);
+  err = SNESLineSearchSetType(ls, SNESSHELL);CHECK_PETSC_ERROR(err);
+  err = SNESLineSearchShellSetUserFunc(ls, lineSearch, (void*) formulation);CHECK_PETSC_ERROR(err);
 
-  err = SNESGetSNESLineSearch(_snes, &ls); CHECK_PETSC_ERROR(err);
-  err = SNESLineSearchSetType(ls, SNESSHELL); CHECK_PETSC_ERROR(err);
-  err = SNESLineSearchShellSetUserFunc(ls, lineSearch, (void*) formulation); CHECK_PETSC_ERROR(err);
+  // Get SNES options and allow the user to override the line search type
+  err = SNESSetFromOptions(_snes);CHECK_PETSC_ERROR(err);
+  err = SNESSetComputeInitialGuess(_snes, initialGuess, (void*) formulation);CHECK_PETSC_ERROR(err);
 
   if (formulation->splitFields()) {
     PetscKSP ksp = 0;



More information about the CIG-COMMITS mailing list