From 44c9122b7e04ee8ae816c8a3f79e23ac03bcb833 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <tasmith4@illinois.edu> Date: Sat, 20 Jul 2019 16:23:06 -0500 Subject: [PATCH] added test for WENO weights (positive direction) --- test.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/test.py b/test.py index fde5322..4311695 100644 --- a/test.py +++ b/test.py @@ -17,6 +17,7 @@ from pyopencl.tools import ( # noqa import utilities as u +@pytest.mark.slow @pytest.mark.parametrize(("gen_fluxes_str,char_fluxes_pos_str,char_fluxes_neg_str," "combined_metric,R_str,flux_expected_str"), [ ("4 11.2 8 8 46.4,1 2.6 1 1 7.1", @@ -73,6 +74,7 @@ def test_weno_flux_uniform_grid( u.compare_arrays(flux_dev.get(), flux_expected) +@pytest.mark.slow @pytest.mark.parametrize(("gen_fluxes_str,consistent_expected_str"), [ ("4 11.2 8 8 46.4,1 2.6 1 1 7.1", "2.5 6.9 4.5 4.5 26.75"), @@ -98,6 +100,7 @@ def test_consistent_part_uniform_grid( u.compare_arrays(consistent_dev.get(), consistent_expected) +@pytest.mark.slow @pytest.mark.parametrize(("char_fluxes_str,combined_metric," "R_str,dissipation_expected_str"), [ (("1.09071563 1.23015152 1.23015152 7.52305259 0.232956271," @@ -142,6 +145,45 @@ def test_dissipation_part_pos_uniform_grid( u.compare_arrays(dissipation_dev.get(), dissipation_expected) +@pytest.mark.parametrize(("char_fluxes_str,combined_metric,weights_expected_str"), [ + (("1.09071563 1.23015152 1.23015152 7.52305259 0.232956271," + "0.467376796 -0.6627417 -0.6627417 1.47953026 0.312527304"), + 1.0, + ("0.999999998 1. 1. 1. 0.999990928," + "2.23542587e-9 2.62886024e-11 2.62886024e-11 2.52995663e-13 " + "8.39888392e-6," + "1.78838212e-10 2.10309347e-12 2.10309347e-12 2.0239658e-14 " + "6.7286569e-7")), + #(("0.0672231577 0.248528137 0.248528137 0.374562227 0.107250611," + # "0.168354897 -0.0585786438 -0.0585786438 0.306026299 0.727493464"), + # 1.0, + # ("0.99999652 0.999999959 0.999999959 0.99998353 0.999999998," + # "3.22170414e-6 3.79356095e-8 3.79356095e-8 0.0000152478162 " + # "2.28039336e-9," + # "2.57963115e-7 3.03513836e-9 3.03513836e-9 1.22216217e-6 " + # "1.82435737e-10")) + ]) +def test_weno_weights_pos_uniform_grid( + ctx_factory, char_fluxes_str, combined_metric, weights_expected_str): + prg = u.get_weno_program_with_root_kernel("weno_weights_pos") + queue = u.get_queue(ctx_factory) + + nvars = 5 + + char_fluxes = u.expand_to_6( + u.transposed_array_from_string(char_fluxes_str)) + weights_dev = u.empty_array_on_device(queue, nvars, 3) + + prg(queue, nvars=nvars, + characteristic_fluxes=char_fluxes, + combined_frozen_metrics=combined_metric, + w=weights_dev) + + weights_expected = u.transposed_array_from_string(weights_expected_str) + u.compare_arrays(weights_dev.get(), weights_expected) + + +@pytest.mark.slow @pytest.mark.parametrize(("char_fluxes_str,combined_metric," "R_str,dissipation_expected_str"), [ (("-0.168354897 -0.0585786438 -0.0585786438 -0.727493464 -0.306026299," -- GitLab