Skip to content

Commit 58a7b7a

Browse files
committed
Corrected the slicing for pull_3d_hdiv
1 parent 059483d commit 58a7b7a

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

psydac/feec/pull_push.py

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -313,31 +313,8 @@ def f1_logical(eta1, eta2, eta3):
313313
J_inv_value = F.jacobian_inv(eta1, eta2, eta3)
314314

315315
det_value = F.metric_det(eta1, eta2, eta3)**0.5
316-
317-
# Attempt the computation, isolating each part for clarity
318-
try:
319-
value_1 = (
320-
J_inv_value[..., 0, 0].T * a1_phys
321-
+ J_inv_value[..., 0, 1].T * a2_phys
322-
+ J_inv_value[..., 0, 2].T * a3_phys
323-
)
324-
print("Shape of value_1:", value_1.shape)
325-
except ValueError as e:
326-
print("Error encountered:", e)
327-
print("Type of a1_phys:", type(a1_phys), "Value:", a1_phys)
328-
print("Type of a2_phys:", type(a2_phys), "Value:", a2_phys)
329-
print("Type of a3_phys:", type(a3_phys), "Value:", a3_phys)
330-
if isinstance(a1_phys, int) or isinstance(a2_phys, int) or isinstance(a3_phys, int):
331-
print("Error: One of a1_phys, a2_phys, or a3_phys is an integer, expected array.")
332-
print("Shape of J_inv_value:", J_inv_value.shape)
333-
print("Shape of det_value:", det_value.shape)
334-
print("Shape of J_inv_value[..., 0, 0].T:", J_inv_value[..., 0, 0].T.shape)
335-
print("Shape of J_inv_value[..., 0, 1].T:", J_inv_value[..., 0, 1].T.shape)
336-
print("Shape of J_inv_value[..., 0, 2].T:", J_inv_value[..., 0, 2].T.shape)
337-
print("Shape of a1_phys:", a1_phys.shape)
338-
print("Shape of a2_phys:", a2_phys.shape)
339-
print("Shape of a3_phys:", a3_phys.shape)
340-
value_1 = J_inv_value[..., 0, 0].T * a1_phys + J_inv_value[..., 0, 1].T * a2_phys + J_inv_value[..., 0, 2].T * a3_phys
316+
317+
value_1 = J_inv_value[0, 0] * a1_phys + J_inv_value[0, 1] * a2_phys + J_inv_value[0, 2] * a3_phys
341318
return det_value * value_1
342319

343320
def f2_logical(eta1, eta2, eta3):
@@ -349,7 +326,7 @@ def f2_logical(eta1, eta2, eta3):
349326

350327
J_inv_value = F.jacobian_inv(eta1, eta2, eta3)
351328
det_value = F.metric_det(eta1, eta2, eta3)**0.5
352-
value_2 = J_inv_value[..., 1, 0].T * a1_phys + J_inv_value[..., 1, 1].T * a2_phys + J_inv_value[..., 1, 2].T * a3_phys
329+
value_2 = J_inv_value[1, 0] * a1_phys + J_inv_value[1, 1] * a2_phys + J_inv_value[1, 2] * a3_phys
353330
return det_value * value_2
354331

355332
def f3_logical(eta1, eta2, eta3):
@@ -361,7 +338,7 @@ def f3_logical(eta1, eta2, eta3):
361338

362339
J_inv_value = F.jacobian_inv(eta1, eta2, eta3)
363340
det_value = F.metric_det(eta1, eta2, eta3)**0.5
364-
value_3 = J_inv_value[..., 2, 0].T * a1_phys + J_inv_value[..., 2, 1].T * a2_phys + J_inv_value[..., 2, 2].T * a3_phys
341+
value_3 = J_inv_value[2, 0] * a1_phys + J_inv_value[2, 1] * a2_phys + J_inv_value[2, 2] * a3_phys
365342
return det_value * value_3
366343

367344
return f1_logical, f2_logical, f3_logical

0 commit comments

Comments
 (0)