Index: /issm/trunk-jpl/externalpackages/petsc/install-3.7-macosx64.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.7-macosx64.sh	(revision 20553)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.7-macosx64.sh	(revision 20553)
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -eu
+
+#Some cleanup
+rm -rf install petsc-3.7.0 src
+mkdir install src
+
+#Download from ISSM server
+$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-lite-3.7.0.tar.gz' 'petsc-3.7.0.tar.gz'
+
+#Untar and move petsc to install directory
+tar -zxvf  petsc-3.7.0.tar.gz
+mv petsc-3.7.0/* src/
+rm -rf petsc-3.7.0
+
+#configure
+cd src
+./config/configure.py \
+	--CXXOPTFLAGS="-g -O3" \
+	--COPTFLAGS="-g -O3" \
+	--FOPTFLAGS="-g -O3" \
+	--prefix="$ISSM_DIR/externalpackages/petsc/install" \
+	--with-mpi-dir="$ISSM_DIR/externalpackages/mpich/install" \
+	--PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
+	--with-debugging=0 \
+	--with-valgrind=0 \
+	--with-x=0 \
+	--with-ssl=0 \
+	--with-shared-libraries=1 \
+	--download-metis=1 \
+	--download-parmetis=1 \
+	--download-mumps=1 \
+	--download-scalapack=1
+
+#Compile and intall
+make
+make install
Index: /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp	(revision 20552)
+++ /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp	(revision 20553)
@@ -560,6 +560,11 @@
 		PetscOptionsInsertMultipleString(options); //our patch
 		#else
+		#if (_PETSC_MINOR_>=7)
+		PetscOptionsSetFromOptions(NULL);
+		PetscOptionsClear(NULL);
+		#else
 		PetscOptionsSetFromOptions();
 		PetscOptionsClear();
+		#endif
 		//PetscOptionsSetFromOptions();
 		PetscOptionsInsertMultipleString(options); //our patch
Index: /issm/trunk-jpl/src/c/cores/controltao_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/controltao_core.cpp	(revision 20552)
+++ /issm/trunk-jpl/src/c/cores/controltao_core.cpp	(revision 20553)
@@ -36,5 +36,5 @@
 	int                 num_controls,solution_type;
 	int                 maxsteps,maxiter;
-	IssmDouble          fatol,frtol,gatol,grtol,gttol;
+	IssmDouble          gatol,grtol,gttol;
 	AppCtx              user;
 	#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
@@ -64,6 +64,4 @@
 	femmodel->parameters->FindParam(&maxsteps,InversionMaxstepsEnum);
 	femmodel->parameters->FindParam(&maxiter,InversionMaxiterEnum);
-	femmodel->parameters->FindParam(&fatol,InversionFatolEnum);
-	femmodel->parameters->FindParam(&frtol,InversionFrtolEnum);
 	femmodel->parameters->FindParam(&gatol,InversionGatolEnum);
 	femmodel->parameters->FindParam(&grtol,InversionGrtolEnum);
@@ -85,5 +83,9 @@
 	TaoSetMaximumFunctionEvaluations(tao,maxiter);
 	TaoSetMaximumIterations(tao,maxsteps);
-	TaoSetTolerances(tao,fatol,frtol,gatol,grtol,gttol);
+	#if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_<7)
+	TaoSetTolerances(tao,0,0,gatol,grtol,gttol);
+	#else
+	TaoSetTolerances(tao,gatol,grtol,gttol);
+	#endif
 
 	GetVectorFromControlInputsx(&X, femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"value");
Index: /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscSolver.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscSolver.cpp	(revision 20552)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscSolver.cpp	(revision 20553)
@@ -64,5 +64,9 @@
 	if(VerboseSolver())PetscOptionsPrint(stdout);
 	#else
-	if(VerboseSolver())PetscOptionsView(PETSC_VIEWER_STDOUT_WORLD);
+		#if _PETSC_MINOR_<7
+		if(VerboseSolver())PetscOptionsView(PETSC_VIEWER_STDOUT_WORLD);
+		#else
+		if(VerboseSolver())PetscOptionsView(NULL,PETSC_VIEWER_STDOUT_WORLD);
+		#endif
 	#endif
 
@@ -77,5 +81,9 @@
 	/*Now, check that we are not giving an initial guess to the solver, if we are running a direct solver: */
 	#if _PETSC_MAJOR_ >= 3 
-	PetscOptionsGetString(PETSC_NULL,"-ksp_type",ksp_type,49,&flg);
+		#if _PETSC_MINOR_<7
+		PetscOptionsGetString(PETSC_NULL,"-ksp_type",ksp_type,49,&flg);
+		#else
+		PetscOptionsGetString(NULL,PETSC_NULL,"-ksp_type",ksp_type,49,&flg);
+		#endif
 	if (strcmp(ksp_type,"preonly")==0)uf0=NULL;
 	#endif
Index: /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp	(revision 20552)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp	(revision 20553)
@@ -31,5 +31,9 @@
 
 	/*retrieve mat_type option: */
+	#if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=7)
+	PetscOptionsGetString(NULL,PETSC_NULL,"-mat_type",&option[0],100,&flag);
+	#else
 	PetscOptionsGetString(PETSC_NULL,"-mat_type",&option[0],100,&flag);
+	#endif
 
 	if (strcmp(option,"aijmumps")==0){
@@ -53,5 +57,9 @@
 
 	#if _PETSC_MAJOR_ >= 3 
-	PetscOptionsGetString(PETSC_NULL,"-pc_factor_mat_solver_package",&option[0],100,&flag);
+		#if (_PETSC_MINOR_>=7)
+		PetscOptionsGetString(NULL,PETSC_NULL,"-pc_factor_mat_solver_package",&option[0],100,&flag);
+		#else
+		PetscOptionsGetString(PETSC_NULL,"-pc_factor_mat_solver_package",&option[0],100,&flag);
+		#endif
 	if (strcmp(option,"mumps")==0){
 		solver_type=MUMPSPACKAGE_LU;
@@ -59,5 +67,9 @@
 	#endif
 
+	#if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=7)
+	PetscOptionsGetString(NULL,PETSC_NULL,"-issm_option_solver",&option[0],100,&flag);
+	#else
 	PetscOptionsGetString(PETSC_NULL,"-issm_option_solver",&option[0],100,&flag);
+	#endif
 	if (strcmp(option,"FS")==0){
 		solver_type=FSSolverEnum;
Index: /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp	(revision 20552)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp	(revision 20553)
@@ -56,5 +56,9 @@
 				len--; first[len] = 0;
 			}
+			#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 7
 			PetscOptionsSetValue(first,second);
+			#else
+			PetscOptionsSetValue(NULL,first,second);
+			#endif
 			break;
 		}
@@ -67,5 +71,9 @@
 					len--; first[len] = 0;
 				}
+				#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 7
 				PetscOptionsSetValue(first,NULL);
+				#else
+				PetscOptionsSetValue(NULL,first,NULL);
+				#endif
 				/*Preparing next loop step*/
 				first=second;
@@ -78,5 +86,9 @@
 					len--; second[len] = 0;
 				}
+				#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 7
 				PetscOptionsSetValue(first,second);
+				#else
+				PetscOptionsSetValue(NULL,first,second);
+				#endif
 				first_token=1;
 			}
