From 7fbad513a7747b4963580c8971bc8053baff698d Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Wed, 21 Apr 2021 20:36:08 -0600 Subject: [PATCH] step-27: limit p-level difference --- examples/step-27/doc/results.dox | 58 ++++++++++++++++---------------- examples/step-27/step-27.cc | 14 ++++++++ 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/examples/step-27/doc/results.dox b/examples/step-27/doc/results.dox index afc00d258a..8d43f29d73 100644 --- a/examples/step-27/doc/results.dox +++ b/examples/step-27/doc/results.dox @@ -21,20 +21,20 @@ Cycle 1: Number of constraints : 756 Cycle 2: Number of active cells : 927 - Number of degrees of freedom: 7978 - Number of constraints : 1760 + Number of degrees of freedom: 8226 + Number of constraints : 1856 Cycle 3: - Number of active cells : 1020 - Number of degrees of freedom: 11750 - Number of constraints : 2898 + Number of active cells : 978 + Number of degrees of freedom: 12146 + Number of constraints : 2944 Cycle 4: - Number of active cells : 1158 - Number of degrees of freedom: 16342 - Number of constraints : 3892 + Number of active cells : 1104 + Number of degrees of freedom: 16892 + Number of constraints : 3998 Cycle 5: - Number of active cells : 1197 - Number of degrees of freedom: 20569 - Number of constraints : 4954 + Number of active cells : 1149 + Number of degrees of freedom: 22078 + Number of constraints : 5230 @endcode The first thing we learn from this is that the number of constrained degrees @@ -64,36 +64,36 @@ Secondly, let us look at the sequence of meshes generated:
- Triangulation containing reentrant corners without adaptive refinement.
- Triangulation containing reentrant corners with one level of
          refinement. New cells are placed near the corners.
- Triangulation containing reentrant corners with two levels of
          refinement. New cells are placed near the corners.
- Triangulation containing reentrant corners with three levels of
          refinement. New cells are placed near the corners.
- Triangulation containing reentrant corners with four levels of
          refinement. New cells are placed near the corners.
- Triangulation containing reentrant corners with five levels of
          refinement. New cells are placed near the corners. @@ -108,32 +108,32 @@ to degree seven:
- Initial grid where all cells contain just biquadratic functions.
- Depiction of local approximation degrees after one refinement.
- Depiction of local approximation degrees after two refinements.
- Depiction of local approximation degrees after three refinements.
- Depiction of local approximation degrees after four refinements.
- Depiction of local approximation degrees after five refinements.
@@ -152,32 +152,32 @@ indicating least smoothness and lighter indicating the smoothest areas:
- Estimated regularity per cell on the initial grid.
- Depiction of the estimated regularity per cell after one refinement.
- Depiction of the estimated regularity per cell after two refinements.
- Depiction of the estimated regularity per cell after three refinements.
- Depiction of the estimated regularity per cell after four refinements.
- Depiction of the estimated regularity per cell after five refinements.
diff --git a/examples/step-27/step-27.cc b/examples/step-27/step-27.cc index 898867bedc..9a2261597f 100644 --- a/examples/step-27/step-27.cc +++ b/examples/step-27/step-27.cc @@ -441,6 +441,20 @@ namespace Step27 // not both at once. hp::Refinement::choose_p_over_h(dof_handler); + // For grid adaptive refinement, we ensure a 2:1 mesh balance by limiting + // the difference of refinement levels of neighboring cells to one by + // calling Triangulation::prepare_coarsening_and_refinement(). We would + // like to achieve something similar for the p-levels of neighboring + // cells: levels of future finite elements are not allowed to differ by + // more than a specified difference. With its default parameters, a call + // of hp::Refinement::limit_p_level_difference() ensures that their level + // difference is limited to one. This will not necessarily decrease the + // number of hanging nodes in the domain, but makes sure that high order + // polynomials are not constrained to much lower polynomials on faces, + // e.g., fifth order to second order polynomials. + triangulation.prepare_coarsening_and_refinement(); + hp::Refinement::limit_p_level_difference(dof_handler); + // At the end of this procedure, we then refine the mesh. During this // process, children of cells undergoing bisection inherit their mother // cell's finite element index. Further, future finite element indices -- 2.39.5