From 5f5e14b71696a5e49b8a2883a444b04a05c61b9d Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sat, 23 Nov 2024 15:52:38 +0100 Subject: [PATCH] Rename FIV::normal() to normal_vector() and introduce FIV::quadrature_point() --- .../changes/incompatibilities/20241123Munch | 3 + doc/news/changes/minor/20241123Munch | 4 ++ examples/step-50/step-50.cc | 7 +- examples/step-85/step-85.cc | 3 +- include/deal.II/fe/fe_interface_values.h | 65 +++++++++++++++---- tests/feinterface/fe_interface_values_12.cc | 9 ++- tests/feinterface/step-12.cc | 4 ++ 7 files changed, 78 insertions(+), 17 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20241123Munch create mode 100644 doc/news/changes/minor/20241123Munch diff --git a/doc/news/changes/incompatibilities/20241123Munch b/doc/news/changes/incompatibilities/20241123Munch new file mode 100644 index 0000000000..c400ae62cc --- /dev/null +++ b/doc/news/changes/incompatibilities/20241123Munch @@ -0,0 +1,3 @@ +Changed: FEInterfaceValues::normal() has been renamed FEInterfaceValues::normal_vector(). +
+(Peter Munch, 2024/11/23) diff --git a/doc/news/changes/minor/20241123Munch b/doc/news/changes/minor/20241123Munch new file mode 100644 index 0000000000..5a26642ed8 --- /dev/null +++ b/doc/news/changes/minor/20241123Munch @@ -0,0 +1,4 @@ +Improved: The function FEInterfaceValues::quadrature_point() has +been added. +
+(Peter Munch, 2024/11/23) diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index 11f3835fc5..185f35f326 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -1355,9 +1355,10 @@ namespace Step50 qpoint < fe_interface_values.n_quadrature_points; ++qpoint) { - const double jump = - coeff1 * grad_u[0][qpoint] * fe_interface_values.normal(qpoint) - - coeff2 * grad_u[1][qpoint] * fe_interface_values.normal(qpoint); + const double jump = coeff1 * grad_u[0][qpoint] * + fe_interface_values.normal_vector(qpoint) - + coeff2 * grad_u[1][qpoint] * + fe_interface_values.normal_vector(qpoint); jump_norm_square += jump * jump * fe_interface_values.JxW(qpoint); } diff --git a/examples/step-85/step-85.cc b/examples/step-85/step-85.cc index 5afa0d2ed3..827552b696 100644 --- a/examples/step-85/step-85.cc +++ b/examples/step-85/step-85.cc @@ -503,7 +503,8 @@ namespace Step85 q < fe_interface_values.n_quadrature_points; ++q) { - const Tensor<1, dim> normal = fe_interface_values.normal(q); + const Tensor<1, dim> normal = + fe_interface_values.normal_vector(q); for (unsigned int i = 0; i < n_interface_dofs; ++i) for (unsigned int j = 0; j < n_interface_dofs; ++j) { diff --git a/include/deal.II/fe/fe_interface_values.h b/include/deal.II/fe/fe_interface_values.h index 98e2b364bb..4f16316977 100644 --- a/include/deal.II/fe/fe_interface_values.h +++ b/include/deal.II/fe/fe_interface_values.h @@ -1605,6 +1605,29 @@ public: const std::vector & get_JxW_values() const; + /** + * Return the normal in a given quadrature point. + * + * The normal points in outwards direction as seen from the first cell of + * this interface. + * + * @dealiiRequiresUpdateFlags{update_normal_vectors} + */ + DEAL_II_DEPRECATED_EARLY_WITH_COMMENT("Use the function normal_vector().") + Tensor<1, spacedim> + normal(const unsigned int q_point_index) const; + + /** + * Return the normal in a given quadrature point. + * + * The normal points in outwards direction as seen from the first cell of + * this interface. + * + * @dealiiRequiresUpdateFlags{update_normal_vectors} + */ + Tensor<1, spacedim> + normal_vector(const unsigned int q_point_index) const; + /** * Return the normal vector of the interface in each quadrature point. * @@ -1627,6 +1650,15 @@ public: std_cxx20::ranges::iota_view quadrature_point_indices() const; + /** + * Return the location of the q_pointth quadrature point in + * real space. + * + * @dealiiRequiresUpdateFlags{update_quadrature_points} + */ + const Point & + quadrature_point(const unsigned int q_point) const; + /** * Return a reference to the quadrature points in real space. * @@ -1706,17 +1738,6 @@ public: std::array interface_dof_to_dof_indices(const unsigned int interface_dof_index) const; - /** - * Return the normal in a given quadrature point. - * - * The normal points in outwards direction as seen from the first cell of - * this interface. - * - * @dealiiRequiresUpdateFlags{update_normal_vectors} - */ - Tensor<1, spacedim> - normal(const unsigned int q_point_index) const; - /** * @} */ @@ -2773,6 +2794,18 @@ FEInterfaceValues::quadrature_point_indices() const +template +const Point & +FEInterfaceValues::quadrature_point( + const unsigned int q_point) const +{ + Assert(fe_face_values != nullptr, + ExcMessage("This call requires a call to reinit() first.")); + return fe_face_values->quadrature_point(q_point); +} + + + template const std::vector> & FEInterfaceValues::get_quadrature_points() const @@ -2885,6 +2918,16 @@ FEInterfaceValues::get_fe_face_values( template Tensor<1, spacedim> FEInterfaceValues::normal(const unsigned int q_point_index) const +{ + return normal_vector(q_point_index); +} + + + +template +Tensor<1, spacedim> +FEInterfaceValues::normal_vector( + const unsigned int q_point_index) const { return fe_face_values->normal_vector(q_point_index); } diff --git a/tests/feinterface/fe_interface_values_12.cc b/tests/feinterface/fe_interface_values_12.cc index 39f8e68496..994118b8f6 100644 --- a/tests/feinterface/fe_interface_values_12.cc +++ b/tests/feinterface/fe_interface_values_12.cc @@ -90,8 +90,13 @@ test(const unsigned int fe_degree0, const unsigned int fe_degree1 = 0) const auto &q_points = fiv.get_quadrature_points(); for (unsigned int qpoint = 0; qpoint < q_points.size(); ++qpoint) - deallog << "qpoint " << qpoint << ": " << q_points[qpoint] - << std::endl; + { + Assert(q_points[qpoint] == fiv.quadrature_point(qpoint), + ExcInternalError()); + + deallog << "qpoint " << qpoint << ": " << q_points[qpoint] + << std::endl; + } for (unsigned int idx = 0; idx < n_dofs; ++idx) { diff --git a/tests/feinterface/step-12.cc b/tests/feinterface/step-12.cc index 02ebfe1980..e75b8d81cc 100644 --- a/tests/feinterface/step-12.cc +++ b/tests/feinterface/step-12.cc @@ -313,6 +313,10 @@ namespace Step12 for (unsigned int point = 0; point < q_points.size(); ++point) { + Assert(normals[point] == + scratch_data.fe_interface_values.normal_vector(point), + ExcInternalError()); + const double beta_n = beta(q_points[point]) * normals[point]; if (beta_n > 0) -- 2.39.5