From 7c95c4e607228bfa9fc81aa1aff31aa137ac06b8 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 31 May 2012 08:52:36 +0000 Subject: [PATCH] Two more tests that currently fail. git-svn-id: https://svn.dealii.org/trunk@25582 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fe/mapping_real_to_unit_q4_sphere.cc | 102 ++++++++++++++++++ .../cmp/generic | 9 ++ tests/fe/mapping_real_to_unit_q4_sphere_x.cc | 95 ++++++++++++++++ .../cmp/generic | 9 ++ 4 files changed, 215 insertions(+) create mode 100644 tests/fe/mapping_real_to_unit_q4_sphere.cc create mode 100644 tests/fe/mapping_real_to_unit_q4_sphere/cmp/generic create mode 100644 tests/fe/mapping_real_to_unit_q4_sphere_x.cc create mode 100644 tests/fe/mapping_real_to_unit_q4_sphere_x/cmp/generic diff --git a/tests/fe/mapping_real_to_unit_q4_sphere.cc b/tests/fe/mapping_real_to_unit_q4_sphere.cc new file mode 100644 index 0000000000..16e57afa1d --- /dev/null +++ b/tests/fe/mapping_real_to_unit_q4_sphere.cc @@ -0,0 +1,102 @@ +//----------------------------------------------------------------------------- +// $Id: data_out_base_pvd.cc 25569 2012-05-30 12:53:31Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2012 by 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. +// +//----------------------------------------------------------------------------- + + +// this is a variation of the _q4_curved test, with data extracted by +// Eric Heien from the Aspect code. we used to trip an assertion (the +// Newton iteration in transform_real_to_unit_cell did not converge) +// because the point we look for is outside the Q1 mapped cell but +// inside the Q4 mapped cell. as part of the algorithm, we get an +// initial guess for the inverse Q4 mapping by running an inverse Q1 +// mapping, and we failed to find a solution in the latter. +// +// a redux of this test is in the mapping_real_to_unit_q4_sphere_* +// tests + +#include "../tests.h" + +#include +#include +#include +#include +#include + + +void test_real_to_unit_cell() +{ + const unsigned int dim = 3; + + // define a spherical cap boundary + // to be used for one of the faces + const double radius = Point(1.43757e-10, 4.48023e+06, 4.48023e+06).norm(); + HyperBallBoundary boundary (Point(), radius); + + // create the mesh: a single cell + // with the following coordinates: + std::vector > vertices; + vertices.push_back (Point( 6.70384e-11, 3.17728e+06, 3.17728e+06)); + vertices.push_back (Point( -1.46060e+06, 3.99043e+06, 1.46060e+06)); + vertices.push_back (Point( -1.46060e+06, 1.46060e+06, 3.99043e+06)); + vertices.push_back (Point( -2.59424e+06, 2.59424e+06, 2.59424e+06)); + vertices.push_back (Point( 1.43757e-10, 4.48023e+06, 4.48023e+06)); + vertices.push_back (Point( -2.05956e+06, 5.62684e+06, 2.05956e+06)); + vertices.push_back (Point( -2.05956e+06, 2.05956e+06, 5.62684e+06)); + vertices.push_back (Point( -3.65809e+06, 3.65809e+06, 3.65809e+06)); + // the points above don't show + // enough digits to have the same + // outer radius, so normalize the + // four outer ones + for (unsigned int v=4; v<8; ++v) + vertices[v] *= radius/vertices[v].norm(); + std::vector > cells; + { + CellData d = {{0,1,2,3,4,5,6,7},{0}}; + cells.push_back(d); + } + Triangulation triangulation; + triangulation.create_triangulation (vertices, cells, + SubCellData()); + + // set the boundary indicator for + // one face and adjacent edges of + // the single cell + triangulation.set_boundary (1, boundary); + triangulation.begin_active()->face(5)->set_all_boundary_indicators (1); + + // now try to find the coordinates + // of the following point in the + // reference coordinate system of + // the cell + const Point p (-3.56413e+06, 1.74215e+06, 2.14762e+06); + MappingQ map(4); + typename Triangulation::active_cell_iterator + cell = triangulation.begin_active(); + deallog << map.transform_real_to_unit_cell(cell,p) << std::endl; +} + + +int +main() +{ + std::ofstream logfile ("mapping_real_to_unit_q4_sphere/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test_real_to_unit_cell(); + + return 0; +} + + + diff --git a/tests/fe/mapping_real_to_unit_q4_sphere/cmp/generic b/tests/fe/mapping_real_to_unit_q4_sphere/cmp/generic new file mode 100644 index 0000000000..7bea8b1c89 --- /dev/null +++ b/tests/fe/mapping_real_to_unit_q4_sphere/cmp/generic @@ -0,0 +1,9 @@ + +DEAL::dim=1, spacedim=1 +DEAL::OK +DEAL::dim=2, spacedim=2 +DEAL::OK +DEAL::dim=3, spacedim=3 +DEAL::OK +DEAL::dim=1, spacedim=2 +DEAL::OK diff --git a/tests/fe/mapping_real_to_unit_q4_sphere_x.cc b/tests/fe/mapping_real_to_unit_q4_sphere_x.cc new file mode 100644 index 0000000000..8b018af8b5 --- /dev/null +++ b/tests/fe/mapping_real_to_unit_q4_sphere_x.cc @@ -0,0 +1,95 @@ +//----------------------------------------------------------------------------- +// $Id: data_out_base_pvd.cc 25569 2012-05-30 12:53:31Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2012 by 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. +// +//----------------------------------------------------------------------------- + + +// a redux of mapping_real_to_unit_q4_sphere. one doesn't in fact need +// the Q4 mapping, the problem already happens in the initial guess +// generation using a Q1 mapping + +#include "../tests.h" + +#include +#include +#include +#include +#include + + +void test_real_to_unit_cell() +{ + const unsigned int dim = 3; + + // define a spherical cap boundary + // to be used for one of the faces + const double radius = Point(1.43757e-10, 4.48023e+06, 4.48023e+06).norm(); + HyperBallBoundary boundary (Point(), radius); + + // create the mesh: a single cell + // with the following coordinates: + std::vector > vertices; + vertices.push_back (Point( 6.70384e-11, 3.17728e+06, 3.17728e+06)); + vertices.push_back (Point( -1.46060e+06, 3.99043e+06, 1.46060e+06)); + vertices.push_back (Point( -1.46060e+06, 1.46060e+06, 3.99043e+06)); + vertices.push_back (Point( -2.59424e+06, 2.59424e+06, 2.59424e+06)); + vertices.push_back (Point( 1.43757e-10, 4.48023e+06, 4.48023e+06)); + vertices.push_back (Point( -2.05956e+06, 5.62684e+06, 2.05956e+06)); + vertices.push_back (Point( -2.05956e+06, 2.05956e+06, 5.62684e+06)); + vertices.push_back (Point( -3.65809e+06, 3.65809e+06, 3.65809e+06)); + // the points above don't show + // enough digits to have the same + // outer radius, so normalize the + // four outer ones + for (unsigned int v=4; v<8; ++v) + vertices[v] *= radius/vertices[v].norm(); + std::vector > cells; + { + CellData d = {{0,1,2,3,4,5,6,7},{0}}; + cells.push_back(d); + } + Triangulation triangulation; + triangulation.create_triangulation (vertices, cells, + SubCellData()); + + // set the boundary indicator for + // one face and adjacent edges of + // the single cell + triangulation.set_boundary (1, boundary); + triangulation.begin_active()->face(5)->set_all_boundary_indicators (1); + + // now try to find the coordinates + // of the following point in the + // reference coordinate system of + // the cell + const Point p (-3.56413e+06, 1.74215e+06, 2.14762e+06); + MappingQ1 map; + typename Triangulation::active_cell_iterator + cell = triangulation.begin_active(); + deallog << map.transform_real_to_unit_cell(cell,p) << std::endl; +} + + +int +main() +{ + std::ofstream logfile ("mapping_real_to_unit_q4_sphere_x/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test_real_to_unit_cell(); + + return 0; +} + + + diff --git a/tests/fe/mapping_real_to_unit_q4_sphere_x/cmp/generic b/tests/fe/mapping_real_to_unit_q4_sphere_x/cmp/generic new file mode 100644 index 0000000000..7bea8b1c89 --- /dev/null +++ b/tests/fe/mapping_real_to_unit_q4_sphere_x/cmp/generic @@ -0,0 +1,9 @@ + +DEAL::dim=1, spacedim=1 +DEAL::OK +DEAL::dim=2, spacedim=2 +DEAL::OK +DEAL::dim=3, spacedim=3 +DEAL::OK +DEAL::dim=1, spacedim=2 +DEAL::OK -- 2.39.5