From 2f24f12522165c465d758dd99e8086ddf7e5a1a3 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <tasmith4@illinois.edu> Date: Wed, 29 May 2019 18:19:36 -0500 Subject: [PATCH] add Roe property check --- comparison_fixtures.py | 10 ++++++++++ test.py | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/comparison_fixtures.py b/comparison_fixtures.py index 402f9be..04c7432 100644 --- a/comparison_fixtures.py +++ b/comparison_fixtures.py @@ -1,3 +1,4 @@ +import numpy as np from pytest import approx @@ -8,3 +9,12 @@ def arrays(a, b): def roe_identity(states, R, Rinv): dState = states[:,1] - states[:,0] arrays(R@(Rinv@dState), dState) + + +def roe_property(states, fluxes, R, Rinv, lam): + dState = states[:,1] - states[:,0] + dFlux = fluxes[:,1] - fluxes[:,0] + + temp = Rinv@dState + temp = np.multiply(lam, temp) + arrays(R@temp, dFlux) diff --git a/test.py b/test.py index ab3af8c..d71231e 100644 --- a/test.py +++ b/test.py @@ -26,8 +26,8 @@ def test_roe(ctx_factory): compare.roe_identity(states, R, Rinv) - #fluxes = setup.array_from_string("4 11.2 8 8 46.4,1 2.6 1 1 7.1") - #compare.roe_property(states, fluxes, R, Rinv, lam) + fluxes = setup.array_from_string("4 1,11.2 2.6,8 1,8 1,46.4 7.1") + compare.roe_property(states, fluxes, R, Rinv, lam) def test_matvec(ctx_factory): -- GitLab