[cig-commits] r1408 - in branches/s-wang2: for_deal.II/examples/step-32 for_deal.II/include/deal.II/lac source/simulator

s-wang at dealii.org s-wang at dealii.org
Sat Dec 1 20:06:07 PST 2012


Author: s-wang
Date: 2012-12-01 21:06:06 -0700 (Sat, 01 Dec 2012)
New Revision: 1408

Modified:
   branches/s-wang2/for_deal.II/examples/step-32/test-step-32.cc
   branches/s-wang2/for_deal.II/include/deal.II/lac/petsc_parallel_vector.h
   branches/s-wang2/source/simulator/checkpoint_restart.cc
   branches/s-wang2/source/simulator/core.cc
   branches/s-wang2/source/simulator/initial_conditions.cc
   branches/s-wang2/source/simulator/solver.cc
Log:
removed update_ghost_values() previously needed by Petsc vectors.

Modified: branches/s-wang2/for_deal.II/examples/step-32/test-step-32.cc
===================================================================
--- branches/s-wang2/for_deal.II/examples/step-32/test-step-32.cc	2012-12-01 13:33:08 UTC (rev 1407)
+++ branches/s-wang2/for_deal.II/examples/step-32/test-step-32.cc	2012-12-02 04:06:06 UTC (rev 1408)
@@ -2330,9 +2330,6 @@
     temperature_solution = solution;
     old_temperature_solution = solution;
     old_old_temperature_solution = solution;
-    temperature_solution.update_ghost_values();
-    old_temperature_solution.update_ghost_values();
-    old_old_temperature_solution.update_ghost_values();
   }
 
 

Modified: branches/s-wang2/for_deal.II/include/deal.II/lac/petsc_parallel_vector.h
===================================================================
--- branches/s-wang2/for_deal.II/include/deal.II/lac/petsc_parallel_vector.h	2012-12-01 13:33:08 UTC (rev 1407)
+++ branches/s-wang2/for_deal.II/include/deal.II/lac/petsc_parallel_vector.h	2012-12-02 04:06:06 UTC (rev 1408)
@@ -486,6 +486,9 @@
       const int ierr = VecCopy (v.vector, vector);
       AssertThrow (ierr == 0, ExcPETScError(ierr));
 
+      if (ghosted)
+    	  update_ghost_values();
+
       return *this;
     }
 

Modified: branches/s-wang2/source/simulator/checkpoint_restart.cc
===================================================================
--- branches/s-wang2/source/simulator/checkpoint_restart.cc	2012-12-01 13:33:08 UTC (rev 1407)
+++ branches/s-wang2/source/simulator/checkpoint_restart.cc	2012-12-02 04:06:06 UTC (rev 1408)
@@ -160,9 +160,9 @@
 
     system_trans.deserialize (x_system);
 
-    solution = distributed_system;						solution.update_ghost_values();
-    old_solution = old_distributed_system;				old_solution.update_ghost_values();
-    old_old_solution = old_old_distributed_system;		old_old_solution.update_ghost_values();
+    solution = distributed_system;
+    old_solution = old_distributed_system;
+    old_old_solution = old_old_distributed_system;
 
     //read zlib compressed resume.z
     {

Modified: branches/s-wang2/source/simulator/core.cc
===================================================================
--- branches/s-wang2/source/simulator/core.cc	2012-12-01 13:33:08 UTC (rev 1407)
+++ branches/s-wang2/source/simulator/core.cc	2012-12-02 04:06:06 UTC (rev 1408)
@@ -1203,8 +1203,8 @@
       system_tmp[1] = &(old_distributed_system);
 
       system_trans.interpolate (system_tmp);
-      solution     = distributed_system;				solution.update_ghost_values();
-      old_solution = old_distributed_system;			old_solution.update_ghost_values();
+      solution     = distributed_system;
+      old_solution = old_distributed_system;
     }
 
     computing_timer.exit_section();
