MCPcopy Create free account
hub / github.com/DedalusProject/dedalus / test_convert_vector

Function test_convert_vector

dedalus/tests/test_polar_operators.py:142–153  ·  view source on GitHub ↗
(Nphi, Nr, k, dealias, basis, dtype, layout)

Source from the content-addressed store, hash-verified

140@pytest.mark.parametrize('dtype', [np.float64, np.complex128])
141@pytest.mark.parametrize('layout', ['c', 'g'])
142def test_convert_vector(Nphi, Nr, k, dealias, basis, dtype, layout):
143 c, d, b, phi, r, x, y = basis(Nphi, Nr, k, dealias, dtype)
144 u = field.Field(dist=d, bases=(b,), tensorsig=(c,), dtype=dtype)
145 u.preset_scales(b.dealias)
146 ex = np.array([-np.sin(phi)+0.*r,np.cos(phi)+0.*r])
147 ey = np.array([np.cos(phi)+0.*r,np.sin(phi)+0.*r])
148 u['g'] = 4*x**3*ey + 3*y**2*ey
149 v = operators.Laplacian(u, c).evaluate()
150 u.change_layout(layout)
151 v.change_layout(layout)
152 w = (u + v).evaluate()
153 assert np.allclose(w['g'], u['g'] + v['g'])
154
155
156@pytest.mark.parametrize('basis', [build_disk, build_annulus])

Callers

nothing calls this directly

Calls 5

change_layoutMethod · 0.95
FieldMethod · 0.80
preset_scalesMethod · 0.80
arrayMethod · 0.80
evaluateMethod · 0.45

Tested by

no test coverage detected