Skip to content

Commit

Permalink
[field] Fix laplace() with skewness correction
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed May 22, 2024
1 parent 06d9778 commit 7a0a93b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions phi/field/_field_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ def laplace(u: Field,
nb_distances = u.mesh.neighbor_distances
connecting_grad = (u.mesh.connectivity * neighbor_val - u.values) / nb_distances # (T_N - T_P) / d_PN
if correct_skew and gradient is not None: # skewness correction
assert dual(gradient), f"prev_grad must contain a dual dimension listing the gradient components"
gradient = rename_dims(gradient, dual, 'vector')
assert dual(gradient).names == ('~vector',), f"gradient must contain one dual dim '~vector' listing the gradient components but got {gradient.shape}"
gradient = gradient.at_faces(boundary=NONE, order=order, upwind=upwind).values
nb_offsets = u.mesh.neighbor_offsets
n1 = (u.face_normals.vector @ nb_offsets.vector) * nb_offsets / nb_distances ** 2 # (n·d_PN) d_PN / d_PN^2
Expand Down

0 comments on commit 7a0a93b

Please sign in to comment.