From: Jaeryun Yim Date: Wed, 13 Jan 2016 09:01:22 +0000 (+0900) Subject: Add tests for the P1 nonconforming nonparametric element. X-Git-Tag: v8.5.0-rc1~624^2~37 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0979e62ca52791a97eafe556970d5248769f9b3;p=dealii.git Add tests for the P1 nonconforming nonparametric element. Shape value and shape gradient tests on a genuine quadrilateral. --- diff --git a/tests/fe/p1nc_nonparametric_04.cc b/tests/fe/p1nc_nonparametric_04.cc new file mode 100644 index 0000000000..f6bcdc68e7 --- /dev/null +++ b/tests/fe/p1nc_nonparametric_04.cc @@ -0,0 +1,93 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +// check the P1NC nonparametric element on a genuine quadrilateral. + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#define PRECISION 5 + + +template +Point bilinear (const Point &p) +{ + Point q = p ; + if (dim>=2) + { + q(0) = 16.*p(0) +4.*p(1) -10.*p(0)*p(1) ; + q(1) = 6.*p(1) +4.*p(0)*p(1) ; + } + + return q ; +} + + + +template +void +check() +{ + Triangulation triangulation; + GridGenerator::hyper_cube (triangulation, 0., 1.); + GridTools::transform (&bilinear, triangulation) ; + + FE_P1NCNonparametric fe; + DoFHandler dof_handler (triangulation); + dof_handler.distribute_dofs(fe); + + QGauss quadrature(3); + FEValues fe_values (fe, quadrature, update_values | update_q_points); + fe_values.reinit (dof_handler.begin_active()); + + for (unsigned int q=0; q(); +} + + + diff --git a/tests/fe/p1nc_nonparametric_04.output b/tests/fe/p1nc_nonparametric_04.output new file mode 100644 index 0000000000..e0a8158123 --- /dev/null +++ b/tests/fe/p1nc_nonparametric_04.output @@ -0,0 +1,10 @@ + +DEAL::index=0 position=2.12702 0.72702 values=0.64730 0.13333 0.36667 -0.14730 +DEAL::index=1 position=7.88730 0.90161 values=0.44365 0.44365 0.05635 0.05635 +DEAL::index=2 position=13.64758 1.07621 values=0.24000 0.75397 -0.25397 0.26000 +DEAL::index=3 position=3.23972 3.22540 values=0.44365 0.05635 0.44365 0.05635 +DEAL::index=4 position=7.50000 4.00000 values=0.25000 0.25000 0.25000 0.25000 +DEAL::index=5 position=11.76028 4.77460 values=0.05635 0.44365 0.05635 0.44365 +DEAL::index=6 position=4.35242 5.72379 values=0.24000 -0.02063 0.52063 0.26000 +DEAL::index=7 position=7.11270 7.09839 values=0.05635 0.05635 0.44365 0.44365 +DEAL::index=8 position=9.87298 8.47298 values=-0.12730 0.13333 0.36667 0.62730 diff --git a/tests/fe/p1nc_nonparametric_08.cc b/tests/fe/p1nc_nonparametric_08.cc new file mode 100644 index 0000000000..4a433771cb --- /dev/null +++ b/tests/fe/p1nc_nonparametric_08.cc @@ -0,0 +1,93 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +// check the P1NC nonparametric element's gradient on a genuine quadrilateral. + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#define PRECISION 5 + + +template +Point bilinear (const Point &p) +{ + Point q = p ; + if (dim>=2) + { + q(0) = 16.*p(0) +4.*p(1) -10.*p(0)*p(1) ; + q(1) = 6.*p(1) +4.*p(0)*p(1) ; + } + + return q ; +} + + + +template +void +check() +{ + Triangulation triangulation; + GridGenerator::hyper_cube (triangulation, 0., 1.); + GridTools::transform (&bilinear, triangulation) ; + + FE_P1NCNonparametric fe; + DoFHandler dof_handler (triangulation); + dof_handler.distribute_dofs(fe); + + QGauss quadrature(3); + FEValues fe_values (fe, quadrature, update_gradients | update_q_points); + fe_values.reinit (dof_handler.begin_active()); + + for (unsigned int q=0; q(); +} + + + diff --git a/tests/fe/p1nc_nonparametric_08.output b/tests/fe/p1nc_nonparametric_08.output new file mode 100644 index 0000000000..5ce91a63f5 --- /dev/null +++ b/tests/fe/p1nc_nonparametric_08.output @@ -0,0 +1,10 @@ + +DEAL::index=0 position=2.12702 0.72702 values=[-0.03333 -0.06667] [0.05556 -0.05556] [-0.05556 0.05556] [0.03333 0.06667] +DEAL::index=1 position=7.88730 0.90161 values=[-0.03333 -0.06667] [0.05556 -0.05556] [-0.05556 0.05556] [0.03333 0.06667] +DEAL::index=2 position=13.64758 1.07621 values=[-0.03333 -0.06667] [0.05556 -0.05556] [-0.05556 0.05556] [0.03333 0.06667] +DEAL::index=3 position=3.23972 3.22540 values=[-0.03333 -0.06667] [0.05556 -0.05556] [-0.05556 0.05556] [0.03333 0.06667] +DEAL::index=4 position=7.50000 4.00000 values=[-0.03333 -0.06667] [0.05556 -0.05556] [-0.05556 0.05556] [0.03333 0.06667] +DEAL::index=5 position=11.76028 4.77460 values=[-0.03333 -0.06667] [0.05556 -0.05556] [-0.05556 0.05556] [0.03333 0.06667] +DEAL::index=6 position=4.35242 5.72379 values=[-0.03333 -0.06667] [0.05556 -0.05556] [-0.05556 0.05556] [0.03333 0.06667] +DEAL::index=7 position=7.11270 7.09839 values=[-0.03333 -0.06667] [0.05556 -0.05556] [-0.05556 0.05556] [0.03333 0.06667] +DEAL::index=8 position=9.87298 8.47298 values=[-0.03333 -0.06667] [0.05556 -0.05556] [-0.05556 0.05556] [0.03333 0.06667]