Skip to content

Commit 2bfd8e2

Browse files
author
Clovis Lambert
committed
coord_system3d: fixing more tests
1 parent 0d70488 commit 2bfd8e2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

fluidsim/operators/test/test_coord_system3d.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def test_compute_cylindrical_components(shift_origin, vector_kind, allclose):
185185
r_h = make_r_h(shift_origin)
186186
r_sph_not0 = make_r_sph_not0(shift_origin)
187187
x, y, z = get_coords(shift_origin)
188+
_z = z
188189

189190
r_h_not0 = np.where(r_h != 0, r_h, EPSILON)
190191

@@ -273,12 +274,16 @@ def test_compute_radial_component_pure_radial(shift_origin, allclose):
273274
converter = make_converter(shift_origin)
274275
r_sph_not0 = make_r_sph_not0(shift_origin)
275276
x, y, z = get_coords(shift_origin)
277+
vr_exp = np.ones(shape)
278+
mask = np.argwhere((x == 0.0) & (y == 0.0) & (z == 0.0))
279+
for index in mask:
280+
vr_exp[tuple(index)] = 0.0
276281

277282
vx = x / r_sph_not0
278283
vy = y / r_sph_not0
279284
vz = z / r_sph_not0
280285
vr = converter.compute_radial_component(vx, vy, vz)
281-
assert allclose(vr, np.ones(shape))
286+
assert allclose(vr, vr_exp)
282287

283288

284289
@pytest.mark.parametrize("shift_origin", [False, True])
@@ -324,6 +329,9 @@ def test_compute_spherical_components(shift_origin, vector_kind, allclose):
324329
vy = y / r_sph_not0
325330
vz = z / r_sph_not0
326331
vr_exp = np.ones(shape)
332+
mask = np.argwhere((x == 0.0) & (y == 0.0) & (z == 0.0))
333+
for index in mask:
334+
vr_exp[tuple(index)] = 0.0
327335
vt_exp = np.zeros(shape) # azimuthal
328336
vp_exp = np.zeros(shape) # polar
329337

0 commit comments

Comments
 (0)