From: Marc Fehling Date: Thu, 22 Aug 2024 23:14:47 +0000 (-0600) Subject: Add hp hanging node face test. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc25c728e6cc720782374a4215ca4b543477e4ec;p=dealii.git Add hp hanging node face test. --- diff --git a/tests/hp/hp_hanging_nodes_03.cc b/tests/hp/hp_hanging_nodes_03.cc new file mode 100644 index 0000000000..81be324918 --- /dev/null +++ b/tests/hp/hp_hanging_nodes_03.cc @@ -0,0 +1,120 @@ +// ------------------------------------------------------------------------ +// +// SPDX-License-Identifier: LGPL-2.1-or-later +// Copyright (C) 2024 by the deal.II authors +// +// This file is part of the deal.II library. +// +// Part of the source code is dual licensed under Apache-2.0 WITH +// LLVM-exception OR LGPL-2.1-or-later. Detailed license information +// governing the source code and code contributions can be found in +// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. +// +// ------------------------------------------------------------------------ + + +// investigate how the order in which we process hanging nodes on faces +// affect hp-discretizations in 3D +// +// Case 0: Case 1: +// +---+ +-+-+ +// | | |2|2| +// | 2 | +-+-+ +// | | |2|2| +// +---+-+-+ +-+-+---+ +// | |2|2| | | | +// | 3 +-+-+ | 3 | 2 | +// | |2|2| | | | +// +---+---+ +---+-+-+ + + +#include +#include + +#include + +#include +#include + +#include + +#include + +#include "../tests.h" + + +void +test(const int skip_cell) +{ + constexpr int dim = 3; + + // set up grid + Triangulation triangulation; + { + const std::vector repetitions({2, 2, 1}); + const Point bottom_left(-1, -1, 0); + const Point top_right(1, 1, 1); + const std::vector n_cells_to_remove({-1, -1, 0}); + + GridGenerator::subdivided_hyper_L( + triangulation, repetitions, bottom_left, top_right, n_cells_to_remove); + } + + // set up hp-refinement + DoFHandler dof_handler(triangulation); + { + auto cell = dof_handler.begin_active(); + cell->set_active_fe_index(1); + if (skip_cell) + ++cell; + (++cell)->set_refine_flag(); + + triangulation.execute_coarsening_and_refinement(); + } + + // enumerate dofs + hp::FECollection fe_collection; + { + for (unsigned int degree = 2; degree <= 3; ++degree) + fe_collection.push_back(FE_Q(degree)); + dof_handler.distribute_dofs(fe_collection); + } + + // make hanging node constraints + AffineConstraints constraints; + { + DoFTools::make_hanging_node_constraints(dof_handler, constraints); + constraints.print(deallog.get_file_stream()); + } + +#if true + // output vtu + DataOut data_out; + { + Vector fe_degrees(triangulation.n_active_cells()); + for (const auto &cell : dof_handler.active_cell_iterators()) + fe_degrees(cell->active_cell_index()) = cell->get_fe().degree; + + data_out.attach_dof_handler(dof_handler); + data_out.add_data_vector(fe_degrees, "fe_degrees"); + data_out.build_patches(); + + std::ofstream output("output-" + Utilities::to_string(skip_cell) + ".vtu"); + data_out.write_vtu(output); + } +#endif + + deallog << "OK" << std::endl; +} + + +int +main() +{ + initlog(); + + deallog << "Case 0:" << std::endl; + test(0); + deallog << "Case 1:" << std::endl; + test(1); +} diff --git a/tests/hp/hp_hanging_nodes_03.output b/tests/hp/hp_hanging_nodes_03.output new file mode 100644 index 0000000000..20f7a6f15b --- /dev/null +++ b/tests/hp/hp_hanging_nodes_03.output @@ -0,0 +1,407 @@ + +DEAL::Case 0: + 21 20: 1.00000 + 21 85: -0.447214 + 21 159: 0.447214 + 25 24: 1.00000 + 25 59: -0.447214 + 25 63: 0.447214 + 5 4: 1.00000 + 5 59: 0.447214 + 5 85: -0.447214 + 13 12: 1.00000 + 13 63: 0.447214 + 13 159: -0.447214 + 31 20: -0.447214 + 31 24: 0.447214 + 31 30: 1.00000 + 32 4: -0.447214 + 32 12: 0.447214 + 32 30: 1.00000 + 33 4: -0.447214 + 33 12: 0.447214 + 33 20: -0.447214 + 33 24: 0.447214 + 33 30: 1.00000 + 33 59: -0.200000 + 33 63: 0.200000 + 33 85: 0.200000 + 33 159: -0.200000 + 87 4: 1.25000 + 87 59: 0.154508 + 87 85: -0.404508 + 89 20: 1.25000 + 89 85: -0.404508 + 89 159: 0.154508 + 91 4: -0.505636 + 91 12: 0.193136 + 91 20: -0.505636 + 91 24: 0.193136 + 91 30: 1.56250 + 91 59: -0.0625000 + 91 63: 0.0238729 + 91 85: 0.163627 + 91 159: -0.0625000 + 101 20: 0.937500 + 101 85: 0.0716186 + 101 159: -0.00911863 + 103 4: 0.0895233 + 103 12: -0.0113983 + 103 20: -0.379227 + 103 24: 0.144852 + 103 30: 1.17188 + 103 59: 0.0110657 + 103 63: -0.00140891 + 103 85: -0.0289703 + 103 159: 0.00368856 + 93 4: 0.937500 + 93 59: -0.00911863 + 93 85: 0.0716186 + 97 4: -0.379227 + 97 12: 0.144852 + 97 20: 0.0895233 + 97 24: -0.0113983 + 97 30: 1.17188 + 97 59: 0.00368856 + 97 63: -0.00140891 + 97 85: -0.0289703 + 97 159: 0.0110657 + 105 4: 0.0671425 + 105 12: -0.00854871 + 105 20: 0.0671425 + 105 24: -0.00854871 + 105 30: 0.878906 + 105 59: -0.000653064 + 105 63: 8.31494e-05 + 105 85: 0.00512923 + 105 159: -0.000653064 + 131 24: 1.25000 + 131 59: -0.404508 + 131 63: 0.154508 + 139 24: 0.937500 + 139 59: 0.0716186 + 139 63: -0.00911863 + 133 4: 0.937500 + 133 59: 0.490881 + 133 85: -0.428381 + 136 4: -0.379227 + 136 12: 0.144852 + 136 20: -0.535477 + 136 24: 0.613602 + 136 30: 1.17188 + 136 59: -0.198566 + 136 63: 0.0758453 + 136 85: 0.173284 + 136 159: -0.0661886 + 141 4: 0.0671425 + 141 12: -0.00854871 + 141 20: -0.401608 + 141 24: 0.460201 + 141 30: 0.878906 + 141 59: 0.0351562 + 141 63: -0.00447616 + 141 85: -0.0306801 + 141 159: 0.00390625 + 161 12: 1.25000 + 161 63: 0.154508 + 161 159: -0.404508 + 167 20: 0.937500 + 167 85: -0.428381 + 167 159: 0.490881 + 169 4: -0.535477 + 169 12: 0.613602 + 169 20: -0.379227 + 169 24: 0.144852 + 169 30: 1.17188 + 169 59: -0.0661886 + 169 63: 0.0758453 + 169 85: 0.173284 + 169 159: -0.198566 + 163 12: 0.937500 + 163 63: -0.00911863 + 163 159: 0.0716186 + 171 4: -0.401608 + 171 12: 0.460201 + 171 20: 0.0671425 + 171 24: -0.00854871 + 171 30: 0.878906 + 171 59: 0.00390625 + 171 63: -0.00447616 + 171 85: -0.0306801 + 171 159: 0.0351562 + 193 24: 0.937500 + 193 59: -0.428381 + 193 63: 0.490881 + 190 12: 0.937500 + 190 63: 0.490881 + 190 159: -0.428381 + 195 4: -0.401608 + 195 12: 0.460201 + 195 20: -0.401608 + 195 24: 0.460201 + 195 30: 0.878906 + 195 59: -0.210284 + 195 63: 0.240965 + 195 85: 0.183511 + 195 159: -0.210284 + 8 58: 0.323607 + 8 59: -0.123607 + 8 68: 0.800000 + 9 58: -0.123607 + 9 59: 0.323607 + 9 68: 0.800000 + 16 62: 0.323607 + 16 63: -0.123607 + 16 72: 0.800000 + 17 62: -0.123607 + 17 63: 0.323607 + 17 72: 0.800000 + 22 58: 0.323607 + 22 62: -0.123607 + 22 74: 0.800000 + 23 58: -0.123607 + 23 62: 0.323607 + 23 74: 0.800000 + 24 59: 0.323607 + 24 63: -0.123607 + 24 75: 0.800000 + 38 58: 0.104721 + 38 59: -0.0400000 + 38 62: -0.0400000 + 38 63: 0.0152786 + 38 68: 0.258885 + 38 72: -0.0988854 + 38 74: 0.258885 + 38 75: -0.0988854 + 38 80: 0.640000 + 39 58: -0.0400000 + 39 59: 0.0152786 + 39 62: 0.104721 + 39 63: -0.0400000 + 39 68: -0.0988854 + 39 72: 0.258885 + 39 74: 0.258885 + 39 75: -0.0988854 + 39 80: 0.640000 + 40 58: -0.0400000 + 40 59: 0.104721 + 40 62: 0.0152786 + 40 63: -0.0400000 + 40 68: 0.258885 + 40 72: -0.0988854 + 40 74: -0.0988854 + 40 75: 0.258885 + 40 80: 0.640000 + 41 58: 0.0152786 + 41 59: -0.0400000 + 41 62: -0.0400000 + 41 63: 0.104721 + 41 68: -0.0988854 + 41 72: 0.258885 + 41 74: -0.0988854 + 41 75: 0.258885 + 41 80: 0.640000 +DEAL::OK +DEAL::Case 1: + 9 8: 1.00000 + 9 60: 0.447214 + 9 85: -0.447214 + 17 16: 1.00000 + 17 64: 0.447214 + 17 159: -0.447214 + 23 22: 1.00000 + 23 85: -0.447214 + 23 159: 0.447214 + 25 24: 1.00000 + 25 60: -0.447214 + 25 64: 0.447214 + 39 8: -0.447214 + 39 16: 0.447214 + 39 38: 1.00000 + 40 22: -0.447214 + 40 24: 0.447214 + 40 38: 1.00000 + 41 8: -0.447214 + 41 16: 0.447214 + 41 22: -0.447214 + 41 24: 0.447214 + 41 38: 1.00000 + 41 60: -0.200000 + 41 64: 0.200000 + 41 85: 0.200000 + 41 159: -0.200000 + 89 22: 1.25000 + 89 85: -0.404508 + 89 159: 0.154508 + 86 8: 1.25000 + 86 60: 0.154508 + 86 85: -0.404508 + 90 8: -0.505636 + 90 16: 0.193136 + 90 22: -0.505636 + 90 24: 0.193136 + 90 38: 1.56250 + 90 60: -0.0625000 + 90 64: 0.0238729 + 90 85: 0.163627 + 90 159: -0.0625000 + 95 8: 0.937500 + 95 60: -0.00911863 + 95 85: 0.0716186 + 99 8: -0.379227 + 99 16: 0.144852 + 99 22: 0.0895233 + 99 24: -0.0113983 + 99 38: 1.17188 + 99 60: 0.00368856 + 99 64: -0.00140891 + 99 85: -0.0289703 + 99 159: 0.0110657 + 101 22: 0.937500 + 101 85: 0.0716186 + 101 159: -0.00911863 + 102 8: 0.0895233 + 102 16: -0.0113983 + 102 22: -0.379227 + 102 24: 0.144852 + 102 38: 1.17188 + 102 60: 0.0110657 + 102 64: -0.00140891 + 102 85: -0.0289703 + 102 159: 0.00368856 + 107 8: 0.0671425 + 107 16: -0.00854871 + 107 22: 0.0671425 + 107 24: -0.00854871 + 107 38: 0.878906 + 107 60: -0.000653064 + 107 64: 8.31494e-05 + 107 85: 0.00512923 + 107 159: -0.000653064 + 160 16: 1.25000 + 160 64: 0.154508 + 160 159: -0.404508 + 165 16: 0.937500 + 165 64: -0.00911863 + 165 159: 0.0716186 + 167 22: 0.937500 + 167 85: -0.428381 + 167 159: 0.490881 + 168 8: -0.535477 + 168 16: 0.613602 + 168 22: -0.379227 + 168 24: 0.144852 + 168 38: 1.17188 + 168 60: -0.0661886 + 168 64: 0.0758453 + 168 85: 0.173284 + 168 159: -0.198566 + 173 8: -0.401608 + 173 16: 0.460201 + 173 22: 0.0671425 + 173 24: -0.00854871 + 173 38: 0.878906 + 173 60: 0.00390625 + 173 64: -0.00447616 + 173 85: -0.0306801 + 173 159: 0.0351562 + 113 24: 1.25000 + 113 60: -0.404508 + 113 64: 0.154508 + 116 8: 0.937500 + 116 60: 0.490881 + 116 85: -0.428381 + 119 8: -0.379227 + 119 16: 0.144852 + 119 22: -0.535477 + 119 24: 0.613602 + 119 38: 1.17188 + 119 60: -0.198566 + 119 64: 0.0758453 + 119 85: 0.173284 + 119 159: -0.0661886 + 121 24: 0.937500 + 121 60: 0.0716186 + 121 64: -0.00911863 + 124 8: 0.0671425 + 124 16: -0.00854871 + 124 22: -0.401608 + 124 24: 0.460201 + 124 38: 0.878906 + 124 60: 0.0351562 + 124 64: -0.00447616 + 124 85: -0.0306801 + 124 159: 0.00390625 + 179 16: 0.937500 + 179 64: 0.490881 + 179 159: -0.428381 + 181 24: 0.937500 + 181 60: -0.428381 + 181 64: 0.490881 + 184 8: -0.401608 + 184 16: 0.460201 + 184 22: -0.401608 + 184 24: 0.460201 + 184 38: 0.878906 + 184 60: -0.210284 + 184 64: 0.240965 + 184 85: 0.183511 + 184 159: -0.210284 + 20 58: 0.323607 + 20 62: -0.123607 + 20 74: 0.800000 + 21 58: -0.123607 + 21 62: 0.323607 + 21 74: 0.800000 + 24 60: 0.323607 + 24 64: -0.123607 + 24 76: 0.800000 + 4 58: 0.323607 + 4 60: -0.123607 + 4 66: 0.800000 + 5 58: -0.123607 + 5 60: 0.323607 + 5 66: 0.800000 + 12 62: 0.323607 + 12 64: -0.123607 + 12 70: 0.800000 + 13 62: -0.123607 + 13 64: 0.323607 + 13 70: 0.800000 + 30 58: 0.104721 + 30 60: -0.0400000 + 30 62: -0.0400000 + 30 64: 0.0152786 + 30 66: 0.258885 + 30 70: -0.0988854 + 30 74: 0.258885 + 30 76: -0.0988854 + 30 78: 0.640000 + 31 58: -0.0400000 + 31 60: 0.104721 + 31 62: 0.0152786 + 31 64: -0.0400000 + 31 66: 0.258885 + 31 70: -0.0988854 + 31 74: -0.0988854 + 31 76: 0.258885 + 31 78: 0.640000 + 32 58: -0.0400000 + 32 60: 0.0152786 + 32 62: 0.104721 + 32 64: -0.0400000 + 32 66: -0.0988854 + 32 70: 0.258885 + 32 74: 0.258885 + 32 76: -0.0988854 + 32 78: 0.640000 + 33 58: 0.0152786 + 33 60: -0.0400000 + 33 62: -0.0400000 + 33 64: 0.104721 + 33 66: -0.0988854 + 33 70: 0.258885 + 33 74: -0.0988854 + 33 76: 0.258885 + 33 78: 0.640000 +DEAL::OK