]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Step-44: Moved assembly static condensation outside linear solver function
authorJean-Paul Pelteret <jppelteret@gmail.com>
Thu, 14 Apr 2011 17:37:09 +0000 (17:37 +0000)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Thu, 14 Apr 2011 17:37:09 +0000 (17:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@23596 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-44/step-44.cc

index 0e8badbb306d770c7a8570b95668de9a87806fe8..14d8ce657fc4b718c481dc1aa373f77c98ad2f44 100644 (file)
@@ -1013,7 +1013,7 @@ template <int dim>
     BlockVector <double> solution_delta (dofs_per_block);
     solution_delta.collect_sizes ();
 
-    while (time.current() < time.end()) {
+    while (time.current() <= time.end()) {
        solution_delta = 0.0;
 
        // Solve step and update total solution vector
@@ -1127,7 +1127,8 @@ template <int dim>
         csp.block(t_dof,t_dof).reinit (n_dofs_t, n_dofs_t);
         csp.collect_sizes();
 
-        DoFTools::make_sparsity_pattern (dof_handler_ref, csp, constraints, false);
+       DoFTools::make_sparsity_pattern (dof_handler_ref, csp);
+//        DoFTools::make_sparsity_pattern (dof_handler_ref, csp, constraints, false);
 //        DoFTools::make_sparsity_pattern (dof_handler_ref, coupling, csp, constraints, false);
         sparsity_pattern.copy_from (csp);
     }
@@ -1338,7 +1339,13 @@ template <int dim>
        }
        
        // No convergence -> continue with calculations
-       assemble_system_K (); // Assemble stiffness matrix
+       // Assemble stiffness matrix
+       assemble_system_K (); 
+       
+       // Do the static condensation to make K'_uu, and put K_pt^{-1}
+       // in the K_pt block and K_tt^{-1} in the K_pp block
+        assemble_SC();
+       
        constraints.condense (tangent_matrix, residual); // Apply BC's
        solve_linear_system (newton_update);
        constraints.distribute(newton_update); // Populate the constrained DOF's with their values
@@ -1446,10 +1453,6 @@ template <int dim>
 
     // Solve for du
     {
-       // Do the static condensation to make K'_uu, and put K_pt^{-1}
-       // in the K_pt block and K_tt^{-1} in the K_pp block
-        assemble_SC();
-
        // K'uu du = Ru − Kup Ktp^-1 (Rt − Ktt Kpt^{-1} Rp)
        tangent_matrix.block(p_dof, t_dof).vmult(A.block(t_dof), residual.block(p_dof));
        tangent_matrix.block(t_dof, t_dof).vmult (B.block(t_dof), A.block(t_dof));

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.