@@ -1218,7 +1218,7 @@
   {
     // start any scheme with an extrapolated value from the previous
     // two time steps if those are available
-    current_linearization_point = old_solution;			current_linearization_point.update_ghost_values();
+    current_linearization_point = old_solution;
     if (timestep_number > 1)
       {
         //TODO: Trilinos sadd does not like ghost vectors even as input. Copy
@@ -1230,7 +1230,7 @@
         distr_solution .sadd ((1 + time_step/old_time_step),
                               -time_step/old_time_step,
                               distr_old_solution);
-        current_linearization_point = distr_solution;		current_linearization_point.update_ghost_values();
+        current_linearization_point = distr_solution;
       }
 
     switch (parameters.nonlinear_solver)
@@ -1241,14 +1241,14 @@
           build_advection_preconditioner(0,T_preconditioner);
           solve_advection(0);
 
-          current_linearization_point.block(2) = solution.block(2);		current_linearization_point.block(2).update_ghost_values();
+          current_linearization_point.block(2) = solution.block(2);
 
           for (unsigned int c=0; c<parameters.n_compositional_fields; ++c)
             {
               assemble_advection_system (1+c);
               build_advection_preconditioner(1+c,C_preconditioner);
               solve_advection(1+c); // this is correct, 0 would be temperature
-              current_linearization_point.block(3+c) = solution.block(3+c);		current_linearization_point.block(3+c).update_ghost_values();
+              current_linearization_point.block(3+c) = solution.block(3+c);
             }
 
           assemble_stokes_system();
@@ -1275,7 +1275,7 @@
 
               const double temperature_residual = solve_advection(0);
 
-              current_linearization_point.block(2) = solution.block(2);				current_linearization_point.block(2).update_ghost_values();
+              current_linearization_point.block(2) = solution.block(2);
               rebuild_stokes_matrix = true;
               std::vector<double> composition_residual (parameters.n_compositional_fields,0);
 
@@ -1285,7 +1285,7 @@
                   build_advection_preconditioner(c+1,C_preconditioner);
                   composition_residual[c]
                     = solve_advection(1+c); // 1+n is correct, because 0 is for temperature
-                  current_linearization_point.block(3+c) = solution.block(3+c);		current_linearization_point.block(3+c).update_ghost_values();
+                  current_linearization_point.block(3+c) = solution.block(3+c);
                 }
 
               assemble_stokes_system();
@@ -1294,7 +1294,7 @@
 
               const double stokes_residual = solve_stokes();
 
-              current_linearization_point = solution;				current_linearization_point.update_ghost_values();
+              current_linearization_point = solution;
 
               pcout << "   Nonlinear residuals: " << temperature_residual
                     << ", " << stokes_residual;
@@ -1354,7 +1354,7 @@
               assemble_stokes_system();
               build_stokes_preconditioner();
               solve_stokes();
-              old_solution = solution;				old_solution.update_ghost_values();
+              old_solution = solution;
 
               pcout << std::endl;
             }
@@ -1504,8 +1504,8 @@
         time += time_step;
         ++timestep_number;
         {
-          old_old_solution      = old_solution;			old_old_solution.update_ghost_values();			//shuqiangwang: need to check when this is needed.
-          old_solution          = solution;				old_solution.update_ghost_values();
+          old_old_solution      = old_solution;
+          old_solution          = solution;
         }
 
         // periodically generate snapshots so that we can resume here

Modified: branches/s-wang2/source/simulator/initial_conditions.cc
===================================================================
--- branches/s-wang2/source/simulator/initial_conditions.cc	2012-12-01 13:33:08 UTC (rev 1407)
+++ branches/s-wang2/source/simulator/initial_conditions.cc	2012-12-02 04:06:06 UTC (rev 1408)
@@ -156,9 +156,9 @@
         constraints.distribute(initial_solution);
 
         // copy temperature/composition block only
-        solution.block(2+n) = initial_solution.block(2+n);				solution.block(2+n).update_ghost_values();
-        old_solution.block(2+n) = initial_solution.block(2+n);			old_solution.block(2+n).update_ghost_values();
-        old_old_solution.block(2+n) = initial_solution.block(2+n);		old_old_solution.block(2+n).update_ghost_values();
+        solution.block(2+n) = initial_solution.block(2+n);
+        old_solution.block(2+n) = initial_solution.block(2+n);
+        old_old_solution.block(2+n) = initial_solution.block(2+n);
       }
   }
 
@@ -292,12 +292,10 @@
 
     // normalize the pressure in such a way that the surface pressure
     // equals a known and desired value
-    old_solution.update_ghost_values();
     normalize_pressure(old_solution);
-    old_solution.update_ghost_values();
 
     // set the current solution to the same value as the previous solution
-    solution = old_solution;					solution.update_ghost_values();
+    solution = old_solution;
   }
 }
 

Modified: branches/s-wang2/source/simulator/solver.cc
===================================================================
--- branches/s-wang2/source/simulator/solver.cc	2012-12-01 13:33:08 UTC (rev 1407)
+++ branches/s-wang2/source/simulator/solver.cc	2012-12-02 04:06:06 UTC (rev 1408)
@@ -323,7 +323,7 @@
     			  system_rhs.block(index+2), index==0?*T_preconditioner:*C_preconditioner);
 
       current_constraints.distribute (distributed_solution);
-      solution.block(index+2) = distributed_solution.block(index+2);		solution.block(index+2).update_ghost_values();
+      solution.block(index+2) = distributed_solution.block(index+2);
 
       // print number of iterations and also record it in the
       // statistics file
@@ -450,10 +450,8 @@
 
     // now rescale the pressure back to real physical units
     solution.block(1) *= pressure_scaling;
-    solution.update_ghost_values();
 
     normalize_pressure(solution);
-    solution.update_ghost_values();
 
     // print the number of iterations to screen and record it in the
     // statistics file



More information about the CIG-COMMITS mailing list