Skip to content

Commit

Permalink
Fix stencil test classes names (#391)
Browse files Browse the repository at this point in the history
This PR fixes the test class names to be up to date with the new stencil names.
  • Loading branch information
huppd authored and iomaganaris committed Jun 18, 2024
1 parent 1decf07 commit 504cc5c
Show file tree
Hide file tree
Showing 108 changed files with 428 additions and 385 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@


@field_operator
def _set_zero_c() -> Field[[CellDim], float]:
def _init_zero_c() -> Field[[CellDim], float]:
return broadcast(0.0, (CellDim,))


@program(grid_type=GridType.UNSTRUCTURED)
def set_zero_c(field: Field[[CellDim], float]):
_set_zero_c(out=field)
def init_zero_c(field: Field[[CellDim], float]):
_init_zero_c(out=field)
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@


@field_operator
def _set_zero_c_k() -> Field[[CellDim, KDim], float]:
def _init_zero_c_k() -> Field[[CellDim, KDim], float]:
return broadcast(0.0, (CellDim, KDim))


@program(grid_type=GridType.UNSTRUCTURED)
def set_zero_c_k(field: Field[[CellDim, KDim], float]):
_set_zero_c_k(out=field)
def init_zero_c_k(field: Field[[CellDim, KDim], float]):
_init_zero_c_k(out=field)
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

import pytest

from icon4py.model.atmosphere.advection.set_zero_c import set_zero_c
from icon4py.model.atmosphere.advection.init_zero_c import init_zero_c
from icon4py.model.common.dimension import CellDim
from icon4py.model.common.test_utils.helpers import StencilTest, random_field, zero_field


class TestSetZeroCellK(StencilTest):
PROGRAM = set_zero_c
class TestInitZeroCellK(StencilTest):
PROGRAM = init_zero_c
OUTPUTS = ("field",)

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

import pytest

from icon4py.model.atmosphere.advection.set_zero_c_k import set_zero_c_k
from icon4py.model.atmosphere.advection.init_zero_c_k import init_zero_c_k
from icon4py.model.common.dimension import CellDim, KDim
from icon4py.model.common.test_utils.helpers import StencilTest, random_field, zero_field


class TestSetZeroCK(StencilTest):
PROGRAM = set_zero_c_k
class TestInitZeroCK(StencilTest):
PROGRAM = init_zero_c_k
OUTPUTS = ("field",)

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ def scale_k(field: Field[[KDim], float], factor: float, scaled_field: Field[[KDi


@field_operator
def _set_zero_v_k() -> Field[[VertexDim, KDim], float]:
def _init_zero_v_k() -> Field[[VertexDim, KDim], float]:
return broadcast(0.0, (VertexDim, KDim))


@program(grid_type=GridType.UNSTRUCTURED, backend=backend)
def set_zero_v_k(field: Field[[VertexDim, KDim], float]):
_set_zero_v_k(out=field)
def init_zero_v_k(field: Field[[VertexDim, KDim], float]):
_init_zero_v_k(out=field)


@field_operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from icon4py.model.atmosphere.diffusion.diffusion_utils import (
_setup_runtime_diff_multfac_vn,
_setup_smag_limit,
init_zero_v_k,
scale_k,
set_zero_v_k,
setup_fields_for_initial_step,
)
from icon4py.model.common.dimension import KDim, VertexDim
Expand Down Expand Up @@ -104,10 +104,10 @@ def test_diff_multfac_vn_smag_limit_for_loop_run_with_k4_substeps(backend):
assert np.allclose(expected_smag_limit, smag_limit.asnumpy())


def test_set_zero_vertex_k(backend):
def test_init_zero_vertex_k(backend):
grid = SimpleGrid()
f = random_field(grid, VertexDim, KDim)
set_zero_v_k(f, offset_provider={})
init_zero_v_k(f, offset_provider={})
assert np.allclose(0.0, f.asnumpy())


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
where,
)

from icon4py.model.atmosphere.dycore.set_two_edge_kdim_fields_to_zero_wp import (
_set_two_edge_kdim_fields_to_zero_wp,
from icon4py.model.atmosphere.dycore.init_two_edge_kdim_fields_with_zero_wp import (
_init_two_edge_kdim_fields_with_zero_wp,
)
from icon4py.model.common.dimension import (
E2C,
Expand All @@ -43,7 +43,7 @@


@field_operator
def _add_extra_diffusion_for_wn_approaching_cfl(
def _add_extra_diffusion_for_normal_wind_tendency_approaching_cfl(
levelmask: Field[[KDim], bool],
c_lin_e: Field[[EdgeDim, E2CDim], wpfloat],
z_w_con_c_full: Field[[CellDim, KDim], vpfloat],
Expand All @@ -64,7 +64,7 @@ def _add_extra_diffusion_for_wn_approaching_cfl(
(z_w_con_c_full, ddqz_z_full_e, ddt_vn_apc, cfl_w_limit), wpfloat
)

w_con_e, difcoef = _set_two_edge_kdim_fields_to_zero_wp()
w_con_e, difcoef = _init_two_edge_kdim_fields_with_zero_wp()

w_con_e = where(
levelmask | levelmask(Koff[1]),
Expand Down Expand Up @@ -99,7 +99,7 @@ def _add_extra_diffusion_for_wn_approaching_cfl(


@program(grid_type=GridType.UNSTRUCTURED, backend=backend)
def add_extra_diffusion_for_wn_approaching_cfl(
def add_extra_diffusion_for_normal_wind_tendency_approaching_cfl(
levelmask: Field[[KDim], bool],
c_lin_e: Field[[EdgeDim, E2CDim], wpfloat],
z_w_con_c_full: Field[[CellDim, KDim], vpfloat],
Expand All @@ -119,7 +119,7 @@ def add_extra_diffusion_for_wn_approaching_cfl(
vertical_start: int32,
vertical_end: int32,
):
_add_extra_diffusion_for_wn_approaching_cfl(
_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl(
levelmask,
c_lin_e,
z_w_con_c_full,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@field_operator
def _compute_horizontal_gradient_of_extner_pressure_for_multiple_levels(
def _compute_horizontal_gradient_of_exner_pressure_for_multiple_levels(
inv_dual_edge_length: Field[[EdgeDim], wpfloat],
z_exner_ex_pr: Field[[CellDim, KDim], vpfloat],
zdiff_gradp: Field[[ECDim, KDim], vpfloat],
Expand Down Expand Up @@ -60,7 +60,7 @@ def _compute_horizontal_gradient_of_extner_pressure_for_multiple_levels(


@program(grid_type=GridType.UNSTRUCTURED, backend=backend)
def compute_horizontal_gradient_of_extner_pressure_for_multiple_levels(
def compute_horizontal_gradient_of_exner_pressure_for_multiple_levels(
inv_dual_edge_length: Field[[EdgeDim], wpfloat],
z_exner_ex_pr: Field[[CellDim, KDim], vpfloat],
zdiff_gradp: Field[[ECDim, KDim], vpfloat],
Expand All @@ -73,7 +73,7 @@ def compute_horizontal_gradient_of_extner_pressure_for_multiple_levels(
vertical_start: int32,
vertical_end: int32,
):
_compute_horizontal_gradient_of_extner_pressure_for_multiple_levels(
_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels(
inv_dual_edge_length,
z_exner_ex_pr,
zdiff_gradp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


@field_operator
def _compute_pertubation_of_rho_and_theta(
def _compute_perturbation_of_rho_and_theta(
rho: Field[[CellDim, KDim], wpfloat],
rho_ref_mc: Field[[CellDim, KDim], vpfloat],
theta_v: Field[[CellDim, KDim], wpfloat],
Expand All @@ -36,7 +36,7 @@ def _compute_pertubation_of_rho_and_theta(


@program(grid_type=GridType.UNSTRUCTURED, backend=backend)
def compute_pertubation_of_rho_and_theta(
def compute_perturbation_of_rho_and_theta(
rho: Field[[CellDim, KDim], wpfloat],
rho_ref_mc: Field[[CellDim, KDim], vpfloat],
theta_v: Field[[CellDim, KDim], wpfloat],
Expand All @@ -48,7 +48,7 @@ def compute_pertubation_of_rho_and_theta(
vertical_start: int32,
vertical_end: int32,
):
_compute_pertubation_of_rho_and_theta(
_compute_perturbation_of_rho_and_theta(
rho,
rho_ref_mc,
theta_v,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
from gt4py.next.ffront.decorator import field_operator, program
from gt4py.next.ffront.fbuiltins import Field, astype, int32

from icon4py.model.atmosphere.dycore.compute_pertubation_of_rho_and_theta import (
_compute_pertubation_of_rho_and_theta,
from icon4py.model.atmosphere.dycore.compute_perturbation_of_rho_and_theta import (
_compute_perturbation_of_rho_and_theta,
)
from icon4py.model.common.dimension import CellDim, KDim, Koff
from icon4py.model.common.settings import backend
from icon4py.model.common.type_alias import vpfloat, wpfloat


@field_operator
def _compute_pertubation_of_rho_and_theta_and_rho_at_ic(
def _compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers(
wgtfac_c: Field[[CellDim, KDim], vpfloat],
rho: Field[[CellDim, KDim], wpfloat],
rho_ref_mc: Field[[CellDim, KDim], vpfloat],
Expand All @@ -39,14 +39,14 @@ def _compute_pertubation_of_rho_and_theta_and_rho_at_ic(
wgtfac_c_wp = astype(wgtfac_c, wpfloat)

rho_ic = wgtfac_c_wp * rho + (wpfloat("1.0") - wgtfac_c_wp) * rho(Koff[-1])
z_rth_pr_1, z_rth_pr_2 = _compute_pertubation_of_rho_and_theta(
z_rth_pr_1, z_rth_pr_2 = _compute_perturbation_of_rho_and_theta(
rho=rho, rho_ref_mc=rho_ref_mc, theta_v=theta_v, theta_ref_mc=theta_ref_mc
)
return rho_ic, z_rth_pr_1, z_rth_pr_2


@program(grid_type=GridType.UNSTRUCTURED, backend=backend)
def compute_pertubation_of_rho_and_theta_and_rho_at_ic(
def compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers(
wgtfac_c: Field[[CellDim, KDim], vpfloat],
rho: Field[[CellDim, KDim], wpfloat],
rho_ref_mc: Field[[CellDim, KDim], vpfloat],
Expand All @@ -60,7 +60,7 @@ def compute_pertubation_of_rho_and_theta_and_rho_at_ic(
vertical_start: int32,
vertical_end: int32,
):
_compute_pertubation_of_rho_and_theta_and_rho_at_ic(
_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers(
wgtfac_c,
rho,
rho_ref_mc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from icon4py.model.atmosphere.dycore.compute_advective_vertical_wind_tendency import (
_compute_advective_vertical_wind_tendency,
)
from icon4py.model.atmosphere.dycore.interpolate_contravatiant_vertical_verlocity_to_full_levels import (
_interpolate_contravatiant_vertical_verlocity_to_full_levels,
from icon4py.model.atmosphere.dycore.interpolate_contravariant_vertical_velocity_to_full_levels import (
_interpolate_contravariant_vertical_velocity_to_full_levels,
)
from icon4py.model.common.dimension import C2E2CODim, CEDim, CellDim, EdgeDim, KDim
from icon4py.model.common.settings import backend
Expand Down Expand Up @@ -123,7 +123,7 @@ def _fused_velocity_advection_stencil_15_to_18(
lvn_only: bool,
extra_diffu: bool,
) -> tuple[Field[[CellDim, KDim], vpfloat], Field[[CellDim, KDim], vpfloat]]:
z_w_con_c_full = _interpolate_contravatiant_vertical_verlocity_to_full_levels(z_w_con_c)
z_w_con_c_full = _interpolate_contravariant_vertical_velocity_to_full_levels(z_w_con_c)
ddt_w_adv = (
_fused_velocity_advection_stencil_16_to_18(
z_w_con_c,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from gt4py.next.ffront.decorator import field_operator, program
from gt4py.next.ffront.fbuiltins import int32, maximum, where

from icon4py.model.atmosphere.dycore.add_extra_diffusion_for_wn_approaching_cfl import (
_add_extra_diffusion_for_wn_approaching_cfl,
from icon4py.model.atmosphere.dycore.add_extra_diffusion_for_normal_wind_tendency_approaching_cfl import (
_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl,
)
from icon4py.model.atmosphere.dycore.compute_advective_normal_wind_tendency import (
_compute_advective_normal_wind_tendency,
Expand Down Expand Up @@ -81,7 +81,7 @@ def _fused_velocity_advection_stencil_19_to_20(
ddt_vn_apc = (
where(
maximum(2, nrdmax - 2) <= k < nlev - 3,
_add_extra_diffusion_for_wn_approaching_cfl(
_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl(
levelmask,
c_lin_e,
z_w_con_c_full,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
from icon4py.model.atmosphere.dycore.interpolate_vn_to_ie_and_compute_ekin_on_edges import (
_interpolate_vn_to_ie_and_compute_ekin_on_edges,
)
from icon4py.model.atmosphere.dycore.interpolate_vt_to_ie import _interpolate_vt_to_ie
from icon4py.model.atmosphere.dycore.interpolate_vt_to_interface_edges import (
_interpolate_vt_to_interface_edges,
)
from icon4py.model.atmosphere.dycore.mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl import (
_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl,
)
Expand Down Expand Up @@ -63,7 +65,7 @@ def compute_interface_vt_vn_and_kinetic_energy(
z_vt_ie = (
where(
1 <= k < nlev,
_interpolate_vt_to_ie(wgtfac_e, vt),
_interpolate_vt_to_interface_edges(wgtfac_e, vt),
z_vt_ie,
)
if not lvn_only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
from icon4py.model.atmosphere.dycore.correct_contravariant_vertical_velocity import (
_correct_contravariant_vertical_velocity,
)
from icon4py.model.atmosphere.dycore.init_cell_kdim_field_with_zero_vp import (
_init_cell_kdim_field_with_zero_vp,
)
from icon4py.model.atmosphere.dycore.interpolate_to_cell_center import _interpolate_to_cell_center
from icon4py.model.atmosphere.dycore.interpolate_to_half_levels_vp import (
_interpolate_to_half_levels_vp,
)
from icon4py.model.atmosphere.dycore.set_cell_kdim_field_to_zero_vp import (
_set_cell_kdim_field_to_zero_vp,
)
from icon4py.model.common.dimension import CEDim, CellDim, EdgeDim, KDim
from icon4py.model.common.settings import backend
from icon4py.model.common.type_alias import vpfloat, wpfloat
Expand Down Expand Up @@ -65,7 +65,7 @@ def _fused_velocity_advection_stencil_8_to_13_predictor(
z_w_con_c = where(
k < nlev,
_copy_cell_kdim_field_to_vp(w),
_set_cell_kdim_field_to_zero_vp(),
_init_cell_kdim_field_with_zero_vp(),
)

z_w_con_c = where(
Expand Down Expand Up @@ -104,7 +104,7 @@ def _fused_velocity_advection_stencil_8_to_13_corrector(
z_w_con_c = where(
k < nlev,
_copy_cell_kdim_field_to_vp(w),
_set_cell_kdim_field_to_zero_vp(),
_init_cell_kdim_field_with_zero_vp(),
)

z_w_con_c = where(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
from icon4py.model.atmosphere.dycore.correct_contravariant_vertical_velocity import (
_correct_contravariant_vertical_velocity,
)
from icon4py.model.atmosphere.dycore.init_cell_kdim_field_with_zero_vp import (
_init_cell_kdim_field_with_zero_vp,
)
from icon4py.model.atmosphere.dycore.interpolate_to_cell_center import _interpolate_to_cell_center
from icon4py.model.atmosphere.dycore.interpolate_to_half_levels_vp import (
_interpolate_to_half_levels_vp,
)
from icon4py.model.atmosphere.dycore.set_cell_kdim_field_to_zero_vp import (
_set_cell_kdim_field_to_zero_vp,
)
from icon4py.model.common.dimension import CEDim, CellDim, EdgeDim, KDim
from icon4py.model.common.settings import backend
from icon4py.model.common.type_alias import vpfloat, wpfloat
Expand Down Expand Up @@ -91,7 +91,7 @@ def _fused_velocity_advection_stencil_8_to_14(
z_w_con_c = where(
k < nlevp1,
_copy_cell_kdim_field_to_vp(w),
_set_cell_kdim_field_to_zero_vp(),
_init_cell_kdim_field_with_zero_vp(),
)

z_w_con_c = where(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@


@field_operator
def _set_cell_kdim_field_to_zero_vp() -> Field[[CellDim, KDim], vpfloat]:
def _init_cell_kdim_field_with_zero_vp() -> Field[[CellDim, KDim], vpfloat]:
"""Formerly known as _mo_solve_nonhydro_stencil_03, _mo_solve_nonhydro_stencil_11_lower, _mo_solve_nonhydro_stencil_45, _mo_solve_nonhydro_stencil_45_b, or _mo_velocity_advection_stencil_12."""
return broadcast(vpfloat("0.0"), (CellDim, KDim))


@program(grid_type=GridType.UNSTRUCTURED, backend=backend)
def set_cell_kdim_field_to_zero_vp(
field_to_zero_vp: Field[[CellDim, KDim], vpfloat],
def init_cell_kdim_field_with_zero_vp(
field_with_zero_vp: Field[[CellDim, KDim], vpfloat],
horizontal_start: int32,
horizontal_end: int32,
vertical_start: int32,
vertical_end: int32,
):
_set_cell_kdim_field_to_zero_vp(
out=field_to_zero_vp,
_init_cell_kdim_field_with_zero_vp(
out=field_with_zero_vp,
domain={
CellDim: (horizontal_start, horizontal_end),
KDim: (vertical_start, vertical_end),
Expand Down
Loading

0 comments on commit 504cc5c

Please sign in to comment.