Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix v_limit_prbl_sm_stencil_01 #107

Merged
merged 2 commits into from
Oct 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions advection/src/icon4py/advection/v_limit_prbl_sm_stencil_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later

from functional.ffront.decorator import field_operator, program
from functional.ffront.fbuiltins import (
Field,
FieldOffset,
abs,
broadcast,
minimum,
where,
)
from functional.ffront.fbuiltins import Field, FieldOffset, abs, minimum, where

from icon4py.common.dimension import CellDim, KDim

Expand All @@ -31,14 +24,11 @@
def _v_limit_prbl_sm_stencil_01(
p_face: Field[[CellDim, KDim], float],
p_cc: Field[[CellDim, KDim], float],
) -> Field[[CellDim, KDim], float]:
) -> tuple[Field[[CellDim, KDim], float], Field[[CellDim, KDim], float]]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the return type is fine,
but below do you need the broadcast? you are then reassigning in the where..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, not strictly necessary. will remove


z_delta = p_face - p_face(Koff[1])
z_a6i = -6.0 * (p_cc - 0.5 * (p_face + p_face(Koff[1])))

q_face_up = broadcast(1.0, (CellDim, KDim))
q_face_low = broadcast(1.0, (CellDim, KDim))

q_face_up, q_face_low = where(
abs(z_delta) < z_a6i,
where(
Expand Down