From f93a3ec5d749a237faae0c84b9809aa1b363573d Mon Sep 17 00:00:00 2001 From: leicht Date: Wed, 11 Jun 2008 09:10:33 +0000 Subject: [PATCH] Additional tests that currently fail as MappingQ does not care about non-standard faces in the right way. git-svn-id: https://svn.dealii.org/trunk@16294 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fail/mesh_3d_25.cc | 120 +++++++++++++++++++++++++++++ tests/fail/mesh_3d_25/cmp/generic | 16 ++++ tests/fail/mesh_3d_26.cc | 122 ++++++++++++++++++++++++++++++ tests/fail/mesh_3d_26/cmp/generic | 16 ++++ 4 files changed, 274 insertions(+) create mode 100644 tests/fail/mesh_3d_25.cc create mode 100644 tests/fail/mesh_3d_25/cmp/generic create mode 100644 tests/fail/mesh_3d_26.cc create mode 100644 tests/fail/mesh_3d_26/cmp/generic diff --git a/tests/fail/mesh_3d_25.cc b/tests/fail/mesh_3d_25.cc new file mode 100644 index 0000000000..e4e8c4e935 --- /dev/null +++ b/tests/fail/mesh_3d_25.cc @@ -0,0 +1,120 @@ +//---------------------------- mesh_3d_25.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006, 2008 by Timo Heister and the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- mesh_3d_25.cc --------------------------- + + +// an adaptation of the mesh_3d_22 test. check that +// VectorTools::interpolate works for FE_Q(p) elements correctly on a mesh +// with a cell that has a wrong face rotation. when using a MappingQ(3), we +// calculated interpolation points wrongly + +#include "../tests.h" +#include "../bits/mesh_3d.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +using namespace dealii; +using namespace std; + +template +class F : public Function +{ + public: + F (const unsigned int q) : q(q) {} + + virtual double value (const Point &p, + const unsigned int) const + { + double v=0; + for (unsigned int d=0; d +void test (Triangulation& triangulation) +{ + MappingQ<3> mapping(3); + for (unsigned int p=1; p<7-dim; ++p) + { + FE_Q fe(p); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs (fe); + + Vector interpolant (dof_handler.n_dofs()); + Vector error (triangulation.n_active_cells()); + for (unsigned int q=0; q<=p+2; ++q) + { + // interpolate the function + VectorTools::interpolate (mapping, dof_handler, + F (q), + interpolant); + + // then compute the interpolation error + VectorTools::integrate_difference (mapping, dof_handler, + interpolant, + F (q), + error, + QGauss(q+2), + VectorTools::L2_norm); + deallog << fe.get_name() << ", P_" << q + << ", rel. error=" << error.l2_norm() / interpolant.l2_norm() + << std::endl; + if (q<=p) + Assert (error.l2_norm() < 1e-12*interpolant.l2_norm(), + ExcInternalError()); + } + } +} + + + + +int main () +{ + std::ofstream logfile ("mesh_3d_25/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.0e-10); + + Triangulation<3> triangulation; + + create_two_cubes_rotation(triangulation,1); + test<3>(triangulation); +} + diff --git a/tests/fail/mesh_3d_25/cmp/generic b/tests/fail/mesh_3d_25/cmp/generic new file mode 100644 index 0000000000..53ab098682 --- /dev/null +++ b/tests/fail/mesh_3d_25/cmp/generic @@ -0,0 +1,16 @@ + +DEAL::FE_Q<3>(1), P_0, rel. error=0 +DEAL::FE_Q<3>(1), P_1, rel. error=0 +DEAL::FE_Q<3>(1), P_2, rel. error=0.0597945 +DEAL::FE_Q<3>(1), P_3, rel. error=0.0498625 +DEAL::FE_Q<3>(2), P_0, rel. error=0 +DEAL::FE_Q<3>(2), P_1, rel. error=0 +DEAL::FE_Q<3>(2), P_2, rel. error=0 +DEAL::FE_Q<3>(2), P_3, rel. error=0.00331875 +DEAL::FE_Q<3>(2), P_4, rel. error=0.00412760 +DEAL::FE_Q<3>(3), P_0, rel. error=0 +DEAL::FE_Q<3>(3), P_1, rel. error=0 +DEAL::FE_Q<3>(3), P_2, rel. error=0 +DEAL::FE_Q<3>(3), P_3, rel. error=0 +DEAL::FE_Q<3>(3), P_4, rel. error=0.000321938 +DEAL::FE_Q<3>(3), P_5, rel. error=0.000423313 diff --git a/tests/fail/mesh_3d_26.cc b/tests/fail/mesh_3d_26.cc new file mode 100644 index 0000000000..babae54994 --- /dev/null +++ b/tests/fail/mesh_3d_26.cc @@ -0,0 +1,122 @@ +//---------------------------- mesh_3d_26.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006, 2008 by Timo Heister and the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- mesh_3d_26.cc --------------------------- + + +// an adaptation of the mesh_3d_22 test. check that VectorTools::interpolate +// works for FE_Q(p) elements correctly on a mesh with a cell that has a wrong +// face orientation in the interior of the domain. when using a MappingQ(3), we +// calculated interpolation points wrongly + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +using namespace dealii; +using namespace std; + +template +class F : public Function +{ + public: + F (const unsigned int q) : q(q) {} + + virtual double value (const Point &p, + const unsigned int) const + { + double v=0; + for (unsigned int d=0; d +void test (Triangulation& triangulation) +{ + // create a MappingQ(3) which is used on ALL + // cells + MappingQ<3> mapping(3, true); + for (unsigned int p=1; p<7-dim; ++p) + { + FE_Q fe(p); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs (fe); + + Vector interpolant (dof_handler.n_dofs()); + Vector error (triangulation.n_active_cells()); + for (unsigned int q=0; q<=p+2; ++q) + { + // interpolate the function + VectorTools::interpolate (mapping, dof_handler, + F (q), + interpolant); + + // then compute the interpolation error + VectorTools::integrate_difference (mapping, dof_handler, + interpolant, + F (q), + error, + QGauss(q+2), + VectorTools::L2_norm); + deallog << fe.get_name() << ", P_" << q + << ", rel. error=" << error.l2_norm() / interpolant.l2_norm() + << std::endl; + if (q<=p) + Assert (error.l2_norm() < 1e-12*interpolant.l2_norm(), + ExcInternalError()); + } + } +} + + + + +int main () +{ + std::ofstream logfile ("mesh_3d_26/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.0e-10); + + Triangulation<3> triangulation; + GridGenerator::hyper_ball(triangulation); + triangulation.refine_global(1); + test<3>(triangulation); +} + diff --git a/tests/fail/mesh_3d_26/cmp/generic b/tests/fail/mesh_3d_26/cmp/generic new file mode 100644 index 0000000000..caf98c4dd1 --- /dev/null +++ b/tests/fail/mesh_3d_26/cmp/generic @@ -0,0 +1,16 @@ + +DEAL::FE_Q<3>(1), P_0, rel. error=0 +DEAL::FE_Q<3>(1), P_1, rel. error=0 +DEAL::FE_Q<3>(1), P_2, rel. error=0.00836936 +DEAL::FE_Q<3>(1), P_3, rel. error=0.0101346 +DEAL::FE_Q<3>(2), P_0, rel. error=0 +DEAL::FE_Q<3>(2), P_1, rel. error=0 +DEAL::FE_Q<3>(2), P_2, rel. error=0 +DEAL::FE_Q<3>(2), P_3, rel. error=0.000301004 +DEAL::FE_Q<3>(2), P_4, rel. error=0.000466547 +DEAL::FE_Q<3>(3), P_0, rel. error=0 +DEAL::FE_Q<3>(3), P_1, rel. error=0 +DEAL::FE_Q<3>(3), P_2, rel. error=0 +DEAL::FE_Q<3>(3), P_3, rel. error=0 +DEAL::FE_Q<3>(3), P_4, rel. error=2.53469e-05 +DEAL::FE_Q<3>(3), P_5, rel. error=4.45045e-05 -- 2.39.5