From: David Wells Date: Sat, 28 Jul 2018 17:45:58 +0000 (-0400) Subject: Add a test for Bessel function values. X-Git-Tag: v9.1.0-rc1~872^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=136b78e127bca644f27fd6f0597fa6494c7c7b93;p=dealii.git Add a test for Bessel function values. This verifies that the upcoming change produces the same results as the present implementation. --- diff --git a/tests/base/bessel_function_values.cc b/tests/base/bessel_function_values.cc new file mode 100644 index 0000000000..0a0fd4529b --- /dev/null +++ b/tests/base/bessel_function_values.cc @@ -0,0 +1,43 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 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. +// +// --------------------------------------------------------------------- + + +// Verify that the new C++17 Bessel function produces equivalent output to jn. + + +#include + +#include "../tests.h" + + +int +main() +{ + initlog(); + + for (unsigned int order = 0; order < 3; order += 1) + for (double wave_n = -4.0; wave_n < 4.0; wave_n += 1.5) + for (double x = 1.0; x < 2.0; x += 0.5) + for (double y = 2.0; y < 3.0; y += 0.5) + { + Functions::Bessel1<2> bessel(order, wave_n, Point<2>(x, y)); + + const Point<2> new_point(x + 0.1, y + 0.1); + deallog << "value at (" << new_point[0] << ", " << new_point[1] + << ") = " << bessel.value(new_point) << std::endl; + deallog << "gradient at (" << new_point[0] << ", " << new_point[1] + << ") = " << bessel.gradient(new_point) << std::endl; + } +} diff --git a/tests/base/bessel_function_values.output b/tests/base/bessel_function_values.output new file mode 100644 index 0000000000..afd64b99d8 --- /dev/null +++ b/tests/base/bessel_function_values.output @@ -0,0 +1,145 @@ + +DEAL::value at (1.10000, 2.10000) = 0.921586 +DEAL::gradient at (1.10000, 2.10000) = -0.768424 -0.768424 +DEAL::value at (1.10000, 2.60000) = 0.921586 +DEAL::gradient at (1.10000, 2.60000) = -0.768424 -0.768424 +DEAL::value at (1.60000, 2.10000) = 0.921586 +DEAL::gradient at (1.60000, 2.10000) = -0.768424 -0.768424 +DEAL::value at (1.60000, 2.60000) = 0.921586 +DEAL::gradient at (1.60000, 2.60000) = -0.768424 -0.768424 +DEAL::value at (1.10000, 2.10000) = 0.968993 +DEAL::gradient at (1.10000, 2.10000) = -0.307643 -0.307643 +DEAL::value at (1.10000, 2.60000) = 0.968993 +DEAL::gradient at (1.10000, 2.60000) = -0.307643 -0.307643 +DEAL::value at (1.60000, 2.10000) = 0.968993 +DEAL::gradient at (1.60000, 2.10000) = -0.307643 -0.307643 +DEAL::value at (1.60000, 2.60000) = 0.968993 +DEAL::gradient at (1.60000, 2.60000) = -0.307643 -0.307643 +DEAL::value at (1.10000, 2.10000) = 0.995006 +DEAL::gradient at (1.10000, 2.10000) = -0.0498751 -0.0498751 +DEAL::value at (1.10000, 2.60000) = 0.995006 +DEAL::gradient at (1.10000, 2.60000) = -0.0498751 -0.0498751 +DEAL::value at (1.60000, 2.10000) = 0.995006 +DEAL::gradient at (1.60000, 2.10000) = -0.0498751 -0.0498751 +DEAL::value at (1.60000, 2.60000) = 0.995006 +DEAL::gradient at (1.60000, 2.60000) = -0.0498751 -0.0498751 +DEAL::value at (1.10000, 2.10000) = 0.998750 +DEAL::gradient at (1.10000, 2.10000) = -0.0124922 -0.0124922 +DEAL::value at (1.10000, 2.60000) = 0.998750 +DEAL::gradient at (1.10000, 2.60000) = -0.0124922 -0.0124922 +DEAL::value at (1.60000, 2.10000) = 0.998750 +DEAL::gradient at (1.60000, 2.10000) = -0.0124922 -0.0124922 +DEAL::value at (1.60000, 2.60000) = 0.998750 +DEAL::gradient at (1.60000, 2.60000) = -0.0124922 -0.0124922 +DEAL::value at (1.10000, 2.10000) = 0.980100 +DEAL::gradient at (1.10000, 2.10000) = -0.198007 -0.198007 +DEAL::value at (1.10000, 2.60000) = 0.980100 +DEAL::gradient at (1.10000, 2.60000) = -0.198007 -0.198007 +DEAL::value at (1.60000, 2.10000) = 0.980100 +DEAL::gradient at (1.60000, 2.10000) = -0.198007 -0.198007 +DEAL::value at (1.60000, 2.60000) = 0.980100 +DEAL::gradient at (1.60000, 2.60000) = -0.198007 -0.198007 +DEAL::value at (1.10000, 2.10000) = 0.939682 +DEAL::gradient at (1.10000, 2.10000) = -0.593933 -0.593933 +DEAL::value at (1.10000, 2.60000) = 0.939682 +DEAL::gradient at (1.10000, 2.60000) = -0.593933 -0.593933 +DEAL::value at (1.60000, 2.10000) = 0.939682 +DEAL::gradient at (1.60000, 2.10000) = -0.593933 -0.593933 +DEAL::value at (1.60000, 2.60000) = 0.939682 +DEAL::gradient at (1.60000, 2.60000) = -0.593933 -0.593933 +DEAL::value at (1.10000, 2.10000) = -0.271679 +DEAL::gradient at (1.10000, 2.10000) = -1.24824 -1.24824 +DEAL::value at (1.10000, 2.60000) = -0.271679 +DEAL::gradient at (1.10000, 2.60000) = -1.24824 -1.24824 +DEAL::value at (1.60000, 2.10000) = -0.271679 +DEAL::gradient at (1.60000, 2.10000) = -1.24824 -1.24824 +DEAL::value at (1.60000, 2.60000) = -0.271679 +DEAL::gradient at (1.60000, 2.60000) = -1.24824 -1.24824 +DEAL::value at (1.10000, 2.10000) = -0.174029 +DEAL::gradient at (1.10000, 2.10000) = -0.842810 -0.842810 +DEAL::value at (1.10000, 2.60000) = -0.174029 +DEAL::gradient at (1.10000, 2.60000) = -0.842810 -0.842810 +DEAL::value at (1.60000, 2.10000) = -0.174029 +DEAL::gradient at (1.60000, 2.10000) = -0.842810 -0.842810 +DEAL::value at (1.60000, 2.60000) = -0.174029 +DEAL::gradient at (1.60000, 2.60000) = -0.842810 -0.842810 +DEAL::value at (1.10000, 2.10000) = -0.0705340 +DEAL::gradient at (1.10000, 2.10000) = -0.350905 -0.350905 +DEAL::value at (1.10000, 2.60000) = -0.0705340 +DEAL::gradient at (1.10000, 2.60000) = -0.350905 -0.350905 +DEAL::value at (1.60000, 2.10000) = -0.0705340 +DEAL::gradient at (1.60000, 2.10000) = -0.350905 -0.350905 +DEAL::value at (1.60000, 2.60000) = -0.0705340 +DEAL::gradient at (1.60000, 2.60000) = -0.350905 -0.350905 +DEAL::value at (1.10000, 2.10000) = 0.0353332 +DEAL::gradient at (1.10000, 2.10000) = 0.176445 0.176445 +DEAL::value at (1.10000, 2.60000) = 0.0353332 +DEAL::gradient at (1.10000, 2.60000) = 0.176445 0.176445 +DEAL::value at (1.60000, 2.10000) = 0.0353332 +DEAL::gradient at (1.60000, 2.10000) = 0.176445 0.176445 +DEAL::value at (1.60000, 2.60000) = 0.0353332 +DEAL::gradient at (1.60000, 2.60000) = 0.176445 0.176445 +DEAL::value at (1.10000, 2.10000) = 0.140012 +DEAL::gradient at (1.10000, 2.10000) = 0.686011 0.686011 +DEAL::value at (1.10000, 2.60000) = 0.140012 +DEAL::gradient at (1.10000, 2.60000) = 0.686011 0.686011 +DEAL::value at (1.60000, 2.10000) = 0.140012 +DEAL::gradient at (1.60000, 2.10000) = 0.686011 0.686011 +DEAL::value at (1.60000, 2.60000) = 0.140012 +DEAL::gradient at (1.60000, 2.60000) = 0.686011 0.686011 +DEAL::value at (1.10000, 2.10000) = 0.239985 +DEAL::gradient at (1.10000, 2.10000) = 1.12567 1.12567 +DEAL::value at (1.10000, 2.60000) = 0.239985 +DEAL::gradient at (1.10000, 2.60000) = 1.12567 1.12567 +DEAL::value at (1.60000, 2.10000) = 0.239985 +DEAL::gradient at (1.60000, 2.10000) = 1.12567 1.12567 +DEAL::value at (1.60000, 2.60000) = 0.239985 +DEAL::gradient at (1.60000, 2.60000) = 1.12567 1.12567 +DEAL::value at (1.10000, 2.10000) = 0.0389439 +DEAL::gradient at (1.10000, 2.10000) = 0.378984 0.378984 +DEAL::value at (1.10000, 2.60000) = 0.0389439 +DEAL::gradient at (1.10000, 2.60000) = 0.378984 0.378984 +DEAL::value at (1.60000, 2.10000) = 0.0389439 +DEAL::gradient at (1.60000, 2.10000) = 0.378984 0.378984 +DEAL::value at (1.60000, 2.60000) = 0.0389439 +DEAL::gradient at (1.60000, 2.60000) = 0.378984 0.378984 +DEAL::value at (1.10000, 2.10000) = 0.0154629 +DEAL::gradient at (1.10000, 2.10000) = 0.153014 0.153014 +DEAL::value at (1.10000, 2.60000) = 0.0154629 +DEAL::gradient at (1.10000, 2.60000) = 0.153014 0.153014 +DEAL::value at (1.60000, 2.10000) = 0.0154629 +DEAL::gradient at (1.60000, 2.10000) = 0.153014 0.153014 +DEAL::value at (1.60000, 2.60000) = 0.0154629 +DEAL::gradient at (1.60000, 2.60000) = 0.153014 0.153014 +DEAL::value at (1.10000, 2.10000) = 0.00249584 +DEAL::gradient at (1.10000, 2.10000) = 0.0249167 0.0249167 +DEAL::value at (1.10000, 2.60000) = 0.00249584 +DEAL::gradient at (1.10000, 2.60000) = 0.0249167 0.0249167 +DEAL::value at (1.60000, 2.10000) = 0.00249584 +DEAL::gradient at (1.60000, 2.10000) = 0.0249167 0.0249167 +DEAL::value at (1.60000, 2.60000) = 0.00249584 +DEAL::gradient at (1.60000, 2.60000) = 0.0249167 0.0249167 +DEAL::value at (1.10000, 2.10000) = 0.000624740 +DEAL::gradient at (1.10000, 2.10000) = 0.00624479 0.00624479 +DEAL::value at (1.10000, 2.60000) = 0.000624740 +DEAL::gradient at (1.10000, 2.60000) = 0.00624479 0.00624479 +DEAL::value at (1.60000, 2.10000) = 0.000624740 +DEAL::gradient at (1.60000, 2.10000) = 0.00624479 0.00624479 +DEAL::value at (1.60000, 2.60000) = 0.000624740 +DEAL::gradient at (1.60000, 2.60000) = 0.00624479 0.00624479 +DEAL::value at (1.10000, 2.10000) = 0.00993350 +DEAL::gradient at (1.10000, 2.10000) = 0.0986717 0.0986717 +DEAL::value at (1.10000, 2.60000) = 0.00993350 +DEAL::gradient at (1.10000, 2.60000) = 0.0986717 0.0986717 +DEAL::value at (1.60000, 2.10000) = 0.00993350 +DEAL::gradient at (1.60000, 2.10000) = 0.0986717 0.0986717 +DEAL::value at (1.60000, 2.60000) = 0.00993350 +DEAL::gradient at (1.60000, 2.60000) = 0.0986717 0.0986717 +DEAL::value at (1.10000, 2.10000) = 0.0300045 +DEAL::gradient at (1.10000, 2.10000) = 0.293888 0.293888 +DEAL::value at (1.10000, 2.60000) = 0.0300045 +DEAL::gradient at (1.10000, 2.60000) = 0.293888 0.293888 +DEAL::value at (1.60000, 2.10000) = 0.0300045 +DEAL::gradient at (1.60000, 2.10000) = 0.293888 0.293888 +DEAL::value at (1.60000, 2.60000) = 0.0300045 +DEAL::gradient at (1.60000, 2.60000) = 0.293888 0.293888