From c0e1bf98e144265f3a7f3e38c01c1bd5af5af596 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Thu, 27 Feb 2020 22:51:50 -0600 Subject: [PATCH 01/18] Add some functions for wavy metrics that just return uniform metrics --- test/data_for_test.py | 45 +++++++++++++++++++++++++------------------ test/wavy_metrics.py | 33 +++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 test/wavy_metrics.py diff --git a/test/data_for_test.py b/test/data_for_test.py index 483d50b..afd750a 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -1,4 +1,4 @@ -__copyright__ = "Copyright (C) 2019 Timothy A. Smith" +__copyright__ = "Copyright (C) 2019-2020 Timothy A. Smith" __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy @@ -24,6 +24,7 @@ import numpy as np import pytest import utilities as u import weno_reference_implementation as ref +import wavy_metrics as wavy class WindowData: @@ -72,6 +73,9 @@ def metrics_generator(): dtype=np.float64, order="F") jacobians = np.repeat(1.0, 6) + elif (metric_str == "wavy"): + metrics = wavy.metrics(ndim) + jacobians = wavy.jacobians(ndim) else: raise ValueError("Metric string {} not supported".format(metric_str)) return metrics, jacobians @@ -80,24 +84,27 @@ def metrics_generator(): @pytest.fixture(scope="session", params=[ - ("sine", "x", "uniform"), - ("sine", "y", "uniform"), - ("sine", "z", "uniform"), - ("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), - ("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), - ("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), - ("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), - ("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), - ("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), - ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), - ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), - ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), - ("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), - ("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), - ("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), - ("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), - ("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), - ("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") + ("sine", "x", "wavy"), + ("sine", "y", "wavy"), + ("sine", "z", "wavy"), + #("sine", "x", "uniform"), + #("sine", "y", "uniform"), + #("sine", "z", "uniform"), + #("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), + #("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), + #("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), + #("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), + #("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), + #("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), + #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), + #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), + #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), + #("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), + #("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), + #("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), + #("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), + #("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), + #("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") ]) def window_data(request, states_generator, metrics_generator): states_str = request.param[0] diff --git a/test/wavy_metrics.py b/test/wavy_metrics.py new file mode 100644 index 0000000..672d0c1 --- /dev/null +++ b/test/wavy_metrics.py @@ -0,0 +1,33 @@ +__copyright__ = "Copyright (C) 2020 Timothy A. Smith" + +__license__ = """ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" + +import numpy as np + + +def metrics(ndim): + return np.array([np.identity(ndim) for i in range(6)], + dtype=np.float64, + order="F") + + +def jacobians(ndim): + return np.array([1.0 for i in range(6)], dtype=np.float64, order="F") -- GitLab From 3cfd088e08f7fb6ed3dcccd1dc9349b7c26be3f0 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 28 Feb 2020 19:30:57 -0600 Subject: [PATCH 02/18] refactor API to wavy metrics --- test/data_for_test.py | 14 +++++++------- test/{wavy_metrics.py => wavy_metrics_3d.py} | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 11 deletions(-) rename test/{wavy_metrics.py => wavy_metrics_3d.py} (73%) diff --git a/test/data_for_test.py b/test/data_for_test.py index afd750a..06f485e 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -24,7 +24,7 @@ import numpy as np import pytest import utilities as u import weno_reference_implementation as ref -import wavy_metrics as wavy +import wavy_metrics_3d as wavy3d class WindowData: @@ -73,9 +73,9 @@ def metrics_generator(): dtype=np.float64, order="F") jacobians = np.repeat(1.0, 6) - elif (metric_str == "wavy"): - metrics = wavy.metrics(ndim) - jacobians = wavy.jacobians(ndim) + elif (metric_str == "wavy3d"): + metrics = wavy3d.metrics() + jacobians = wavy3d.jacobians() else: raise ValueError("Metric string {} not supported".format(metric_str)) return metrics, jacobians @@ -84,9 +84,9 @@ def metrics_generator(): @pytest.fixture(scope="session", params=[ - ("sine", "x", "wavy"), - ("sine", "y", "wavy"), - ("sine", "z", "wavy"), + ("sine", "x", "wavy3d"), + ("sine", "y", "wavy3d"), + ("sine", "z", "wavy3d"), #("sine", "x", "uniform"), #("sine", "y", "uniform"), #("sine", "z", "uniform"), diff --git a/test/wavy_metrics.py b/test/wavy_metrics_3d.py similarity index 73% rename from test/wavy_metrics.py rename to test/wavy_metrics_3d.py index 672d0c1..4096eff 100644 --- a/test/wavy_metrics.py +++ b/test/wavy_metrics_3d.py @@ -20,14 +20,25 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +# The wavy grid and curvilinear metric formulation used here was taken from +# T. Nonomura, et al., Comput. Fluids 107 (2015) 242-255 + import numpy as np -def metrics(ndim): - return np.array([np.identity(ndim) for i in range(6)], +def weighted_metrics(): + return np.array([np.identity(3) for i in range(6)], dtype=np.float64, order="F") -def jacobians(ndim): - return np.array([1.0 for i in range(6)], dtype=np.float64, order="F") +def inverse_jacobians(): + return np.array([1.0 for i in range(6)], dtype=np.float64) + + +def metrics(): + return weighted_metrics()*jacobians()[:,None,None] + + +def jacobians(): + return np.reciprocal(inverse_jacobians()) -- GitLab From 6109a854f60f9d2ce5db3ca748d493ac5f74ace7 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Sat, 29 Feb 2020 09:46:56 -0700 Subject: [PATCH 03/18] add some constants, setup choice of direction --- test/data_for_test.py | 8 ++--- test/wavy_metrics_3d.py | 72 +++++++++++++++++++++++++++++++++++------ 2 files changed, 66 insertions(+), 14 deletions(-) diff --git a/test/data_for_test.py b/test/data_for_test.py index 06f485e..1711bfd 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -67,15 +67,15 @@ def states_generator(): def metrics_generator(): ndim = ref.gas.ndim - def window_metrics(metric_str): + def window_metrics(metric_str, dim): if (metric_str == "uniform"): metrics = np.array([np.identity(ndim) for i in range(6)], dtype=np.float64, order="F") jacobians = np.repeat(1.0, 6) elif (metric_str == "wavy3d"): - metrics = wavy3d.metrics() - jacobians = wavy3d.jacobians() + metrics = wavy3d.metrics(dim) + jacobians = wavy3d.jacobians(dim) else: raise ValueError("Metric string {} not supported".format(metric_str)) return metrics, jacobians @@ -113,7 +113,7 @@ def window_data(request, states_generator, metrics_generator): return WindowData(states_generator(states_str), dir_str, - metrics_generator(metric_str)) + metrics_generator(metric_str, dir_str)) class PairData: diff --git a/test/wavy_metrics_3d.py b/test/wavy_metrics_3d.py index 4096eff..d83ce26 100644 --- a/test/wavy_metrics_3d.py +++ b/test/wavy_metrics_3d.py @@ -25,20 +25,72 @@ THE SOFTWARE. import numpy as np +# grid parameters +Lx = 4 +Ly = 4 +Lz = 4 -def weighted_metrics(): - return np.array([np.identity(3) for i in range(6)], - dtype=np.float64, - order="F") +# grid indices +# built-in assumption is j goes from 1 to j_max, and similarly with k, l +j_max = 21 +k_max = 21 +l_max = 21 +dx = Lx/(j_max - 1) +dy = Ly/(k_max - 1) +dz = Lz/(l_max - 1) -def inverse_jacobians(): - return np.array([1.0 for i in range(6)], dtype=np.float64) +def weighted_metric_mat(j, k, l): + """ returns weighted metric matrix at a single grid point with indices j,k,l""" + arr = np.identity(3) + #FIXME: Shouldn't be uniform + return arr -def metrics(): - return weighted_metrics()*jacobians()[:,None,None] +def inverse_jacobian(j, k, l): + """ returns inverse jacobian at a single grid point with indices j,k,l""" + #FIXME: Shouldn't be uniform + return 1.0 -def jacobians(): - return np.reciprocal(inverse_jacobians()) + +def weighted_metrics(dim): + if dim == "x": + return np.array([weighted_metric_mat(j+1,1,1) for j in range(6)], + dtype=np.float64, + order="F") + elif dim == "y": + return np.array([weighted_metric_mat(1,k+1,1) for k in range(6)], + dtype=np.float64, + order="F") + elif dim == "z": + return np.array([weighted_metric_mat(1,1,l+1) for l in range(6)], + dtype=np.float64, + order="F") + else: + raise ValueError("Dimension {} not supported".format(dim)) + + +def inverse_jacobians(dim): + if dim == "x": + return np.array([inverse_jacobian(j+1,1,1) for j in range(6)], + dtype=np.float64, + order="F") + elif dim == "y": + return np.array([inverse_jacobian(1,k+1,1) for k in range(6)], + dtype=np.float64, + order="F") + elif dim == "z": + return np.array([inverse_jacobian(1,1,l+1) for l in range(6)], + dtype=np.float64, + order="F") + else: + raise ValueError("Dimension {} not supported".format(dim)) + + +def metrics(dim): + return weighted_metrics(dim)*jacobians(dim)[:,None,None] + + +def jacobians(dim): + return np.reciprocal(inverse_jacobians(dim)) -- GitLab From 4f36f206e13b9ba4a1a049eda879c4bc7f990e50 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Sat, 29 Feb 2020 09:54:22 -0700 Subject: [PATCH 04/18] clean up and remove some duplication in wavy metrics --- test/wavy_metrics_3d.py | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/test/wavy_metrics_3d.py b/test/wavy_metrics_3d.py index d83ce26..df1f801 100644 --- a/test/wavy_metrics_3d.py +++ b/test/wavy_metrics_3d.py @@ -54,43 +54,30 @@ def inverse_jacobian(j, k, l): return 1.0 -def weighted_metrics(dim): +def array_along_dim(func, dim): if dim == "x": - return np.array([weighted_metric_mat(j+1,1,1) for j in range(6)], + return np.array([func(j+1,1,1) for j in range(6)], dtype=np.float64, order="F") elif dim == "y": - return np.array([weighted_metric_mat(1,k+1,1) for k in range(6)], + return np.array([func(1,k+1,1) for k in range(6)], dtype=np.float64, order="F") elif dim == "z": - return np.array([weighted_metric_mat(1,1,l+1) for l in range(6)], + return np.array([func(1,1,l+1) for l in range(6)], dtype=np.float64, order="F") else: raise ValueError("Dimension {} not supported".format(dim)) -def inverse_jacobians(dim): - if dim == "x": - return np.array([inverse_jacobian(j+1,1,1) for j in range(6)], - dtype=np.float64, - order="F") - elif dim == "y": - return np.array([inverse_jacobian(1,k+1,1) for k in range(6)], - dtype=np.float64, - order="F") - elif dim == "z": - return np.array([inverse_jacobian(1,1,l+1) for l in range(6)], - dtype=np.float64, - order="F") - else: - raise ValueError("Dimension {} not supported".format(dim)) +def weighted_metrics(dim): + return array_along_dim(weighted_metric_mat, dim) -def metrics(dim): - return weighted_metrics(dim)*jacobians(dim)[:,None,None] +def jacobians(dim): + return np.reciprocal(array_along_dim(inverse_jacobian, dim)) -def jacobians(dim): - return np.reciprocal(inverse_jacobians(dim)) +def metrics(dim): + return weighted_metrics(dim)*jacobians(dim)[:,None,None] -- GitLab From 5f901fec1557b66362f364ec260cc30c3ea21742 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Sat, 29 Feb 2020 10:14:57 -0700 Subject: [PATCH 05/18] added non-uniform jacobians --- test/wavy_metrics_3d.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/test/wavy_metrics_3d.py b/test/wavy_metrics_3d.py index df1f801..935e0e4 100644 --- a/test/wavy_metrics_3d.py +++ b/test/wavy_metrics_3d.py @@ -41,17 +41,40 @@ dy = Ly/(k_max - 1) dz = Lz/(l_max - 1) +def cos_x(xi): + return np.cos((4*np.pi*dx*xi)/Lx) + +def cos_y(eta): + return np.cos((4*np.pi*dy*eta)/Ly) + +def cos_z(zeta): + return np.cos((4*np.pi*dz*zeta)/Lz) + +def sin_x(xi): + return np.sin((4*np.pi*dx*xi)/Lx) + +def sin_y(eta): + return np.sin((4*np.pi*dy*eta)/Ly) + +def sin_z(zeta): + return np.sin((4*np.pi*dz*zeta)/Lz) + + def weighted_metric_mat(j, k, l): """ returns weighted metric matrix at a single grid point with indices j,k,l""" arr = np.identity(3) #FIXME: Shouldn't be uniform return arr - def inverse_jacobian(j, k, l): """ returns inverse jacobian at a single grid point with indices j,k,l""" - #FIXME: Shouldn't be uniform - return 1.0 + return dx*dy*dz*( + Lx*Ly*Lz + -16*(pi^2)*Ly*dx*dz*cos_z(zeta)*cos_x(xi)*sin_y(eta)^2 + -16*(pi^2)*Lz*dx*dy*cos_y(eta)*cos_x(xi)*sin_z(zeta)^2 + -16*(pi^2)*Lx*dz*dy*cos_y(eta)*cos_z(zeta)*sin_x(xi)^2 + +16*(pi^3)*dx*dy*dz*sin_x(2*xi)*sin_y(2*eta)*sin_z(2*zeta) + )/(Lx*Ly*Lz) def array_along_dim(func, dim): -- GitLab From 11b7136937d9c076d37b286d865aeb483a3d39e8 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Sat, 29 Feb 2020 10:30:09 -0700 Subject: [PATCH 06/18] some more refactoring, start on weighted metric matrix --- test/wavy_metrics_3d.py | 58 ++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/test/wavy_metrics_3d.py b/test/wavy_metrics_3d.py index 935e0e4..dd39f6d 100644 --- a/test/wavy_metrics_3d.py +++ b/test/wavy_metrics_3d.py @@ -24,12 +24,15 @@ THE SOFTWARE. # T. Nonomura, et al., Comput. Fluids 107 (2015) 242-255 import numpy as np +import numpy.pi as pi # grid parameters Lx = 4 Ly = 4 Lz = 4 +Lprod = Lx*Ly*Lz + # grid indices # built-in assumption is j goes from 1 to j_max, and similarly with k, l j_max = 21 @@ -42,39 +45,68 @@ dz = Lz/(l_max - 1) def cos_x(xi): - return np.cos((4*np.pi*dx*xi)/Lx) + return np.cos((4*pi*dx*xi)/Lx) def cos_y(eta): - return np.cos((4*np.pi*dy*eta)/Ly) + return np.cos((4*pi*dy*eta)/Ly) def cos_z(zeta): - return np.cos((4*np.pi*dz*zeta)/Lz) + return np.cos((4*pi*dz*zeta)/Lz) def sin_x(xi): - return np.sin((4*np.pi*dx*xi)/Lx) + return np.sin((4*pi*dx*xi)/Lx) def sin_y(eta): - return np.sin((4*np.pi*dy*eta)/Ly) + return np.sin((4*pi*dy*eta)/Ly) def sin_z(zeta): - return np.sin((4*np.pi*dz*zeta)/Lz) + return np.sin((4*pi*dz*zeta)/Lz) + + +def blue_x(xi, eta, zeta): + return 16*(pi^2)*Lx*dz*dy*cos_y(eta)*cos_z(zeta)*sin_x(xi)^2 + +def blue_y(xi, eta, zeta): + return 16*(pi^2)*Ly*dx*dz*cos_z(zeta)*cos_x(xi)*sin_y(eta)^2 + +def blue_z(xi, eta, zeta): + return 16*(pi^2)*Lz*dx*dy*cos_y(eta)*cos_x(xi)*sin_z(zeta)^2 + + +def coords_from_indices(j, k, l): + return (j-1, k-1, l-1) def weighted_metric_mat(j, k, l): """ returns weighted metric matrix at a single grid point with indices j,k,l""" - arr = np.identity(3) - #FIXME: Shouldn't be uniform + xi, eta, zeta = coords_from_indices(j, k, l) + arr = np.zeros([3,3]) + + arr[0,0] = dy*dz*(Lprod - blue_x(xi, eta, zeta))/Lprod + arr[1,0] = + arr[2,0] = + + arr[0,1] = + arr[1,1] = dx*dz*(Lprod - blue_y(xi, eta, zeta))/Lprod + arr[2,1] = + + arr[0,2] = + arr[1,2] = + arr[2,2] = dx*dy*(Lprod - blue_z(xi, eta, zeta))/Lprod + return arr + def inverse_jacobian(j, k, l): """ returns inverse jacobian at a single grid point with indices j,k,l""" + xi, eta, zeta = coords_from_indices(j, k, l) return dx*dy*dz*( - Lx*Ly*Lz - -16*(pi^2)*Ly*dx*dz*cos_z(zeta)*cos_x(xi)*sin_y(eta)^2 - -16*(pi^2)*Lz*dx*dy*cos_y(eta)*cos_x(xi)*sin_z(zeta)^2 - -16*(pi^2)*Lx*dz*dy*cos_y(eta)*cos_z(zeta)*sin_x(xi)^2 + Lprod + - blue_x(xi, eta, zeta) + - blue_y(xi, eta, zeta) + - blue_z(xi, eta, zeta) +16*(pi^3)*dx*dy*dz*sin_x(2*xi)*sin_y(2*eta)*sin_z(2*zeta) - )/(Lx*Ly*Lz) + )/Lprod def array_along_dim(func, dim): -- GitLab From 7b796888bee4eb8a3c7b31f4accca1deb5b729bf Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 17:18:00 -0700 Subject: [PATCH 07/18] initial implementation of wavy mesh complete --- test/wavy_metrics_3d.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/wavy_metrics_3d.py b/test/wavy_metrics_3d.py index dd39f6d..6aca999 100644 --- a/test/wavy_metrics_3d.py +++ b/test/wavy_metrics_3d.py @@ -83,15 +83,21 @@ def weighted_metric_mat(j, k, l): arr = np.zeros([3,3]) arr[0,0] = dy*dz*(Lprod - blue_x(xi, eta, zeta))/Lprod - arr[1,0] = - arr[2,0] = + arr[1,0] = 4*pi*dx*dy*dz*cos_x(xi)*(-Lz*sin_z(zeta) + + 4*pi*dz*cos_z(zeta)*sin_y(eta)*sin_x(xi))/(Lx*Lz) + arr[2,0] = 4*pi*dx*dy*dz*cos_x(xi)*(-Ly*sin_y(eta) + + 4*pi*dy*cos_y(eta)*sin_z(zeta)*sin_x(xi))/(Lx*Ly) - arr[0,1] = + arr[0,1] = 4*pi*dx*dy*dz*cos_y(eta)*(-Lz*sin_z(zeta) + + 4*pi*dz*cos_z(zeta)*sin_x(xi)*sin_y(eta))/(Ly*Lz) arr[1,1] = dx*dz*(Lprod - blue_y(xi, eta, zeta))/Lprod - arr[2,1] = + arr[2,1] = 4*pi*dx*dy*dz*cos_y(eta)*(-Lx*sin_x(xi) + + 4*pi*dx*cos_x(xi)*sin_z(zeta)*sin_y(eta))/(Ly*Lx) - arr[0,2] = - arr[1,2] = + arr[0,2] = 4*pi*dx*dy*dz*cos_z(zeta)*(-Ly*sin_y(eta) + + 4*pi*dy*cos_y(eta)*sin_x(xi)*sin_z(zeta))/(Lz*Ly) + arr[1,2] = 4*pi*dx*dy*dz*cos_z(zeta)*(-Lx*sin_x(xi) + + 4*pi*dx*cos_x(xi)*sin_y(eta)*sin_z(zeta))/(Lz*Lx) arr[2,2] = dx*dy*(Lprod - blue_z(xi, eta, zeta))/Lprod return arr -- GitLab From 268e99feaded700bb204a5211ff02548156b8b1b Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 17:21:05 -0700 Subject: [PATCH 08/18] fix some interpreter complaints --- test/wavy_metrics_3d.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/wavy_metrics_3d.py b/test/wavy_metrics_3d.py index 6aca999..adfdf0c 100644 --- a/test/wavy_metrics_3d.py +++ b/test/wavy_metrics_3d.py @@ -24,7 +24,7 @@ THE SOFTWARE. # T. Nonomura, et al., Comput. Fluids 107 (2015) 242-255 import numpy as np -import numpy.pi as pi +from numpy import pi # grid parameters Lx = 4 @@ -64,13 +64,13 @@ def sin_z(zeta): def blue_x(xi, eta, zeta): - return 16*(pi^2)*Lx*dz*dy*cos_y(eta)*cos_z(zeta)*sin_x(xi)^2 + return 16*(pi**2)*Lx*dz*dy*cos_y(eta)*cos_z(zeta)*sin_x(xi)**2 def blue_y(xi, eta, zeta): - return 16*(pi^2)*Ly*dx*dz*cos_z(zeta)*cos_x(xi)*sin_y(eta)^2 + return 16*(pi**2)*Ly*dx*dz*cos_z(zeta)*cos_x(xi)*sin_y(eta)**2 def blue_z(xi, eta, zeta): - return 16*(pi^2)*Lz*dx*dy*cos_y(eta)*cos_x(xi)*sin_z(zeta)^2 + return 16*(pi**2)*Lz*dx*dy*cos_y(eta)*cos_x(xi)*sin_z(zeta)**2 def coords_from_indices(j, k, l): @@ -111,7 +111,7 @@ def inverse_jacobian(j, k, l): - blue_x(xi, eta, zeta) - blue_y(xi, eta, zeta) - blue_z(xi, eta, zeta) - +16*(pi^3)*dx*dy*dz*sin_x(2*xi)*sin_y(2*eta)*sin_z(2*zeta) + +16*(pi**3)*dx*dy*dz*sin_x(2*xi)*sin_y(2*eta)*sin_z(2*zeta) )/Lprod -- GitLab From 8ea794a7d2d7e64ae118a6cb921289d06b1cedeb Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 22:22:19 -0700 Subject: [PATCH 09/18] uncomment tests and add xfail marks --- test/data_for_test.py | 36 ++++++++++++++++++------------------ test/test_flux_window_ops.py | 4 ++++ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/test/data_for_test.py b/test/data_for_test.py index 1711bfd..99feb03 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -87,24 +87,24 @@ def metrics_generator(): ("sine", "x", "wavy3d"), ("sine", "y", "wavy3d"), ("sine", "z", "wavy3d"), - #("sine", "x", "uniform"), - #("sine", "y", "uniform"), - #("sine", "z", "uniform"), - #("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), - #("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), - #("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), - #("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), - #("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), - #("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), - #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), - #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), - #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), - #("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), - #("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), - #("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), - #("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), - #("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), - #("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") + ("sine", "x", "uniform"), + ("sine", "y", "uniform"), + ("sine", "z", "uniform"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), + ("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), + ("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), + ("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), + ("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), + ("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), + ("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), + ("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), + ("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), + ("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") ]) def window_data(request, states_generator, metrics_generator): states_str = request.param[0] diff --git a/test/test_flux_window_ops.py b/test/test_flux_window_ops.py index 4bdb27e..4e72a85 100644 --- a/test/test_flux_window_ops.py +++ b/test/test_flux_window_ops.py @@ -98,6 +98,8 @@ def window_results(queue, window_data): def test_pointwise_eigenvalues(queue, window_results): data = window_results + if not np.array_equal(data.metrics[0], data.metrics[1]): + pytest.xfail("expect failure with non-uniform metrics") prg = u.get_weno_program_with_root_kernel("pointwise_eigenvalues") @@ -111,6 +113,8 @@ def test_pointwise_eigenvalues(queue, window_results): def test_flux_splitting(queue, window_results): data = window_results + if not np.array_equal(data.metrics[0], data.metrics[1]): + pytest.xfail("expect failure with non-uniform metrics") prg = u.get_weno_program_with_root_kernel("split_characteristic_fluxes") -- GitLab From d4ce757bbb7f0c8cf9f7bdabd24c2655b4a42331 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 22:31:56 -0700 Subject: [PATCH 10/18] mark weno weights tests xfail for wavy metric tests --- test/test_flux_window_ops.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/test_flux_window_ops.py b/test/test_flux_window_ops.py index 4e72a85..f1d1a7e 100644 --- a/test/test_flux_window_ops.py +++ b/test/test_flux_window_ops.py @@ -203,6 +203,8 @@ def test_dissipation_part_neg(queue, window_results): @pytest.mark.slow def test_weno_weights_pos(queue, window_results): data = window_results + if not np.array_equal(data.metrics[0], data.metrics[1]): + pytest.xfail("expect failure with non-uniform metrics") prg = u.get_weno_program_with_root_kernel("weno_weights_pos") @@ -222,6 +224,8 @@ def test_weno_weights_pos(queue, window_results): @pytest.mark.slow def test_weno_weights_neg(queue, window_results): data = window_results + if not np.array_equal(data.metrics[0], data.metrics[1]): + pytest.xfail("expect failure with non-uniform metrics") prg = u.get_weno_program_with_root_kernel("weno_weights_neg") -- GitLab From c322d2dfc89239b9ae77350dd062c85fa64701fb Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 22:43:15 -0700 Subject: [PATCH 11/18] remove xfail label for pointwise eigenvalue test --- test/test_flux_window_ops.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/test_flux_window_ops.py b/test/test_flux_window_ops.py index f1d1a7e..08885cd 100644 --- a/test/test_flux_window_ops.py +++ b/test/test_flux_window_ops.py @@ -98,8 +98,6 @@ def window_results(queue, window_data): def test_pointwise_eigenvalues(queue, window_results): data = window_results - if not np.array_equal(data.metrics[0], data.metrics[1]): - pytest.xfail("expect failure with non-uniform metrics") prg = u.get_weno_program_with_root_kernel("pointwise_eigenvalues") -- GitLab From a96678960706b43784cf292f5afc8aa3dd403a0a Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 22:44:22 -0700 Subject: [PATCH 12/18] comment out uniform metric tests for now --- test/data_for_test.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/data_for_test.py b/test/data_for_test.py index 99feb03..1711bfd 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -87,24 +87,24 @@ def metrics_generator(): ("sine", "x", "wavy3d"), ("sine", "y", "wavy3d"), ("sine", "z", "wavy3d"), - ("sine", "x", "uniform"), - ("sine", "y", "uniform"), - ("sine", "z", "uniform"), - ("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), - ("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), - ("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), - ("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), - ("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), - ("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), - ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), - ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), - ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), - ("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), - ("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), - ("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), - ("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), - ("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), - ("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") + #("sine", "x", "uniform"), + #("sine", "y", "uniform"), + #("sine", "z", "uniform"), + #("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), + #("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), + #("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), + #("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), + #("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), + #("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), + #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), + #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), + #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), + #("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), + #("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), + #("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), + #("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), + #("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), + #("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") ]) def window_data(request, states_generator, metrics_generator): states_str = request.param[0] -- GitLab From 0d4ed4d7054949da2b4701648c0a88a780d90b3e Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 23:28:53 -0700 Subject: [PATCH 13/18] pass metrics to pointwise eigenvalues --- WENO.F90 | 22 +++++++++++++++------- test/test_flux_window_ops.py | 6 ++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/WENO.F90 b/WENO.F90 index 5a7a6f4..80780a4 100644 --- a/WENO.F90 +++ b/WENO.F90 @@ -61,7 +61,8 @@ subroutine compute_flux_derivatives(nvars, ndim, nx, ny, nz, d, & generalized_states_frozen, & generalized_fluxes_frozen) - call pointwise_eigenvalues(nvars, 1, states(:, i-2:i+3, j, k), lambda_pointwise) + call pointwise_eigenvalues(nvars, ndim, 1, states(:, i-2:i+3, j, k), & + metrics(:, :, i-2:i+3, j, k), lambda_pointwise) call roe_eigensystem(nvars, ndim, 1, states(:, i:i+1, j, k), & metrics_frozen, R, R_inv, lambda_roe) @@ -111,7 +112,8 @@ subroutine compute_flux_derivatives(nvars, ndim, nx, ny, nz, d, & generalized_states_frozen, & generalized_fluxes_frozen) - call pointwise_eigenvalues(nvars, 2, states(:, i, j-2:j+3, k), lambda_pointwise) + call pointwise_eigenvalues(nvars, ndim, 2, states(:, i, j-2:j+3, k), & + metrics(:, :, i, j-2:j+3, k), lambda_pointwise) call roe_eigensystem(nvars, ndim, 2, states(:, i, j:j+1, k), & metrics_frozen, R, R_inv, lambda_roe) @@ -162,7 +164,8 @@ subroutine compute_flux_derivatives(nvars, ndim, nx, ny, nz, d, & generalized_states_frozen, & generalized_fluxes_frozen) - call pointwise_eigenvalues(nvars, 3, states(:, i, j, k-2:k+3), lambda_pointwise) + call pointwise_eigenvalues(nvars, ndim, 3, states(:, i, j, k-2:k+3), & + metrics(:, :, i, j, k-2:k+3), lambda_pointwise) call roe_eigensystem(nvars, ndim, 3, states(:, i, j, k:k+1), & metrics_frozen, R, R_inv, lambda_roe) @@ -199,32 +202,37 @@ subroutine compute_flux_derivatives(nvars, ndim, nx, ny, nz, d, & !$loopy end tagged: flux_z_diff end subroutine -subroutine pointwise_eigenvalues(nvars, d, states, lambda_pointwise) +subroutine pointwise_eigenvalues(nvars, ndim, d, states, metrics, lambda_pointwise) implicit none integer, intent(in) :: nvars + integer, intent(in) :: ndim integer, intent(in) :: d real*8, intent(in) :: states(nvars, -2:3) + real*8, intent(in) :: metrics(ndim, ndim, -2:3) real*8, intent(out) :: lambda_pointwise(nvars, -2:3) - real*8 u(3), c, p, rho, ke + real*8 u(3), c, p, rho, ke, metric_norm integer v, k, i do k=-2,3 rho = states(1,k) ke = 0.0d0 + metric_norm = 0.0d0 do i=1,3 u(i) = states(i+1,k)/rho ke = ke + u(i)**2 + metric_norm = metric_norm + metrics(d,i,k)**2 end do + metric_norm = sqrt(metric_norm) p = (1.4d0 - 1)*(states(nvars,k) - 0.5d0*rho*ke) c = sqrt(1.4d0*p/rho) do v=1,nvars-2 lambda_pointwise(v,k) = u(d) end do - lambda_pointwise(nvars-1,k) = u(d) + c - lambda_pointwise(nvars,k) = u(d) - c + lambda_pointwise(nvars-1,k) = u(d) + c*metric_norm + lambda_pointwise(nvars,k) = u(d) - c*metric_norm end do end subroutine diff --git a/test/test_flux_window_ops.py b/test/test_flux_window_ops.py index 08885cd..702c9fc 100644 --- a/test/test_flux_window_ops.py +++ b/test/test_flux_window_ops.py @@ -101,10 +101,12 @@ def test_pointwise_eigenvalues(queue, window_results): prg = u.get_weno_program_with_root_kernel("pointwise_eigenvalues") + metric_arg = np.moveaxis(data.metrics, 0, -1).copy(order="F") lam_dev = u.empty_array_on_device(queue, data.nvars, 6) - prg(queue, nvars=data.nvars, d=data.direction, - states=data.states, lambda_pointwise=lam_dev) + prg(queue, nvars=data.nvars, ndim=data.ndim, d=data.direction, + states=data.states, metrics=metric_arg, + lambda_pointwise=lam_dev) u.compare_arrays(lam_dev.get(), data.lam_pointwise) -- GitLab From d54ed60aa61a8ecdf5d8e6b5cbc50c05aebabfd2 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 23:30:16 -0700 Subject: [PATCH 14/18] reactivate uniform metric tests --- test/data_for_test.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/data_for_test.py b/test/data_for_test.py index 1711bfd..99feb03 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -87,24 +87,24 @@ def metrics_generator(): ("sine", "x", "wavy3d"), ("sine", "y", "wavy3d"), ("sine", "z", "wavy3d"), - #("sine", "x", "uniform"), - #("sine", "y", "uniform"), - #("sine", "z", "uniform"), - #("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), - #("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), - #("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), - #("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), - #("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), - #("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), - #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), - #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), - #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), - #("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), - #("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), - #("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), - #("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), - #("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), - #("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") + ("sine", "x", "uniform"), + ("sine", "y", "uniform"), + ("sine", "z", "uniform"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), + ("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), + ("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), + ("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), + ("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), + ("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), + ("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), + ("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), + ("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), + ("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") ]) def window_data(request, states_generator, metrics_generator): states_str = request.param[0] -- GitLab From de9240f4feda0b9d3301625b886e687e528fa8fc Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 23:38:10 -0700 Subject: [PATCH 15/18] comment out uniform metric tests for now --- test/data_for_test.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/data_for_test.py b/test/data_for_test.py index 99feb03..1711bfd 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -87,24 +87,24 @@ def metrics_generator(): ("sine", "x", "wavy3d"), ("sine", "y", "wavy3d"), ("sine", "z", "wavy3d"), - ("sine", "x", "uniform"), - ("sine", "y", "uniform"), - ("sine", "z", "uniform"), - ("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), - ("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), - ("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), - ("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), - ("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), - ("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), - ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), - ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), - ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), - ("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), - ("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), - ("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), - ("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), - ("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), - ("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") + #("sine", "x", "uniform"), + #("sine", "y", "uniform"), + #("sine", "z", "uniform"), + #("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), + #("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), + #("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), + #("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), + #("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), + #("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), + #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), + #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), + #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), + #("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), + #("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), + #("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), + #("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), + #("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), + #("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") ]) def window_data(request, states_generator, metrics_generator): states_str = request.param[0] -- GitLab From b1052ac37e79be192907138ea761a97c7dadca08 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Fri, 6 Mar 2020 23:40:05 -0700 Subject: [PATCH 16/18] take away xfail mark on flux splitting test --- test/test_flux_window_ops.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/test_flux_window_ops.py b/test/test_flux_window_ops.py index 702c9fc..bd4ca4e 100644 --- a/test/test_flux_window_ops.py +++ b/test/test_flux_window_ops.py @@ -113,8 +113,6 @@ def test_pointwise_eigenvalues(queue, window_results): def test_flux_splitting(queue, window_results): data = window_results - if not np.array_equal(data.metrics[0], data.metrics[1]): - pytest.xfail("expect failure with non-uniform metrics") prg = u.get_weno_program_with_root_kernel("split_characteristic_fluxes") -- GitLab From 100bd009f2972e29c471aed5b93da49a80d5f5c1 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Sat, 7 Mar 2020 07:49:21 -0700 Subject: [PATCH 17/18] fix bug where test fixture was not passing correct generalized states to flux splitting --- test/test_flux_window_ops.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_flux_window_ops.py b/test/test_flux_window_ops.py index bd4ca4e..8c22c13 100644 --- a/test/test_flux_window_ops.py +++ b/test/test_flux_window_ops.py @@ -58,6 +58,8 @@ class WindowResults: self.frozen_jacobian = pair.frozen_jacobian self.combined_frozen_metric = pair.combined_frozen_metrics[self.dir_internal] + self.generalized_states_frozen = self.states/self.frozen_jacobian + self.generalized_fluxes = data.generalized_fluxes self.generalized_fluxes_frozen = np.array([np.dot(flux, self.frozen_metrics) for flux in data.fluxes])[:,:,self.dir_internal].T.copy(order="F") @@ -120,7 +122,7 @@ def test_flux_splitting(queue, window_results): fluxes_neg_dev = u.empty_array_on_device(queue, data.nvars, 6) prg(queue, nvars=data.nvars, - generalized_states_frozen=data.states, + generalized_states_frozen=data.generalized_states_frozen, generalized_fluxes_frozen=data.generalized_fluxes_frozen, R_inv=data.R_inv, wavespeeds=data.wavespeeds, -- GitLab From 1706874a7c2383dec4e1dc32475b0714cfeaed6d Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Sat, 7 Mar 2020 07:49:58 -0700 Subject: [PATCH 18/18] reactivate uniform metric tests --- test/data_for_test.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/data_for_test.py b/test/data_for_test.py index 1711bfd..99feb03 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -87,24 +87,24 @@ def metrics_generator(): ("sine", "x", "wavy3d"), ("sine", "y", "wavy3d"), ("sine", "z", "wavy3d"), - #("sine", "x", "uniform"), - #("sine", "y", "uniform"), - #("sine", "z", "uniform"), - #("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), - #("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), - #("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), - #("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), - #("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), - #("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), - #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), - #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), - #("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), - #("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), - #("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), - #("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), - #("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), - #("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), - #("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") + ("sine", "x", "uniform"), + ("sine", "y", "uniform"), + ("sine", "z", "uniform"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "x", "uniform"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "y", "uniform"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "z", "uniform"), + ("2 4 4 4 20,1 1 1 1 5.5", "x", "uniform"), + ("2 4 4 4 20,1 1 1 1 5.5", "y", "uniform"), + ("2 4 4 4 20,1 1 1 1 5.5", "z", "uniform"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x", "uniform"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y", "uniform"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z", "uniform"), + ("2 4 8 12 64,1 1 2 3 11", "x", "uniform"), + ("2 8 12 4 64,1 2 3 1 11", "y", "uniform"), + ("2 12 4 8 64,1 3 1 2 11", "z", "uniform"), + ("1 -1 -2 -3 11,2 -4 -8 -12 64", "x", "uniform"), + ("1 -2 -3 -1 11,2 -8 -12 -4 64", "y", "uniform"), + ("1 -3 -1 -2 11,2 -12 -4 -8 64", "z", "uniform") ]) def window_data(request, states_generator, metrics_generator): states_str = request.param[0] -- GitLab