From d2b8c760d90529b40af7c32892afb904e11a84d9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 12 Apr 2015 21:59:06 -0500 Subject: [PATCH] Add a missing call to distribute() to step-26 after SolutionTransfer. This was pointed out in #757 but it only addresses part of the problem: I believe a similar call is also missing steps 31, 32, 33, 42, 43. It is there in step-15. --- examples/step-26/step-26.cc | 16 ++++++++---- include/deal.II/numerics/solution_transfer.h | 27 +++++++++++++++----- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/examples/step-26/step-26.cc b/examples/step-26/step-26.cc index 69cd670707..7eea6c9eda 100644 --- a/examples/step-26/step-26.cc +++ b/examples/step-26/step-26.cc @@ -1,6 +1,6 @@ /* --------------------------------------------------------------------- * - * Copyright (C) 2013 - 2014 by the deal.II authors + * Copyright (C) 2013 - 2015 by the deal.II authors * * This file is part of the deal.II library. * @@ -402,14 +402,20 @@ namespace Step26 triangulation.prepare_coarsening_and_refinement(); solution_trans.prepare_for_coarsening_and_refinement(previous_solution); - // Now everything is ready, so do the refinement and recreate the dof - // structure on the new grid, and initialize the matrix structures and the - // new vectors in the setup_system function. Next, we actually - // perform the interpolation of the solution from old to new grid. + // Now everything is ready, so do the refinement and recreate the DoF + // structure on the new grid, and finally initialize the matrix structures + // and the new vectors in the setup_system function. Next, we + // actually perform the interpolation of the solution from old to new + // grid. The final step is to apply the hanging node constraints to the + // solution vector, i.e., to make sure that the values of degrees of + // freedom located on hanging nodes are so that the solution is + // continuous. This is necessary since SolutionTransfer only operates on + // cells locally, without regard to the neighborhoof. triangulation.execute_coarsening_and_refinement (); setup_system (); solution_trans.interpolate(previous_solution, solution); + constraints.distribute (solution); } diff --git a/include/deal.II/numerics/solution_transfer.h b/include/deal.II/numerics/solution_transfer.h index 24326c7db3..a1d3684c29 100644 --- a/include/deal.II/numerics/solution_transfer.h +++ b/include/deal.II/numerics/solution_transfer.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 1999 - 2014 by the deal.II authors +// Copyright (C) 1999 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -35,9 +35,9 @@ DEAL_II_NAMESPACE_OPEN * solution vector) from one mesh to another that is obtained from the first * by a single refinement and/or coarsening step. During interpolation the * vector is reinitialized to the new size and filled with the interpolated - * values. This class is used in the step-15, step-31, and step-33 tutorial - * programs. A version of this class that works on parallel triangulations is - * available as parallel::distributed::SolutionTransfer. + * values. This class is used in the step-15, step-26, step-31, and step-33 + * tutorial programs. A version of this class that works on parallel + * triangulations is available as parallel::distributed::SolutionTransfer. * *

Usage

* @@ -110,8 +110,8 @@ DEAL_II_NAMESPACE_OPEN * soltrans.interpolate(solution, interpolated_solution); * @endcode * - * Multiple calls to the function interpolate (const Vector &in, - * Vector &out) are NOT allowed. Interpolating several functions + * Multiple calls to the function interpolate (const Vector &in, + * Vector &out) are NOT allowed. Interpolating several functions * can be performed in one step by using void interpolate (const * vector >&all_in, vector >&all_out) * const, and using the respective @p @@ -127,6 +127,21 @@ DEAL_II_NAMESPACE_OPEN * want to transfer. * * + *

Interpolating in the presence of hanging nodes and boundary values

+ * + * The interpolation onto the new mesh is a local operation, i.e., it + * interpolates onto the new mesh only. If that new mesh has hanging nodes, + * you will therefore get a solution that does not satisfy hanging node + * constraints. The same is true with boundary values: the interpolated + * solution will just be the interpolation of the old solution at the + * boundary, and this may or may not satisfy boundary values at newly + * introduced boundary nodes. + * + * Consequently, you may have to apply hanging node or boundary value + * constraints after interpolation. step-15 and step-26 have examples of + * dealing with this. + * + * *

Implementation

* *