-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
228 additions
and
32 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...mmon/src/icon4py/model/common/interpolation/stencils/mo_intp_rbf_rbf_vec_interpol_cell.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# ICON4Py - ICON inspired code in Python and GT4Py | ||
# | ||
# Copyright (c) 2022, ETH Zurich and MeteoSwiss | ||
# All rights reserved. | ||
# | ||
# This file is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU General Public License as published by the | ||
# Free Software Foundation, either version 3 of the License, or any later | ||
# version. See the LICENSE.txt file at the top-level directory of this | ||
# distribution for a copy of the license or check <https://www.gnu.org/licenses/>. | ||
# | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
from gt4py.next.common import GridType | ||
from gt4py.next.ffront.decorator import field_operator, program | ||
from gt4py.next.ffront.fbuiltins import Field, int32, neighbor_sum | ||
|
||
from icon4py.model.common.dimension import ( | ||
C2E, | ||
C2EDim, | ||
CellDim, | ||
EdgeDim, | ||
KDim, | ||
) | ||
from icon4py.model.common.settings import backend | ||
from icon4py.model.common.type_alias import wpfloat | ||
|
||
|
||
@field_operator | ||
def _mo_intp_rbf_rbf_vec_interpol_cell( | ||
p_vn_in: Field[[EdgeDim, KDim], wpfloat], | ||
ptr_coeff_1: Field[[CellDim, C2EDim], wpfloat], | ||
ptr_coeff_2: Field[[CellDim, C2EDim], wpfloat], | ||
) -> tuple[Field[[CellDim, KDim], wpfloat], Field[[CellDim, KDim], wpfloat]]: | ||
p_u_out = neighbor_sum(ptr_coeff_1 * p_vn_in(C2E), axis=C2EDim) | ||
p_v_out = neighbor_sum(ptr_coeff_2 * p_vn_in(C2E), axis=C2EDim) | ||
return p_u_out, p_v_out | ||
|
||
|
||
@program(grid_type=GridType.UNSTRUCTURED, backend=backend) | ||
def mo_intp_rbf_rbf_vec_interpol_cell( | ||
p_vn_in: Field[[EdgeDim, KDim], wpfloat], | ||
ptr_coeff_1: Field[[CellDim, C2EDim], wpfloat], | ||
ptr_coeff_2: Field[[CellDim, C2EDim], wpfloat], | ||
p_u_out: Field[[CellDim, KDim], wpfloat], | ||
p_v_out: Field[[CellDim, KDim], wpfloat], | ||
horizontal_start: int32, | ||
horizontal_end: int32, | ||
vertical_start: int32, | ||
vertical_end: int32, | ||
): | ||
_mo_intp_rbf_rbf_vec_interpol_cell( | ||
p_vn_in, | ||
ptr_coeff_1, | ||
ptr_coeff_2, | ||
out=(p_u_out, p_v_out), | ||
domain={ | ||
CellDim: (horizontal_start, horizontal_end), | ||
KDim: (vertical_start, vertical_end), | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.