From: Jean-Paul Pelteret Date: Thu, 14 Apr 2011 17:37:09 +0000 (+0000) Subject: Step-44: Moved assembly static condensation outside linear solver function X-Git-Tag: v8.0.0~4161 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbf790ef86e177a9121946d3a1448d9366c9f9f3;p=dealii.git Step-44: Moved assembly static condensation outside linear solver function git-svn-id: https://svn.dealii.org/trunk@23596 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-44/step-44.cc b/deal.II/examples/step-44/step-44.cc index 0e8badbb30..14d8ce657f 100644 --- a/deal.II/examples/step-44/step-44.cc +++ b/deal.II/examples/step-44/step-44.cc @@ -1013,7 +1013,7 @@ template BlockVector 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 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 } // 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 // 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));