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 1/8] 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 2/8] 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 3/8] 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 4/8] 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 5/8] 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 6/8] 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 7/8] 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 8/8] 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