From fd2a887b61d25d4010c156c43cc8c8061e8bc0ac Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 22 Oct 2007 19:12:50 +0000 Subject: [PATCH] Fix the bug that we only re-set the rhs vector to zero if we were building the matrix, instead of every time. Disable adaptivity again for the moment since it is too fragile. Do output only every few steps. git-svn-id: https://svn.dealii.org/trunk@15365 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-22/step-22.cc | 47 +++++++++++++++++++---------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/deal.II/examples/step-22/step-22.cc b/deal.II/examples/step-22/step-22.cc index 3e9e170600..9ddfaf893f 100644 --- a/deal.II/examples/step-22/step-22.cc +++ b/deal.II/examples/step-22/step-22.cc @@ -502,11 +502,10 @@ template void BoussinesqFlowProblem::assemble_system () { if (rebuild_matrices == true) - { - system_matrix=0; - system_rhs=0; - } - + system_matrix=0; + + system_rhs=0; + QGauss quadrature_formula(degree+2); QGauss face_quadrature_formula(degree+2); @@ -1048,7 +1047,7 @@ void BoussinesqFlowProblem::solve () template void BoussinesqFlowProblem::output_results () const { - if (timestep_number % 1 != 0) + if (timestep_number % 10 != 0) return; std::vector solution_names (dim, "velocity"); @@ -1202,17 +1201,32 @@ void BoussinesqFlowProblem::run () } - setup_dofs(false); + const bool do_adaptivity = false; - VectorTools::project (dof_handler, - hanging_node_constraints, - QGauss(degree+2), - InitialValues(), - old_solution); + if (do_adaptivity) + { + setup_dofs(false); + + VectorTools::project (dof_handler, + hanging_node_constraints, + QGauss(degree+2), + InitialValues(), + old_solution); - for (unsigned int pre_refinement=0; pre_refinement<4-dim; ++pre_refinement) + for (unsigned int pre_refinement=0; pre_refinement<4-dim; ++pre_refinement) + { + refine_mesh (); + + VectorTools::project (dof_handler, + hanging_node_constraints, + QGauss(degree+2), + InitialValues(), + old_solution); + } + } + else { - refine_mesh (); + setup_dofs(true); VectorTools::project (dof_handler, hanging_node_constraints, @@ -1246,8 +1260,9 @@ void BoussinesqFlowProblem::run () std::cout << std::endl; - if (timestep_number % 10 == 0) - refine_mesh (); + if (do_adaptivity) + if (timestep_number % 10 == 0) + refine_mesh (); } while (time <= 500); } -- 2.39.5