From 71bd80c2a3bab43241316a23edb12020c4af47cd Mon Sep 17 00:00:00 2001 From: frohne Date: Mon, 19 Nov 2012 11:59:43 +0000 Subject: [PATCH] clean up and comment the solve-function git-svn-id: https://svn.dealii.org/trunk@27576 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-42/step-42.cc | 45 +++++++++++++++++------------ 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/deal.II/examples/step-42/step-42.cc b/deal.II/examples/step-42/step-42.cc index 5571fc7769..644787bc18 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -1042,8 +1042,31 @@ namespace Step42 constraints_dirichlet_hanging_nodes.close (); } - - + // @sect4{PlasticityContactProblem::solve} + + // In addition to step-41 we have + // to deal with the hanging node + // constraints. Again we also consider + // the locally_owned_dofs only by + // creating the vector distributed_solution. + // + // For the hanging nodes we have to apply + // the set_zero function to system_rhs_newton. + // This is necessary if a hanging node x_0 + // has one neighbor x_1 which is in contact + // and one neighbor x_2 which is not. This + // leads to an inhomogeneity constraint + // with value x_1/2 in the ConstraintMatrix. + // So the corresponding entries in the + // ride-hang-side are non-zero with a + // meaningless value. These values have to + // to set to zero. + + // The rest of the funtion is smiliar to + // step-41 except that we use a FGMRES-solver + // instead of CG. For a very small hardening + // value gamma the linear system becomes + // almost semi definite but still symmetric. template void PlasticityContactProblem::solve () { @@ -1054,16 +1077,8 @@ namespace Step42 distributed_solution = solution; constraints_hanging_nodes.set_zero (distributed_solution); - /* This is necessary if contact constraints are neighbors of - * hanging nodes constraints. In that case these hanging node - * constraints are inhomogeneity constraints and the corresponding - * values in the right-hand-side vector contains meaningless - * values. So these values have to be set to zero. - */ constraints_hanging_nodes.set_zero (system_rhs_newton); - // Solving iterative - MPI_Barrier (mpi_communicator); t.restart(); @@ -1077,19 +1092,11 @@ namespace Step42 MPI_Barrier (mpi_communicator); t.restart(); - // ReductionControl solver_control (10000, 1e-15, 1e-4); - // SolverCG - // solver (solver_control, mpi_communicator); - // solver.solve (system_matrix_newton, distributed_solution, system_rhs_newton, preconditioner_u); - PrimitiveVectorMemory mem; TrilinosWrappers::MPI::Vector tmp (system_rhs_newton); const double solver_tolerance = 1e-4 * system_matrix_newton.residual (tmp, distributed_solution, system_rhs_newton); - // resid_vector = tmp; - // output_results ("Startresidual"); - SolverControl solver_control (system_matrix_newton.m(), solver_tolerance); SolverFGMRES solver(solver_control, mem, @@ -1099,7 +1106,7 @@ namespace Step42 pcout << "Initial error: " << solver_control.initial_value() <