From 4dc640a01ad9fcf99f4d103403fe0ea776029f66 Mon Sep 17 00:00:00 2001 From: frohne Date: Fri, 21 Oct 2011 16:51:00 +0000 Subject: [PATCH] revision of projection_active_set () git-svn-id: https://svn.dealii.org/trunk@24652 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-41/step-41.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/deal.II/examples/step-41/step-41.cc b/deal.II/examples/step-41/step-41.cc index 88650a1a14..9e4c57c552 100644 --- a/deal.II/examples/step-41/step-41.cc +++ b/deal.II/examples/step-41/step-41.cc @@ -107,6 +107,7 @@ class Step4 TrilinosWrappers::SparseMatrix system_matrix_complete; TrilinosWrappers::Vector solution; + TrilinosWrappers::Vector tmp_solution; TrilinosWrappers::Vector system_rhs; TrilinosWrappers::Vector system_rhs_complete; TrilinosWrappers::Vector resid_vector; @@ -366,7 +367,7 @@ template void Step4::make_grid () { GridGenerator::hyper_cube (triangulation, -1, 1); - triangulation.refine_global (4); + triangulation.refine_global (7); std::cout << " Number of active cells: " << triangulation.n_active_cells() @@ -405,6 +406,7 @@ void Step4::setup_system () system_matrix_complete.reinit (sparsity_pattern); solution.reinit (dof_handler.n_dofs()); + tmp_solution.reinit (dof_handler.n_dofs()); system_rhs.reinit (dof_handler.n_dofs()); system_rhs_complete.reinit (dof_handler.n_dofs()); resid_vector.reinit (dof_handler.n_dofs()); @@ -681,7 +683,7 @@ void Step4::projection_active_set () Point point (cell->vertex (v)[0], cell->vertex (v)[1]); double obstacle_value = obstacle.value (point); - if (solution (index_x) <= obstacle_value && resid_vector (index_x) >= 0) + if (solution (index_x) <= obstacle_value && resid_vector (index_x) >= -1e-15) { constraints.add_line (index_x); constraints.set_inhomogeneity (index_x, obstacle_value); @@ -758,7 +760,7 @@ void Step4::output_results (const std::string& title) const DataOut data_out; data_out.attach_dof_handler (dof_handler); - data_out.add_data_vector (solution, "Displacement"); + data_out.add_data_vector (tmp_solution, "Displacement"); data_out.add_data_vector (resid_vector, "Residual"); data_out.add_data_vector (active_set, "ActiveSet"); @@ -830,6 +832,7 @@ void Step4::run () // <::run () if (resid_vector (k) > 0) resid_vector (k) = 0; + std::cout<< "Update Active Set:"<::run () { break; } - - std::cout<< "Update Active Set:"<