From 2f5d47edcc34b026da83ec572f4146e36ab0012b Mon Sep 17 00:00:00 2001 From: Thomas Baumann <39156931+brownbaerchen@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:38:48 +0200 Subject: [PATCH 1/3] Some fixes for new numpy version --- .../implementations/problem_classes/AllenCahn_Temp_MPIFFT.py | 4 ++-- .../problem_classes/generic_MPIFFT_Laplacian.py | 4 ++-- pySDC/projects/DAE/tests/test_SemiImplicitDAE.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py b/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py index d2ad696b36..01f2e99e32 100644 --- a/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py +++ b/pySDC/implementations/problem_classes/AllenCahn_Temp_MPIFFT.py @@ -123,7 +123,7 @@ def __init__( L = np.array([self.L] * ndim, dtype=float) # get local mesh - X = np.ogrid[self.fft.local_slice(False)] + X = list(np.ogrid[self.fft.local_slice(False)]) N = self.fft.global_shape() for i in range(len(N)): X[i] = X[i] * L[i] / N[i] @@ -135,7 +135,7 @@ def __init__( k = [np.fft.fftfreq(n, 1.0 / n).astype(int) for n in N[:-1]] k.append(np.fft.rfftfreq(N[-1], 1.0 / N[-1]).astype(int)) K = [ki[si] for ki, si in zip(k, s)] - Ks = np.meshgrid(*K, indexing='ij', sparse=True) + Ks = list(np.meshgrid(*K, indexing='ij', sparse=True)) Lp = 2 * np.pi / L for i in range(ndim): Ks[i] = (Ks[i] * Lp[i]).astype(float) diff --git a/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py b/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py index 0142045340..883494a6bf 100644 --- a/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py +++ b/pySDC/implementations/problem_classes/generic_MPIFFT_Laplacian.py @@ -102,7 +102,7 @@ def __init__( ) # get local mesh - X = self.xp.ogrid[self.fft.local_slice(False)] + X = list(self.xp.ogrid[self.fft.local_slice(False)]) N = self.fft.global_shape() for i in range(len(N)): X[i] = x0 + (X[i] * L[i] / N[i]) @@ -113,7 +113,7 @@ def __init__( N = self.fft.global_shape() k = [self.xp.fft.fftfreq(n, 1.0 / n).astype(int) for n in N] K = [ki[si] for ki, si in zip(k, s)] - Ks = self.xp.meshgrid(*K, indexing='ij', sparse=True) + Ks = list(self.xp.meshgrid(*K, indexing='ij', sparse=True)) Lp = 2 * np.pi / self.L for i in range(self.ndim): Ks[i] = (Ks[i] * Lp[i]).astype(float) diff --git a/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py b/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py index ccd37ebec1..6f69448cf1 100644 --- a/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py +++ b/pySDC/projects/DAE/tests/test_SemiImplicitDAE.py @@ -207,7 +207,7 @@ def testComputeEndpoint(quad_type): L.sweep.compute_end_point() - assert np.isclose(L.u[-1], L.uend), "Endpoint is not computed correctly!" + assert np.allclose(L.u[-1], L.uend), "Endpoint is not computed correctly!" @pytest.mark.base From fccb757e1281320add3b24e1259045a2c0a3a2b8 Mon Sep 17 00:00:00 2001 From: Thomas Baumann <39156931+brownbaerchen@users.noreply.github.com> Date: Wed, 19 Jun 2024 10:24:33 +0200 Subject: [PATCH 2/3] Fix for Allen-Cahn project --- .../AllenCahn_Bayreuth/run_temp_forcing_verification.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pySDC/projects/AllenCahn_Bayreuth/run_temp_forcing_verification.py b/pySDC/projects/AllenCahn_Bayreuth/run_temp_forcing_verification.py index 8ade08fb4c..7cabcee841 100644 --- a/pySDC/projects/AllenCahn_Bayreuth/run_temp_forcing_verification.py +++ b/pySDC/projects/AllenCahn_Bayreuth/run_temp_forcing_verification.py @@ -182,7 +182,9 @@ def main(nprocs_space=None, cwd='.'): print(f'Order of accuracy: {orders[-1]:4.2f}\n') assert errors[2 + 1] < 8e-10, f'Errors are too high, got {errors[2 + 1]}' - assert np.isclose(orders[1], 4.6, rtol=7e-02), f'Order of accuracy is not within tolerance, got {orders[1]}' + assert np.isclose( + orders[1].view(np.ndarray), 4.6, rtol=7e-02 + ), f'Order of accuracy is not within tolerance, got {orders[1]}' if __name__ == "__main__": From 700b211767a46b29d1a3384f620fc36c58192851 Mon Sep 17 00:00:00 2001 From: Robert Speck Date: Thu, 20 Jun 2024 08:15:34 +0200 Subject: [PATCH 3/3] Update environment.yml --- pySDC/projects/parallelSDC/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySDC/projects/parallelSDC/environment.yml b/pySDC/projects/parallelSDC/environment.yml index 1961bb5c3b..7d5baaebbd 100644 --- a/pySDC/projects/parallelSDC/environment.yml +++ b/pySDC/projects/parallelSDC/environment.yml @@ -7,7 +7,7 @@ channels: dependencies: - numpy>=1.15.4 - scipy>=0.17.1 - - matplotlib>=3.0,<=3.5.3 + - matplotlib>=3.0 - dill>=0.2.6 - mpich - mpi4py>=3.0.0