From 8acb0be31e060ede271e8ccbde9cf26972ab3026 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <tasmith4@illinois.edu> Date: Fri, 28 Jun 2019 23:59:57 -0500 Subject: [PATCH] add flux splitting test with no parametrization --- test.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test.py b/test.py index b64ddfb..1b4f6d1 100644 --- a/test.py +++ b/test.py @@ -18,6 +18,36 @@ from pyopencl.tools import ( # noqa import utilities as u +def test_flux_splitting_uniform_grid( + ctx_factory, states_str, fluxes_str, R_inv_str, wavespeeds_str, + fluxes_pos_expected_str, fluxes_neg_expected_str): + prg = u.get_weno_program_with_root_kernel("split_characteristic_fluxes") + queue = u.get_queue(ctx_factory) + + nvars = 5 + + states = u.transposed_array_from_string(states_str) + fluxes = u.transposed_array_from_string(fluxes_str) + R_inv = u.array_from_string(R_inv_str) + wavespeeds = u.array_from_string(wavespeeds_str) + fluxes_pos_dev = u.empty_array_on_device(queue, nvars, 6) + fluxes_neg_dev = u.empty_array_on_device(queue, nvars, 6) + + prg(queue, nvars=nvars, + generalized_states_frozen=states, + generalized_fluxes_frozen=fluxes, + R_inv=R_inv, + wavespeeds=wavespeeds, + characteristic_fluxes_pos=fluxes_pos_dev, + characteristic_fluxes_neg=fluxes_neg_dev) + + fluxes_pos_expected = u.array_from_string(fluxes_pos_expected_str) + u.compare_arrays(fluxes_pos_dev.get(), fluxes_pos_expected) + + fluxes_neg_expected = u.array_from_string(fluxes_neg_expected_str) + u.compare_arrays(fluxes_neg_dev.get(), fluxes_neg_expected) + + @pytest.mark.parametrize("lam_pointwise_str,lam_roe_str,lam_expected_str", [ ("1 2 3 4 5,2 4 6 8 10", "1.5 3 4.5 6 7.5", "2.2 4.4 6.6 8.8 11"), ("1 2 3 4 5,-2 -4 -6 -8 -10", "1.5 3 4.5 6 7.5", "2.2 4.4 6.6 8.8 11"), -- GitLab