From 7048b667da71433f269d780219b3dbad190578e9 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Sun, 29 Mar 2020 15:58:39 +0200 Subject: [PATCH] Testcase --- tests/fe/cell_similarity_12.cc | 128 +++++++++++++++++++++++++++++ tests/fe/cell_similarity_12.output | 112 +++++++++++++++++++++++++ 2 files changed, 240 insertions(+) create mode 100644 tests/fe/cell_similarity_12.cc create mode 100644 tests/fe/cell_similarity_12.output diff --git a/tests/fe/cell_similarity_12.cc b/tests/fe/cell_similarity_12.cc new file mode 100644 index 0000000000..fe0e482eb4 --- /dev/null +++ b/tests/fe/cell_similarity_12.cc @@ -0,0 +1,128 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2020 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + + +// Check the CellSimilarity with MappingFEField - since the field can be +// arbitrarily deformed, we should not get any similarity. + +#include +#include + +#include + +#include +#include +#include +#include + +#include + +#include + +#include "../tests.h" + + + +template +void +test(const unsigned int degree) +{ + Triangulation tria; + GridGenerator::hyper_cube(tria); + tria.refine_global(1); + + FESystem fe_grid(FE_Q(degree), dim); + DoFHandler dof_grid(tria); + dof_grid.distribute_dofs(fe_grid); + Vector euler; + euler.reinit(dof_grid.n_dofs()); + const ComponentMask mask(dim, true); + VectorTools::get_position_vector(dof_grid, euler, mask); + + FE_Q fe(1); + deallog << "FE=" << fe.get_name() << std::endl; + + MappingFEField mapping(dof_grid, euler, mask); + deallog << "Mapping=MappingFEField(FE_Q(" << degree << "))" << std::endl; + + DoFHandler dof(tria); + dof.distribute_dofs(fe); + + std::vector> points(2); + for (unsigned int d = 0; d < dim; ++d) + points[0][d] = 0.1; + for (unsigned int d = 0; d < dim; ++d) + points[1][d] = 0.85; + + const Quadrature quadrature(points); + FEValues fe_values(mapping, + fe, + quadrature, + update_gradients | update_jacobians); + + const auto check = [&]() { + for (const auto &cell : dof.active_cell_iterators()) + { + fe_values.reinit(cell); + + deallog << "Jacobians: "; + for (unsigned int q = 0; q < fe_values.n_quadrature_points; ++q) + { + deallog << "[ "; + for (unsigned int d = 0; d < dim; ++d) + for (unsigned int e = 0; e < dim; ++e) + deallog << fe_values.jacobian(q)[d][e] << " "; + deallog << " ] "; + } + deallog << std::endl; + deallog << "Derivatives of shape function: "; + for (unsigned int q = 0; q < fe_values.n_quadrature_points; ++q) + { + deallog << "[ "; + for (unsigned int d = 0; d < dim; ++d) + deallog << fe_values.shape_grad(fe.dofs_per_cell / 2, q)[d] + << " "; + deallog << " ] "; + } + deallog << std::endl; + } + }; + + deallog << "Undeformed configuration" << std::endl; + check(); + + euler(euler.size() - 1) += 0.01; + deallog << "Last Euler point deformed" << std::endl; + check(); + + euler(0) += 0.01; + deallog << "First and last Euler points deformed" << std::endl; + check(); +} + + + +int +main() +{ + initlog(); + deallog << std::setprecision(8); + MultithreadInfo::set_thread_limit(1); + + test<2>(1); + test<2>(2); + test<3>(1); +} diff --git a/tests/fe/cell_similarity_12.output b/tests/fe/cell_similarity_12.output new file mode 100644 index 0000000000..50577da647 --- /dev/null +++ b/tests/fe/cell_similarity_12.output @@ -0,0 +1,112 @@ + +DEAL::FE=FE_Q<2>(1) +DEAL::Mapping=MappingFEField(FE_Q(1)) +DEAL::Undeformed configuration +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -2.7755576e-17 0.0000000 0.50000000 ] [ 0.50000000 -1.1102230e-16 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -2.7755576e-17 0.0000000 0.50000000 ] [ 0.50000000 -1.1102230e-16 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Last Euler point deformed +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -2.7755576e-17 0.0000000 0.50000000 ] [ 0.50000000 -1.1102230e-16 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -2.7755576e-17 0.0010000000 0.50100000 ] [ 0.50000000 -1.1102230e-16 0.0085000000 0.50850000 ] +DEAL::Derivatives of shape function: [ -0.20359281 1.7964072 ] [ -1.7050147 0.29498525 ] +DEAL::First and last Euler points deformed +DEAL::Jacobians: [ 0.49100000 -0.0090000000 0.0000000 0.50000000 ] [ 0.49850000 -0.0015000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20366599 1.7963340 ] [ -1.7051153 0.29488465 ] +DEAL::Jacobians: [ 0.50000000 -2.7755576e-17 0.0000000 0.50000000 ] [ 0.50000000 -1.1102230e-16 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -2.7755576e-17 0.0010000000 0.50100000 ] [ 0.50000000 -1.1102230e-16 0.0085000000 0.50850000 ] +DEAL::Derivatives of shape function: [ -0.20359281 1.7964072 ] [ -1.7050147 0.29498525 ] +DEAL::FE=FE_Q<2>(1) +DEAL::Mapping=MappingFEField(FE_Q(2)) +DEAL::Undeformed configuration +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -1.1102230e-16 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 -2.2204460e-16 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -1.1102230e-16 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 -2.2204460e-16 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Last Euler point deformed +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -1.1102230e-16 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 -2.2204460e-16 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -1.1102230e-16 0.011520000 0.51152000 ] [ 0.50000000 0.0000000 -0.014280000 0.48572000 ] +DEAL::Derivatives of shape function: [ -0.24053800 1.7594620 ] [ -1.6911801 0.30881990 ] +DEAL::First and last Euler points deformed +DEAL::Jacobians: [ 0.48128000 -0.018720000 0.0000000 0.50000000 ] [ 0.49958000 -0.00042000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20777926 1.7922207 ] [ -1.7014292 0.29857080 ] +DEAL::Jacobians: [ 0.50000000 -1.1102230e-16 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 0.0000000 0.50000000 ] [ 0.50000000 0.0000000 -2.2204460e-16 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.20000000 1.8000000 ] [ -1.7000000 0.30000000 ] +DEAL::Jacobians: [ 0.50000000 -1.1102230e-16 0.011520000 0.51152000 ] [ 0.50000000 0.0000000 -0.014280000 0.48572000 ] +DEAL::Derivatives of shape function: [ -0.24053800 1.7594620 ] [ -1.6911801 0.30881990 ] +DEAL::FE=FE_Q<3>(1) +DEAL::Mapping=MappingFEField(FE_Q(1)) +DEAL::Undeformed configuration +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 3.4694470e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 3.4694470e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 6.9388939e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 6.9388939e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 3.4694470e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 3.4694470e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 6.9388939e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 6.9388939e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Last Euler point deformed +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 3.4694470e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 3.4694470e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 6.9388939e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 6.9388939e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 3.4694470e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 3.4694470e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 6.9388939e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 6.9388939e-18 0.00010000000 0.00010000000 0.50010000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0072250000 0.0072250000 0.50722500 ] +DEAL::Derivatives of shape function: [ -0.18032394 -0.18032394 1.6196761 ] [ -0.25564099 -0.25564099 0.044359012 ] +DEAL::First and last Euler points deformed +DEAL::Jacobians: [ 0.49190000 -0.0081000000 -0.0081000000 0.0000000 0.50000000 3.4694470e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.49977500 -0.00022500000 -0.00022500000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18296402 -0.18296402 1.6170360 ] [ -0.25511480 -0.25511480 0.044885198 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 3.4694470e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 6.9388939e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 6.9388939e-18 0.0000000 3.4694470e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 3.4694470e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 3.4694470e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 0.0000000 3.4694470e-18 0.0000000 0.50000000 6.9388939e-18 0.0000000 6.9388939e-18 0.50000000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 ] +DEAL::Derivatives of shape function: [ -0.18000000 -0.18000000 1.6200000 ] [ -0.25500000 -0.25500000 0.045000000 ] +DEAL::Jacobians: [ 0.50000000 -1.3877788e-17 0.0000000 0.0000000 0.50000000 6.9388939e-18 0.00010000000 0.00010000000 0.50010000 ] [ 0.50000000 0.0000000 0.0000000 0.0000000 0.50000000 0.0000000 0.0072250000 0.0072250000 0.50722500 ] +DEAL::Derivatives of shape function: [ -0.18032394 -0.18032394 1.6196761 ] [ -0.25564099 -0.25564099 0.044359012 ] -- 2.39.5