[cig-commits] commit: PETScStokesSolver compiles

Mercurial hg at geodynamics.org
Wed Dec 9 20:51:06 PST 2009


changeset:   93:d80d53c357e0
user:        Marc Spiegelman <mspieg at ldeo.columbia.edu>
date:        Sat Dec 05 08:23:03 2009 -0500
files:       MADDs-1/cpp/PETScStokesSolver.cpp
description:
PETScStokesSolver compiles


diff -r de7f60d82394 -r d80d53c357e0 MADDs-1/cpp/PETScStokesSolver.cpp
--- a/MADDs-1/cpp/PETScStokesSolver.cpp	Sat Dec 05 06:00:28 2009 -0500
+++ b/MADDs-1/cpp/PETScStokesSolver.cpp	Sat Dec 05 08:23:03 2009 -0500
@@ -19,7 +19,6 @@
 #include <dolfin/fem/Assembler.h>
 #include <dolfin/fem/BoundaryCondition.h>
 #include <dolfin/function/Function.h>
-#include <dolfin/function/SubFunction.h>
 #include <dolfin/la/PETScMatrix.h>
 #include <dolfin/la/PETScVector.h>
 #include <dolfin/la/PETScKrylovSolver.h>
@@ -56,9 +55,7 @@ void PETScStokesSolver(const dolfin::For
   PCFieldSplitSetType(pc,PC_COMPOSITE_MULTIPLICATIVE); /* block Gauss-Seidel between the two fields */
 
   //set up splits for P2_P1 fields u,p
-  Function v,p;
-  v = u[0];
-  p = u[1];
+  Function v=u[0],p=u[1];
   PetscInt nBlocks=1, nSubs=0;
   PetscInt idx0[] = {0};
   PetscInt idx1[] = {v.vector().size()};
@@ -110,11 +107,11 @@ void PETScStokesSolver(const dolfin::For
 
     // set null space vector pressure components to q
     double*  values = new double[xn.size()];
-    xn.get(values);
+    xn.get_local(values);
     int istart = xn.size()-p.vector().size();
     for (dolfin::uint i=istart; i < xn.size(); i++ )
       values[i] = q;
-    xn.set(values);
+    xn.set_local(values);
     xn.apply();
     delete [] values; 
 
@@ -128,7 +125,7 @@ void PETScStokesSolver(const dolfin::For
     //check to see if it's really in the null space
     PETScVector y;
     A.mult(xn, y);
-    printf("||A*x_n||=%g, y_max=%g, y_min=%g\n",y.norm(dolfin::l2),y.max(),y.min()); 
+    printf("||A*x_n||=%g, y_max=%g, y_min=%g\n",y.norm("l2"),y.max(),y.min()); 
   }
 
   KSPSolve(ksp, *b.vec(), *x.vec());



More information about the CIG-COMMITS mailing list