def test_ForcingCovariance_mult_parallel(my_ensemble, fs, fc, cov): "test that the multiplication method of ForcingCovariance can be called independently in an ensemble" fc.assemble() if my_ensemble.ensemble_comm.rank == 0: x = Function(fs).vector() x.set_local(np.ones(x.local_size())) y = Function(fs).vector() fc.mult(x, y) ygathered = y.gather() assert_allclose(ygathered, np.dot(cov, np.ones(nx + 1))) elif my_ensemble.ensemble_comm.rank == 1: x = Function(fs).vector() x.set_local(0.5 * np.ones(x.local_size())) y = Function(fs).vector() fc.mult(x, y) ygathered = y.gather() assert_allclose(ygathered, np.dot(cov, 0.5 * np.ones(nx + 1)))
def test_ForcingCovariance_mult(fs, fc, cov): "test the multiplication method of ForcingCovariance" fc.assemble() x = Function(fs).vector() x.set_local(np.ones(x.local_size())) y = Function(fs).vector() fc.mult(x, y) ygathered = y.gather() assert_allclose(ygathered, np.dot(cov, np.ones(nx + 1)))