Read about our upcoming Code of Conduct on this issue

Commit ebdce091 authored by Pierre Augier's avatar Pierre Augier
Browse files

Try to fix an issue with MPI and test cleanup

parent d6877f15d4ed
Pipeline #20030 passed with stage
in 17 minutes and 7 seconds
import unittest
import pytest
import numpy as np
import matplotlib.pyplot as plt
......@@ -95,6 +97,7 @@ class TestOutput(TestSimulBase):
params.output.spectra.kzkh_periodicity = 2
@pytest.mark.filterwarnings("ignore:divide by zero encountered in log10")
def test_output(self):
sim = self.sim
......@@ -232,14 +235,17 @@ class TestNoShearModes(TestSimulBase):
data = sim.output.spectra.load_kzkh_mean(
tmin=0.2, key_to_load=["Khd", "Kz", "Khr", "A"]
)
means = sim.output.spatial_means.load()
if mpi.nb_proc > 1:
mpi.comm.barrier()
# check k \cdot v = 0
assert np.allclose(data["Khd"][0, :].sum(), 0.0)
assert np.allclose(data["Kz"][:, 0].sum(), 0.0)
# check energy in shear modes
EKhs = sim.output.spatial_means.load()["EKhs"]
E = sim.output.spatial_means.load()["E"]
EKhs = means["EKhs"]
E = means["E"]
ratio = EKhs[-1] / E[-1]
assert ratio < 1e-15
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment