From: frohne Date: Tue, 25 Oct 2011 20:18:20 +0000 (+0000) Subject: scaling the residual X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad9159aa46dd9f584e30149ff40722346fe43ae2;p=dealii-svn.git scaling the residual git-svn-id: https://svn.dealii.org/trunk@24674 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-41/step-41.cc b/deal.II/examples/step-41/step-41.cc index 64214fb25c..ce6ca9462d 100644 --- a/deal.II/examples/step-41/step-41.cc +++ b/deal.II/examples/step-41/step-41.cc @@ -99,6 +99,7 @@ class Step4 Triangulation triangulation; FE_Q fe; DoFHandler dof_handler; + unsigned int n_refinements; ConstraintMatrix constraints; @@ -112,8 +113,7 @@ class Step4 TrilinosWrappers::Vector system_rhs_complete; TrilinosWrappers::Vector resid_vector; TrilinosWrappers::Vector active_set; - - std::map boundary_values; + TrilinosWrappers::Vector diag_mass_matrix_vector; }; @@ -363,7 +363,8 @@ template void Step4::make_grid () { GridGenerator::hyper_cube (triangulation, -1, 1); - triangulation.refine_global (7); + n_refinements = 5; + triangulation.refine_global (n_refinements); std::cout << " Number of active cells: " << triangulation.n_active_cells() @@ -406,6 +407,7 @@ void Step4::setup_system () system_rhs_complete.reinit (dof_handler.n_dofs()); resid_vector.reinit (dof_handler.n_dofs()); active_set.reinit (dof_handler.n_dofs()); + diag_mass_matrix_vector.reinit (dof_handler.n_dofs()); } @@ -615,9 +617,11 @@ void Step4::projection_active_set () Point point (cell->vertex (v)[0], cell->vertex (v)[1]); double obstacle_value = obstacle.value (point); double solution_index_x = solution (index_x); - if (solution_index_x <= obstacle_value && - (resid_vector (index_x) >= solution_index_x - obstacle_value)) +// if (solution_index_x <= obstacle_value && + if ((resid_vector (index_x)*std::pow (2, 2*n_refinements)*diag_mass_matrix_vector (index_x) >= solution_index_x - obstacle_value)) { + std::cout<< std::pow (2, 2*n_refinements) << ", " << diag_mass_matrix_vector (index_x) <::run () system_matrix_complete.copy_from (system_matrix); system_rhs_complete = system_rhs; + for (unsigned int j=0; j