From a460d5075bb88072efaffa5a5e1dddef6d46a55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Thu, 4 Sep 2025 14:42:18 +0200 Subject: [PATCH 001/111] add first batch of program tests to continuous benchmarking --- .../stencil_tests/test_apply_diffusion_to_vn.py | 16 +++++++++++++++- ...mpute_horizontal_gradients_for_turbulence.py | 16 +++++++++++++++- ...ulate_nabla2_and_smag_coefficients_for_vn.py | 15 ++++++++++++++- ...iffusion_nabla_of_theta_over_steep_points.py | 17 +++++++++++++++-- .../test_mo_intp_rbf_rbf_vec_interpol_vertex.py | 17 +++++++++++++++-- 5 files changed, 74 insertions(+), 7 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index 946f1132a5..534b9079ce 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -15,7 +15,7 @@ from icon4py.model.common import dimension as dims from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing.stencil_tests import StencilTest +from icon4py.model.testing.stencil_tests import StencilTest, StandardStaticVariants from .test_apply_nabla2_and_nabla4_global_to_vn import apply_nabla2_and_nabla4_global_to_vn_numpy from .test_apply_nabla2_and_nabla4_to_vn import apply_nabla2_and_nabla4_to_vn_numpy @@ -26,9 +26,23 @@ @pytest.mark.uses_concat_where +@pytest.mark.continuous_benchmarking class TestApplyDiffusionToVn(StencilTest): PROGRAM = apply_diffusion_to_vn OUTPUTS = ("vn",) + STATIC_PARAMS = { + StandardStaticVariants.NONE: None, + StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index 493b5e3f1e..a78fef7025 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -15,7 +15,7 @@ from icon4py.model.common import dimension as dims from icon4py.model.common.grid import base from icon4py.model.common.utils.data_allocation import random_field, zero_field -from icon4py.model.testing.stencil_tests import StencilTest +from icon4py.model.testing.stencil_tests import StencilTest, StandardStaticVariants from .test_apply_nabla2_to_w import apply_nabla2_to_w_numpy from .test_apply_nabla2_to_w_in_upper_damping_layer import ( @@ -28,9 +28,23 @@ @pytest.mark.embedded_remap_error +@pytest.mark.continuous_benchmarking class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence(StencilTest): PROGRAM = apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence OUTPUTS = ("w", "dwdx", "dwdy") + STATIC_PARAMS = { + StandardStaticVariants.NONE: None, + StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index 83d006abb2..c6652317b3 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -18,10 +18,23 @@ from icon4py.model.testing import stencil_tests -@pytest.mark.skip_value_error +@pytest.mark.continuous_benchmarking class TestCalculateNabla2AndSmagCoefficientsForVn(stencil_tests.StencilTest): PROGRAM = calculate_nabla2_and_smag_coefficients_for_vn OUTPUTS = ("kh_smag_e", "kh_smag_ec", "z_nabla2_e") + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py index acff8879c6..5588c9321c 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py @@ -19,7 +19,7 @@ random_mask, zero_field, ) -from icon4py.model.testing.stencil_tests import StencilTest +from icon4py.model.testing.stencil_tests import StencilTest, StandardStaticVariants def truly_horizontal_diffusion_nabla_of_theta_over_steep_points_numpy( @@ -62,10 +62,23 @@ def truly_horizontal_diffusion_nabla_of_theta_over_steep_points_numpy( @pytest.mark.uses_as_offset -@pytest.mark.skip_value_error +@pytest.mark.continuous_benchmarking class TestTrulyHorizontalDiffusionNablaOfThetaOverSteepPoints(StencilTest): PROGRAM = truly_horizontal_diffusion_nabla_of_theta_over_steep_points OUTPUTS = ("z_temp",) + STATIC_PARAMS = { + StandardStaticVariants.NONE: None, + StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( diff --git a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py index f6e5034fa9..21dc17dafe 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py @@ -18,13 +18,26 @@ ) from icon4py.model.common.type_alias import wpfloat from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing.stencil_tests import StencilTest +from icon4py.model.testing.stencil_tests import StencilTest, StandardStaticVariants -@pytest.mark.skip_value_error +@pytest.mark.continuous_benchmarking class TestMoIntpRbfRbfVecInterpolVertex(StencilTest): PROGRAM = mo_intp_rbf_rbf_vec_interpol_vertex OUTPUTS = ("p_u_out", "p_v_out") + STATIC_PARAMS = { + StandardStaticVariants.NONE: None, + StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( From 84abc04e9237d80daad8b888368b62642330a05e Mon Sep 17 00:00:00 2001 From: Rico Haeuselmann Date: Thu, 4 Sep 2025 15:13:10 +0200 Subject: [PATCH 002/111] fix static params for apply_diffusion_to_vn Co-authored-by: Hannes Vogt --- .../tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index 534b9079ce..b3828cbc2e 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -35,6 +35,7 @@ class TestApplyDiffusionToVn(StencilTest): StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", + "start_2nd_nudge_line_idx_e", "vertical_start", "vertical_end", ), From 50e83651d1b9d9299308f50d63af452b465dd597 Mon Sep 17 00:00:00 2001 From: Rico Haeuselmann Date: Fri, 5 Sep 2025 10:22:34 +0200 Subject: [PATCH 003/111] improve static params for apply_diffusion_to_w_... test Co-authored-by: Hannes Vogt --- ...sion_to_w_and_compute_horizontal_gradients_for_turbulence.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index a78fef7025..8a238bbc75 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -39,8 +39,10 @@ class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence(StencilTes "horizontal_end", "vertical_start", "vertical_end", + "limited_area", ), StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "limited_area", "vertical_start", "vertical_end", ), From aacd35bbdaaec116a84dd701b154472a588587c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 5 Sep 2025 11:07:22 +0200 Subject: [PATCH 004/111] add static params and remove indirectly used prog from benchmarking --- .../stencil_tests/test_apply_diffusion_to_vn.py | 2 ++ ..._compute_horizontal_gradients_for_turbulence.py | 8 ++++++-- ...l_diffusion_nabla_of_theta_over_steep_points.py | 14 -------------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index b3828cbc2e..b15794015a 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -38,10 +38,12 @@ class TestApplyDiffusionToVn(StencilTest): "start_2nd_nudge_line_idx_e", "vertical_start", "vertical_end", + "limited_area", ), StandardStaticVariants.COMPILE_TIME_VERTICAL: ( "vertical_start", "vertical_end", + "limited_area", ), } diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index 8a238bbc75..5353237816 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -37,14 +37,18 @@ class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence(StencilTes StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", + "halo_idx", + "interior_idx", "vertical_start", "vertical_end", - "limited_area", + "nrdmax", + "type_shear", ), StandardStaticVariants.COMPILE_TIME_VERTICAL: ( - "limited_area", "vertical_start", "vertical_end", + "nrdmax", + "type_shear", ), } diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py index 5588c9321c..9003b5585b 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py @@ -62,23 +62,9 @@ def truly_horizontal_diffusion_nabla_of_theta_over_steep_points_numpy( @pytest.mark.uses_as_offset -@pytest.mark.continuous_benchmarking class TestTrulyHorizontalDiffusionNablaOfThetaOverSteepPoints(StencilTest): PROGRAM = truly_horizontal_diffusion_nabla_of_theta_over_steep_points OUTPUTS = ("z_temp",) - STATIC_PARAMS = { - StandardStaticVariants.NONE: None, - StandardStaticVariants.COMPILE_TIME_DOMAIN: ( - "horizontal_start", - "horizontal_end", - "vertical_start", - "vertical_end", - ), - StandardStaticVariants.COMPILE_TIME_VERTICAL: ( - "vertical_start", - "vertical_end", - ), - } @staticmethod def reference( From d042c9864b8d29c7f8dea8ad9cc08c1b9ea0d681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 5 Sep 2025 14:29:04 +0200 Subject: [PATCH 005/111] update dockerfile to trigger a rebuild with newer bencher CLI --- ci/docker/base.Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/docker/base.Dockerfile b/ci/docker/base.Dockerfile index 099ab1d06c..1b476e8bf3 100644 --- a/ci/docker/base.Dockerfile +++ b/ci/docker/base.Dockerfile @@ -37,6 +37,10 @@ ENV PATH="/root/.cargo/bin:${PATH}" RUN rustc --version && which rustc && cargo --version && which cargo # Install Bencher for performance monitoring +# Update the following comment to trigger a rebuild to update the CLI: +# last update: 2025-09-05 +# This is necessary because the cloud version and the CLI version have to match +# but obviously, version changes do not register in the Dockerfile hash. RUN curl --proto '=https' --tlsv1.2 -sSfL https://bencher.dev/download/install-cli.sh | sh RUN bencher --version && which bencher From ba94c10dd1640af1443e6a5b92eafb9709c3ed31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 12 Sep 2025 10:53:46 +0200 Subject: [PATCH 006/111] add compute_derived_horizontal_winds_... to benchmarking --- ...nds_and_ke_and_contravariant_correction.py | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 399165ea85..ccbb4e995c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -48,6 +48,7 @@ def extrapolate_to_surface_numpy(wgtfacq_e: np.ndarray, vn: np.ndarray) -> np.nd return vn_at_surface +@pytest.mark.continuous_benchmarking @pytest.mark.embedded_remap_error class TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection( stencil_tests.StencilTest @@ -61,6 +62,20 @@ class TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContrava "contravariant_correction_at_edges_on_model_levels", "horizontal_advection_of_w_at_edges_on_half_levels", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + "nflatlev", + ), + } @staticmethod def _fused_velocity_advection_stencil_1_to_6_numpy( @@ -258,8 +273,9 @@ def reference( horizontal_advection_of_w_at_edges_on_half_levels=horizontal_advection_of_w_at_edges_on_half_levels, ) - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + @pytest.fixture(params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]]) + def input_data(self, request, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + skip_compute_predictor_vertical_advection = request.param["skip_compute_predictor_vertical_advection"] horizontal_advection_of_w_at_edges_on_half_levels = data_alloc.zero_field( grid, dims.EdgeDim, dims.KDim ) @@ -289,8 +305,6 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala nlev = grid.num_levels nflatlev = 13 - skip_compute_predictor_vertical_advection = False - edge_domain = h_grid.domain(dims.EdgeDim) # For the ICON grid we use the proper domain bounds (otherwise we will run into non-protected skip values) horizontal_start = grid.start_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5)) From 3dcdd34c732a88ee06ff167b00e66b702b7680d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Tue, 16 Sep 2025 13:20:21 +0200 Subject: [PATCH 007/111] temporarily remove failing parametrization case. --- ...ved_horizontal_winds_and_ke_and_contravariant_correction.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 0e10855b1c..801ef62bd6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -273,7 +273,8 @@ def reference( horizontal_advection_of_w_at_edges_on_half_levels=horizontal_advection_of_w_at_edges_on_half_levels, ) - @pytest.fixture(params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]]) + # TODO(ricoh): Add True case. Blocked by test failure (issue: #875) + @pytest.fixture(params=[{"skip_compute_predictor_vertical_advection": value} for value in [False]]) def input_data(self, request, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: skip_compute_predictor_vertical_advection = request.param["skip_compute_predictor_vertical_advection"] horizontal_advection_of_w_at_edges_on_half_levels = data_alloc.zero_field( From 367ba1f0ec0c8fec3d36a399273c300fa7788ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Tue, 16 Sep 2025 13:39:45 +0200 Subject: [PATCH 008/111] add compute_advection_in_vertical... program --- ...te_advection_in_vertical_momentum_equation.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index bff7b97677..709e7649d0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -268,6 +268,7 @@ def compute_advective_vertical_wind_tendency_and_apply_diffusion_numpy( return vertical_wind_advective_tendency +@pytest.mark.continuous_benchmarking @pytest.mark.embedded_remap_error class TestFusedVelocityAdvectionStencilVMomentum(stencil_tests.StencilTest): PROGRAM = compute_advection_in_vertical_momentum_equation @@ -276,6 +277,21 @@ class TestFusedVelocityAdvectionStencilVMomentum(stencil_tests.StencilTest): "contravariant_corrected_w_at_cells_on_model_levels", "vertical_cfl", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + "end_index_of_damping_layer", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + "end_index_of_damping_layer", + ), + } @staticmethod def reference( From c4b33c3743ae4dab0cfc838add9991224887861f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Tue, 16 Sep 2025 13:57:21 +0200 Subject: [PATCH 009/111] add benchmarking for advection_in_horizontal... program --- ...vection_in_horizontal_momentum_equation.py | 21 ++++++++++++++++--- ...nds_and_ke_and_contravariant_correction.py | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index 4340ee9ea4..26e8969600 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -138,6 +138,21 @@ def _add_extra_diffusion_for_normal_wind_tendency_approaching_cfl_without_levelm class TestFusedVelocityAdvectionStencilsHMomentum(stencil_tests.StencilTest): PROGRAM = compute_advection_in_horizontal_momentum_equation OUTPUTS = ("normal_wind_advective_tendency",) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "end_index_of_damping_layer", + "vertical_start", + "vertical_end", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "end_index_of_damping_layer", + "vertical_start", + "vertical_end", + ) + } @staticmethod def reference( @@ -227,8 +242,8 @@ def reference( return dict(normal_wind_advective_tendency=normal_wind_advective_tendency) - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + @pytest.fixture(params=[{"apply_extra_diffusion_on_vn": value} for value in [True, False]]) + def input_data(self, request, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: normal_wind_advective_tendency = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) horizontal_kinetic_energy_at_edges_on_model_levels = data_alloc.random_field( @@ -257,7 +272,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala scalfac_exdiff = 0.6 dtime = 2.0 cfl_w_limit = 0.65 / dtime - apply_extra_diffusion_on_vn = True + apply_extra_diffusion_on_vn = request.param["apply_extra_diffusion_on_vn"] end_index_of_damping_layer = 5 edge_domain = h_grid.domain(dims.EdgeDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 801ef62bd6..083c1c8825 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -69,6 +69,7 @@ class TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContrava "horizontal_end", "vertical_start", "vertical_end", + "nflatlev", ), stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( "vertical_start", From bdc3296301c56c0b9d05f47d59412aac2f4456ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Tue, 16 Sep 2025 14:11:06 +0200 Subject: [PATCH 010/111] add benchmarking for compute_perturbed... program --- ..._perturbed_quantities_and_interpolation.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index 778f768481..e9e31fb1e5 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -64,6 +64,7 @@ def compute_first_vertical_derivative_numpy( return first_vertical_derivative +@pytest.mark.continuous_benchmarking @pytest.mark.uses_concat_where class TestComputePerturbedQuantitiesAndInterpolation(stencil_tests.StencilTest): PROGRAM = compute_perturbed_quantities_and_interpolation @@ -80,6 +81,33 @@ class TestComputePerturbedQuantitiesAndInterpolation(stencil_tests.StencilTest): "pressure_buoyancy_acceleration_at_cells_on_half_levels", "d2dz2_of_temporal_extrapolation_of_perturbed_exner_on_model_levels", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "limited_area", + "igradp_method", + "start_cell_lateral_boundary_level_3", + "start_cell_halo_level_2", + "end_cell_end", + "end_cell_halo", + "end_cell_halo_level_2", + "start_cell_lateral_boundary", + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + "nflatlev", + "nflat_gradp" + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "limited_area", + "igradp_method", + "vertical_start", + "vertical_end", + "nflatlev", + "nflat_gradp" + ), + } @staticmethod def reference( From 5836fbf51c7519e3f626a9a2e296cd8f8ba4fca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Tue, 16 Sep 2025 14:17:24 +0200 Subject: [PATCH 011/111] add benchmarking for 'compute_hydrostatic...' program --- .../test_compute_hydrostatic_correction_term.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py index 79217ba75d..01e5727fdd 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py @@ -18,7 +18,7 @@ from icon4py.model.common.grid import base from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing.stencil_tests import StencilTest +from icon4py.model.testing.stencil_tests import StencilTest, StandardStaticVariants def compute_hydrostatic_correction_term_numpy( @@ -86,11 +86,24 @@ def _apply_index_field( return z_hydro_corr -@pytest.mark.skip_value_error +@pytest.mark.continuous_benchmarking @pytest.mark.uses_as_offset class TestComputeHydrostaticCorrectionTerm(StencilTest): OUTPUTS = ("z_hydro_corr",) PROGRAM = compute_hydrostatic_correction_term + STATIC_PARAMS = { + StandardStaticVariants.NONE: None, + StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( From 7d041d53dd946421c0aff25b06b181ba61a7f337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Tue, 16 Sep 2025 15:07:04 +0200 Subject: [PATCH 012/111] fix precommit messages --- .../stencil_tests/test_apply_diffusion_to_vn.py | 2 +- ..._compute_horizontal_gradients_for_turbulence.py | 2 +- ...te_advection_in_horizontal_momentum_equation.py | 8 +++++--- ...pute_advection_in_vertical_momentum_equation.py | 2 +- ...al_winds_and_ke_and_contravariant_correction.py | 14 ++++++++++---- .../test_compute_hydrostatic_correction_term.py | 4 ++-- ...mpute_perturbed_quantities_and_interpolation.py | 6 +++--- .../test_mo_intp_rbf_rbf_vec_interpol_vertex.py | 2 +- 8 files changed, 24 insertions(+), 16 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index b15794015a..2ca65484e3 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -15,7 +15,7 @@ from icon4py.model.common import dimension as dims from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing.stencil_tests import StencilTest, StandardStaticVariants +from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest from .test_apply_nabla2_and_nabla4_global_to_vn import apply_nabla2_and_nabla4_global_to_vn_numpy from .test_apply_nabla2_and_nabla4_to_vn import apply_nabla2_and_nabla4_to_vn_numpy diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index 1d3ff993e5..c15179a95b 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -15,7 +15,7 @@ from icon4py.model.common import dimension as dims from icon4py.model.common.grid import base from icon4py.model.common.utils.data_allocation import random_field, zero_field -from icon4py.model.testing.stencil_tests import StencilTest, StandardStaticVariants +from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest from .test_apply_nabla2_to_w import apply_nabla2_to_w_numpy from .test_apply_nabla2_to_w_in_upper_damping_layer import ( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index 26e8969600..ad09b5e60c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -139,7 +139,7 @@ class TestFusedVelocityAdvectionStencilsHMomentum(stencil_tests.StencilTest): PROGRAM = compute_advection_in_horizontal_momentum_equation OUTPUTS = ("normal_wind_advective_tendency",) STATIC_PARAMS = { - stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.NONE: (), stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", @@ -151,7 +151,7 @@ class TestFusedVelocityAdvectionStencilsHMomentum(stencil_tests.StencilTest): "end_index_of_damping_layer", "vertical_start", "vertical_end", - ) + ), } @staticmethod @@ -243,7 +243,9 @@ def reference( return dict(normal_wind_advective_tendency=normal_wind_advective_tendency) @pytest.fixture(params=[{"apply_extra_diffusion_on_vn": value} for value in [True, False]]) - def input_data(self, request, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + def input_data( + self, request: pytest.FixtureRequest, grid: base.Grid + ) -> dict[str, gtx.Field | state_utils.ScalarType]: normal_wind_advective_tendency = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) horizontal_kinetic_energy_at_edges_on_model_levels = data_alloc.random_field( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 709e7649d0..5c9ade921e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -278,7 +278,7 @@ class TestFusedVelocityAdvectionStencilVMomentum(stencil_tests.StencilTest): "vertical_cfl", ) STATIC_PARAMS = { - stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.NONE: (), stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 083c1c8825..22d70561c0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -63,7 +63,7 @@ class TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContrava "horizontal_advection_of_w_at_edges_on_half_levels", ) STATIC_PARAMS = { - stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.NONE: (), stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", @@ -275,9 +275,15 @@ def reference( ) # TODO(ricoh): Add True case. Blocked by test failure (issue: #875) - @pytest.fixture(params=[{"skip_compute_predictor_vertical_advection": value} for value in [False]]) - def input_data(self, request, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: - skip_compute_predictor_vertical_advection = request.param["skip_compute_predictor_vertical_advection"] + @pytest.fixture( + params=[{"skip_compute_predictor_vertical_advection": value} for value in [False]] + ) + def input_data( + self, request: pytest.FixtureRequest, grid: base.Grid + ) -> dict[str, gtx.Field | state_utils.ScalarType]: + skip_compute_predictor_vertical_advection = request.param[ + "skip_compute_predictor_vertical_advection" + ] horizontal_advection_of_w_at_edges_on_half_levels = data_alloc.zero_field( grid, dims.EdgeDim, dims.KDim ) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py index 01e5727fdd..1c041b2a89 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py @@ -18,7 +18,7 @@ from icon4py.model.common.grid import base from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing.stencil_tests import StencilTest, StandardStaticVariants +from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest def compute_hydrostatic_correction_term_numpy( @@ -92,7 +92,7 @@ class TestComputeHydrostaticCorrectionTerm(StencilTest): OUTPUTS = ("z_hydro_corr",) PROGRAM = compute_hydrostatic_correction_term STATIC_PARAMS = { - StandardStaticVariants.NONE: None, + StandardStaticVariants.NONE: (), StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index e9e31fb1e5..02a12daba5 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -82,7 +82,7 @@ class TestComputePerturbedQuantitiesAndInterpolation(stencil_tests.StencilTest): "d2dz2_of_temporal_extrapolation_of_perturbed_exner_on_model_levels", ) STATIC_PARAMS = { - stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.NONE: (), stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "limited_area", "igradp_method", @@ -97,7 +97,7 @@ class TestComputePerturbedQuantitiesAndInterpolation(stencil_tests.StencilTest): "vertical_start", "vertical_end", "nflatlev", - "nflat_gradp" + "nflat_gradp", ), stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( "limited_area", @@ -105,7 +105,7 @@ class TestComputePerturbedQuantitiesAndInterpolation(stencil_tests.StencilTest): "vertical_start", "vertical_end", "nflatlev", - "nflat_gradp" + "nflat_gradp", ), } diff --git a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py index 21dc17dafe..d551fc265e 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py @@ -18,7 +18,7 @@ ) from icon4py.model.common.type_alias import wpfloat from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing.stencil_tests import StencilTest, StandardStaticVariants +from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest @pytest.mark.continuous_benchmarking From a30e5da8f31dc0cebdf2bab01648ea44a7d30f81 Mon Sep 17 00:00:00 2001 From: Ong Chia Rui <93439630+OngChia@users.noreply.github.com> Date: Fri, 12 Sep 2025 14:50:58 +0200 Subject: [PATCH 013/111] fix a bug in grid-savepoint reading during driver initialization (#866) Fix bug in the input arguments of `IconSerialDataProvider.from_grid_savepoint` in `initialization_utils.py` of the driver package after this PR https://github.com/C2SM/icon4py/pull/829 is merged. --- .../model/driver/icon4py_configuration.py | 18 ++- .../icon4py/model/driver/icon4py_driver.py | 84 ++++------ .../model/driver/initialization_utils.py | 149 +++++++++++------- .../{test_timeloop.py => test_icon4py.py} | 88 +++++++---- model/driver/tests/driver/utils.py | 4 +- 5 files changed, 195 insertions(+), 148 deletions(-) rename model/driver/tests/driver/integration_tests/{test_timeloop.py => test_icon4py.py} (89%) diff --git a/model/driver/src/icon4py/model/driver/icon4py_configuration.py b/model/driver/src/icon4py/model/driver/icon4py_configuration.py index fad9abcfef..066326d827 100644 --- a/model/driver/src/icon4py/model/driver/icon4py_configuration.py +++ b/model/driver/src/icon4py/model/driver/icon4py_configuration.py @@ -13,8 +13,7 @@ from gt4py.next import backend as gtx_backend, metrics as gtx_metrics from icon4py.model.atmosphere.diffusion import diffusion -from icon4py.model.atmosphere.dycore import solve_nonhydro as solve_nh -from icon4py.model.common import constants +from icon4py.model.atmosphere.dycore import dycore_states, solve_nonhydro as solve_nh from icon4py.model.common.grid import vertical as v_grid from icon4py.model.driver import initialization_utils as driver_init @@ -74,7 +73,6 @@ def _mch_ch_r04b09_diffusion_config(): return diffusion.DiffusionConfig( diffusion_type=diffusion.DiffusionType.SMAGORINSKY_4TH_ORDER, hdiff_w=True, - n_substeps=n_substeps_reduced, hdiff_vn=True, type_t_diffu=2, type_vn_diffu=1, @@ -82,14 +80,20 @@ def _mch_ch_r04b09_diffusion_config(): hdiff_w_efdt_ratio=15.0, smagorinski_scaling_factor=0.025, zdiffu_t=True, + thslp_zdiffu=0.02, + thhgtd_zdiffu=125.0, velocity_boundary_diffusion_denom=150.0, - max_nudging_coefficient=0.075 * constants.DEFAULT_DYNAMICS_TO_PHYSICS_TIMESTEP_RATIO, + max_nudging_coefficient=0.375, + n_substeps=n_substeps_reduced, + shear_type=diffusion.TurbulenceShearForcingType.VERTICAL_HORIZONTAL_OF_HORIZONTAL_VERTICAL_WIND, ) def _mch_ch_r04b09_nonhydro_config(): return solve_nh.NonHydrostaticConfig( - ndyn_substeps_var=n_substeps_reduced, - max_nudging_coefficient=0.075 * constants.DEFAULT_DYNAMICS_TO_PHYSICS_TIMESTEP_RATIO, + divdamp_order=dycore_states.DivergenceDampingOrder.COMBINED, + iau_wgt_dyn=1.0, + fourth_order_divdamp_factor=0.004, + max_nudging_coefficient=0.375, ) def _jabw_vertical_config(): @@ -126,7 +130,7 @@ def _mch_ch_r04b09_config(): Icon4pyRunConfig( dtime=datetime.timedelta(seconds=10.0), start_date=datetime.datetime(2021, 6, 20, 12, 0, 0), - end_date=datetime.datetime(2021, 6, 20, 12, 0, 10), + end_date=datetime.datetime(2021, 6, 20, 12, 0, 30), n_substeps=n_substeps_reduced, apply_initial_stabilization=True, backend=backend, diff --git a/model/driver/src/icon4py/model/driver/icon4py_driver.py b/model/driver/src/icon4py/model/driver/icon4py_driver.py index 39d7131762..6edeed27fb 100644 --- a/model/driver/src/icon4py/model/driver/icon4py_driver.py +++ b/model/driver/src/icon4py/model/driver/icon4py_driver.py @@ -9,7 +9,6 @@ import datetime import logging import pathlib -import uuid from collections.abc import Callable from typing import NamedTuple @@ -339,9 +338,7 @@ def initialize( props: decomposition.ProcessProperties, serialization_type: driver_init.SerializationType, experiment_type: driver_init.ExperimentType, - grid_id: uuid.UUID, - grid_root, - grid_level, + grid_file: pathlib.Path, backend: gtx_backend.Backend, ) -> tuple[TimeLoop, DriverStates, DriverParams]: """ @@ -359,9 +356,8 @@ def initialize( props: Processor properties. serialization_type: Serialization type. experiment_type: Experiment type. - grid_id: Grid ID. - grid_root: Grid root. - grid_level: Grid level. + grid_file: Path of the grid. + backend: GT4Py backend. Returns: TimeLoop: Time loop object. @@ -373,24 +369,20 @@ def initialize( config = driver_config.read_config(experiment_type=experiment_type, backend=backend) decomp_info = driver_init.read_decomp_info( - file_path, - props, - backend, - serialization_type, - grid_id, - grid_root, - grid_level, + path=file_path, + grid_file=grid_file, + procs_props=props, + backend=backend, + ser_type=serialization_type, ) log.info(f"initializing the grid from '{file_path}'") - icon_grid = driver_init.read_icon_grid( - file_path, + grid = driver_init.read_icon_grid( + path=file_path, + grid_file=grid_file, backend=backend, rank=props.rank, ser_type=serialization_type, - grid_id=grid_id, - grid_root=grid_root, - grid_level=grid_level, ) log.info(f"reading input fields from '{file_path}'") ( @@ -399,14 +391,12 @@ def initialize( vertical_geometry, c_owner_mask, ) = driver_init.read_geometry_fields( - file_path, + path=file_path, + grid_file=grid_file, vertical_grid_config=config.vertical_grid_config, backend=backend, rank=props.rank, ser_type=serialization_type, - grid_id=grid_id, - grid_root=grid_root, - grid_level=grid_level, ) ( diffusion_metric_state, @@ -415,11 +405,9 @@ def initialize( solve_nonhydro_interpolation_state, _, ) = driver_init.read_static_fields( - grid_id, - grid_root, - grid_level, - file_path, - backend, + path=file_path, + grid_file=grid_file, + backend=backend, rank=props.rank, ser_type=serialization_type, ) @@ -428,7 +416,7 @@ def initialize( diffusion_params = diffusion.DiffusionParams(config.diffusion_config) exchange = decomposition.create_exchange(props, decomp_info) diffusion_granule = diffusion.Diffusion( - icon_grid, + grid, config.diffusion_config, diffusion_params, vertical_geometry, @@ -443,7 +431,7 @@ def initialize( nonhydro_params = solve_nh.NonHydrostaticParams(config.solve_nonhydro_config) solve_nonhydro_granule = solve_nh.SolveNonhydro( - grid=icon_grid, + grid=grid, backend=backend, config=config.solve_nonhydro_config, params=nonhydro_params, @@ -464,10 +452,10 @@ def initialize( prognostic_state_now, prognostic_state_next, ) = driver_init.read_initial_state( - icon_grid, - cell_geometry, - edge_geometry, - file_path, + grid=grid, + cell_param=cell_geometry, + edge_param=edge_geometry, + path=file_path, backend=backend, rank=props.rank, experiment_type=experiment_type, @@ -521,25 +509,14 @@ def initialize( "Currently, users can also set it to either jabw or grauss_3d_torus to generate analytic initial condition for the JW and mountain wave tests, respectively (they are placed in abs_path_to_icon4py/model/driver/src/icon4py/model/driver/test_cases/).", ) @click.option( - "--grid_root", - default=2, - show_default=True, - help="Grid root division (please refer to Sadourny et al. 1968 or ICON documentation for more information). When torus grid is used, it must be set to 2.", -) -@click.option( - "--grid_level", - default=4, - show_default=True, - help="Grid refinement level. When torus grid is used, it must be set to 0.", -) -@click.option( - "--grid_id", - default="af122aca-1dd2-11b2-a7f8-c7bf6bc21eba", - help="uuid of the horizontal grid ('uuidOfHGrid' from gridfile)", + "--grid_file", + required=True, + help="Path of the grid file.", ) @click.option( "--enable_output", is_flag=True, + default=False, help="Enable all debugging messages. Otherwise, only critical error messages are printed.", ) @click.option( @@ -560,9 +537,7 @@ def icon4py_driver( mpi, serialization_type, experiment_type, - grid_id, - grid_root, - grid_level, + grid_file, enable_output, enable_profiling, icon4py_driver_backend, @@ -596,7 +571,6 @@ def icon4py_driver( backend = model_backends.BACKENDS[icon4py_driver_backend] parallel_props = decomposition.get_processor_properties(decomposition.get_runtype(with_mpi=mpi)) - grid_id = uuid.UUID(grid_id) driver_init.configure_logging(run_path, experiment_type, enable_output, parallel_props) time_loop: TimeLoop @@ -607,9 +581,7 @@ def icon4py_driver( parallel_props, serialization_type, experiment_type, - grid_id, - grid_root, - grid_level, + pathlib.Path(grid_file), backend, ) log.info(f"Starting ICON dycore run: {time_loop.simulation_date.isoformat()}") diff --git a/model/driver/src/icon4py/model/driver/initialization_utils.py b/model/driver/src/icon4py/model/driver/initialization_utils.py index 89cdd68361..4424ec9914 100644 --- a/model/driver/src/icon4py/model/driver/initialization_utils.py +++ b/model/driver/src/icon4py/model/driver/initialization_utils.py @@ -7,10 +7,11 @@ # SPDX-License-Identifier: BSD-3-Clause import enum +import functools import logging import pathlib -import uuid +import netCDF4 as nc4 from gt4py.next import backend as gtx_backend from icon4py.model.atmosphere.diffusion import diffusion_states @@ -20,7 +21,12 @@ definitions as decomposition, mpi_decomposition as mpi_decomp, ) -from icon4py.model.common.grid import icon as icon_grid, states as grid_states, vertical as v_grid +from icon4py.model.common.grid import ( + base, + icon as icon_grid, + states as grid_states, + vertical as v_grid, +) from icon4py.model.common.states import ( diagnostic_state as diagnostics, prognostic_state as prognostics, @@ -31,11 +37,6 @@ from icon4py.model.testing import serialbox as sb -# TODO(egparedes): Read these hardcoded constants from grid file -GRID_LEVEL = 4 -GRID_ROOT = 2 -GLOBAL_GRID_ID = uuid.UUID("af122aca-1dd2-11b2-a7f8-c7bf6bc21eba") - SB_ONLY_MSG = "Only ser_type='sb' is implemented so far." INITIALIZATION_ERROR_MSG = "The requested experiment type is not implemented." @@ -59,37 +60,29 @@ class ExperimentType(str, enum.Enum): def read_icon_grid( path: pathlib.Path, + grid_file: pathlib.Path, backend: gtx_backend.Backend, - rank=0, + rank: int = 0, ser_type: SerializationType = SerializationType.SB, - grid_id=GLOBAL_GRID_ID, - grid_root=GRID_ROOT, - grid_level=GRID_LEVEL, ) -> icon_grid.IconGrid: """ Read icon grid. Args: path: path where to find the input data + grid_file: path of the grid + backend: GT4Py backend rank: mpi rank of the current compute node ser_type: type of input data. Currently only 'sb (serialbox)' is supported. It reads from ppser serialized test data - grid_id: id (uuid) of the horizontal grid - grid_root: global grid root division number - grid_level: global grid refinement number Returns: IconGrid parsed from a given input type. """ if ser_type == SerializationType.SB: - return ( - sb.IconSerialDataProvider( - backend=backend, - fname_prefix="icon_pydycore", - path=str(path.absolute()), - do_print=False, - mpi_rank=rank, - ) - .from_savepoint_grid(grid_id, grid_root, grid_level) - .construct_icon_grid(backend=backend) - ) + return _grid_savepoint( + backend=backend, + path=path, + grid_file=grid_file, + rank=rank, + ).construct_icon_grid(backend=backend) else: raise NotImplementedError(SB_ONLY_MSG) @@ -98,7 +91,7 @@ def model_initialization_serialbox( grid: icon_grid.IconGrid, path: pathlib.Path, backend: gtx_backend.Backend, - rank=0, + rank: int = 0, ) -> tuple[ diffusion_states.DiffusionDiagnosticState, dycore_states.DiagnosticStateNonHydro, @@ -115,6 +108,7 @@ def model_initialization_serialbox( Args: grid: IconGrid path: path where to find the input data + backend: GT4Py backend rank: mpi rank of the current compute node Returns: A tuple containing Diagnostic variables for diffusion and solve_nonhydro granules, PrepAdvection, second order divdamp factor, diagnostic variables, and two prognostic @@ -148,19 +142,21 @@ def model_initialization_serialbox( normal_wind_tendency_due_to_slow_physics_process=solve_nonhydro_init_savepoint.ddt_vn_phy(), grf_tend_vn=solve_nonhydro_init_savepoint.grf_tend_vn(), normal_wind_advective_tendency=common_utils.PredictorCorrectorPair( + velocity_init_savepoint.ddt_vn_apc_pc(0), velocity_init_savepoint.ddt_vn_apc_pc(1), - velocity_init_savepoint.ddt_vn_apc_pc(2), ), vertical_wind_advective_tendency=common_utils.PredictorCorrectorPair( + velocity_init_savepoint.ddt_w_adv_pc(0), velocity_init_savepoint.ddt_w_adv_pc(1), - velocity_init_savepoint.ddt_w_adv_pc(2), ), tangential_wind=velocity_init_savepoint.vt(), vn_on_half_levels=velocity_init_savepoint.vn_ie(), contravariant_correction_at_cells_on_half_levels=velocity_init_savepoint.w_concorr_c(), - rho_iau_increment=solve_nonhydro_init_savepoint.rho_incr(), - normal_wind_iau_increment=solve_nonhydro_init_savepoint.vn_incr(), - exner_iau_increment=solve_nonhydro_init_savepoint.exner_incr(), + rho_iau_increment=data_alloc.zero_field(grid, dims.CellDim, dims.KDim, backend=backend), + normal_wind_iau_increment=data_alloc.zero_field( + grid, dims.EdgeDim, dims.KDim, backend=backend + ), + exner_iau_increment=data_alloc.zero_field(grid, dims.CellDim, dims.KDim, backend=backend), exner_dynamical_increment=solve_nonhydro_init_savepoint.exner_dyn_incr(), ) @@ -328,13 +324,11 @@ def read_initial_state( def read_geometry_fields( path: pathlib.Path, + grid_file: pathlib.Path, vertical_grid_config: v_grid.VerticalGridConfig, backend: gtx_backend.Backend, - rank=0, + rank: int = 0, ser_type: SerializationType = SerializationType.SB, - grid_id=GLOBAL_GRID_ID, - grid_root=GRID_ROOT, - grid_level=GRID_LEVEL, ) -> tuple[ grid_states.EdgeParams, grid_states.CellParams, @@ -346,18 +340,17 @@ def read_geometry_fields( Args: path: path to the serialized input data + grid_file: path of the grid vertical_grid_config: Vertical grid configuration + backend: GT4py backend rank: mpi rank of the current compute node ser_type: (optional) defaults to SB=serialbox, type of input data to be read - grid_id: id (uuid) of the horizontal grid - grid_root: global grid root division number - grid_level: global grid refinement number Returns: a tuple containing fields describing edges, cells, vertical properties of the model the data is originally obtained from the grid file (horizontal fields) or some special input files. """ if ser_type == SerializationType.SB: - sp = _grid_savepoint(backend, path, rank, grid_id, grid_root, grid_level) + sp = _grid_savepoint(backend, path, grid_file, rank) edge_geometry = sp.construct_edge_geometry() cell_geometry = sp.construct_cell_geometry() vct_a, vct_b = v_grid.get_vct_a_and_vct_b(vertical_grid_config, backend) @@ -372,7 +365,11 @@ def read_geometry_fields( # TODO(OngChia): cannot be cached (@functools.cache) after adding backend. TypeError: unhashable type: 'CompiledbFactory' -def _serial_data_provider(backend, path, rank) -> sb.IconSerialDataProvider: +def _serial_data_provider( + backend: gtx_backend.Backend, + path: pathlib.Path, + rank: int, +) -> sb.IconSerialDataProvider: return sb.IconSerialDataProvider( backend=backend, fname_prefix="icon_pydycore", @@ -383,37 +380,43 @@ def _serial_data_provider(backend, path, rank) -> sb.IconSerialDataProvider: # TODO(OngChia): cannot be cached (@functools.cache) after adding backend. TypeError: unhashable type: 'CompiledbFactory' -def _grid_savepoint(backend, path, rank, grid_id, grid_root, grid_level) -> sb.IconGridSavepoint: +def _grid_savepoint( + backend: gtx_backend.Backend, + path: pathlib.Path, + grid_file: pathlib.Path, + rank: int, +) -> sb.IconGridSavepoint: + global_grid_params, grid_uuid = _create_grid_global_params(grid_file) sp = _serial_data_provider(backend, path, rank).from_savepoint_grid( - grid_id, grid_root, grid_level + grid_uuid, + global_grid_params.grid_shape, ) return sp def read_decomp_info( path: pathlib.Path, + grid_file: pathlib.Path, procs_props: decomposition.ProcessProperties, backend: gtx_backend.Backend, ser_type=SerializationType.SB, - grid_id=GLOBAL_GRID_ID, - grid_root=GRID_ROOT, - grid_level=GRID_LEVEL, ) -> decomposition.DecompositionInfo: if ser_type == SerializationType.SB: return _grid_savepoint( - backend, path, procs_props.rank, grid_id, grid_root, grid_level + backend, + path, + grid_file, + procs_props.rank, ).construct_decomposition_info() else: raise NotImplementedError(SB_ONLY_MSG) def read_static_fields( - grid_id: str, - grid_root: int, - grid_level: int, path: pathlib.Path, + grid_file: pathlib.Path, backend: gtx_backend.Backend, - rank=0, + rank: int = 0, ser_type: SerializationType = SerializationType.SB, ) -> tuple[ diffusion_states.DiffusionMetricState, @@ -426,8 +429,9 @@ def read_static_fields( Read fields for metric and interpolation state. Args: - grid: IconGrid path: path to the serialized input data + grid_file: path of the grid + backend: GT4Py backend rank: mpi rank, defaults to 0 for serial run ser_type: (optional) defaults to SB=serialbox, type of input data to be read @@ -466,7 +470,7 @@ def read_static_fields( nudgecoeff_e=interpolation_savepoint.nudgecoeff_e(), ) metrics_savepoint = data_provider.from_metrics_savepoint() - grid_savepoint = data_provider.from_savepoint_grid(grid_id, grid_root, grid_level) + grid_savepoint = _grid_savepoint(backend, path, grid_file, rank) solve_nonhydro_metric_state = dycore_states.MetricStateNonHydro( bdy_halo_c=metrics_savepoint.bdy_halo_c(), mask_prog_halo_c=metrics_savepoint.mask_prog_halo_c(), @@ -535,15 +539,19 @@ def configure_logging( Args: run_path: path to the output folder where the logfile should be stored experiment_name: name of the simulation + enable_output: enable output logging messages above debug level + processor_procs: ProcessProperties """ + if not enable_output: + return run_dir = ( pathlib.Path(run_path).absolute() if run_path else pathlib.Path(__file__).absolute().parent ) run_dir.mkdir(exist_ok=True) logfile = run_dir.joinpath(f"dummy_dycore_driver_{experiment_name}.log") logfile.touch(exist_ok=True) - logging_level = logging.DEBUG if enable_output else logging.CRITICAL + logging_level = logging.DEBUG logging.basicConfig( level=logging_level, format="%(asctime)s %(filename)-20s (%(lineno)-4d) : %(funcName)-20s: %(levelname)-8s %(message)s", @@ -559,3 +567,38 @@ def configure_logging( console_handler.setFormatter(formatter) console_handler.setLevel(logging_level) logging.getLogger("").addHandler(console_handler) + + +@functools.cache +def _create_grid_global_params( + grid_file: pathlib.Path, +) -> tuple[icon_grid.GlobalGridParams, str]: + """ + Create global grid params and its uuid. + + Args: + grid_file: path of the grid file + + Returns: + global_grid_params: GlobalGridParams + grid_uuid: id (uuid) of the horizontal grid + """ + grid = nc4.Dataset(grid_file, "r", format="NETCDF4") + grid_root = grid.getncattr("grid_root") + grid_level = grid.getncattr("grid_level") + grid_uuid = grid.getncattr("uuidOfHGrid") + try: + grid_geometry_type = base.GeometryType(grid.getncattr("grid_geometry")) + except AttributeError: + log.warning( + "Global attribute grid_geometry is not found in the grid. Icosahedral grid is assumed." + ) + grid_geometry_type = base.GeometryType.ICOSAHEDRON + grid.close() + global_grid_params = icon_grid.GlobalGridParams( + grid_shape=icon_grid.GridShape( + geometry_type=grid_geometry_type, + subdivision=icon_grid.GridSubdivision(root=grid_root, level=grid_level), + ), + ) + return global_grid_params, grid_uuid diff --git a/model/driver/tests/driver/integration_tests/test_timeloop.py b/model/driver/tests/driver/integration_tests/test_icon4py.py similarity index 89% rename from model/driver/tests/driver/integration_tests/test_timeloop.py rename to model/driver/tests/driver/integration_tests/test_icon4py.py index 3376b5a96c..fccd3ccd4c 100644 --- a/model/driver/tests/driver/integration_tests/test_timeloop.py +++ b/model/driver/tests/driver/integration_tests/test_icon4py.py @@ -9,13 +9,14 @@ from typing import TYPE_CHECKING +import click import pytest import icon4py.model.common.grid.states as grid_states import icon4py.model.common.utils as common_utils from icon4py.model.atmosphere.diffusion import diffusion from icon4py.model.atmosphere.dycore import dycore_states, solve_nonhydro as solve_nh -from icon4py.model.common import dimension as dims +from icon4py.model.common import dimension as dims, model_backends from icon4py.model.common.grid import vertical as v_grid from icon4py.model.common.states import prognostic_state as prognostics from icon4py.model.common.utils import data_allocation as data_alloc @@ -25,7 +26,7 @@ initialization_utils as driver_init, serialbox_helpers as driver_sb, ) -from icon4py.model.testing import definitions, test_utils +from icon4py.model.testing import datatest_utils as dt_utils, definitions, grid_utils, test_utils from icon4py.model.testing.fixtures.datatest import backend from ..fixtures import * # noqa: F403 @@ -72,34 +73,6 @@ False, True, ), - ( - definitions.Experiments.EXCLAIM_APE, - 1, - 2, - 1, - 2, - "2000-01-01T00:00:00.000", - "2000-01-01T00:00:02.000", - "2000-01-01T00:00:02.000", - "2000-01-01T00:00:02.000", - False, - False, - False, - ), - ( - definitions.Experiments.EXCLAIM_APE, - 1, - 2, - 1, - 2, - "2000-01-01T00:00:02.000", - "2000-01-01T00:00:04.000", - "2000-01-01T00:00:04.000", - "2000-01-01T00:00:04.000", - False, - False, - True, - ), ( definitions.Experiments.GAUSS3D, 1, @@ -387,3 +360,58 @@ def test_run_timeloop_single_step( prognostic_states.current.rho.asnumpy(), rho_sp.asnumpy(), ) + + +@pytest.mark.embedded_remap_error +@pytest.mark.datatest +@pytest.mark.parametrize( + "experiment, experiment_type", + [ + ( + definitions.Experiments.MCH_CH_R04B09, + driver_init.ExperimentType.ANY.value, + ), + ], +) +def test_driver( + experiment, + experiment_type, + *, + data_provider, + ranked_data_path, + backend, +): + """ + This is a only test to check if the icon4py driver runs from serialized data without verifying the end result. + The timeloop is verified by test_run_timeloop_single_step above. + TODO(anyone): Remove or modify this test when it is ready to run the driver from the grid file without having to initialize static fields from serialized data. + """ + data_path = dt_utils.get_datapath_for_experiment( + ranked_base_path=ranked_data_path, + experiment=experiment, + ) + gm = grid_utils.get_grid_manager_from_experiment( + experiment=experiment, + keep_skip_values=True, + backend=backend, + ) + + backend_name = None + for key, value in model_backends.BACKENDS.items(): + if value == backend: + backend_name = key + + assert backend_name is not None + + icon4py_driver.icon4py_driver( + [ + str(data_path), + "--experiment_type", + experiment_type, + "--grid_file", + str(gm._file_name), + "--icon4py_driver_backend", + backend_name, + ], + standalone_mode=False, + ) diff --git a/model/driver/tests/driver/utils.py b/model/driver/tests/driver/utils.py index 4b99a214cd..1ae4389880 100644 --- a/model/driver/tests/driver/utils.py +++ b/model/driver/tests/driver/utils.py @@ -25,7 +25,7 @@ def mch_ch_r04b09_dsl_icon4pyrun_config( Create Icon4pyRunConfig matching MCH_CH_r04b09_dsl. Set values to the ones used in the MCH_CH_r04b09_dsl experiment where they differ - from the default. Backend is not used because granules are set independently in test_timeloop.py. + from the default. Backend is not used because granules are set independently in test_icon4py.py. """ return driver_config.Icon4pyRunConfig( dtime=timedelta(seconds=10.0), @@ -49,7 +49,7 @@ def exclaim_ape_icon4pyrun_config( Create Icon4pyRunConfig matching exclaim_ape_R02B04. Set values to the ones used in the exclaim_ape_R02B04 experiment where they differ - from the default. Backend is not used because granules are set independently in test_timeloop.py + from the default. Backend is not used because granules are set independently in test_icon4py.py """ return driver_config.Icon4pyRunConfig( dtime=timedelta(seconds=2.0), From ca2f4f211294c84d9eed8154a273b4ae0b2a9e60 Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Fri, 12 Sep 2025 15:00:29 +0200 Subject: [PATCH 014/111] Fix cupy cfl reduction performance by raveling the array (#872) On the mch-ch1_medium experiment - this is 4% faster on the full timestep compared to the version without `ravel`; - within fluctuations there is no difference between no reduction and this version. --- .../src/icon4py/model/atmosphere/dycore/velocity_advection.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/velocity_advection.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/velocity_advection.py index 04df7bddfe..ee9975abd9 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/velocity_advection.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/velocity_advection.py @@ -279,11 +279,13 @@ def run_predictor_step( skip_compute_predictor_vertical_advection=skip_compute_predictor_vertical_advection, ) + # Reductions should be performed on flat, contiguous arrays for best cupy performance + # as otherwise cupy won't use cub optimized kernels. max_vertical_cfl = float( self.vertical_cfl.array_ns.max( self.vertical_cfl.ndarray[ self._start_cell_lateral_boundary_level_4 : self._end_cell_halo, : - ] + ].ravel(order="K") ) ) diagnostic_state.max_vertical_cfl = max(max_vertical_cfl, diagnostic_state.max_vertical_cfl) From 36f5583c23672718c84f342263e2b7dcafd9a7ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20M=C3=BCller?= <147368808+philip-paul-mueller@users.noreply.github.com> Date: Fri, 12 Sep 2025 16:20:21 +0200 Subject: [PATCH 015/111] Update to GT4Py v1.0.9 (dace fix) (#840) Co-authored-by: Edoardo Paone --- model/atmosphere/advection/pyproject.toml | 2 +- model/atmosphere/diffusion/pyproject.toml | 2 +- model/atmosphere/dycore/pyproject.toml | 2 +- .../microphysics/pyproject.toml | 2 +- .../muphys/pyproject.toml | 2 +- model/common/pyproject.toml | 2 +- model/driver/pyproject.toml | 2 +- model/testing/pyproject.toml | 2 +- tools/pyproject.toml | 2 +- uv.lock | 34 +++++++++---------- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/model/atmosphere/advection/pyproject.toml b/model/atmosphere/advection/pyproject.toml index dc2c0d08b6..ed5008b47d 100644 --- a/model/atmosphere/advection/pyproject.toml +++ b/model/atmosphere/advection/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ # workspace members "icon4py-common>=0.0.6", # external dependencies - "gt4py==1.0.8", + "gt4py==1.0.9", 'packaging>=20.0' ] description = "ICON advection." diff --git a/model/atmosphere/diffusion/pyproject.toml b/model/atmosphere/diffusion/pyproject.toml index 3075c9f668..8e47254167 100644 --- a/model/atmosphere/diffusion/pyproject.toml +++ b/model/atmosphere/diffusion/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ # workspace members "icon4py-common>=0.0.6", # external dependencies - "gt4py==1.0.8", + "gt4py==1.0.9", 'packaging>=20.0' ] description = "ICON diffusion." diff --git a/model/atmosphere/dycore/pyproject.toml b/model/atmosphere/dycore/pyproject.toml index 48cbab785a..ece60c4b75 100644 --- a/model/atmosphere/dycore/pyproject.toml +++ b/model/atmosphere/dycore/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ # workspace members "icon4py-common>=0.0.6", # external dependencies - "gt4py==1.0.8", + "gt4py==1.0.9", 'packaging>=20.0' ] description = "ICON dynamical core." diff --git a/model/atmosphere/subgrid_scale_physics/microphysics/pyproject.toml b/model/atmosphere/subgrid_scale_physics/microphysics/pyproject.toml index 8edb9fb35f..e80e262703 100644 --- a/model/atmosphere/subgrid_scale_physics/microphysics/pyproject.toml +++ b/model/atmosphere/subgrid_scale_physics/microphysics/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ # workspace members "icon4py-common>=0.0.6", # external dependencies - "gt4py==1.0.8", + "gt4py==1.0.9", 'packaging>=20.0' ] description = "ICON microphysics." diff --git a/model/atmosphere/subgrid_scale_physics/muphys/pyproject.toml b/model/atmosphere/subgrid_scale_physics/muphys/pyproject.toml index 0588161111..76b74470b0 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/pyproject.toml +++ b/model/atmosphere/subgrid_scale_physics/muphys/pyproject.toml @@ -25,7 +25,7 @@ dependencies = [ # workspace members "icon4py-common[io]>=0.0.6", # external dependencies - "gt4py==1.0.8", + "gt4py==1.0.9", "packaging>=20.0" ] description = "ICON subgrid scale muphys parameterization." diff --git a/model/common/pyproject.toml b/model/common/pyproject.toml index f06edf4fca..c59ff754f5 100644 --- a/model/common/pyproject.toml +++ b/model/common/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ 'Topic :: Scientific/Engineering :: Physics' ] dependencies = [ - 'gt4py==1.0.8', + 'gt4py==1.0.9', 'packaging>=20.0', 'packaging>=20.0', 'typing-extensions>=4.11.0', diff --git a/model/driver/pyproject.toml b/model/driver/pyproject.toml index 51bc818dde..5ec5edfc6f 100644 --- a/model/driver/pyproject.toml +++ b/model/driver/pyproject.toml @@ -31,7 +31,7 @@ dependencies = [ # external dependencies "click>=8.0.1", "devtools>=0.12", - "gt4py==1.0.8", + "gt4py==1.0.9", "packaging>=20.0", "numpy>=1.23.3" ] diff --git a/model/testing/pyproject.toml b/model/testing/pyproject.toml index 3905ffda56..311168b49b 100644 --- a/model/testing/pyproject.toml +++ b/model/testing/pyproject.toml @@ -27,7 +27,7 @@ dependencies = [ 'icon4py-common[io]>=0.0.6', # external dependencies "filelock>=3.18.0", - "gt4py==1.0.8", + "gt4py==1.0.9", "numpy>=1.23.3", 'packaging>=20.0', "pytest>=8.0.1", diff --git a/tools/pyproject.toml b/tools/pyproject.toml index ae268b12f8..a8e7acc768 100644 --- a/tools/pyproject.toml +++ b/tools/pyproject.toml @@ -30,7 +30,7 @@ dependencies = [ 'icon4py-common>=0.0.6', # external dependencies 'cffi>=1.5', - 'gt4py==1.0.8', + 'gt4py==1.0.9', "numpy>=1.23.3", 'packaging>=20.0', 'click>=8.1.7', diff --git a/uv.lock b/uv.lock index 34861433c3..9d46fbfd5b 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.10" resolution-markers = [ "python_full_version < '3.11'", @@ -173,8 +173,8 @@ dependencies = [ { name = "packaging" }, { name = "pathspec" }, { name = "platformdirs" }, - { name = "tomli", marker = "python_full_version < '3.11'" }, - { name = "typing-extensions", marker = "python_full_version < '3.11'" }, + { name = "tomli", marker = "python_full_version < '3.11' or (extra == 'extra-7-icon4py-cuda11' and extra == 'extra-7-icon4py-cuda12')" }, + { name = "typing-extensions", marker = "python_full_version < '3.11' or (extra == 'extra-7-icon4py-cuda11' and extra == 'extra-7-icon4py-cuda12')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/d8/0d/cc2fb42b8c50d80143221515dd7e4766995bd07c56c9a3ed30baf080b6dc/black-24.10.0.tar.gz", hash = "sha256:846ea64c97afe3bc677b761787993be4991810ecc7a4a937816dd6bddedc4875", size = 645813, upload-time = "2024-10-07T19:20:50.361Z" } wheels = [ @@ -587,7 +587,7 @@ name = "click" version = "8.1.7" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "colorama", marker = "sys_platform == 'win32' or (extra == 'extra-7-icon4py-cuda11' and extra == 'extra-7-icon4py-cuda12')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de", size = 336121, upload-time = "2023-08-17T17:29:11.868Z" } wheels = [ @@ -1428,7 +1428,7 @@ wheels = [ [[package]] name = "gt4py" -version = "1.0.8" +version = "1.0.9" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "attrs" }, @@ -1460,9 +1460,9 @@ dependencies = [ { name = "versioningit" }, { name = "xxhash" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/45/83/0d546c3b8987ddb771a0a9780bc74688bdd2f702e925ea30da667506b72a/gt4py-1.0.8.tar.gz", hash = "sha256:1dd686836377dbcbd4d0c20ba4757fdb4ed605d3468c548a5dabb52aed5d3047", size = 723685, upload-time = "2025-09-04T07:22:23.997Z" } +sdist = { url = "https://files.pythonhosted.org/packages/a9/1c/2577d3b2380dc3e5451432a96de730ce4fdf4b602f63b9b989d0373f9ed4/gt4py-1.0.9.tar.gz", hash = "sha256:8b7d1eab14b1d093d1db943de8d8a759e9b979464892533d31c9ff9d6abc53ca", size = 724634, upload-time = "2025-09-12T12:30:50.244Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ae/6d/5b1119125f3a76f06160a745ff1e714440fa8dcc1123e637977b51f944d1/gt4py-1.0.8-py3-none-any.whl", hash = "sha256:4ad705ddbbaee8aed1a7a38748314ee6223b93ef705721c29bd9730eec3ac6c5", size = 924753, upload-time = "2025-09-04T07:22:22.23Z" }, + { url = "https://files.pythonhosted.org/packages/52/bc/e49d6dfc6169ea10dc10ed723b281aa841d7c644297c95a427455317638a/gt4py-1.0.9-py3-none-any.whl", hash = "sha256:1ef45657dd470e77bbe0f5cc9bf3c17493efc0df498ee74897069b2cbf6ac9cb", size = 925459, upload-time = "2025-09-12T12:30:48.731Z" }, ] [package.optional-dependencies] @@ -1805,7 +1805,7 @@ dependencies = [ [package.metadata] requires-dist = [ - { name = "gt4py", specifier = "==1.0.8" }, + { name = "gt4py", specifier = "==1.0.9" }, { name = "icon4py-common", editable = "model/common" }, { name = "packaging", specifier = ">=20.0" }, ] @@ -1822,7 +1822,7 @@ dependencies = [ [package.metadata] requires-dist = [ - { name = "gt4py", specifier = "==1.0.8" }, + { name = "gt4py", specifier = "==1.0.9" }, { name = "icon4py-common", editable = "model/common" }, { name = "packaging", specifier = ">=20.0" }, ] @@ -1839,7 +1839,7 @@ dependencies = [ [package.metadata] requires-dist = [ - { name = "gt4py", specifier = "==1.0.8" }, + { name = "gt4py", specifier = "==1.0.9" }, { name = "icon4py-common", editable = "model/common" }, { name = "packaging", specifier = ">=20.0" }, ] @@ -1856,7 +1856,7 @@ dependencies = [ [package.metadata] requires-dist = [ - { name = "gt4py", specifier = "==1.0.8" }, + { name = "gt4py", specifier = "==1.0.9" }, { name = "icon4py-common", editable = "model/common" }, { name = "packaging", specifier = ">=20.0" }, ] @@ -1873,7 +1873,7 @@ dependencies = [ [package.metadata] requires-dist = [ - { name = "gt4py", specifier = "==1.0.8" }, + { name = "gt4py", specifier = "==1.0.9" }, { name = "icon4py-common", extras = ["io"], editable = "model/common" }, { name = "packaging", specifier = ">=20.0" }, ] @@ -1943,7 +1943,7 @@ requires-dist = [ { name = "dace", marker = "extra == 'dace'", git = "https://github.com/GridTools/dace?tag=__gt4py-next-integration_2025_08_28" }, { name = "datashader", marker = "extra == 'io'", specifier = ">=0.16.1" }, { name = "ghex", marker = "extra == 'distributed'", specifier = ">=0.3.0" }, - { name = "gt4py", specifier = "==1.0.8" }, + { name = "gt4py", specifier = "==1.0.9" }, { name = "gt4py", extras = ["cuda11"], marker = "extra == 'cuda11'" }, { name = "gt4py", extras = ["cuda12"], marker = "extra == 'cuda12'" }, { name = "gt4py", extras = ["next"], marker = "extra == 'dace'" }, @@ -1982,7 +1982,7 @@ dependencies = [ requires-dist = [ { name = "click", specifier = ">=8.0.1" }, { name = "devtools", specifier = ">=0.12" }, - { name = "gt4py", specifier = "==1.0.8" }, + { name = "gt4py", specifier = "==1.0.9" }, { name = "icon4py-atmosphere-diffusion", editable = "model/atmosphere/diffusion" }, { name = "icon4py-atmosphere-dycore", editable = "model/atmosphere/dycore" }, { name = "icon4py-common", editable = "model/common" }, @@ -2010,7 +2010,7 @@ dependencies = [ [package.metadata] requires-dist = [ { name = "filelock", specifier = ">=3.18.0" }, - { name = "gt4py", specifier = "==1.0.8" }, + { name = "gt4py", specifier = "==1.0.9" }, { name = "icon4py-common", extras = ["io"], editable = "model/common" }, { name = "numpy", specifier = ">=1.23.3" }, { name = "packaging", specifier = ">=20.0" }, @@ -2056,7 +2056,7 @@ requires-dist = [ { name = "cupy-cuda11x", marker = "extra == 'cuda11'", specifier = ">=13.0" }, { name = "cupy-cuda12x", marker = "extra == 'cuda12'", specifier = ">=13.0" }, { name = "fprettify", specifier = ">=0.3.7" }, - { name = "gt4py", specifier = "==1.0.8" }, + { name = "gt4py", specifier = "==1.0.9" }, { name = "gt4py", extras = ["cuda11"], marker = "extra == 'cuda11'" }, { name = "gt4py", extras = ["cuda12"], marker = "extra == 'cuda12'" }, { name = "icon4py-atmosphere-advection", editable = "model/atmosphere/advection" }, @@ -4776,7 +4776,7 @@ version = "3.1.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "packaging" }, - { name = "tomli", marker = "python_full_version < '3.11'" }, + { name = "tomli", marker = "python_full_version < '3.11' or (extra == 'extra-7-icon4py-cuda11' and extra == 'extra-7-icon4py-cuda12')" }, ] sdist = { url = "https://files.pythonhosted.org/packages/5c/9b/941647e9e3616b5da7bbc4601ed9920f44a886704100fa8151406c07c149/versioningit-3.1.2.tar.gz", hash = "sha256:4db83ed99f56b07d83940bee3445ca46ca120d13b6b304cdb5fb44e5aa4edec0", size = 213047, upload-time = "2024-07-20T12:41:07.927Z" } wheels = [ From 510dfae1637fc384d23c6bbc130f54628765c82e Mon Sep 17 00:00:00 2001 From: Magdalena Date: Fri, 12 Sep 2025 16:32:05 +0200 Subject: [PATCH 016/111] delete outdated top level README.md from tools (#870) delete top level README.md from tools --- tools/README.md | 126 ------------------------------------------------ 1 file changed, 126 deletions(-) delete mode 100644 tools/README.md diff --git a/tools/README.md b/tools/README.md deleted file mode 100644 index 08efacdffd..0000000000 --- a/tools/README.md +++ /dev/null @@ -1,126 +0,0 @@ -# ICON4Py Tools - -## Description - -Tools and utilities for integrating icon4py code into the ICON model. - -## Installation instructions - -Until development reaches a stable state, we recommend that you follow the general instructions in the [../README.md](../README.md) root folder to install `icon4py.tools` and all of its dependencies in a virtual environment. - -## Command-line tools - -# py2fgen - -`py2fgen` is a command-line interface (CLI) tool designed to generate C and Fortran 90 (F90) wrappers, as well as a C library, for embedding a Python module into C and Fortran applications. This tool facilitates the embedding of Python code into Fortran programs by utilizing the [`CFFI`](https://cffi.readthedocs.io/en/latest/embedding) library. `CFFI` instantiates a Python interpreter to execute Python code which is "frozen" into the dynamic library generated by `CFFI`. - -**Note:** `py2fgen` has been used to embed the diffusion and dycore granule into ICON. It is important to remember that there are performance implications related to converting Fortran pointers to array-like objects that can be used in Python. It is also important to note that functions embedded into Fortran can only accept arguments with intrinsic types, as well as arrays. It is currently not possible to pass derived types to embedded Python functions. - -## Usage - -`py2fgen` simplifies the process of embedding Python functions into C and Fortran codebases. Here's how to use it: - -```bash -py2fgen [OPTIONS] MODULE_IMPORT_PATH FUNCTION_NAME - -Arguments: - MODULE_IMPORT_PATH The Python module import path to the module where the functions to be embedded are defined. - FUNCTIONS A comma-separated list of functions to be embedded in the case of multiple, otherwise just the function name. - PLUGIN_NAME The name of the plugin used for creating the shared library and bindings. -Options: - -o, --output-path PATH Specify the directory for generated code and - compiled libraries. - -b, --backend [CPU|GPU|ROUNDTRIP] - Set the backend to use, thereby unpacking - Fortran pointers into NumPy or CuPy arrays - respectively. - -d, --debug-mode Enable debug mode to log additional Python - runtime information. - -p, --profile Profile granule runtime and unpacking - Fortran pointers into NumPy or CuPy arrays. - --limited-area Enable limited area mode. -``` - -## Initialising the grid - -When embedding granules it may be necessary to have access to the representation of the ICON grid inside the granule. In order to initialise the grid for each granule there exists a `grid_init_` function which must also be embedded and called from Fortran. Each granule has access to a module state which is defined in a dictionary at the top of the module, for example `diffusion_wrapper_state` in the diffusion wrapper. - -## Environment variables - -In order to run the embedded code from Fortran it is necessary to set environment variables based on whether you are running in a CPU or GPU context. For more information on these, as well as other information on how to build and integrate embedded code into ICON using py2fgen see [this document](https://hackmd.io/OmmNptDRTe2lex7GXuYDIQ#Python-Granule-Integration-into-ICON). - -### Example - -To create a Fortran interface along with the dynamic library for a Python function named `square` within the module `example.functions`, execute: - -```bash -py2fgen example.functions square -``` - -It is also possible to generate bindings for more than one function at a time by using a comma-separated list of function names: - -```bash -py2fgen example.functions square,square2 -``` - -`py2fgen` can accept two types of functions: - -- **Simple Function:** Any Python function can be exposed. -- **GT4Py Program:** Specifically, a Python function decorated with a `@program` decorator. - -**Important:** All arguments in the exposed functions must use GT4Py style type hints. These are used by the parser to map GT4Py types to C and Fortran types in the generated bindings. - -## Generated Files - -Running `py2fgen` generates five key files: - -- **.c File**: Contains the generated CFFI code and the frozen Python code. -- **.so File**: The compiled dynamic C library containing the CFFI code. -- **.h File**: Declares the function signature of your exposed function. -- **.f90 File**: Contains a Fortran interface to the C function in the dynamic library. -- **.o File**: Represents the object code of the CFFI plugin. -- (Optional) **.py File**: Contains the Python code frozen into the dynamic library (available with `--debug-mode`). - -## Running from Fortran - -To use the generated CFFI plugin in a Fortran program, call the subroutine defined in the `.f90` interface file. Ensure that any arrays passed to the subroutine are in column-major order. - -Examples can be found under `tools/tests/py2fgen/fortran_samples`. - -## Compilation - -Compiling your Fortran driver code requires a Fortran compiler, such as `gfortran` or `nvfortran`. Follow these steps: - -1. Compile and link the Fortran driver code along with the Fortran interface and dynamic library: - -```bash -gfortran -I. -Wl,-rpath=. -L. _plugin.f90 .f90 -l_plugin -o -``` - -Replace ``, ``, and `` with the appropriate names for your project. - -**Note:** When executing the compiled binary make sure that you have sourced a Python virtual environment where all required dependencies to run the embedded Python code are present. - -## Error handling - -All generated Python wrapper code is wrapped in a `try: ... except: ...` block, with the wrapper function returning an error code `1` if an Exception ocurred -and `0` otherwise. In case of an exception the error message is written to the `py2f_cffi.log` file, which is located in the same directory as the generated bindings. -This means that on the Fortran side we can handle errors gracefully as follows: - -```Fortran -integer(c_int) :: rc -real(c_double), dimension(:, :), allocatable :: input, result - -call square(input, result, rc) - -! handle the Python error here - if (rc /= 0) then - print *, "Python failed with exit code = ", rc - call exit(1) - end if -``` - -## Other requirements - -- Embedded Python functions must have type hints for all function parameters, as these are used to derive the corresponding C and Fortran types. -- Embedded Python functions are assumed to modify function parameters in-place. Explicitly returning anything is currently not supported. From 38242936566bd72deae1fa933837dea50ba8f558 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Sep 2025 08:14:06 +0200 Subject: [PATCH 017/111] Bump actions/setup-python from 5 to 6 (#863) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
Release notes

Sourced from actions/setup-python's releases.

v6.0.0

What's Changed

Breaking Changes

Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. See Release Notes

Enhancements:

Bug fixes:

Dependency updates:

New Contributors

Full Changelog: https://github.com/actions/setup-python/compare/v5...v6.0.0

v5.6.0

What's Changed

Full Changelog: https://github.com/actions/setup-python/compare/v5...v5.6.0

v5.5.0

What's Changed

Enhancements:

Bug fixes:

... (truncated)

Commits
  • e797f83 Upgrade to node 24 (#1164)
  • 3d1e2d2 Revert "Enhance cache-dependency-path handling to support files outside the w...
  • 65b0712 Clarify pythonLocation behavior for PyPy and GraalPy in environment variables...
  • 5b668cf Bump actions/checkout from 4 to 5 (#1181)
  • f62a0e2 Change missing cache directory error to warning (#1182)
  • 9322b3c Upgrade setuptools to 78.1.1 to fix path traversal vulnerability in PackageIn...
  • fbeb884 Bump form-data to fix critical vulnerabilities #182 & #183 (#1163)
  • 03bb615 Bump idna from 2.9 to 3.7 in /tests/data (#843)
  • 36da51d Add version parsing from Pipfile (#1067)
  • 3c6f142 update documentation (#1156)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/setup-python&package-manager=github_actions&previous-version=5&new-version=6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/icon4py-qa.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/icon4py-qa.yml b/.github/workflows/icon4py-qa.yml index 2b8dbf9c84..0574c7a9b2 100644 --- a/.github/workflows/icon4py-qa.yml +++ b/.github/workflows/icon4py-qa.yml @@ -21,7 +21,7 @@ jobs: sudo apt-get install libboost-all-dev - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version-file: ".python-version" From 1c899eba7b4c51fcfb24e1677366b29330665e82 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 15 Sep 2025 10:55:40 +0200 Subject: [PATCH 018/111] Clean up 41_to_60 for better performance (#784) - Removed `vertical_mass_flux_at_cells_on_half_levels`, `tridiagonal_alpha_coeff_at_cells_on_half_levels`, `tridiagonal_beta_coeff_at_cells_on_model_levels`, `exner_explicit_term` and `rho_explicit_term` from intermediate fields passed around - Combined `_vertically_implicit_solver_at_corrector/predictor_step_before/after_solving_w` - Improved initialization of scans (level 0 and 80) (together with @philip-paul-mueller ) - Removed any unnecessary initializations related to them (i.e. `next_w`) - Handle related unit tests - Make sure that the values for the `n_lev` vertical level are passed from `_set_surface_boundary_condtion_for_computation_of_w` to `_vertically_implicit_solver_at_corrector/predictor_step_before_solving_w` properly - Improves DaCe handling of temporaries --------- Co-authored-by: "Ong Chia Rui" --- .../model/atmosphere/dycore/solve_nonhydro.py | 47 -- ...diagonal_matrix_for_w_back_substitution.py | 2 +- ..._tridiagonal_matrix_for_w_forward_sweep.py | 52 +- .../vertically_implicit_dycore_solver.py | 673 +++++++----------- .../integration_tests/test_solve_nonhydro.py | 107 --- ...diagonal_matrix_for_w_back_substitution.py | 5 +- ..._tridiagonal_matrix_for_w_forward_sweep.py | 4 + ...mplicit_dycore_solver_at_corrector_step.py | 42 +- ...mplicit_dycore_solver_at_predictor_step.py | 44 +- 9 files changed, 311 insertions(+), 665 deletions(-) diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_nonhydro.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_nonhydro.py index 8bb3e3c547..f9cfe2054b 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_nonhydro.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/solve_nonhydro.py @@ -82,26 +82,6 @@ class IntermediateFields: """ Declared as z_gradh_exner in ICON. """ - tridiagonal_alpha_coeff_at_cells_on_half_levels: fa.CellKField[ - ta.vpfloat - ] # TODO(): change this back to KHalfDim, but how do we treat it wrt to field_operators and domain? - """ - Declared as z_alpha in ICON. - """ - tridiagonal_beta_coeff_at_cells_on_model_levels: fa.CellKField[ta.vpfloat] - """ - Declared as z_beta in ICON. - """ - exner_explicit_term: fa.CellKField[ta.wpfloat] - """ - Declared as z_exner_expl in ICON. - """ - vertical_mass_flux_at_cells_on_half_levels: fa.EdgeKField[ - ta.wpfloat - ] # TODO(): change this back to KHalfDim, but how do we treat it wrt to field_operators and domain? - """ - Declared as z_contr_w_fl_l in ICON. - """ rho_at_edges_on_model_levels: fa.EdgeKField[ta.wpfloat] """ Declared as z_rho_e in ICON. @@ -122,10 +102,6 @@ class IntermediateFields: """ Declared as z_graddiv_vn in ICON. """ - rho_explicit_term: fa.CellKField[ta.wpfloat] - """ - Declared as z_rho_expl in ICON. - """ dwdz_at_cells_on_model_levels: fa.CellKField[ta.vpfloat] """ Declared as z_dwdz_dd in ICON. @@ -141,18 +117,6 @@ def allocate( horizontal_pressure_gradient=data_alloc.zero_field( grid, dims.EdgeDim, dims.KDim, backend=backend ), - tridiagonal_alpha_coeff_at_cells_on_half_levels=data_alloc.zero_field( - grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, backend=backend - ), - tridiagonal_beta_coeff_at_cells_on_model_levels=data_alloc.zero_field( - grid, dims.CellDim, dims.KDim, backend=backend - ), - exner_explicit_term=data_alloc.zero_field( - grid, dims.CellDim, dims.KDim, backend=backend - ), - vertical_mass_flux_at_cells_on_half_levels=data_alloc.zero_field( - grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, backend=backend - ), rho_at_edges_on_model_levels=data_alloc.zero_field( grid, dims.EdgeDim, dims.KDim, backend=backend ), @@ -162,7 +126,6 @@ def allocate( horizontal_gradient_of_normal_wind_divergence=data_alloc.zero_field( grid, dims.EdgeDim, dims.KDim, backend=backend ), - rho_explicit_term=data_alloc.zero_field(grid, dims.CellDim, dims.KDim, backend=backend), dwdz_at_cells_on_model_levels=data_alloc.zero_field( grid, dims.CellDim, dims.KDim, backend=backend ), @@ -1229,12 +1192,7 @@ def run_predictor_step( self._vertically_implicit_solver_at_predictor_step( contravariant_correction_at_cells_on_half_levels=diagnostic_state_nh.contravariant_correction_at_cells_on_half_levels, - vertical_mass_flux_at_cells_on_half_levels=z_fields.vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels=z_fields.tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=z_fields.tridiagonal_alpha_coeff_at_cells_on_half_levels, next_w=prognostic_states.next.w, - rho_explicit_term=z_fields.rho_explicit_term, - exner_explicit_term=z_fields.exner_explicit_term, next_rho=prognostic_states.next.rho, next_exner=prognostic_states.next.exner, next_theta_v=prognostic_states.next.theta_v, @@ -1413,12 +1371,7 @@ def run_corrector_step( ) self._vertically_implicit_solver_at_corrector_step( - vertical_mass_flux_at_cells_on_half_levels=z_fields.vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels=z_fields.tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=z_fields.tridiagonal_alpha_coeff_at_cells_on_half_levels, next_w=prognostic_states.next.w, - rho_explicit_term=z_fields.rho_explicit_term, - exner_explicit_term=z_fields.exner_explicit_term, next_rho=prognostic_states.next.rho, next_exner=prognostic_states.next.exner, next_theta_v=prognostic_states.next.theta_v, diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/solve_tridiagonal_matrix_for_w_back_substitution.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/solve_tridiagonal_matrix_for_w_back_substitution.py index a00925162e..4b370372f3 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/solve_tridiagonal_matrix_for_w_back_substitution.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/solve_tridiagonal_matrix_for_w_back_substitution.py @@ -12,7 +12,7 @@ from icon4py.model.common.type_alias import vpfloat, wpfloat -@gtx.scan_operator(axis=dims.KDim, forward=False, init=wpfloat("1.0")) +@gtx.scan_operator(axis=dims.KDim, forward=False, init=wpfloat("0.0")) def _solve_tridiagonal_matrix_for_w_back_substitution_scan( w_state: wpfloat, z_q: vpfloat, w: wpfloat ) -> wpfloat: diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/solve_tridiagonal_matrix_for_w_forward_sweep.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/solve_tridiagonal_matrix_for_w_forward_sweep.py index 0649d3f156..c5a20860e5 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/solve_tridiagonal_matrix_for_w_forward_sweep.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/solve_tridiagonal_matrix_for_w_forward_sweep.py @@ -13,23 +13,35 @@ from icon4py.model.common.type_alias import vpfloat, wpfloat -@gtx.scan_operator(axis=dims.KDim, forward=True, init=(vpfloat("1.0"), 0.0, True)) -def _w( - state: tuple[vpfloat, float, bool], - w_prev: wpfloat, # only accessed at the first k-level - z_q_prev: vpfloat, - z_a: vpfloat, - z_b: vpfloat, - z_c: vpfloat, - w_prep: wpfloat, +@gtx.scan_operator( + axis=dims.KDim, + forward=True, + init=( + vpfloat("0.0"), + 0.0, + ), # boundary condition for upper tridiagonal element and w at model top +) +def tridiagonal_forward_sweep_for_w( + state_kminus1: tuple[vpfloat, float], + a: vpfloat, + b: vpfloat, + c: vpfloat, + d: wpfloat, ): - first = state[2] - z_q_m1 = z_q_prev if first else astype(state[0], vpfloat) - w_m1 = w_prev if first else state[1] - z_g = vpfloat("1.0") / (z_b + z_a * z_q_m1) - z_q_new = (vpfloat("0.0") - z_c) * z_g - w_new = (w_prep - astype(z_a, wpfloat) * w_m1) * astype(z_g, wpfloat) - return z_q_new, w_new, False + """ + | 1 0 | | w_0 | | 0 | | 1 0 | | w_0 | | 0 | + | a_1 b_1 c_1 | | w_1 | | d_1 | | 0 1 cnew_1 | | w_1 | | dnew_1 | + | a_2 b_2 c_2 | | w_2 | = | d_2 | ==> | 0 1 cnew_2 | | w_2 | = | dnew_2 | + | a_3 b_3 c_3 | | w_3 | | d_3 | | 0 1 cnew_3 | | w_3 | | dnew_3 | + | a_4 b_4 c_4 | | w_4 | | d_4 | | 0 1 cnew_4 | | w_4 | | dnew_4 | + | ... | | ... | | ... | | ... | | ... | | ... | + """ + c_kminus1 = astype(state_kminus1[0], vpfloat) + d_kminus1 = state_kminus1[1] + normalization = vpfloat("1.0") / (b + a * c_kminus1) # normalize diagonal element to 1 + c_new = (vpfloat("0.0") - c) * normalization + d_new = (d - astype(a, wpfloat) * d_kminus1) * astype(normalization, wpfloat) + return c_new, d_new @gtx.field_operator @@ -41,8 +53,6 @@ def _solve_tridiagonal_matrix_for_w_forward_sweep( z_beta: fa.CellKField[vpfloat], z_w_expl: fa.CellKField[wpfloat], z_exner_expl: fa.CellKField[wpfloat], - z_q: fa.CellKField[vpfloat], - w: fa.CellKField[wpfloat], dtime: wpfloat, cpd: wpfloat, ) -> tuple[fa.CellKField[vpfloat], fa.CellKField[wpfloat]]: @@ -55,9 +65,7 @@ def _solve_tridiagonal_matrix_for_w_forward_sweep( z_b = vpfloat("1.0") + z_gamma_vp * z_alpha * (z_beta(Koff[-1]) + z_beta) z_gamma_wp = astype(z_gamma_vp, wpfloat) w_prep = z_w_expl - z_gamma_wp * (z_exner_expl(Koff[-1]) - z_exner_expl) - w_prev = w(Koff[-1]) - z_q_prev = z_q(Koff[-1]) - z_q_res, w_res, _ = _w(w_prev, z_q_prev, z_a, z_b, z_c, w_prep) + z_q_res, w_res = tridiagonal_forward_sweep_for_w(z_a, z_b, z_c, w_prep) return z_q_res, w_res @@ -87,8 +95,6 @@ def solve_tridiagonal_matrix_for_w_forward_sweep( z_beta, z_w_expl, z_exner_expl, - z_q, - w, dtime, cpd, out=(z_q, w), diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/vertically_implicit_dycore_solver.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/vertically_implicit_dycore_solver.py index dc83325f75..462bb4c220 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/vertically_implicit_dycore_solver.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/stencils/vertically_implicit_dycore_solver.py @@ -84,19 +84,8 @@ def _interpolate_contravariant_correction_from_edges_on_model_levels_to_cells_on @gtx.field_operator def _set_surface_boundary_condition_for_computation_of_w( contravariant_correction_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], -) -> tuple[fa.CellKField[ta.vpfloat], fa.CellKField[ta.wpfloat], fa.CellKField[ta.wpfloat]]: - tridiagonal_alpha_coeff_at_cells_on_half_levels = broadcast( - vpfloat("0.0"), (dims.CellDim, dims.KDim) - ) - vertical_mass_flux_at_cells_on_half_levels = broadcast( - wpfloat("0.0"), (dims.CellDim, dims.KDim) - ) - - return ( - tridiagonal_alpha_coeff_at_cells_on_half_levels, - astype(contravariant_correction_at_cells_on_half_levels, wpfloat), - vertical_mass_flux_at_cells_on_half_levels, - ) +) -> fa.CellKField[ta.wpfloat]: + return astype(contravariant_correction_at_cells_on_half_levels, wpfloat) @gtx.field_operator @@ -184,9 +173,53 @@ def _compute_solver_coefficients_matrix( @gtx.field_operator -def _vertically_implicit_solver_at_predictor_step_before_solving_w( - vertical_mass_flux_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - next_w: fa.CellKField[ta.wpfloat], +def solve_w( + last_inner_level: gtx.int32, + next_w: fa.CellKField[wpfloat], + vwind_impl_wgt: fa.CellField[wpfloat], + theta_v_ic: fa.CellKField[wpfloat], + ddqz_z_half: fa.CellKField[vpfloat], + z_alpha: fa.CellKField[vpfloat], + z_beta: fa.CellKField[vpfloat], + z_w_expl: fa.CellKField[wpfloat], + z_exner_expl: fa.CellKField[wpfloat], + dtime: wpfloat, + cpd: wpfloat, +) -> fa.CellKField[wpfloat]: + ( + tridiagonal_intermediate_result, + next_w_intermediate_result, + ) = concat_where( + dims.KDim > 0, + _solve_tridiagonal_matrix_for_w_forward_sweep( + vwind_impl_wgt=vwind_impl_wgt, + theta_v_ic=theta_v_ic, + ddqz_z_half=ddqz_z_half, + z_alpha=z_alpha, + z_beta=z_beta, + z_w_expl=z_w_expl, + z_exner_expl=z_exner_expl, + dtime=dtime, + cpd=cpd, + ), + (broadcast(vpfloat("0.0"), (dims.CellDim,)), broadcast(wpfloat("0.0"), (dims.CellDim,))), + ) + next_w = concat_where( + dims.KDim < last_inner_level, + _solve_tridiagonal_matrix_for_w_back_substitution_scan( + z_q=tridiagonal_intermediate_result, + w=next_w_intermediate_result, + ), + next_w, + ) + return next_w + + +@gtx.field_operator +def _vertically_implicit_solver_at_predictor_step( + next_w: fa.CellKField[ + ta.wpfloat + ], # necessary input because the last vertical level is set outside this field operator geofac_div: gtx.Field[gtx.Dims[dims.CellDim, dims.C2EDim], ta.wpfloat], mass_flux_at_edges_on_model_levels: fa.EdgeKField[ta.wpfloat], theta_v_flux_at_edges_on_model_levels: fa.EdgeKField[ta.wpfloat], @@ -207,9 +240,18 @@ def _vertically_implicit_solver_at_predictor_step_before_solving_w( rho_iau_increment: fa.CellKField[ta.vpfloat], exner_iau_increment: fa.CellKField[ta.vpfloat], ddqz_z_half: fa.CellKField[ta.vpfloat], + exner_dynamical_increment: fa.CellKField[ta.wpfloat], + dwdz_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], + rayleigh_damping_factor: fa.KField[ta.wpfloat], + reference_exner_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], iau_wgt_dyn: ta.wpfloat, dtime: ta.wpfloat, + rayleigh_type: gtx.int32, + divdamp_type: gtx.int32, is_iau_active: bool, + at_first_substep: bool, + end_index_of_damping_layer: gtx.int32, + kstart_moist: gtx.int32, n_lev: gtx.int32, ) -> tuple[ fa.CellKField[ta.wpfloat], @@ -225,8 +267,6 @@ def _vertically_implicit_solver_at_predictor_step_before_solving_w( z_theta_v_fl_e=theta_v_flux_at_edges_on_model_levels, ) - tridiagonal_intermediate_result = broadcast(vpfloat("0.0"), (dims.CellDim, dims.KDim)) - w_explicit_term = concat_where( 1 <= dims.KDim, _compute_w_explicit_term_with_predictor_advective_tendency( @@ -238,24 +278,14 @@ def _vertically_implicit_solver_at_predictor_step_before_solving_w( broadcast(wpfloat("0.0"), (dims.CellDim, dims.KDim)), ) - (next_w, vertical_mass_flux_at_cells_on_half_levels) = concat_where( - dims.KDim == 0, - ( - broadcast(wpfloat("0.0"), (dims.CellDim,)), - broadcast(wpfloat("0.0"), (dims.CellDim,)), - ), - (next_w, vertical_mass_flux_at_cells_on_half_levels), - ) - vertical_mass_flux_at_cells_on_half_levels = concat_where( - # TODO(OngChia): (dims.KDim < n_lev) is needed. Otherwise, the stencil test fails. (1 <= dims.KDim) & (dims.KDim < n_lev), rho_at_cells_on_half_levels * ( -astype(contravariant_correction_at_cells_on_half_levels, wpfloat) + exner_w_explicit_weight_parameter * current_w ), - vertical_mass_flux_at_cells_on_half_levels, + broadcast(wpfloat("0.0"), (dims.CellDim,)), ) ( @@ -271,6 +301,11 @@ def _vertically_implicit_solver_at_predictor_step_before_solving_w( rho_at_cells_on_half_levels=rho_at_cells_on_half_levels, dtime=dtime, ) + tridiagonal_alpha_coeff_at_cells_on_half_levels = concat_where( + dims.KDim < n_lev, + tridiagonal_alpha_coeff_at_cells_on_half_levels, + broadcast(vpfloat("0.0"), (dims.CellDim,)), + ) (rho_explicit_term, exner_explicit_term) = _compute_explicit_part_for_rho_and_exner( rho_nnow=current_rho, @@ -294,82 +329,20 @@ def _vertically_implicit_solver_at_predictor_step_before_solving_w( iau_wgt_dyn=iau_wgt_dyn, ) - tridiagonal_intermediate_result, next_w = concat_where( - dims.KDim > 0, - _solve_tridiagonal_matrix_for_w_forward_sweep( - vwind_impl_wgt=exner_w_implicit_weight_parameter, - theta_v_ic=theta_v_at_cells_on_half_levels, - ddqz_z_half=ddqz_z_half, - z_alpha=tridiagonal_alpha_coeff_at_cells_on_half_levels, - z_beta=tridiagonal_beta_coeff_at_cells_on_model_levels, - z_w_expl=w_explicit_term, - z_exner_expl=exner_explicit_term, - z_q=tridiagonal_intermediate_result, - w=next_w, - dtime=dtime, - cpd=dycore_consts.cpd, - ), - (tridiagonal_intermediate_result, next_w), - ) - - # TODO(OngChia): We should not need this because alpha is zero at n_lev and thus tridiagonal_intermediate_result should be zero at nlev-1. However, stencil test shows it is nonzero. - tridiagonal_intermediate_result = concat_where( - dims.KDim == n_lev - 1, - broadcast(vpfloat("0.0"), (dims.CellDim, dims.KDim)), - tridiagonal_intermediate_result, - ) - - next_w = concat_where( - dims.KDim > 0, - _solve_tridiagonal_matrix_for_w_back_substitution_scan( - z_q=tridiagonal_intermediate_result, w=next_w - ), - next_w, - ) - - return ( - vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels, - next_w, - rho_explicit_term, - exner_explicit_term, + next_w = solve_w( + last_inner_level=n_lev, + next_w=next_w, # n_lev value is set by _set_surface_boundary_condtion_for_computation_of_w + vwind_impl_wgt=exner_w_implicit_weight_parameter, + theta_v_ic=theta_v_at_cells_on_half_levels, + ddqz_z_half=ddqz_z_half, + z_alpha=tridiagonal_alpha_coeff_at_cells_on_half_levels, + z_beta=tridiagonal_beta_coeff_at_cells_on_model_levels, + z_w_expl=w_explicit_term, + z_exner_expl=exner_explicit_term, + dtime=dtime, + cpd=dycore_consts.cpd, ) - -@gtx.field_operator -def _vertically_implicit_solver_at_predictor_step_after_solving_w( - tridiagonal_beta_coeff_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], - tridiagonal_alpha_coeff_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], - next_w: fa.CellKField[ta.wpfloat], - dwdz_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], - exner_dynamical_increment: fa.CellKField[ta.vpfloat], - rho_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - contravariant_correction_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], - current_exner: fa.CellKField[ta.wpfloat], - current_rho: fa.CellKField[ta.wpfloat], - current_theta_v: fa.CellKField[ta.wpfloat], - inv_ddqz_z_full: fa.CellKField[ta.vpfloat], - exner_w_implicit_weight_parameter: fa.CellField[ta.wpfloat], - rayleigh_damping_factor: fa.KField[ta.wpfloat], - reference_exner_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], - rho_explicit_term: fa.CellKField[ta.wpfloat], - exner_explicit_term: fa.CellKField[ta.wpfloat], - dtime: ta.wpfloat, - rayleigh_type: gtx.int32, - divdamp_type: gtx.int32, - at_first_substep: bool, - end_index_of_damping_layer: gtx.int32, - kstart_moist: gtx.int32, -) -> tuple[ - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.vpfloat], - fa.CellKField[ta.vpfloat], -]: - # Because we do not support nesting, it is safe to assume w_1 is a zero field w_1 = broadcast(wpfloat("0.0"), (dims.CellDim,)) if rayleigh_type == rayleigh_damping_options.KLEMP: next_w = concat_where( @@ -428,10 +401,137 @@ def _vertically_implicit_solver_at_predictor_step_after_solving_w( ) -@gtx.field_operator -def _vertically_implicit_solver_at_corrector_step_before_solving_w( - vertical_mass_flux_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], +@gtx.program +def vertically_implicit_solver_at_predictor_step( + contravariant_correction_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], next_w: fa.CellKField[ta.wpfloat], + next_rho: fa.CellKField[ta.wpfloat], + next_exner: fa.CellKField[ta.wpfloat], + next_theta_v: fa.CellKField[ta.wpfloat], + dwdz_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], + exner_dynamical_increment: fa.CellKField[ta.vpfloat], + geofac_div: gtx.Field[gtx.Dims[dims.CellDim, dims.C2EDim], ta.wpfloat], + mass_flux_at_edges_on_model_levels: fa.EdgeKField[ta.wpfloat], + theta_v_flux_at_edges_on_model_levels: fa.EdgeKField[ta.wpfloat], + predictor_vertical_wind_advective_tendency: fa.CellKField[ta.vpfloat], + pressure_buoyancy_acceleration_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], + rho_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], + contravariant_correction_at_edges_on_model_levels: fa.EdgeKField[ta.vpfloat], + exner_w_explicit_weight_parameter: fa.CellField[ta.wpfloat], + current_exner: fa.CellKField[ta.wpfloat], + current_rho: fa.CellKField[ta.wpfloat], + current_theta_v: fa.CellKField[ta.wpfloat], + current_w: fa.CellKField[ta.wpfloat], + inv_ddqz_z_full: fa.CellKField[ta.vpfloat], + exner_w_implicit_weight_parameter: fa.CellField[ta.wpfloat], + theta_v_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], + perturbed_exner_at_cells_on_model_levels: fa.CellKField[ta.wpfloat], + exner_tendency_due_to_slow_physics: fa.CellKField[ta.vpfloat], + rho_iau_increment: fa.CellKField[ta.vpfloat], + exner_iau_increment: fa.CellKField[ta.vpfloat], + ddqz_z_half: fa.CellKField[ta.vpfloat], + rayleigh_damping_factor: fa.KField[ta.wpfloat], + reference_exner_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], + e_bln_c_s: gtx.Field[gtx.Dims[dims.CellDim, dims.C2EDim], wpfloat], + wgtfac_c: fa.CellKField[vpfloat], + wgtfacq_c: fa.CellKField[vpfloat], + iau_wgt_dyn: ta.wpfloat, + dtime: ta.wpfloat, + is_iau_active: bool, + rayleigh_type: gtx.int32, + divdamp_type: gtx.int32, + at_first_substep: bool, + end_index_of_damping_layer: gtx.int32, + kstart_moist: gtx.int32, + flat_level_index_plus1: gtx.int32, + start_cell_index_nudging: gtx.int32, + end_cell_index_local: gtx.int32, + start_cell_index_lateral_lvl3: gtx.int32, + end_cell_index_halo_lvl1: gtx.int32, + vertical_start_index_model_top: gtx.int32, + vertical_end_index_model_surface: gtx.int32, +): + _interpolate_contravariant_correction_from_edges_on_model_levels_to_cells_on_half_levels( + contravariant_correction_at_edges_on_model_levels=contravariant_correction_at_edges_on_model_levels, + e_bln_c_s=e_bln_c_s, + wgtfac_c=wgtfac_c, + wgtfacq_c=wgtfacq_c, + nlev=vertical_end_index_model_surface - 1, + out=contravariant_correction_at_cells_on_half_levels, + domain={ + dims.CellDim: ( + start_cell_index_lateral_lvl3, + end_cell_index_halo_lvl1, + ), + dims.KDim: (flat_level_index_plus1, vertical_end_index_model_surface), + }, + ) + _set_surface_boundary_condition_for_computation_of_w( + contravariant_correction_at_cells_on_half_levels=contravariant_correction_at_cells_on_half_levels, + out=next_w, + domain={ + dims.CellDim: (start_cell_index_nudging, end_cell_index_local), + dims.KDim: (vertical_end_index_model_surface - 1, vertical_end_index_model_surface), + }, + ) + _vertically_implicit_solver_at_predictor_step( + next_w=next_w, + geofac_div=geofac_div, + mass_flux_at_edges_on_model_levels=mass_flux_at_edges_on_model_levels, + theta_v_flux_at_edges_on_model_levels=theta_v_flux_at_edges_on_model_levels, + predictor_vertical_wind_advective_tendency=predictor_vertical_wind_advective_tendency, + pressure_buoyancy_acceleration_at_cells_on_half_levels=pressure_buoyancy_acceleration_at_cells_on_half_levels, + rho_at_cells_on_half_levels=rho_at_cells_on_half_levels, + contravariant_correction_at_cells_on_half_levels=contravariant_correction_at_cells_on_half_levels, + exner_w_explicit_weight_parameter=exner_w_explicit_weight_parameter, + current_exner=current_exner, + current_rho=current_rho, + current_theta_v=current_theta_v, + current_w=current_w, + inv_ddqz_z_full=inv_ddqz_z_full, + exner_w_implicit_weight_parameter=exner_w_implicit_weight_parameter, + theta_v_at_cells_on_half_levels=theta_v_at_cells_on_half_levels, + perturbed_exner_at_cells_on_model_levels=perturbed_exner_at_cells_on_model_levels, + exner_tendency_due_to_slow_physics=exner_tendency_due_to_slow_physics, + rho_iau_increment=rho_iau_increment, + exner_iau_increment=exner_iau_increment, + ddqz_z_half=ddqz_z_half, + dwdz_at_cells_on_model_levels=dwdz_at_cells_on_model_levels, + exner_dynamical_increment=exner_dynamical_increment, + rayleigh_damping_factor=rayleigh_damping_factor, + reference_exner_at_cells_on_model_levels=reference_exner_at_cells_on_model_levels, + iau_wgt_dyn=iau_wgt_dyn, + dtime=dtime, + rayleigh_type=rayleigh_type, + divdamp_type=divdamp_type, + is_iau_active=is_iau_active, + at_first_substep=at_first_substep, + end_index_of_damping_layer=end_index_of_damping_layer, + kstart_moist=kstart_moist, + n_lev=vertical_end_index_model_surface - 1, + out=( + next_w, + next_rho, + next_exner, + next_theta_v, + dwdz_at_cells_on_model_levels, + exner_dynamical_increment, + ), + domain={ + dims.CellDim: (start_cell_index_nudging, end_cell_index_local), + dims.KDim: (vertical_start_index_model_top, vertical_end_index_model_surface - 1), + }, + ) + + +@gtx.field_operator +def _vertically_implicit_solver_at_corrector_step( + next_w: fa.CellKField[ + ta.wpfloat + ], # necessary input because the last vertical level is set outside this field operator + dynamical_vertical_mass_flux_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], + dynamical_vertical_volumetric_flux_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], + exner_dynamical_increment: fa.CellKField[ta.wpfloat], geofac_div: gtx.Field[gtx.Dims[dims.CellDim, dims.C2EDim], ta.wpfloat], mass_flux_at_edges_on_model_levels: fa.EdgeKField[ta.wpfloat], theta_v_flux_at_edges_on_model_levels: fa.EdgeKField[ta.wpfloat], @@ -453,11 +553,21 @@ def _vertically_implicit_solver_at_corrector_step_before_solving_w( rho_iau_increment: fa.CellKField[ta.vpfloat], exner_iau_increment: fa.CellKField[ta.vpfloat], ddqz_z_half: fa.CellKField[ta.vpfloat], + rayleigh_damping_factor: fa.KField[ta.wpfloat], + reference_exner_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], advection_explicit_weight_parameter: ta.wpfloat, advection_implicit_weight_parameter: ta.wpfloat, + lprep_adv: bool, + r_nsubsteps: ta.wpfloat, + ndyn_substeps_var: ta.wpfloat, iau_wgt_dyn: ta.wpfloat, dtime: ta.wpfloat, is_iau_active: bool, + rayleigh_type: gtx.int32, + at_first_substep: bool, + at_last_substep: bool, + end_index_of_damping_layer: gtx.int32, + kstart_moist: gtx.int32, n_lev: gtx.int32, ) -> tuple[ fa.CellKField[ta.wpfloat], @@ -466,16 +576,13 @@ def _vertically_implicit_solver_at_corrector_step_before_solving_w( fa.CellKField[ta.wpfloat], fa.CellKField[ta.wpfloat], fa.CellKField[ta.wpfloat], + fa.CellKField[ta.wpfloat], ]: - # verified for e-9 divergence_of_mass, divergence_of_theta_v = _compute_divergence_of_fluxes_of_rho_and_theta( geofac_div=geofac_div, mass_fl_e=mass_flux_at_edges_on_model_levels, z_theta_v_fl_e=theta_v_flux_at_edges_on_model_levels, ) - - tridiagonal_intermediate_result = broadcast(vpfloat("0.0"), (dims.CellDim, dims.KDim)) - w_explicit_term = concat_where( 1 <= dims.KDim, _compute_w_explicit_term_with_interpolated_predictor_corrector_advective_tendency( @@ -489,27 +596,15 @@ def _vertically_implicit_solver_at_corrector_step_before_solving_w( ), broadcast(wpfloat("0.0"), (dims.CellDim, dims.KDim)), ) - - (next_w, vertical_mass_flux_at_cells_on_half_levels) = concat_where( - dims.KDim == 0, - ( - broadcast(wpfloat("0.0"), (dims.CellDim,)), - broadcast(wpfloat("0.0"), (dims.CellDim,)), - ), - (next_w, vertical_mass_flux_at_cells_on_half_levels), - ) - vertical_mass_flux_at_cells_on_half_levels = concat_where( - # TODO(OngChia): (dims.KDim < n_lev) is needed. Otherwise, the stencil test fails. (1 <= dims.KDim) & (dims.KDim < n_lev), rho_at_cells_on_half_levels * ( -astype(contravariant_correction_at_cells_on_half_levels, wpfloat) + exner_w_explicit_weight_parameter * current_w ), - vertical_mass_flux_at_cells_on_half_levels, + broadcast(wpfloat("0.0"), (dims.CellDim,)), ) - ( tridiagonal_beta_coeff_at_cells_on_model_levels, tridiagonal_alpha_coeff_at_cells_on_half_levels, @@ -523,7 +618,11 @@ def _vertically_implicit_solver_at_corrector_step_before_solving_w( rho_at_cells_on_half_levels=rho_at_cells_on_half_levels, dtime=dtime, ) - + tridiagonal_alpha_coeff_at_cells_on_half_levels = concat_where( + dims.KDim < n_lev, + tridiagonal_alpha_coeff_at_cells_on_half_levels, + broadcast(vpfloat("0.0"), (dims.CellDim,)), + ) (rho_explicit_term, exner_explicit_term) = _compute_explicit_part_for_rho_and_exner( rho_nnow=current_rho, inv_ddqz_z_full=inv_ddqz_z_full, @@ -536,7 +635,6 @@ def _vertically_implicit_solver_at_corrector_step_before_solving_w( ddt_exner_phy=exner_tendency_due_to_slow_physics, dtime=dtime, ) - if is_iau_active: rho_explicit_term, exner_explicit_term = _add_analysis_increments_from_data_assimilation( z_rho_expl=rho_explicit_term, @@ -546,90 +644,22 @@ def _vertically_implicit_solver_at_corrector_step_before_solving_w( iau_wgt_dyn=iau_wgt_dyn, ) - tridiagonal_intermediate_result, next_w = concat_where( - dims.KDim > 0, - _solve_tridiagonal_matrix_for_w_forward_sweep( - vwind_impl_wgt=exner_w_implicit_weight_parameter, - theta_v_ic=theta_v_at_cells_on_half_levels, - ddqz_z_half=ddqz_z_half, - z_alpha=tridiagonal_alpha_coeff_at_cells_on_half_levels, - z_beta=tridiagonal_beta_coeff_at_cells_on_model_levels, - z_w_expl=w_explicit_term, - z_exner_expl=exner_explicit_term, - z_q=tridiagonal_intermediate_result, - w=next_w, - dtime=dtime, - cpd=dycore_consts.cpd, - ), - (tridiagonal_intermediate_result, next_w), - ) - - # TODO(OngChia): We should not need this because alpha is zero at n_lev and thus tridiagonal_intermediate_result should be zero at nlev-1. However, stencil test shows it is nonzero. - tridiagonal_intermediate_result = concat_where( - dims.KDim == n_lev - 1, - broadcast(vpfloat("0.0"), (dims.CellDim, dims.KDim)), - tridiagonal_intermediate_result, - ) - - next_w = concat_where( - dims.KDim > 0, - _solve_tridiagonal_matrix_for_w_back_substitution_scan( - z_q=tridiagonal_intermediate_result, - w=next_w, - ), - next_w, - ) - - return ( - vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels, - next_w, - rho_explicit_term, - exner_explicit_term, + next_w = solve_w( + last_inner_level=n_lev, + next_w=next_w, # n_lev value is set by _set_surface_boundary_condtion_for_computation_of_w + vwind_impl_wgt=exner_w_implicit_weight_parameter, + theta_v_ic=theta_v_at_cells_on_half_levels, + ddqz_z_half=ddqz_z_half, + z_alpha=tridiagonal_alpha_coeff_at_cells_on_half_levels, + z_beta=tridiagonal_beta_coeff_at_cells_on_model_levels, + z_w_expl=w_explicit_term, + z_exner_expl=exner_explicit_term, + dtime=dtime, + cpd=dycore_consts.cpd, ) - -@gtx.field_operator -def _vertically_implicit_solver_at_corrector_step_after_solving_w( - vertical_mass_flux_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - tridiagonal_beta_coeff_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], - tridiagonal_alpha_coeff_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], - next_w: fa.CellKField[ta.wpfloat], - dynamical_vertical_mass_flux_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - dynamical_vertical_volumetric_flux_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - exner_dynamical_increment: fa.CellKField[ta.wpfloat], - rho_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - current_exner: fa.CellKField[ta.wpfloat], - current_rho: fa.CellKField[ta.wpfloat], - current_theta_v: fa.CellKField[ta.wpfloat], - inv_ddqz_z_full: fa.CellKField[ta.vpfloat], - exner_w_implicit_weight_parameter: fa.CellField[ta.wpfloat], - exner_tendency_due_to_slow_physics: fa.CellKField[ta.vpfloat], - rayleigh_damping_factor: fa.KField[ta.wpfloat], - reference_exner_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], - rho_explicit_term: fa.CellKField[ta.wpfloat], - exner_explicit_term: fa.CellKField[ta.wpfloat], - lprep_adv: bool, - r_nsubsteps: ta.wpfloat, - ndyn_substeps_var: ta.wpfloat, - dtime: ta.wpfloat, - rayleigh_type: gtx.int32, - end_index_of_damping_layer: gtx.int32, - kstart_moist: gtx.int32, - at_first_substep: bool, - at_last_substep: bool, -) -> tuple[ - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.wpfloat], - fa.CellKField[ta.vpfloat], -]: - # Because we do not support nesting, it is safe to assume w_1 is a zero field w_1 = broadcast(wpfloat("0.0"), (dims.CellDim,)) + if rayleigh_type == rayleigh_damping_options.KLEMP: next_w = concat_where( (dims.KDim > 0) & (dims.KDim < end_index_of_damping_layer + 1), @@ -687,8 +717,8 @@ def _vertically_implicit_solver_at_corrector_step_after_solving_w( ), ) - exner_dynamical_increment = ( - concat_where( + if at_last_substep: + exner_dynamical_increment = concat_where( dims.KDim >= kstart_moist, _update_dynamical_exner_time_increment( exner=next_exner, @@ -699,9 +729,6 @@ def _vertically_implicit_solver_at_corrector_step_after_solving_w( ), exner_dynamical_increment, ) - if at_last_substep - else exner_dynamical_increment - ) return ( next_w, @@ -714,175 +741,9 @@ def _vertically_implicit_solver_at_corrector_step_after_solving_w( ) -@gtx.program -def vertically_implicit_solver_at_predictor_step( - contravariant_correction_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], - vertical_mass_flux_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - tridiagonal_beta_coeff_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], - tridiagonal_alpha_coeff_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], - next_w: fa.CellKField[ta.wpfloat], - rho_explicit_term: fa.CellKField[ta.wpfloat], - exner_explicit_term: fa.CellKField[ta.wpfloat], - next_rho: fa.CellKField[ta.wpfloat], - next_exner: fa.CellKField[ta.wpfloat], - next_theta_v: fa.CellKField[ta.wpfloat], - dwdz_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], - exner_dynamical_increment: fa.CellKField[ta.vpfloat], - geofac_div: gtx.Field[gtx.Dims[dims.CellDim, dims.C2EDim], ta.wpfloat], - mass_flux_at_edges_on_model_levels: fa.EdgeKField[ta.wpfloat], - theta_v_flux_at_edges_on_model_levels: fa.EdgeKField[ta.wpfloat], - predictor_vertical_wind_advective_tendency: fa.CellKField[ta.vpfloat], - pressure_buoyancy_acceleration_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], - rho_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - contravariant_correction_at_edges_on_model_levels: fa.EdgeKField[ta.vpfloat], - exner_w_explicit_weight_parameter: fa.CellField[ta.wpfloat], - current_exner: fa.CellKField[ta.wpfloat], - current_rho: fa.CellKField[ta.wpfloat], - current_theta_v: fa.CellKField[ta.wpfloat], - current_w: fa.CellKField[ta.wpfloat], - inv_ddqz_z_full: fa.CellKField[ta.vpfloat], - exner_w_implicit_weight_parameter: fa.CellField[ta.wpfloat], - theta_v_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - perturbed_exner_at_cells_on_model_levels: fa.CellKField[ta.wpfloat], - exner_tendency_due_to_slow_physics: fa.CellKField[ta.vpfloat], - rho_iau_increment: fa.CellKField[ta.vpfloat], - exner_iau_increment: fa.CellKField[ta.vpfloat], - ddqz_z_half: fa.CellKField[ta.vpfloat], - rayleigh_damping_factor: fa.KField[ta.wpfloat], - reference_exner_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], - e_bln_c_s: gtx.Field[gtx.Dims[dims.CellDim, dims.C2EDim], wpfloat], - wgtfac_c: fa.CellKField[vpfloat], - wgtfacq_c: fa.CellKField[vpfloat], - iau_wgt_dyn: ta.wpfloat, - dtime: ta.wpfloat, - is_iau_active: bool, - rayleigh_type: gtx.int32, - divdamp_type: gtx.int32, - at_first_substep: bool, - end_index_of_damping_layer: gtx.int32, - kstart_moist: gtx.int32, - flat_level_index_plus1: gtx.int32, - start_cell_index_nudging: gtx.int32, - end_cell_index_local: gtx.int32, - start_cell_index_lateral_lvl3: gtx.int32, - end_cell_index_halo_lvl1: gtx.int32, - vertical_start_index_model_top: gtx.int32, - vertical_end_index_model_surface: gtx.int32, -): - _interpolate_contravariant_correction_from_edges_on_model_levels_to_cells_on_half_levels( - contravariant_correction_at_edges_on_model_levels=contravariant_correction_at_edges_on_model_levels, - e_bln_c_s=e_bln_c_s, - wgtfac_c=wgtfac_c, - wgtfacq_c=wgtfacq_c, - nlev=vertical_end_index_model_surface - 1, - out=contravariant_correction_at_cells_on_half_levels, - domain={ - dims.CellDim: ( - start_cell_index_lateral_lvl3, - end_cell_index_halo_lvl1, - ), - dims.KDim: (flat_level_index_plus1, vertical_end_index_model_surface), - }, - ) - _set_surface_boundary_condition_for_computation_of_w( - contravariant_correction_at_cells_on_half_levels=contravariant_correction_at_cells_on_half_levels, - out=( - tridiagonal_alpha_coeff_at_cells_on_half_levels, - next_w, - vertical_mass_flux_at_cells_on_half_levels, - ), - domain={ - dims.CellDim: (start_cell_index_nudging, end_cell_index_local), - dims.KDim: (vertical_end_index_model_surface - 1, vertical_end_index_model_surface), - }, - ) - - _vertically_implicit_solver_at_predictor_step_before_solving_w( - vertical_mass_flux_at_cells_on_half_levels=vertical_mass_flux_at_cells_on_half_levels, - next_w=next_w, - geofac_div=geofac_div, - mass_flux_at_edges_on_model_levels=mass_flux_at_edges_on_model_levels, - theta_v_flux_at_edges_on_model_levels=theta_v_flux_at_edges_on_model_levels, - predictor_vertical_wind_advective_tendency=predictor_vertical_wind_advective_tendency, - pressure_buoyancy_acceleration_at_cells_on_half_levels=pressure_buoyancy_acceleration_at_cells_on_half_levels, - rho_at_cells_on_half_levels=rho_at_cells_on_half_levels, - contravariant_correction_at_cells_on_half_levels=contravariant_correction_at_cells_on_half_levels, - exner_w_explicit_weight_parameter=exner_w_explicit_weight_parameter, - current_exner=current_exner, - current_rho=current_rho, - current_theta_v=current_theta_v, - current_w=current_w, - inv_ddqz_z_full=inv_ddqz_z_full, - exner_w_implicit_weight_parameter=exner_w_implicit_weight_parameter, - theta_v_at_cells_on_half_levels=theta_v_at_cells_on_half_levels, - perturbed_exner_at_cells_on_model_levels=perturbed_exner_at_cells_on_model_levels, - exner_tendency_due_to_slow_physics=exner_tendency_due_to_slow_physics, - rho_iau_increment=rho_iau_increment, - exner_iau_increment=exner_iau_increment, - ddqz_z_half=ddqz_z_half, - iau_wgt_dyn=iau_wgt_dyn, - dtime=dtime, - is_iau_active=is_iau_active, - n_lev=vertical_end_index_model_surface - 1, - out=( - vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels, - next_w, - rho_explicit_term, - exner_explicit_term, - ), - domain={ - dims.CellDim: (start_cell_index_nudging, end_cell_index_local), - dims.KDim: (vertical_start_index_model_top, vertical_end_index_model_surface - 1), - }, - ) - _vertically_implicit_solver_at_predictor_step_after_solving_w( - tridiagonal_beta_coeff_at_cells_on_model_levels=tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=tridiagonal_alpha_coeff_at_cells_on_half_levels, - next_w=next_w, - dwdz_at_cells_on_model_levels=dwdz_at_cells_on_model_levels, - exner_dynamical_increment=exner_dynamical_increment, - rho_at_cells_on_half_levels=rho_at_cells_on_half_levels, - contravariant_correction_at_cells_on_half_levels=contravariant_correction_at_cells_on_half_levels, - current_exner=current_exner, - current_rho=current_rho, - current_theta_v=current_theta_v, - inv_ddqz_z_full=inv_ddqz_z_full, - exner_w_implicit_weight_parameter=exner_w_implicit_weight_parameter, - rayleigh_damping_factor=rayleigh_damping_factor, - reference_exner_at_cells_on_model_levels=reference_exner_at_cells_on_model_levels, - rho_explicit_term=rho_explicit_term, - exner_explicit_term=exner_explicit_term, - dtime=dtime, - rayleigh_type=rayleigh_type, - divdamp_type=divdamp_type, - at_first_substep=at_first_substep, - end_index_of_damping_layer=end_index_of_damping_layer, - kstart_moist=kstart_moist, - out=( - next_w, - next_rho, - next_exner, - next_theta_v, - dwdz_at_cells_on_model_levels, - exner_dynamical_increment, - ), - domain={ - dims.CellDim: (start_cell_index_nudging, end_cell_index_local), - dims.KDim: (vertical_start_index_model_top, vertical_end_index_model_surface - 1), - }, - ) - - @gtx.program def vertically_implicit_solver_at_corrector_step( - vertical_mass_flux_at_cells_on_half_levels: fa.CellKField[ta.wpfloat], - tridiagonal_beta_coeff_at_cells_on_model_levels: fa.CellKField[ta.vpfloat], - tridiagonal_alpha_coeff_at_cells_on_half_levels: fa.CellKField[ta.vpfloat], next_w: fa.CellKField[ta.wpfloat], - rho_explicit_term: fa.CellKField[ta.wpfloat], - exner_explicit_term: fa.CellKField[ta.wpfloat], next_rho: fa.CellKField[ta.wpfloat], next_exner: fa.CellKField[ta.wpfloat], next_theta_v: fa.CellKField[ta.wpfloat], @@ -932,19 +793,17 @@ def vertically_implicit_solver_at_corrector_step( ): _set_surface_boundary_condition_for_computation_of_w( contravariant_correction_at_cells_on_half_levels=contravariant_correction_at_cells_on_half_levels, - out=( - tridiagonal_alpha_coeff_at_cells_on_half_levels, - next_w, - vertical_mass_flux_at_cells_on_half_levels, - ), + out=next_w, domain={ dims.CellDim: (start_cell_index_nudging, end_cell_index_local), dims.KDim: (vertical_end_index_model_surface - 1, vertical_end_index_model_surface), }, ) - _vertically_implicit_solver_at_corrector_step_before_solving_w( - vertical_mass_flux_at_cells_on_half_levels=vertical_mass_flux_at_cells_on_half_levels, + _vertically_implicit_solver_at_corrector_step( next_w=next_w, + dynamical_vertical_mass_flux_at_cells_on_half_levels=dynamical_vertical_mass_flux_at_cells_on_half_levels, + dynamical_vertical_volumetric_flux_at_cells_on_half_levels=dynamical_vertical_volumetric_flux_at_cells_on_half_levels, + exner_dynamical_increment=exner_dynamical_increment, geofac_div=geofac_div, mass_flux_at_edges_on_model_levels=mass_flux_at_edges_on_model_levels, theta_v_flux_at_edges_on_model_levels=theta_v_flux_at_edges_on_model_levels, @@ -966,54 +825,22 @@ def vertically_implicit_solver_at_corrector_step( rho_iau_increment=rho_iau_increment, exner_iau_increment=exner_iau_increment, ddqz_z_half=ddqz_z_half, - advection_explicit_weight_parameter=advection_explicit_weight_parameter, - advection_implicit_weight_parameter=advection_implicit_weight_parameter, - iau_wgt_dyn=iau_wgt_dyn, - dtime=dtime, - is_iau_active=is_iau_active, - n_lev=vertical_end_index_model_surface - 1, - out=( - vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels, - next_w, - rho_explicit_term, - exner_explicit_term, - ), - domain={ - dims.CellDim: (start_cell_index_nudging, end_cell_index_local), - dims.KDim: (vertical_start_index_model_top, vertical_end_index_model_surface - 1), - }, - ) - - _vertically_implicit_solver_at_corrector_step_after_solving_w( - vertical_mass_flux_at_cells_on_half_levels=vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels=tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=tridiagonal_alpha_coeff_at_cells_on_half_levels, - next_w=next_w, - dynamical_vertical_mass_flux_at_cells_on_half_levels=dynamical_vertical_mass_flux_at_cells_on_half_levels, - dynamical_vertical_volumetric_flux_at_cells_on_half_levels=dynamical_vertical_volumetric_flux_at_cells_on_half_levels, - exner_dynamical_increment=exner_dynamical_increment, - rho_at_cells_on_half_levels=rho_at_cells_on_half_levels, - current_exner=current_exner, - current_rho=current_rho, - current_theta_v=current_theta_v, - inv_ddqz_z_full=inv_ddqz_z_full, - exner_w_implicit_weight_parameter=exner_w_implicit_weight_parameter, - exner_tendency_due_to_slow_physics=exner_tendency_due_to_slow_physics, rayleigh_damping_factor=rayleigh_damping_factor, reference_exner_at_cells_on_model_levels=reference_exner_at_cells_on_model_levels, - rho_explicit_term=rho_explicit_term, - exner_explicit_term=exner_explicit_term, + advection_explicit_weight_parameter=advection_explicit_weight_parameter, + advection_implicit_weight_parameter=advection_implicit_weight_parameter, lprep_adv=lprep_adv, r_nsubsteps=r_nsubsteps, ndyn_substeps_var=ndyn_substeps_var, + iau_wgt_dyn=iau_wgt_dyn, dtime=dtime, + is_iau_active=is_iau_active, rayleigh_type=rayleigh_type, - end_index_of_damping_layer=end_index_of_damping_layer, - kstart_moist=kstart_moist, at_first_substep=at_first_substep, at_last_substep=at_last_substep, + end_index_of_damping_layer=end_index_of_damping_layer, + kstart_moist=kstart_moist, + n_lev=vertical_end_index_model_surface - 1, out=( next_w, next_rho, diff --git a/model/atmosphere/dycore/tests/dycore/integration_tests/test_solve_nonhydro.py b/model/atmosphere/dycore/tests/dycore/integration_tests/test_solve_nonhydro.py index 61d538a893..de864464f7 100644 --- a/model/atmosphere/dycore/tests/dycore/integration_tests/test_solve_nonhydro.py +++ b/model/atmosphere/dycore/tests/dycore/integration_tests/test_solve_nonhydro.py @@ -237,7 +237,6 @@ def test_nonhydro_predictor_step( cell_start_lateral_boundary_level_2 = icon_grid.start_index( cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_3) ) - cell_start_nudging = icon_grid.start_index(cell_domain(h_grid.Zone.NUDGING)) edge_start_lateral_boundary_level_5 = icon_grid.start_index( edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5) @@ -450,45 +449,6 @@ def test_nonhydro_predictor_step( atol=1e-15, ) - # stencils 43, 46, 47 - assert test_utils.dallclose( - solve_nonhydro.intermediate_fields.vertical_mass_flux_at_cells_on_half_levels.asnumpy()[ - cell_start_nudging:, : - ], - sp_exit.z_contr_w_fl_l().asnumpy()[cell_start_nudging:, :], - atol=2e-15, - ) - - # stencil 44, 45 - assert test_utils.dallclose( - solve_nonhydro.intermediate_fields.tridiagonal_alpha_coeff_at_cells_on_half_levels.asnumpy()[ - cell_start_nudging:, : - ], - sp_exit.z_alpha().asnumpy()[cell_start_nudging:, :], - atol=5e-13, - ) - # stencil 44 - assert test_utils.dallclose( - solve_nonhydro.intermediate_fields.tridiagonal_beta_coeff_at_cells_on_model_levels.asnumpy()[ - cell_start_nudging:, : - ], - sp_exit.z_beta().asnumpy()[cell_start_nudging:, :], - atol=2e-15, - ) - - # stencil 48, 49 - assert test_utils.dallclose( - solve_nonhydro.intermediate_fields.rho_explicit_term.asnumpy()[cell_start_nudging:, :], - sp_exit.z_rho_expl().asnumpy()[cell_start_nudging:, :], - atol=2e-15, - ) - # stencil 48, 49 - assert test_utils.dallclose( - solve_nonhydro.intermediate_fields.exner_explicit_term.asnumpy()[cell_start_nudging:, :], - sp_exit.z_exner_expl().asnumpy()[cell_start_nudging:, :], - atol=2e-15, - ) - # end assert test_utils.dallclose(prognostic_state_nnew.rho.asnumpy(), sp_exit.rho_new().asnumpy()) assert test_utils.dallclose( @@ -574,14 +534,9 @@ def test_nonhydro_corrector_step( z_fields = solve_nh.IntermediateFields( horizontal_pressure_gradient=init_savepoint.z_gradh_exner(), - tridiagonal_alpha_coeff_at_cells_on_half_levels=init_savepoint.z_alpha(), - tridiagonal_beta_coeff_at_cells_on_model_levels=init_savepoint.z_beta(), - exner_explicit_term=init_savepoint.z_exner_expl(), - vertical_mass_flux_at_cells_on_half_levels=init_savepoint.z_contr_w_fl_l(), rho_at_edges_on_model_levels=init_savepoint.z_rho_e(), theta_v_at_edges_on_model_levels=init_savepoint.z_theta_v_e(), horizontal_gradient_of_normal_wind_divergence=init_savepoint.z_graddiv_vn(), - rho_explicit_term=init_savepoint.z_rho_expl(), dwdz_at_cells_on_model_levels=init_savepoint.z_dwdz_dd(), horizontal_kinetic_energy_at_edges_on_model_levels=init_savepoint.z_kin_hor_e(), tangential_wind_on_half_levels=init_savepoint.z_vt_ie(), @@ -2114,19 +2069,14 @@ def test_vertically_implicit_solver_at_predictor_step( theta_v_flux_at_edges_on_model_levels = sp_stencil_init.z_theta_v_fl_e() predictor_vertical_wind_advective_tendency = sp_stencil_init.ddt_w_adv_pc(0) pressure_buoyancy_acceleration_at_cells_on_half_levels = sp_stencil_init.z_th_ddz_exner_c() - vertical_mass_flux_at_cells_on_half_levels = sp_stencil_init.z_contr_w_fl_l() rho_at_cells_on_half_levels = sp_stencil_init.rho_ic() contravariant_correction_at_cells_on_half_levels = savepoint_nonhydro_init.w_concorr_c() current_exner = sp_stencil_init.exner_nnow() current_rho = sp_stencil_init.rho_nnow() current_theta_v = sp_stencil_init.theta_v_nnow() current_w = sp_stencil_init.w() - tridiagonal_alpha_coeff_at_cells_on_half_levels = sp_stencil_init.z_alpha() - tridiagonal_beta_coeff_at_cells_on_model_levels = sp_stencil_init.z_beta() theta_v_at_cells_on_half_levels = sp_stencil_init.theta_v_ic() next_w = sp_stencil_init.w() - rho_explicit_term = sp_stencil_init.z_rho_expl() - exner_explicit_term = sp_stencil_init.z_exner_expl() perturbed_exner_at_cells_on_model_levels = sp_stencil_init.exner_pr() exner_tendency_due_to_slow_physics = sp_stencil_init.ddt_exner_phy() rho_iau_increment = sp_stencil_init.rho_incr() @@ -2143,12 +2093,7 @@ def test_vertically_implicit_solver_at_predictor_step( divdamp_type = config.divdamp_type w_concorr_c_ref = sp_nh_exit.w_concorr_c() - z_contr_w_fl_l_ref = sp_nh_exit.z_contr_w_fl_l() - z_beta_ref = sp_nh_exit.z_beta() - z_alpha_ref = sp_nh_exit.z_alpha() w_ref = sp_nh_exit.w_new() - z_rho_expl_ref = sp_nh_exit.z_rho_expl() - z_exner_expl_ref = sp_nh_exit.z_exner_expl() rho_ref = sp_nh_exit.rho_new() exner_ref = sp_nh_exit.exner_new() theta_v_ref = sp_nh_exit.theta_v_new() @@ -2174,12 +2119,7 @@ def test_vertically_implicit_solver_at_predictor_step( backend )( contravariant_correction_at_cells_on_half_levels=contravariant_correction_at_cells_on_half_levels, - vertical_mass_flux_at_cells_on_half_levels=vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels=tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=tridiagonal_alpha_coeff_at_cells_on_half_levels, next_w=next_w, - rho_explicit_term=rho_explicit_term, - exner_explicit_term=exner_explicit_term, next_rho=next_rho, next_exner=next_exner, next_theta_v=next_theta_v, @@ -2233,27 +2173,12 @@ def test_vertically_implicit_solver_at_predictor_step( w_concorr_c_ref.asnumpy(), atol=1e-15, ) - assert test_utils.dallclose( - vertical_mass_flux_at_cells_on_half_levels.asnumpy(), - z_contr_w_fl_l_ref.asnumpy(), - atol=1e-12, - ) - assert test_utils.dallclose( - tridiagonal_beta_coeff_at_cells_on_model_levels.asnumpy(), z_beta_ref.asnumpy() - ) - assert test_utils.dallclose( - tridiagonal_alpha_coeff_at_cells_on_half_levels.asnumpy(), z_alpha_ref.asnumpy() - ) assert test_utils.dallclose( next_w.asnumpy()[start_cell_nudging:, :], w_ref.asnumpy()[start_cell_nudging:, :], rtol=1e-7, atol=1e-12, ) - assert test_utils.dallclose(rho_explicit_term.asnumpy(), z_rho_expl_ref.asnumpy()) - assert test_utils.dallclose( - exner_explicit_term.asnumpy(), z_exner_expl_ref.asnumpy(), rtol=1.0e-10, atol=1.0e-12 - ) assert test_utils.dallclose( next_rho.asnumpy()[start_cell_nudging:, :], rho_ref.asnumpy()[start_cell_nudging:, :] ) @@ -2348,19 +2273,14 @@ def test_vertically_implicit_solver_at_corrector_step( predictor_vertical_wind_advective_tendency = sp_stencil_init.ddt_w_adv_pc(0) corrector_vertical_wind_advective_tendency = sp_stencil_init.ddt_w_adv_pc(1) pressure_buoyancy_acceleration_at_cells_on_half_levels = sp_stencil_init.z_th_ddz_exner_c() - vertical_mass_flux_at_cells_on_half_levels = sp_stencil_init.z_contr_w_fl_l() rho_at_cells_on_half_levels = sp_stencil_init.rho_ic() contravariant_correction_at_cells_on_half_levels = sp_stencil_init.w_concorr_c() current_exner = sp_stencil_init.exner_nnow() current_rho = sp_stencil_init.rho_nnow() current_theta_v = sp_stencil_init.theta_v_nnow() current_w = sp_stencil_init.w() - tridiagonal_alpha_coeff_at_cells_on_half_levels = sp_stencil_init.z_alpha() - tridiagonal_beta_coeff_at_cells_on_model_levels = sp_stencil_init.z_beta() theta_v_at_cells_on_half_levels = sp_stencil_init.theta_v_ic() next_w = sp_stencil_init.w() - rho_explicit_term = sp_stencil_init.z_rho_expl() - exner_explicit_term = sp_stencil_init.z_exner_expl() perturbed_exner_at_cells_on_model_levels = sp_stencil_init.exner_pr() exner_tendency_due_to_slow_physics = sp_stencil_init.ddt_exner_phy() rho_iau_increment = sp_stencil_init.rho_incr() @@ -2380,12 +2300,7 @@ def test_vertically_implicit_solver_at_corrector_step( iau_wgt_dyn = config.iau_wgt_dyn is_iau_active = config.is_iau_active - z_contr_w_fl_l_ref = sp_nh_exit.z_contr_w_fl_l() - z_beta_ref = sp_nh_exit.z_beta() - z_alpha_ref = sp_nh_exit.z_alpha() w_ref = sp_nh_exit.w_new() - z_rho_expl_ref = sp_nh_exit.z_rho_expl() - z_exner_expl_ref = sp_nh_exit.z_exner_expl() rho_ref = sp_nh_exit.rho_new() exner_ref = sp_nh_exit.exner_new() theta_v_ref = sp_nh_exit.theta_v_new() @@ -2407,12 +2322,7 @@ def test_vertically_implicit_solver_at_corrector_step( vertically_implicit_dycore_solver.vertically_implicit_solver_at_corrector_step.with_backend( backend )( - vertical_mass_flux_at_cells_on_half_levels=vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels=tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=tridiagonal_alpha_coeff_at_cells_on_half_levels, next_w=next_w, - rho_explicit_term=rho_explicit_term, - exner_explicit_term=exner_explicit_term, next_rho=next_rho, next_exner=next_exner, next_theta_v=next_theta_v, @@ -2462,29 +2372,12 @@ def test_vertically_implicit_solver_at_corrector_step( offset_provider=offset_provider, ) - assert test_utils.dallclose( - vertical_mass_flux_at_cells_on_half_levels.asnumpy(), - z_contr_w_fl_l_ref.asnumpy(), - atol=1e-12, - ) - assert test_utils.dallclose( - tridiagonal_beta_coeff_at_cells_on_model_levels.asnumpy(), z_beta_ref.asnumpy() - ) - assert test_utils.dallclose( - tridiagonal_alpha_coeff_at_cells_on_half_levels.asnumpy(), z_alpha_ref.asnumpy() - ) assert test_utils.dallclose( next_w.asnumpy()[start_cell_nudging:, :], w_ref.asnumpy()[start_cell_nudging:, :], rtol=1e-10, atol=1e-12, ) - assert test_utils.dallclose(rho_explicit_term.asnumpy(), z_rho_expl_ref.asnumpy()) - assert test_utils.dallclose( - exner_explicit_term.asnumpy(), - z_exner_expl_ref.asnumpy(), - rtol=3e-9, - ) assert test_utils.dallclose( next_rho.asnumpy()[start_cell_nudging:, :], rho_ref.asnumpy()[start_cell_nudging:, :] ) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py index a72986b164..076e84b767 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py @@ -27,10 +27,11 @@ def solve_tridiagonal_matrix_for_w_back_substitution_numpy( z_q: np.ndarray, w: np.ndarray, ) -> np.ndarray: - w_new = np.zeros_like(w) + rng = np.random.default_rng() + w_new = rng.random(w.shape, dtype=w.dtype) last_k_level = w.shape[1] - 1 - w_new[:, last_k_level] = w[:, last_k_level] + z_q[:, last_k_level] + w_new[:, last_k_level] = w[:, last_k_level] for k in reversed(range(1, last_k_level)): w_new[:, k] = w[:, k] + w_new[:, k + 1] * z_q[:, k] w_new[:, 0] = w[:, 0] diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py index d0759c37a6..7bd38f9619 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py @@ -106,7 +106,11 @@ def input_data(self, grid: base_grid.Grid) -> dict[str, gtx.Field | state_utils. grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=ta.wpfloat ) z_q = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) + # z_q first level should always be initialized to zero when solve_tridiagonal_matrix_for_w_forward_sweep is called + z_q.asnumpy()[:, 0] = 0.0 w = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) + # w first level should always be initialized to zero when solve_tridiagonal_matrix_for_w_forward_sweep is called + w.asnumpy()[:, 0] = 0.0 h_start = 0 h_end = gtx.int32(grid.num_cells) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index abb6dce355..c43c2de7be 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -54,12 +54,7 @@ class TestVerticallyImplicitSolverAtCorrectorStep(stencil_tests.StencilTest): PROGRAM = vertically_implicit_solver_at_corrector_step OUTPUTS = ( - "vertical_mass_flux_at_cells_on_half_levels", - "tridiagonal_beta_coeff_at_cells_on_model_levels", - "tridiagonal_alpha_coeff_at_cells_on_half_levels", "next_w", - "rho_explicit_term", - "exner_explicit_term", "next_rho", "next_exner", "next_theta_v", @@ -71,12 +66,7 @@ class TestVerticallyImplicitSolverAtCorrectorStep(stencil_tests.StencilTest): @staticmethod def reference( connectivities: dict[gtx.Dimension, np.ndarray], - vertical_mass_flux_at_cells_on_half_levels: np.ndarray, - tridiagonal_beta_coeff_at_cells_on_model_levels: np.ndarray, - tridiagonal_alpha_coeff_at_cells_on_half_levels: np.ndarray, next_w: np.ndarray, - rho_explicit_term: np.ndarray, - exner_explicit_term: np.ndarray, next_rho: np.ndarray, next_exner: np.ndarray, next_theta_v: np.ndarray, @@ -128,6 +118,17 @@ def reference( horz_idx = horz_idx[:, np.newaxis] vert_idx = np.arange(exner_dynamical_increment.shape[1]) + rng = np.random.default_rng() + vertical_mass_flux_at_cells_on_half_levels = rng.random((horizontal_end, vert_idx.size + 1)) + tridiagonal_beta_coeff_at_cells_on_model_levels = rng.random( + (horizontal_end, vert_idx.size) + ) + tridiagonal_alpha_coeff_at_cells_on_half_levels = rng.random( + (horizontal_end, vert_idx.size + 1) + ) + rho_explicit_term = rng.random(next_rho.shape) + exner_explicit_term = rng.random(next_exner.shape) + divergence_of_mass = np.zeros_like(current_rho) divergence_of_theta_v = np.zeros_like(current_theta_v) divergence_of_mass, divergence_of_theta_v = np.where( @@ -360,12 +361,7 @@ def reference( ) return dict( - vertical_mass_flux_at_cells_on_half_levels=vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels=tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=tridiagonal_alpha_coeff_at_cells_on_half_levels, next_w=next_w, - rho_explicit_term=rho_explicit_term, - exner_explicit_term=exner_explicit_term, next_rho=next_rho, next_exner=next_exner, next_theta_v=next_theta_v, @@ -418,18 +414,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala grid, dims.CellDim, dims.KDim, low=1.0e-5 ) - vertical_mass_flux_at_cells_on_half_levels = data_alloc.zero_field( - grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1} - ) - tridiagonal_beta_coeff_at_cells_on_model_levels = data_alloc.zero_field( - grid, dims.CellDim, dims.KDim - ) - tridiagonal_alpha_coeff_at_cells_on_half_levels = data_alloc.zero_field( - grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1} - ) next_w = data_alloc.zero_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) - rho_explicit_term = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) - exner_explicit_term = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) next_rho = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) next_exner = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) next_theta_v = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) @@ -461,12 +446,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala end_cell_local = grid.end_index(cell_domain(h_grid.Zone.LOCAL)) return dict( - vertical_mass_flux_at_cells_on_half_levels=vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels=tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=tridiagonal_alpha_coeff_at_cells_on_half_levels, next_w=next_w, - rho_explicit_term=rho_explicit_term, - exner_explicit_term=exner_explicit_term, next_rho=next_rho, next_exner=next_exner, next_theta_v=next_theta_v, diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 9e18d03cef..b4866a0f75 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -57,12 +57,7 @@ class TestVerticallyImplicitSolverAtPredictorStep(stencil_tests.StencilTest): PROGRAM = vertically_implicit_solver_at_predictor_step OUTPUTS = ( - "vertical_mass_flux_at_cells_on_half_levels", - "tridiagonal_beta_coeff_at_cells_on_model_levels", - "tridiagonal_alpha_coeff_at_cells_on_half_levels", "next_w", - "rho_explicit_term", - "exner_explicit_term", "next_rho", "next_exner", "next_theta_v", @@ -74,12 +69,7 @@ class TestVerticallyImplicitSolverAtPredictorStep(stencil_tests.StencilTest): def reference( connectivities: dict[gtx.Dimension, np.ndarray], contravariant_correction_at_cells_on_half_levels: np.ndarray, - vertical_mass_flux_at_cells_on_half_levels: np.ndarray, - tridiagonal_beta_coeff_at_cells_on_model_levels: np.ndarray, - tridiagonal_alpha_coeff_at_cells_on_half_levels: np.ndarray, next_w: np.ndarray, - rho_explicit_term: np.ndarray, - exner_explicit_term: np.ndarray, next_rho: np.ndarray, next_exner: np.ndarray, next_theta_v: np.ndarray, @@ -130,6 +120,19 @@ def reference( horz_idx = horz_idx[:, np.newaxis] vert_idx = np.arange(exner_dynamical_increment.shape[1]) + rng = np.random.default_rng() + vertical_mass_flux_at_cells_on_half_levels = rng.random( + (end_cell_index_local, vert_idx.size + 1) + ) + tridiagonal_beta_coeff_at_cells_on_model_levels = rng.random( + (end_cell_index_local, vert_idx.size) + ) + tridiagonal_alpha_coeff_at_cells_on_half_levels = rng.random( + (end_cell_index_local, vert_idx.size + 1) + ) + rho_explicit_term = rng.random(next_rho.shape) + exner_explicit_term = rng.random(next_exner.shape) + contravariant_correction_at_cells_on_half_levels[:, :-1] = np.where( (start_cell_index_lateral_lvl3 <= horz_idx) & (horz_idx < end_cell_index_halo_lvl1) @@ -355,12 +358,7 @@ def reference( ) return dict( - vertical_mass_flux_at_cells_on_half_levels=vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels=tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=tridiagonal_alpha_coeff_at_cells_on_half_levels, next_w=next_w, - rho_explicit_term=rho_explicit_term, - exner_explicit_term=exner_explicit_term, next_rho=next_rho, next_exner=next_exner, next_theta_v=next_theta_v, @@ -381,9 +379,6 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala pressure_buoyancy_acceleration_at_cells_on_half_levels = data_alloc.random_field( grid, dims.CellDim, dims.KDim ) - vertical_mass_flux_at_cells_on_half_levels = data_alloc.random_field( - grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1} - ) rho_at_cells_on_half_levels = data_alloc.random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, low=1.0e-5 ) @@ -420,15 +415,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala wgtfac_c = data_alloc.random_field(grid, dims.CellDim, dims.KDim, low=1.0e-5, high=0.99999) wgtfacq_c = data_alloc.random_field(grid, dims.CellDim, dims.KDim, low=1.0e-5, high=0.99999) - tridiagonal_beta_coeff_at_cells_on_model_levels = data_alloc.zero_field( - grid, dims.CellDim, dims.KDim - ) - tridiagonal_alpha_coeff_at_cells_on_half_levels = data_alloc.zero_field( - grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1} - ) next_w = data_alloc.zero_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) - rho_explicit_term = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) - exner_explicit_term = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) next_rho = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) next_exner = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) next_theta_v = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) @@ -455,12 +442,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala return dict( contravariant_correction_at_cells_on_half_levels=contravariant_correction_at_cells_on_half_levels, - vertical_mass_flux_at_cells_on_half_levels=vertical_mass_flux_at_cells_on_half_levels, - tridiagonal_beta_coeff_at_cells_on_model_levels=tridiagonal_beta_coeff_at_cells_on_model_levels, - tridiagonal_alpha_coeff_at_cells_on_half_levels=tridiagonal_alpha_coeff_at_cells_on_half_levels, next_w=next_w, - rho_explicit_term=rho_explicit_term, - exner_explicit_term=exner_explicit_term, next_rho=next_rho, next_exner=next_exner, next_theta_v=next_theta_v, From 937128bb76fd27f119e5eaffedfefd38816aac95 Mon Sep 17 00:00:00 2001 From: edopao Date: Mon, 15 Sep 2025 11:17:39 +0200 Subject: [PATCH 019/111] Fix memory allocator for zero fields in velocity advection tests (#874) Fix an issue in velocity advection tests, that caused the dace programs to fail: a cupy array was expected as argument, a numpy array was passed. --- .../dycore/integration_tests/test_velocity_advection.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/integration_tests/test_velocity_advection.py b/model/atmosphere/dycore/tests/dycore/integration_tests/test_velocity_advection.py index 693a31ed19..1d928e9cbc 100644 --- a/model/atmosphere/dycore/tests/dycore/integration_tests/test_velocity_advection.py +++ b/model/atmosphere/dycore/tests/dycore/integration_tests/test_velocity_advection.py @@ -628,7 +628,9 @@ def test_compute_contravariant_correction_and_advection_in_vertical_momentum_equ horizontal_advection_of_w_at_edges_on_half_levels = savepoint_velocity_exit.z_v_grad_w() vertical_wind_advective_tendency = savepoint_velocity_init.ddt_w_adv_pc(istep_init - 1) contravariant_corrected_w_at_cells_on_model_levels = savepoint_velocity_init.z_w_con_c_full() - vertical_cfl = data_alloc.zero_field(icon_grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) + vertical_cfl = data_alloc.zero_field( + icon_grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat, backend=backend + ) skip_compute_predictor_vertical_advection = savepoint_velocity_init.lvn_only() coeff1_dwdz = metrics_savepoint.coeff1_dwdz() @@ -780,7 +782,9 @@ def test_compute_advection_in_vertical_momentum_equation( vn_on_half_levels = savepoint_velocity_exit.vn_ie() vertical_wind_advective_tendency = savepoint_velocity_init.ddt_w_adv_pc(istep_init - 1) contravariant_corrected_w_at_cells_on_model_levels = savepoint_velocity_init.z_w_con_c_full() - vertical_cfl = data_alloc.zero_field(icon_grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) + vertical_cfl = data_alloc.zero_field( + icon_grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat, backend=backend + ) coeff1_dwdz = metrics_savepoint.coeff1_dwdz() coeff2_dwdz = metrics_savepoint.coeff2_dwdz() From c1bfd1c3fe076c628515e53a70d5a952430fbd0c Mon Sep 17 00:00:00 2001 From: edopao Date: Mon, 15 Sep 2025 20:35:33 +0200 Subject: [PATCH 020/111] Add dace backend to default CI pipeline (#822) This PR enables CI tests on the dace backend. - In the Github Actions, we run the stencil tests on the CPU backend. - In the CSCS CI, we run the tests with serialized data on the GPU backend, only for diffusion and dycore in order to save compute resources. --- .github/workflows/icon4py-test-model.yml | 2 +- ci/dace.yml | 12 ++++-------- ci/default.yml | 10 ++++++++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/icon4py-test-model.yml b/.github/workflows/icon4py-test-model.yml index c4abf820cc..8bd9696242 100644 --- a/.github/workflows/icon4py-test-model.yml +++ b/.github/workflows/icon4py-test-model.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: python-version: ["3.10", "3.11"] - backend: ["embedded", "gtfn_cpu"] # TODO(): add dace-cpu? + backend: ["embedded", "dace_cpu", "gtfn_cpu"] component: ["advection", "diffusion", "dycore", "microphysics", "muphys", "driver", "common"] steps: - name: Checkout diff --git a/ci/dace.yml b/ci/dace.yml index 27db0f0679..052f2b4ef0 100644 --- a/ci/dace.yml +++ b/ci/dace.yml @@ -3,8 +3,6 @@ include: .test_model_stencils: stage: test - variables: - SLURM_TIMELIMIT: '00:10:00' script: - nox -s "test_model-3.10(stencils, $COMPONENT)" -- --backend=$BACKEND --grid=$GRID rules: @@ -12,6 +10,8 @@ include: variables: SLURM_TIMELIMIT: '00:30:00' - when: on_success + variables: + SLURM_TIMELIMIT: '00:15:00' parallel: matrix: - COMPONENT: [advection, diffusion, dycore, microphysics, common, driver] @@ -25,14 +25,10 @@ test_model_stencils_aarch64: .test_model_datatests: stage: test variables: - SLURM_TIMELIMIT: '00:30:00' + NUM_PROCESSES: 8 + SLURM_TIMELIMIT: '00:45:00' script: - nox -s "test_model-3.10(datatest, $COMPONENT)" -- --backend=$BACKEND --level=$LEVEL - rules: - - if: $COMPONENT == 'common' && $BACKEND == 'dace_gpu' && $LEVEL == 'integration' - variables: - SLURM_TIMELIMIT: '01:30:00' - - when: on_success parallel: matrix: - COMPONENT: [advection, diffusion, dycore, microphysics, common, driver] diff --git a/ci/default.yml b/ci/default.yml index 9d40e07ffc..5fe2b10db8 100644 --- a/ci/default.yml +++ b/ci/default.yml @@ -37,10 +37,16 @@ test_tools_datatests_aarch64: script: - nox -s "test_model-3.10(datatest, $COMPONENT)" -- --backend=$BACKEND --level=$LEVEL rules: + - if: $BACKEND == 'dace_gpu' && $COMPONENT != 'diffusion' && $COMPONENT != 'dycore' + when: never # run only in daily CI, to save compute resources - if: $COMPONENT == 'common' && $LEVEL == 'integration' variables: - NUM_PROCESSES: 2 + NUM_PROCESSES: 1 SLURM_TIMELIMIT: '00:30:00' + - if: $BACKEND == 'dace_gpu' + variables: + NUM_PROCESSES: 8 + SLURM_TIMELIMIT: '00:45:00' - if: $BACKEND == 'embedded' variables: SLURM_TIMELIMIT: '00:15:00' @@ -50,7 +56,7 @@ test_tools_datatests_aarch64: parallel: matrix: - COMPONENT: [advection, diffusion, dycore, microphysics, common, driver] - BACKEND: [embedded, gtfn_cpu, gtfn_gpu] + BACKEND: [embedded, dace_gpu, gtfn_cpu, gtfn_gpu] LEVEL: [integration] # test_model_datatests_x86_64: # extends: [.test_model_datatests, .test_template_x86_64] From bddb09df01f268420aee3f9b53f25919a9f86203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Thu, 18 Sep 2025 16:12:03 +0200 Subject: [PATCH 021/111] add benchmarking for 'vertically_implicit_solver...' program --- ...mplicit_dycore_solver_at_predictor_step.py | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index b4866a0f75..6556796e06 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -53,6 +53,7 @@ ) +@pytest.mark.continuous_benchmarking @pytest.mark.uses_concat_where class TestVerticallyImplicitSolverAtPredictorStep(stencil_tests.StencilTest): PROGRAM = vertically_implicit_solver_at_predictor_step @@ -64,6 +65,33 @@ class TestVerticallyImplicitSolverAtPredictorStep(stencil_tests.StencilTest): "dwdz_at_cells_on_model_levels", "exner_dynamical_increment", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: (), + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "start_cell_index_nudging", + "end_cell_index_local", + "start_cell_index_lateral_lvl3", + "end_cell_index_halo_lvl1", + "end_index_of_damping_layer", + "kstart_moist", + "flat_level_index_plus1", + "vertical_start_index_model_top", + "vertical_end_index_model_surface", + "divdamp_type", + "rayleigh_type", + "is_iau_active", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "end_index_of_damping_layer", + "kstart_moist", + "flat_level_index_plus1", + "vertical_start_index_model_top", + "vertical_end_index_model_surface", + "divdamp_type", + "rayleigh_type", + "is_iau_active", + ), + } @staticmethod def reference( @@ -366,8 +394,10 @@ def reference( exner_dynamical_increment=exner_dynamical_increment, ) - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + @pytest.fixture(params=[{"at_first_substep": value} for value in [True, False]]) + def input_data( + self, request: pytest.FixtureRequest, grid: base.Grid + ) -> dict[str, gtx.Field | state_utils.ScalarType]: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) mass_flux_at_edges_on_model_levels = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) theta_v_flux_at_edges_on_model_levels = data_alloc.random_field( @@ -423,7 +453,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala exner_dynamical_increment = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) is_iau_active = True - at_first_substep = True + at_first_substep = request.param["at_first_substep"] rayleigh_type = 2 divdamp_type = 3 end_index_of_damping_layer = 3 From 48c9b08cadad54d9292bc6eac3fa6d0b0c99a924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 19 Sep 2025 10:36:02 +0200 Subject: [PATCH 022/111] avoid dace backend corner cases in stencil tests --- ...ived_horizontal_winds_and_ke_and_contravariant_correction.py | 2 +- .../test_compute_perturbed_quantities_and_interpolation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 22d70561c0..31575df11c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -311,7 +311,7 @@ def input_data( c_intp = data_alloc.random_field(grid, dims.VertexDim, dims.V2CDim) nlev = grid.num_levels - nflatlev = 13 + nflatlev = (grid.num_levels * 3) // 10 edge_domain = h_grid.domain(dims.EdgeDim) # For the ICON grid we use the proper domain bounds (otherwise we will run into non-protected skip values) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index 02a12daba5..301c2fa0b4 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -432,7 +432,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala end_cell_halo_level_2 = grid.end_index(cell_domain(h_grid.Zone.HALO_LEVEL_2)) nflatlev = 4 - nflat_gradp = 27 + nflat_gradp = grid.num_levels // 2 return dict( temporal_extrapolation_of_perturbed_exner=temporal_extrapolation_of_perturbed_exner, From 70e1720507bdc5deece2fa0813841fb0042b9a75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 19 Sep 2025 10:49:30 +0200 Subject: [PATCH 023/111] add benchmarking for 'interpolate_rho_theta...' program --- ...ls_and_compute_temperature_vertical_gradient.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py index b3fb185c76..e9ab186490 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py @@ -34,6 +34,7 @@ from icon4py.model.testing import stencil_tests +@pytest.mark.continuous_benchmarking class TestInterpolateRhoThetaVToHalfLevelsAndComputePressureBuoyancyAcceleration( stencil_tests.StencilTest ): @@ -44,6 +45,19 @@ class TestInterpolateRhoThetaVToHalfLevelsAndComputePressureBuoyancyAcceleration "theta_v_at_cells_on_half_levels", "pressure_buoyancy_acceleration_at_cells_on_half_levels", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: (), + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( From 1479e80a4e9585439ab2649b2f39c3a00c8496bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 19 Sep 2025 10:50:44 +0200 Subject: [PATCH 024/111] fix typing for static variants in stencil tests --- .../tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py | 2 +- ...sion_to_w_and_compute_horizontal_gradients_for_turbulence.py | 2 +- .../test_calculate_nabla2_and_smag_coefficients_for_vn.py | 2 +- .../tests/diffusion/stencil_tests/test_calculate_nabla4.py | 2 +- .../stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index 2ca65484e3..debdae974f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -31,7 +31,7 @@ class TestApplyDiffusionToVn(StencilTest): PROGRAM = apply_diffusion_to_vn OUTPUTS = ("vn",) STATIC_PARAMS = { - StandardStaticVariants.NONE: None, + StandardStaticVariants.NONE: (), StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index c15179a95b..bdf70f59bd 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -33,7 +33,7 @@ class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence(StencilTes PROGRAM = apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence OUTPUTS = ("w", "dwdx", "dwdy") STATIC_PARAMS = { - StandardStaticVariants.NONE: None, + StandardStaticVariants.NONE: (), StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index c6652317b3..b17c7f578e 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -23,7 +23,7 @@ class TestCalculateNabla2AndSmagCoefficientsForVn(stencil_tests.StencilTest): PROGRAM = calculate_nabla2_and_smag_coefficients_for_vn OUTPUTS = ("kh_smag_e", "kh_smag_ec", "z_nabla2_e") STATIC_PARAMS = { - stencil_tests.StandardStaticVariants.NONE: None, + stencil_tests.StandardStaticVariants.NONE: (), stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py index 305cf3f319..dc8f9ac4ba 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py @@ -60,7 +60,7 @@ class TestCalculateNabla4(StencilTest): PROGRAM = calculate_nabla4 OUTPUTS = ("z_nabla4_e2",) STATIC_PARAMS = { - StandardStaticVariants.NONE: None, + StandardStaticVariants.NONE: (), StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", diff --git a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py index d551fc265e..2137f5e587 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py @@ -26,7 +26,7 @@ class TestMoIntpRbfRbfVecInterpolVertex(StencilTest): PROGRAM = mo_intp_rbf_rbf_vec_interpol_vertex OUTPUTS = ("p_u_out", "p_v_out") STATIC_PARAMS = { - StandardStaticVariants.NONE: None, + StandardStaticVariants.NONE: (), StandardStaticVariants.COMPILE_TIME_DOMAIN: ( "horizontal_start", "horizontal_end", From cf730e8184815261ed6525cd330d930021b67148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 19 Sep 2025 11:08:42 +0200 Subject: [PATCH 025/111] add benchmarking for 'apply_divergence_damping...' program --- ..._apply_divergence_damping_and_update_vn.py | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index d49922254d..65e4910078 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -6,6 +6,8 @@ # Please, refer to the LICENSE file in the root directory. # SPDX-License-Identifier: BSD-3-Clause +import itertools + import gt4py.next as gtx import numpy as np import pytest @@ -24,10 +26,28 @@ divergence_damp_order = DivergenceDampingOrder() +@pytest.mark.continuous_benchmarking @pytest.mark.embedded_remap_error class TestApplyDivergenceDampingAndUpdateVn(test_helpers.StencilTest): PROGRAM = apply_divergence_damping_and_update_vn OUTPUTS = ("next_vn",) + STATIC_PARAMS = { + test_helpers.StandardStaticVariants.NONE: (), + test_helpers.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + "is_iau_active", + "limited_area", + ), + test_helpers.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + "is_iau_active", + "limited_area", + ), + } @staticmethod def reference( @@ -153,7 +173,20 @@ def reference( return dict(next_vn=next_vn) - @pytest.fixture(params=[True, False]) + @pytest.fixture( + params=[ + {"limited_area": la, "divdamp_order": do, "is_iau_active": ia} + for la, do, ia in itertools.product( + [True, False], + [ + DivergenceDampingOrder.SECOND_ORDER, + DivergenceDampingOrder.FOURTH_ORDER, + DivergenceDampingOrder.COMBINED, + ], + [True, False], + ) + ], + ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) horizontal_mask_for_3d_divdamp = data_alloc.random_field(grid, dims.EdgeDim) @@ -190,7 +223,7 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: is_iau_active = True fourth_order_divdamp_factor = 0.004 second_order_divdamp_factor = 0.012 - divdamp_order = 24 + divdamp_order = request.param["divdamp_order"] second_order_divdamp_scaling_coeff = 194588.14247428576 apply_2nd_order_divergence_damping = (divdamp_order == divergence_damp_order.COMBINED) and ( second_order_divdamp_scaling_coeff > 1.0e-6 @@ -202,7 +235,7 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: and (second_order_divdamp_factor <= (4.0 * fourth_order_divdamp_factor)) ) - limited_area = request.param + limited_area = request.param["limited_area"] edge_domain = h_grid.domain(dims.EdgeDim) start_edge_nudging_level_2 = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) From 47d647a1dc7b1717c8e943768c8c9b5e81c35e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 19 Sep 2025 11:33:55 +0200 Subject: [PATCH 026/111] add benchmarking for 'vertically_implicit...corrector...' program --- ...mplicit_dycore_solver_at_corrector_step.py | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index c43c2de7be..72e8daf61c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -5,6 +5,7 @@ # # Please, refer to the LICENSE file in the root directory. # SPDX-License-Identifier: BSD-3-Clause +import itertools from typing import Any import gt4py.next as gtx @@ -50,6 +51,7 @@ from .test_update_mass_volume_flux import update_mass_volume_flux_numpy +@pytest.mark.continuous_benchmarking @pytest.mark.uses_concat_where class TestVerticallyImplicitSolverAtCorrectorStep(stencil_tests.StencilTest): PROGRAM = vertically_implicit_solver_at_corrector_step @@ -62,6 +64,33 @@ class TestVerticallyImplicitSolverAtCorrectorStep(stencil_tests.StencilTest): "dynamical_vertical_volumetric_flux_at_cells_on_half_levels", "exner_dynamical_increment", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: (), + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "start_cell_index_nudging", + "end_cell_index_local", + "end_index_of_damping_layer", + "kstart_moist", + "vertical_start_index_model_top", + "vertical_end_index_model_surface", + "at_first_substep", + "at_last_substep", + "lprep_adv", + "is_iau_active", + "rayleigh_type", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "end_index_of_damping_layer", + "kstart_moist", + "vertical_start_index_model_top", + "vertical_end_index_model_surface", + "at_first_substep", + "at_last_substep", + "lprep_adv", + "is_iau_active", + "rayleigh_type", + ), + } @staticmethod def reference( @@ -370,8 +399,15 @@ def reference( exner_dynamical_increment=exner_dynamical_increment, ) - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + @pytest.fixture( + params=[ + {"at_first_substep": afs, "at_last_substep": als, "lprep_adv": la} + for afs, als, la in itertools.product(*([(True, False)] * 3)) + ] + ) + def input_data( + self, request: pytest.FixtureRequest, grid: base.Grid + ) -> dict[str, gtx.Field | state_utils.ScalarType]: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) mass_flux_at_edges_on_model_levels = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) theta_v_flux_at_edges_on_model_levels = data_alloc.random_field( @@ -426,13 +462,13 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1} ) - lprep_adv = True + lprep_adv = request.param["lprep_adv"] r_nsubsteps = 0.5 is_iau_active = True - at_first_substep = True + at_first_substep = request.param["at_first_substep"] rayleigh_type = 2 end_index_of_damping_layer = 3 - at_last_substep = True + at_last_substep = request.param["at_last_substep"] kstart_moist = 1 dtime = 0.001 veladv_offctr = 0.25 From 3289b3827b6d0bd7980ab131f79a66a487857312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 19 Sep 2025 12:50:31 +0200 Subject: [PATCH 027/111] add benchmarking for 'init_cell...' program --- .../test_init_cell_kdim_field_with_zero_wp.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py index 658499bc80..a0c2e0f902 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py @@ -19,12 +19,26 @@ from icon4py.model.common.states import utils as state_utils from icon4py.model.common.type_alias import wpfloat from icon4py.model.common.utils.data_allocation import zero_field -from icon4py.model.testing.stencil_tests import StencilTest +from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest +@pytest.mark.continuous_benchmarking class TestInitCellKdimFieldWithZeroWp(StencilTest): PROGRAM = init_cell_kdim_field_with_zero_wp OUTPUTS = ("field_with_zero_wp",) + STATIC_PARAMS = { + StandardStaticVariants.NONE: (), + StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( From f3921e7a559e4c962f09e7d5f78832e0eb47d8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rico=20H=C3=A4uselmann?= Date: Fri, 19 Sep 2025 12:52:47 +0200 Subject: [PATCH 028/111] add benchmarking for 'update_mass_flux_weighted' program --- .../test_update_mass_flux_weighted.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py index c9297d94b7..5a0e5422da 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py @@ -19,12 +19,26 @@ from icon4py.model.common.states import utils as state_utils from icon4py.model.common.type_alias import vpfloat, wpfloat from icon4py.model.common.utils.data_allocation import random_field -from icon4py.model.testing.stencil_tests import StencilTest +from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest +@pytest.mark.continuous_benchmarking class TestUpdateMassFluxWeighted(StencilTest): PROGRAM = update_mass_flux_weighted OUTPUTS = ("mass_flx_ic",) + STATIC_PARAMS = { + StandardStaticVariants.NONE: (), + StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( From 9fd8a3fb6aab3ea58c1804a14c10e087311f4f2f Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 29 Sep 2025 15:11:22 +0200 Subject: [PATCH 029/111] Make fixture names readable --- .../test_apply_divergence_damping_and_update_vn.py | 1 + ...horizontal_winds_and_ke_and_contravariant_correction.py | 3 ++- ..._vertically_implicit_dycore_solver_at_corrector_step.py | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index 65e4910078..2bf0347b35 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -186,6 +186,7 @@ def reference( [True, False], ) ], + ids=lambda param: f"limited_area={param['limited_area']},divdamp_order={param['divdamp_order']},is_iau_active={param['is_iau_active']}", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 31575df11c..f328028555 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -276,7 +276,8 @@ def reference( # TODO(ricoh): Add True case. Blocked by test failure (issue: #875) @pytest.fixture( - params=[{"skip_compute_predictor_vertical_advection": value} for value in [False]] + params=[{"skip_compute_predictor_vertical_advection": value} for value in [False]], + ids=lambda param: f"skip_compute_predictor_vertical_advection={param['skip_compute_predictor_vertical_advection']}", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 72e8daf61c..7b86efffa1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -403,7 +403,12 @@ def reference( params=[ {"at_first_substep": afs, "at_last_substep": als, "lprep_adv": la} for afs, als, la in itertools.product(*([(True, False)] * 3)) - ] + ], + ids=lambda p: ( + f"at_first_substep={p['at_first_substep']}," + f"at_last_substep={p['at_last_substep']}," + f"lprep_adv={p['lprep_adv']}" + ), ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid From 1f88e8f74ac5c11e46c387686bdfea4994a2694f Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 29 Sep 2025 15:19:12 +0200 Subject: [PATCH 030/111] Make variable options usable with pytest -k --- .../test_apply_divergence_damping_and_update_vn.py | 2 +- ...t_vertically_implicit_dycore_solver_at_corrector_step.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index 2bf0347b35..c90241697b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -186,7 +186,7 @@ def reference( [True, False], ) ], - ids=lambda param: f"limited_area={param['limited_area']},divdamp_order={param['divdamp_order']},is_iau_active={param['is_iau_active']}", + ids=lambda param: f"limited_area[{param['limited_area']}]__divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 7b86efffa1..ab8ea3d50b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -405,9 +405,9 @@ def reference( for afs, als, la in itertools.product(*([(True, False)] * 3)) ], ids=lambda p: ( - f"at_first_substep={p['at_first_substep']}," - f"at_last_substep={p['at_last_substep']}," - f"lprep_adv={p['lprep_adv']}" + f"at_first_substep[{p['at_first_substep']}]__" + f"at_last_substep[{p['at_last_substep']}]__" + f"lprep_adv[{p['lprep_adv']}]" ), ) def input_data( From 123b25bee8e0abf8d953b6418df9b0b1aa6fee2b Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Tue, 30 Sep 2025 13:54:48 +0200 Subject: [PATCH 031/111] Print gt4py timers in a nice way (along with pytest timers) ------------------------------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests ------------------------------------------------------------------------------------------------------------------------------------------ Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_TestVerticallyImplicitSolverAtCorrectorStep[compile_time_domain-at_first_substep[False]__at_last_substep[False]__lprep_adv[False]] 5.0775 (1.0) 7.9169 (1.14) 5.4656 (1.0) 0.3381 (1.90) 5.4298 (1.0) 0.1788 (1.0) 5;3 182.9632 (1.0) 122 1 test_TestVerticallyImplicitSolverAtCorrectorStep[compile_time_domain-at_first_substep[False]__at_last_substep[False]__lprep_adv[True]] 5.5181 (1.09) 6.9601 (1.0) 5.8356 (1.07) 0.1780 (1.0) 5.8323 (1.07) 0.1792 (1.00) 21;2 171.3618 (0.94) 115 1 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Legend: Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile. OPS: Operations Per Second, computed as 1 / Mean --------------------------------------------------------------------- GT4Py Timer Report ---------------------------------------------------------------------- Benchmark Name | Mean (s) | Std Dev | Runs --------------------------------------------------------------------------------------------------------------------------------------------------------------- VerticallyImplicitSolverAtCorrectorStep[compile_time_domain-at_first_substep[False]__at_last_substep[False]__lprep_adv[True]] | 0.00073964 | 0.00102386 | 118 VerticallyImplicitSolverAtCorrectorStep[compile_time_domain-at_first_substep[False]__at_last_substep[False]__lprep_adv[False]] | 0.00061125 | 0.00007039 | 125 --------------------------------------------------------------------------------------------------------------------------------------------------------------- --- .../src/icon4py/model/testing/pytest_hooks.py | 53 +++++++++++++++++++ .../icon4py/model/testing/stencil_tests.py | 17 +++++- 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index 670f7ff775..8353ec6cdc 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -161,3 +161,56 @@ def pytest_benchmark_update_json(output_json): for bench in output_json["benchmarks"]: bench["fullname"] = _name_from_fullname(bench["fullname"]) + + +@pytest.hookimpl(hookwrapper=True) +def pytest_runtest_makereport(item, call): + """ + Gather GT4Py timer metrics from benchmark fixture and add them to the test report. + """ + outcome = yield + report = outcome.get_result() + if call.when == "call": + benchmark = item.funcargs.get("benchmark", None) + if benchmark and hasattr(benchmark, "extra_info"): + info = benchmark.extra_info.get("gtx_metrics", None) + if info: + filtered_benchmark_name = benchmark.name.split("test_Test")[-1] + # Combine the benchmark name in a readable form with the gtx_metrics data + report.sections.append(("benchmark-extra", tuple([filtered_benchmark_name, info]))) + + +def pytest_terminal_summary(terminalreporter, exitstatus, config): + """ + Add a custom section to the terminal summary with GT4Py timer metrics from benchmarks. + """ + # Gather gtx_metrics + benchmark_gtx_metrics = [] + for outcome in ("passed", "failed", "skipped"): + all_reports = terminalreporter.stats.get(outcome, []) + for report in all_reports: + for secname, info in getattr(report, "sections", []): + if secname == "benchmark-extra": + benchmark_gtx_metrics.append(info) + # Calculate the maximum length of benchmark names for formatting + max_name_len = 0 + for benchmark_name, _ in benchmark_gtx_metrics: + max_name_len = max(len(benchmark_name), max_name_len) + # Print the GT4Py timer report table + if benchmark_gtx_metrics: + terminalreporter.ensure_newline() + header = ( + f"{'Benchmark Name':<{max_name_len}} | {'Mean (s)':>10} | {'Std Dev':>10} | {'Runs':>4}" + ) + title = " GT4Py Timer Report " + sep_len = max(0, len(header) - len(title)) + left = sep_len // 2 + right = sep_len - left + terminalreporter.line("-" * left + title + "-" * right, bold=True, blue=True) + terminalreporter.line(header) + terminalreporter.line("-" * len(header), blue=True) + for benchmark_name, gtx_metrics in benchmark_gtx_metrics: + terminalreporter.line( + f"{benchmark_name:<{max_name_len}} | {gtx_metrics.mean:>10.8f} | {gtx_metrics.std:>10.8f} | {len(gtx_metrics.samples):>4}" + ) + terminalreporter.line("-" * len(header), blue=True) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index b6dd570144..ec10a5860e 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -16,7 +16,13 @@ import numpy as np import pytest from gt4py import eve -from gt4py.next import backend as gtx_backend, constructors, typing as gtx_typing +from gt4py.next import ( + backend as gtx_backend, + config as gtx_config, + constructors, + metrics as gtx_metrics, + typing as gtx_typing, +) # TODO(havogt): import will disappear after FieldOperators support `.compile` from gt4py.next.ffront.decorator import FieldOperator @@ -98,6 +104,15 @@ def test_and_benchmark( **_properly_allocated_input_data, offset_provider=grid.connectivities, ) + # Collect GT4Py runtime metrics if enabled + if gtx_config.COLLECT_METRICS_LEVEL > 0: + assert ( + len(gtx_metrics.program_metrics.data.keys()) == 1 + ), "Expected exactly one entry in gtx_metrics" + benchmark.extra_info["gtx_metrics"] = gtx_metrics.program_metrics.data[ + next(iter(gtx_metrics.program_metrics.data)) + ]["compute"] + gtx_metrics.program_metrics.clear() class StencilTest: From 66855eb5ee45d551c41ab49bef66682781c92655 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 1 Oct 2025 10:26:12 +0200 Subject: [PATCH 032/111] Disable verification if --benchmark_only is set --- .../icon4py/model/testing/stencil_tests.py | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index cbc1b2af36..99f20c2f12 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -82,21 +82,23 @@ def test_and_benchmark( grid: base.Grid, _properly_allocated_input_data: dict[str, gtx.Field | tuple[gtx.Field, ...]], _configured_program: Callable[..., None], + request: pytest.FixtureRequest, ) -> None: - reference_outputs = self.reference( - _ConnectivityConceptFixer( - grid # TODO(havogt): pass as keyword argument (needs fixes in some tests) - ), - **{ - k: v.asnumpy() if isinstance(v, gtx.Field) else v - for k, v in _properly_allocated_input_data.items() - }, - ) - - _configured_program(**_properly_allocated_input_data, offset_provider=grid.connectivities) - self._verify_stencil_test( - input_data=_properly_allocated_input_data, reference_outputs=reference_outputs - ) + if not request.config.getoption("benchmark_only"): + reference_outputs = self.reference( + _ConnectivityConceptFixer( + grid # TODO(havogt): pass as keyword argument (needs fixes in some tests) + ), + **{ + k: v.asnumpy() if isinstance(v, gtx.Field) else v + for k, v in _properly_allocated_input_data.items() + }, + ) + + _configured_program(**_properly_allocated_input_data, offset_provider=grid.connectivities) + self._verify_stencil_test( + input_data=_properly_allocated_input_data, reference_outputs=reference_outputs + ) if benchmark is not None and benchmark.enabled: benchmark( From d39c9f14ee05bef34070e7a38035def939b3e8a8 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 1 Oct 2025 10:26:42 +0200 Subject: [PATCH 033/111] Clean gtx_metrics after the verification --- model/testing/src/icon4py/model/testing/stencil_tests.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 99f20c2f12..566779ffa9 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -101,11 +101,16 @@ def test_and_benchmark( ) if benchmark is not None and benchmark.enabled: + # Clean up GT4Py metrics from previous runs + if gtx_config.COLLECT_METRICS_LEVEL > 0: + gtx_metrics.program_metrics.clear() + benchmark( _configured_program, **_properly_allocated_input_data, offset_provider=grid.connectivities, ) + # Collect GT4Py runtime metrics if enabled if gtx_config.COLLECT_METRICS_LEVEL > 0: assert ( @@ -114,7 +119,6 @@ def test_and_benchmark( benchmark.extra_info["gtx_metrics"] = gtx_metrics.program_metrics.data[ next(iter(gtx_metrics.program_metrics.data)) ]["compute"] - gtx_metrics.program_metrics.clear() class StencilTest: From 4d3a6d67191f031ac407d02453d34d466923ec1c Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 1 Oct 2025 14:37:52 +0200 Subject: [PATCH 034/111] Get rid of the first slow iterations --- .../src/icon4py/model/testing/pytest_hooks.py | 8 +++---- .../icon4py/model/testing/stencil_tests.py | 21 ++++++++++++++----- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index 8353ec6cdc..a935f7bb1b 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -199,9 +199,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): # Print the GT4Py timer report table if benchmark_gtx_metrics: terminalreporter.ensure_newline() - header = ( - f"{'Benchmark Name':<{max_name_len}} | {'Mean (s)':>10} | {'Std Dev':>10} | {'Runs':>4}" - ) + header = f"{'Benchmark Name':<{max_name_len}} | {'Mean (s)':>10} | {'Median (s)':>10} | {'Std Dev':>10} | {'Runs':>4}" title = " GT4Py Timer Report " sep_len = max(0, len(header) - len(title)) left = sep_len // 2 @@ -209,8 +207,10 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): terminalreporter.line("-" * left + title + "-" * right, bold=True, blue=True) terminalreporter.line(header) terminalreporter.line("-" * len(header), blue=True) + import numpy as np + for benchmark_name, gtx_metrics in benchmark_gtx_metrics: terminalreporter.line( - f"{benchmark_name:<{max_name_len}} | {gtx_metrics.mean:>10.8f} | {gtx_metrics.std:>10.8f} | {len(gtx_metrics.samples):>4}" + f"{benchmark_name:<{max_name_len}} | {np.mean(gtx_metrics):>10.8f} | {np.median(gtx_metrics):>10.8f} | {np.std(gtx_metrics):>10.8f} | {len(gtx_metrics):>4}" ) terminalreporter.line("-" * len(header), blue=True) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 566779ffa9..61ced3e40d 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -17,7 +17,6 @@ import pytest from gt4py import eve from gt4py.next import ( - backend as gtx_backend, config as gtx_config, constructors, metrics as gtx_metrics, @@ -84,7 +83,8 @@ def test_and_benchmark( _configured_program: Callable[..., None], request: pytest.FixtureRequest, ) -> None: - if not request.config.getoption("benchmark_only"): + benchmark_only = request.config.getoption("benchmark_only") + if not benchmark_only: reference_outputs = self.reference( _ConnectivityConceptFixer( grid # TODO(havogt): pass as keyword argument (needs fixes in some tests) @@ -101,6 +101,9 @@ def test_and_benchmark( ) if benchmark is not None and benchmark.enabled: + warmup_enabled = request.config.getoption("benchmark_warmup") + if warmup_enabled: + print("[WARNING] Benchmark warmup enabled, GT4Py timers include warmup iterations.") # Clean up GT4Py metrics from previous runs if gtx_config.COLLECT_METRICS_LEVEL > 0: gtx_metrics.program_metrics.clear() @@ -116,9 +119,17 @@ def test_and_benchmark( assert ( len(gtx_metrics.program_metrics.data.keys()) == 1 ), "Expected exactly one entry in gtx_metrics" - benchmark.extra_info["gtx_metrics"] = gtx_metrics.program_metrics.data[ - next(iter(gtx_metrics.program_metrics.data)) - ]["compute"] + # Store GT4Py metrics in benchmark.extra_info + metrics_data = gtx_metrics.program_metrics.data + key = next(iter(metrics_data)) + compute_samples = metrics_data[key]["compute"].samples + # emprically exclude first few iterations as warmup + initial_program_iterations_to_skip = 2 + print(f"GT4Py compute time samples: {compute_samples}") + # Exclude first sample unless running in benchmark_only mode + benchmark.extra_info["gtx_metrics"] = compute_samples[ + initial_program_iterations_to_skip: + ] class StencilTest: From 1129847a597ec4ff99c01a9451a2453ec6a01927 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 1 Oct 2025 15:31:42 +0200 Subject: [PATCH 035/111] Added a few fixture ids --- ...test_compute_advection_in_horizontal_momentum_equation.py | 5 ++++- ...d_horizontal_winds_and_ke_and_contravariant_correction.py | 2 +- ...st_vertically_implicit_dycore_solver_at_predictor_step.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index ad09b5e60c..70c6a4d051 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -242,7 +242,10 @@ def reference( return dict(normal_wind_advective_tendency=normal_wind_advective_tendency) - @pytest.fixture(params=[{"apply_extra_diffusion_on_vn": value} for value in [True, False]]) + @pytest.fixture( + params=[{"apply_extra_diffusion_on_vn": value} for value in [True, False]], + ids=lambda param: f"apply_extra_diffusion_on_vn[{param['apply_extra_diffusion_on_vn']}]", + ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid ) -> dict[str, gtx.Field | state_utils.ScalarType]: diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 69e7811f50..56154fbfc1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -283,7 +283,7 @@ def reference( @pytest.fixture( params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], - ids=lambda param: f"skip_compute_predictor_vertical_advection={param['skip_compute_predictor_vertical_advection']}", + ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", ) def input_data( self, grid: base.Grid, request: pytest.FixtureRequest diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 6556796e06..7273005d8a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -394,7 +394,10 @@ def reference( exner_dynamical_increment=exner_dynamical_increment, ) - @pytest.fixture(params=[{"at_first_substep": value} for value in [True, False]]) + @pytest.fixture( + params=[{"at_first_substep": value} for value in [True, False]], + ids=lambda param: f"at_first_substep[{param['at_first_substep']}]", + ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid ) -> dict[str, gtx.Field | state_utils.ScalarType]: From c6de2d1f50a0a058cad9ba3c4a4b22dd149ca3ce Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Tue, 7 Oct 2025 11:28:40 +0200 Subject: [PATCH 036/111] Add at_first_substep to compile-time constants in vertically_implicit_dycore_solver_at_predictor_step --- .../test_vertically_implicit_dycore_solver_at_predictor_step.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 7273005d8a..83aa4a344a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -80,6 +80,7 @@ class TestVerticallyImplicitSolverAtPredictorStep(stencil_tests.StencilTest): "divdamp_type", "rayleigh_type", "is_iau_active", + "at_first_substep", ), stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( "end_index_of_damping_layer", @@ -90,6 +91,7 @@ class TestVerticallyImplicitSolverAtPredictorStep(stencil_tests.StencilTest): "divdamp_type", "rayleigh_type", "is_iau_active", + "at_first_substep", ), } From 171ffd7e3e22f5feeccf8aadfd3ec479acc203f8 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 8 Oct 2025 16:55:50 +0200 Subject: [PATCH 037/111] Remove debug print of gt4py timers --- model/testing/src/icon4py/model/testing/stencil_tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 61ced3e40d..e3d06e5724 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -125,7 +125,6 @@ def test_and_benchmark( compute_samples = metrics_data[key]["compute"].samples # emprically exclude first few iterations as warmup initial_program_iterations_to_skip = 2 - print(f"GT4Py compute time samples: {compute_samples}") # Exclude first sample unless running in benchmark_only mode benchmark.extra_info["gtx_metrics"] = compute_samples[ initial_program_iterations_to_skip: From 2728bfdb2dddfbfdd401823454a3f0eacd24e076 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 8 Oct 2025 18:57:19 +0200 Subject: [PATCH 038/111] Fix metrics with new gt4py --- .../testing/src/icon4py/model/testing/stencil_tests.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index e3d06e5724..067a5682b9 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -106,7 +106,7 @@ def test_and_benchmark( print("[WARNING] Benchmark warmup enabled, GT4Py timers include warmup iterations.") # Clean up GT4Py metrics from previous runs if gtx_config.COLLECT_METRICS_LEVEL > 0: - gtx_metrics.program_metrics.clear() + gtx_metrics.sources.clear() benchmark( _configured_program, @@ -117,12 +117,12 @@ def test_and_benchmark( # Collect GT4Py runtime metrics if enabled if gtx_config.COLLECT_METRICS_LEVEL > 0: assert ( - len(gtx_metrics.program_metrics.data.keys()) == 1 - ), "Expected exactly one entry in gtx_metrics" + len(gtx_metrics.sources) == 1 + ), "Expected exactly one entry in gtx_metrics.sources" # Store GT4Py metrics in benchmark.extra_info - metrics_data = gtx_metrics.program_metrics.data + metrics_data = gtx_metrics.sources key = next(iter(metrics_data)) - compute_samples = metrics_data[key]["compute"].samples + compute_samples = metrics_data[key].metrics["compute"].samples # emprically exclude first few iterations as warmup initial_program_iterations_to_skip = 2 # Exclude first sample unless running in benchmark_only mode From 18e3817b85134fb4dde4fcba766b7935202eebee Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 10 Oct 2025 20:56:32 +0200 Subject: [PATCH 039/111] Find a way to inherit from existing StencilTests --- .../stencil_tests/test_apply_diffusion_to_vn.py | 6 +++++- .../src/icon4py/model/testing/stencil_tests.py | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index debdae974f..024ad3f775 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -26,7 +26,6 @@ @pytest.mark.uses_concat_where -@pytest.mark.continuous_benchmarking class TestApplyDiffusionToVn(StencilTest): PROGRAM = apply_diffusion_to_vn OUTPUTS = ("vn",) @@ -164,3 +163,8 @@ def input_data(self, grid: base.Grid) -> dict: vertical_start=0, vertical_end=grid.num_levels, ) + + +@pytest.mark.continuous_benchmarking +class TestCBApplyDiffusionToVn(TestApplyDiffusionToVn): + pass diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 067a5682b9..3bac0ca471 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -244,11 +244,22 @@ def static_variant(request: pytest.FixtureRequest) -> Sequence[str]: def __init_subclass__(cls, **kwargs: Any) -> None: super().__init_subclass__(**kwargs) - setattr(cls, f"test_{cls.__name__}", test_and_benchmark) + pytest_prefix = "test_" + + setattr(cls, f"{pytest_prefix}{cls.__name__}", test_and_benchmark) + + # in case a test inherits from another test avoid running the tests of its parent + if cls.__base__ is not None and cls.__base__ != StencilTest: + # TODO(iomaganaris): find a way to hide this instead of using an empty function + setattr(cls, f"{pytest_prefix}{cls.__base__.__name__}", lambda: ()) # decorate `static_variant` with parametrized fixtures, since the # parametrization is only available in the concrete subclass definition - if cls.STATIC_PARAMS is None: + # Check if cls.static_variant is already a pytest fixture to allow inheriting from other StencilTests + if hasattr(cls.static_variant, "_pytestfixturefunction"): + # Already a fixture, do nothing + pass + elif cls.STATIC_PARAMS is None: # not parametrized, return an empty tuple cls.static_variant = staticmethod(pytest.fixture(lambda: ())) # type: ignore[method-assign, assignment] # we override with a non-parametrized function else: From c525572c70d24946078a62affc20cf94a9e2757f Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 13 Oct 2025 12:04:31 +0200 Subject: [PATCH 040/111] Enable inheritance from classes of benchmarks and apply to TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence. Disable verification for tests marked as continuous_benchmarking --- ...ute_horizontal_gradients_for_turbulence.py | 39 +++++++++++++++++-- .../src/icon4py/model/testing/pytest_hooks.py | 13 +++++++ .../icon4py/model/testing/stencil_tests.py | 5 ++- pyproject.toml | 1 + 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index bdf70f59bd..9b0ebbaaac 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -8,12 +8,13 @@ import gt4py.next as gtx import numpy as np import pytest +from gt4py.next.ffront.fbuiltins import int32 from icon4py.model.atmosphere.diffusion.stencils.apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence import ( apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence, ) from icon4py.model.common import dimension as dims -from icon4py.model.common.grid import base +from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils.data_allocation import random_field, zero_field from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest @@ -28,7 +29,6 @@ @pytest.mark.embedded_remap_error -@pytest.mark.continuous_benchmarking class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence(StencilTest): PROGRAM = apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence OUTPUTS = ("w", "dwdx", "dwdy") @@ -119,8 +119,8 @@ def input_data(self, grid: base.Grid) -> dict: diff_multfac_w = 5.0 w = zero_field(grid, dims.CellDim, dims.KDim) - dwdx = zero_field(grid, dims.CellDim, dims.KDim) - dwdy = zero_field(grid, dims.CellDim, dims.KDim) + dwdx = random_field(grid, dims.CellDim, dims.KDim) + dwdy = random_field(grid, dims.CellDim, dims.KDim) return dict( area=area, @@ -142,3 +142,34 @@ def input_data(self, grid: base.Grid) -> dict: vertical_start=0, vertical_end=grid.num_levels, ) + + +@pytest.mark.continuous_benchmarking +class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulenceContinuousBenchmarking( + TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence +): + @pytest.fixture + def input_data(self, grid: base.Grid) -> dict: + assert ( + grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + ), "This test only works with the icon_benchmark grid." + # Use the parent class's fixture indirectly by calling its method, not the fixture itself + base_data = ( + TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence.input_data.__wrapped__( + self, grid + ) + ) + cell_domain = h_grid.domain(dims.CellDim) + base_data["interior_idx"] = grid.start_index(cell_domain(h_grid.Zone.INTERIOR)) + base_data["halo_idx"] = grid.end_index(cell_domain(h_grid.Zone.LOCAL)) + + def _get_start_index_for_w_diffusion() -> int32: + return ( + grid.start_index(cell_domain(h_grid.Zone.NUDGING)) + if grid.limited_area + else grid.start_index(cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_4)) + ) + + base_data["horizontal_start"] = _get_start_index_for_w_diffusion() + base_data["horizontal_end"] = grid.end_index(cell_domain(h_grid.Zone.HALO)) + return base_data diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index a935f7bb1b..519882c953 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -35,6 +35,10 @@ def pytest_configure(config): "markers", "level(name): marks test as unit or integration tests, mostly applicable where both are available", ) + config.addinivalue_line( + "markers", + "skip_verification(reason): skips verification for continuous benchmarking tests", + ) # Check if the --enable-mixed-precision option is set and set the environment variable accordingly if config.getoption("--enable-mixed-precision"): @@ -102,6 +106,15 @@ def pytest_addoption(parser: pytest.Parser): def pytest_collection_modifyitems(config, items): + """Modify collected test items based on command line options.""" + for item in items: + if (marker := item.get_closest_marker("continuous_benchmarking")) is not None: + if not config.getoption("--benchmark-only"): + item.add_marker( + pytest.mark.skip_verification( + reason="Continuous benchmarking tests shouldn't be verified." + ) + ) test_level = config.getoption("--level") if test_level == "any": return diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 3bac0ca471..81a842702d 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -84,7 +84,8 @@ def test_and_benchmark( request: pytest.FixtureRequest, ) -> None: benchmark_only = request.config.getoption("benchmark_only") - if not benchmark_only: + skip_verification = request.node.get_closest_marker("skip_verification") is not None + if (not benchmark_only) and (not skip_verification): reference_outputs = self.reference( _ConnectivityConceptFixer( grid # TODO(havogt): pass as keyword argument (needs fixes in some tests) @@ -251,7 +252,7 @@ def __init_subclass__(cls, **kwargs: Any) -> None: # in case a test inherits from another test avoid running the tests of its parent if cls.__base__ is not None and cls.__base__ != StencilTest: # TODO(iomaganaris): find a way to hide this instead of using an empty function - setattr(cls, f"{pytest_prefix}{cls.__base__.__name__}", lambda: ()) + setattr(cls, f"{pytest_prefix}{cls.__base__.__name__}", pytest.mark.skip(lambda: ())) # decorate `static_variant` with parametrized fixtures, since the # parametrization is only available in the concrete subclass definition diff --git a/pyproject.toml b/pyproject.toml index 062b3dbda1..32e91693f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -184,6 +184,7 @@ markers = [ "infinite_concat_where", "gtfn_too_slow", "continuous_benchmarking", + "skip_verificaion", "benchmark_only: benchmark only tests without verification" ] # add all namespace packages to pythonpath to make them available for pytest From 534d31d607387be610165bfdc01a7c09ff76e1ab Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 13 Oct 2025 15:18:11 +0200 Subject: [PATCH 041/111] Use subclasses for continuous_benchmarking --- .../test_benchmark_diffusion.py | 13 +++- ...ate_nabla2_and_smag_coefficients_for_vn.py | 23 ++++++- .../stencil_tests/test_calculate_nabla4.py | 6 +- ..._apply_divergence_damping_and_update_vn.py | 65 ++++++++++++++----- ...advection_in_vertical_momentum_equation.py | 15 ++++- ...nds_and_ke_and_contravariant_correction.py | 34 +++++++++- ...est_compute_hydrostatic_correction_term.py | 8 ++- ..._perturbed_quantities_and_interpolation.py | 20 +++++- .../test_init_cell_kdim_field_with_zero_wp.py | 6 +- ...d_compute_temperature_vertical_gradient.py | 8 ++- .../test_update_mass_flux_weighted.py | 6 +- ...mplicit_dycore_solver_at_corrector_step.py | 36 +++++++++- ...mplicit_dycore_solver_at_predictor_step.py | 26 +++++++- ...est_mo_intp_rbf_rbf_vec_interpol_vertex.py | 11 +++- 14 files changed, 243 insertions(+), 34 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/integration_tests/test_benchmark_diffusion.py b/model/atmosphere/diffusion/tests/diffusion/integration_tests/test_benchmark_diffusion.py index 8ecd3b7692..f413192a24 100644 --- a/model/atmosphere/diffusion/tests/diffusion/integration_tests/test_benchmark_diffusion.py +++ b/model/atmosphere/diffusion/tests/diffusion/integration_tests/test_benchmark_diffusion.py @@ -43,7 +43,6 @@ @pytest.mark.parametrize( "grid", [definitions.Grids.MCH_OPR_R04B07_DOMAIN01, definitions.Grids.R02B07_GLOBAL] ) -@pytest.mark.continuous_benchmarking @pytest.mark.benchmark_only def test_run_diffusion_benchmark( grid: definitions.GridDescription, @@ -220,3 +219,15 @@ def test_run_diffusion_benchmark( ) benchmark(diffusion_granule.run, diagnostic_state, prognostic_state, dtime) + + +@pytest.mark.continuous_benchmarking +def test_run_diffusion_benchmark_continuous_benchmarking( + grid: definitions.GridDescription, + backend: gtx_typing.Backend | None, + benchmark: Any, +) -> None: + assert ( + grid == definitions.Grids.MCH_OPR_R19B08_DOMAIN01 + ), "This test only works with the icon_benchmark grid." + test_run_diffusion_benchmark(grid, backend, benchmark) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index b17c7f578e..89b447e14a 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -14,11 +14,11 @@ calculate_nabla2_and_smag_coefficients_for_vn, ) from icon4py.model.common import dimension as dims, type_alias as ta +from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils import data_allocation as data_alloc from icon4py.model.testing import stencil_tests -@pytest.mark.continuous_benchmarking class TestCalculateNabla2AndSmagCoefficientsForVn(stencil_tests.StencilTest): PROGRAM = calculate_nabla2_and_smag_coefficients_for_vn OUTPUTS = ("kh_smag_e", "kh_smag_ec", "z_nabla2_e") @@ -157,7 +157,7 @@ def reference( return dict(kh_smag_e=kh_smag_e, kh_smag_ec=kh_smag_ec, z_nabla2_e=z_nabla2_e) @pytest.fixture - def input_data(self, grid): + def input_data(self, grid: base.Grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) smag_offset = ta.vpfloat("9.0") @@ -207,3 +207,22 @@ def input_data(self, grid): vertical_start=0, vertical_end=grid.num_levels, ) + + +@pytest.mark.continuous_benchmarking +class TestCalculateNabla2AndSmagCoefficientsForVnContinuousBenchmarking( + TestCalculateNabla2AndSmagCoefficientsForVn +): + @pytest.fixture + def input_data(self, grid: base.Grid) -> dict: + assert ( + grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + ), "This test only works with the icon_benchmark grid." + base_data = TestCalculateNabla2AndSmagCoefficientsForVn.input_data.__wrapped__(self, grid) + edge_domain = h_grid.domain(dims.EdgeDim) + horizontal_start = grid.start_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5)) + horizontal_end = grid.end_index(edge_domain(h_grid.Zone.HALO_LEVEL_2)) + assert horizontal_start < horizontal_end + base_data["horizontal_start"] = 0 + base_data["horizontal_end"] = grid.num_edges + return base_data diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py index dc8f9ac4ba..064c59e23f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py @@ -55,7 +55,6 @@ def calculate_nabla4_numpy( return z_nabla4_e2 -@pytest.mark.continuous_benchmarking class TestCalculateNabla4(StencilTest): PROGRAM = calculate_nabla4 OUTPUTS = ("z_nabla4_e2",) @@ -129,3 +128,8 @@ def input_data(self, grid) -> dict: vertical_start=0, vertical_end=gtx.int32(grid.num_levels), ) + + +@pytest.mark.continuous_benchmarking +class TestCalculateNabla4ContinuousBenchmarking(TestCalculateNabla4): + pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index c90241697b..8553a67934 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -26,7 +26,6 @@ divergence_damp_order = DivergenceDampingOrder() -@pytest.mark.continuous_benchmarking @pytest.mark.embedded_remap_error class TestApplyDivergenceDampingAndUpdateVn(test_helpers.StencilTest): PROGRAM = apply_divergence_damping_and_update_vn @@ -173,21 +172,7 @@ def reference( return dict(next_vn=next_vn) - @pytest.fixture( - params=[ - {"limited_area": la, "divdamp_order": do, "is_iau_active": ia} - for la, do, ia in itertools.product( - [True, False], - [ - DivergenceDampingOrder.SECOND_ORDER, - DivergenceDampingOrder.FOURTH_ORDER, - DivergenceDampingOrder.COMBINED, - ], - [True, False], - ) - ], - ids=lambda param: f"limited_area[{param['limited_area']}]__divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]", - ) + @pytest.fixture(params=[True, False]) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) horizontal_mask_for_3d_divdamp = data_alloc.random_field(grid, dims.EdgeDim) @@ -224,7 +209,7 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: is_iau_active = True fourth_order_divdamp_factor = 0.004 second_order_divdamp_factor = 0.012 - divdamp_order = request.param["divdamp_order"] + divdamp_order = 24 second_order_divdamp_scaling_coeff = 194588.14247428576 apply_2nd_order_divergence_damping = (divdamp_order == divergence_damp_order.COMBINED) and ( second_order_divdamp_scaling_coeff > 1.0e-6 @@ -236,7 +221,7 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: and (second_order_divdamp_factor <= (4.0 * fourth_order_divdamp_factor)) ) - limited_area = request.param["limited_area"] + limited_area = request.param edge_domain = h_grid.domain(dims.EdgeDim) start_edge_nudging_level_2 = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) @@ -274,3 +259,47 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: vertical_start=0, vertical_end=grid.num_levels, ) + + +@pytest.mark.continuous_benchmarking +class TestApplyDivergenceDampingAndUpdateVnContinuousBenchmarking( + TestApplyDivergenceDampingAndUpdateVn +): + @pytest.fixture( + params=[ + {"limited_area": la, "divdamp_order": do, "is_iau_active": ia} + for la, do, ia in itertools.product( + [True, False], + [ + DivergenceDampingOrder.SECOND_ORDER, + DivergenceDampingOrder.FOURTH_ORDER, + DivergenceDampingOrder.COMBINED, + ], + [True, False], + ) + ], + ids=lambda param: f"limited_area[{param['limited_area']}]__divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]", + ) + def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: + assert ( + grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + ), "This test only works with the icon_benchmark grid." + # Use the parent class's fixture indirectly by calling its method, not the fixture itself + base_data = TestApplyDivergenceDampingAndUpdateVn.input_data.__wrapped__( + self, request, grid + ) + base_data["is_iau_active"] = False + fourth_order_divdamp_factor = 0.004 + second_order_divdamp_factor = 0.032 + divdamp_order = request.param["divdamp_order"] + base_data["second_order_divdamp_scaling_coeff"] = 34497.62082646618 # for icon-ch1(_medium) + base_data["apply_2nd_order_divergence_damping"] = ( + divdamp_order == divergence_damp_order.COMBINED + ) and (base_data["second_order_divdamp_scaling_coeff"] > 1.0e-6) + base_data["apply_4th_order_divergence_damping"] = ( + divdamp_order == divergence_damp_order.FOURTH_ORDER + ) or ( + (divdamp_order == divergence_damp_order.COMBINED) + and (second_order_divdamp_factor <= (4.0 * fourth_order_divdamp_factor)) + ) + return base_data diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index b04ab64c02..2a5a8da5f9 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -268,7 +268,6 @@ def compute_advective_vertical_wind_tendency_and_apply_diffusion_numpy( return vertical_wind_advective_tendency -@pytest.mark.continuous_benchmarking @pytest.mark.embedded_remap_error class TestFusedVelocityAdvectionStencilVMomentum(stencil_tests.StencilTest): PROGRAM = compute_advection_in_vertical_momentum_equation @@ -483,6 +482,13 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala ) +@pytest.mark.continuous_benchmarking +class TestFusedVelocityAdvectionStencilVMomentumContinuousBenchmarking( + TestFusedVelocityAdvectionStencilVMomentum +): + pass + + @pytest.mark.embedded_remap_error class TestFusedVelocityAdvectionStencilVMomentumAndContravariant(stencil_tests.StencilTest): PROGRAM = compute_contravariant_correction_and_advection_in_vertical_momentum_equation @@ -695,3 +701,10 @@ def input_data( vertical_start=vertical_start, vertical_end=vertical_end, ) + + +@pytest.mark.continuous_benchmarking +class TestFusedVelocityAdvectionStencilVMomentumAndContravariantContinuousBenchmarking( + TestFusedVelocityAdvectionStencilVMomentumAndContravariant +): + pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 56154fbfc1..b23d9315c4 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -141,7 +141,6 @@ def extrapolate_to_surface_numpy(wgtfacq_e: np.ndarray, vn: np.ndarray) -> np.nd return vn_at_surface -@pytest.mark.continuous_benchmarking @pytest.mark.embedded_remap_error class TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection( stencil_tests.StencilTest @@ -315,7 +314,7 @@ def input_data( c_intp = data_alloc.random_field(grid, dims.VertexDim, dims.V2CDim) nlev = grid.num_levels - nflatlev = (grid.num_levels * 3) // 10 + nflatlev = 13 skip_compute_predictor_vertical_advection = request.param[ "skip_compute_predictor_vertical_advection" @@ -351,3 +350,34 @@ def input_data( vertical_start=vertical_start, vertical_end=vertical_end, ) + + +@pytest.mark.continuous_benchmarking +class TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrectionContinuousBenchmarking( + TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection +): + @pytest.fixture( + params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], + ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", + ) + def input_data( + self, grid: base.Grid, request: pytest.FixtureRequest + ) -> dict[str, gtx.Field | state_utils.ScalarType]: + assert ( + grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + ), "This test only works with the icon_benchmark grid." + base_data = TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection.input_data.__wrapped__( + self, grid, request + ) + base_data["skip_compute_predictor_vertical_advection"] = request.param[ + "skip_compute_predictor_vertical_advection" + ] + base_data["nflatlev"] = 6 + edge_domain = h_grid.domain(dims.EdgeDim) + base_data["horizontal_start"] = grid.start_index( + edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5) + ) + base_data["horizontal_end"] = grid.end_index(edge_domain(h_grid.Zone.HALO_LEVEL_2)) + base_data["vertical_start"] = 0 + base_data["vertical_end"] = grid.num_levels + 1 + return base_data diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py index 1c041b2a89..8e49c48599 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py @@ -86,7 +86,6 @@ def _apply_index_field( return z_hydro_corr -@pytest.mark.continuous_benchmarking @pytest.mark.uses_as_offset class TestComputeHydrostaticCorrectionTerm(StencilTest): OUTPUTS = ("z_hydro_corr",) @@ -168,3 +167,10 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala vertical_start=0, vertical_end=gtx.int32(grid.num_levels), ) + + +@pytest.mark.continuous_benchmarking +class TestComputeHydrostaticCorrectionTermContinuousBenchmarking( + TestComputeHydrostaticCorrectionTerm +): + pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index 301c2fa0b4..64c45e0804 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -64,7 +64,6 @@ def compute_first_vertical_derivative_numpy( return first_vertical_derivative -@pytest.mark.continuous_benchmarking @pytest.mark.uses_concat_where class TestComputePerturbedQuantitiesAndInterpolation(stencil_tests.StencilTest): PROGRAM = compute_perturbed_quantities_and_interpolation @@ -432,7 +431,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala end_cell_halo_level_2 = grid.end_index(cell_domain(h_grid.Zone.HALO_LEVEL_2)) nflatlev = 4 - nflat_gradp = grid.num_levels // 2 + nflat_gradp = 27 return dict( temporal_extrapolation_of_perturbed_exner=temporal_extrapolation_of_perturbed_exner, @@ -477,3 +476,20 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala vertical_start=0, vertical_end=grid.num_levels + 1, ) + + +@pytest.mark.continuous_benchmarking +class TestComputePerturbedQuantitiesAndInterpolationContinuousBenchmarking( + TestComputePerturbedQuantitiesAndInterpolation +): + @pytest.fixture + def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + assert ( + grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + ), "This test only works with the icon_benchmark grid." + base_data = TestComputePerturbedQuantitiesAndInterpolation.input_data.__wrapped__( + self, grid + ) + base_data["nflatlev"] = 6 + base_data["nflat_gradp"] = 35 + return base_data diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py index a0c2e0f902..943d0419d0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py @@ -22,7 +22,6 @@ from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest -@pytest.mark.continuous_benchmarking class TestInitCellKdimFieldWithZeroWp(StencilTest): PROGRAM = init_cell_kdim_field_with_zero_wp OUTPUTS = ("field_with_zero_wp",) @@ -60,3 +59,8 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala vertical_start=0, vertical_end=gtx.int32(grid.num_levels), ) + + +@pytest.mark.continuous_benchmarking +class TestInitCellKdimFieldWithZeroWpContinuousBenchmarking(TestInitCellKdimFieldWithZeroWp): + pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py index e9ab186490..58e876c9da 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py @@ -34,7 +34,6 @@ from icon4py.model.testing import stencil_tests -@pytest.mark.continuous_benchmarking class TestInterpolateRhoThetaVToHalfLevelsAndComputePressureBuoyancyAcceleration( stencil_tests.StencilTest ): @@ -250,3 +249,10 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala vertical_start=1, vertical_end=grid.num_levels, ) + + +@pytest.mark.continuous_benchmarking +class TestInterpolateRhoThetaVToHalfLevelsAndComputePressureBuoyancyAccelerationContinuousBenchmarking( + TestInterpolateRhoThetaVToHalfLevelsAndComputePressureBuoyancyAcceleration +): + pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py index 5a0e5422da..0013e7e1da 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py @@ -22,7 +22,6 @@ from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest -@pytest.mark.continuous_benchmarking class TestUpdateMassFluxWeighted(StencilTest): PROGRAM = update_mass_flux_weighted OUTPUTS = ("mass_flx_ic",) @@ -85,3 +84,8 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala vertical_start=0, vertical_end=gtx.int32(grid.num_levels), ) + + +@pytest.mark.continuous_benchmarking +class TestUpdateMassFluxWeightedContinuousBenchmarking(TestUpdateMassFluxWeighted): + pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index ab8ea3d50b..4e5b84ce1f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -51,7 +51,6 @@ from .test_update_mass_volume_flux import update_mass_volume_flux_numpy -@pytest.mark.continuous_benchmarking @pytest.mark.uses_concat_where class TestVerticallyImplicitSolverAtCorrectorStep(stencil_tests.StencilTest): PROGRAM = vertically_implicit_solver_at_corrector_step @@ -403,6 +402,7 @@ def reference( params=[ {"at_first_substep": afs, "at_last_substep": als, "lprep_adv": la} for afs, als, la in itertools.product(*([(True, False)] * 3)) + if not (afs and als) ], ids=lambda p: ( f"at_first_substep[{p['at_first_substep']}]__" @@ -535,3 +535,37 @@ def input_data( vertical_start_index_model_top=gtx.int32(0), vertical_end_index_model_surface=gtx.int32(grid.num_levels + 1), ) + + +@pytest.mark.continuous_benchmarking +class TestVerticallyImplicitSolverAtCorrectorStepContinuousBenchmarking( + TestVerticallyImplicitSolverAtCorrectorStep +): + @pytest.fixture( + params=[ + {"at_first_substep": afs, "at_last_substep": als, "lprep_adv": la} + for afs, als, la in itertools.product(*([(True, False)] * 3)) + if not (afs and als) + ], + ids=lambda p: ( + f"at_first_substep[{p['at_first_substep']}]__" + f"at_last_substep[{p['at_last_substep']}]__" + f"lprep_adv[{p['lprep_adv']}]" + ), + ) + def input_data( + self, request: pytest.FixtureRequest, grid: base.Grid + ) -> dict[str, gtx.Field | state_utils.ScalarType]: + assert ( + grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + ), "This test only works with the icon_benchmark grid." + base_data = TestVerticallyImplicitSolverAtCorrectorStep.input_data.__wrapped__( + self, request, grid + ) + base_data["at_first_substep"] = request.param["at_first_substep"] + base_data["at_last_substep"] = request.param["at_last_substep"] + base_data["lprep_adv"] = request.param["lprep_adv"] + base_data["is_iau_active"] = False + base_data["end_index_of_damping_layer"] = 13 + base_data["kstart_moist"] = 0 + return base_data diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 83aa4a344a..0b1f1f5219 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -53,7 +53,6 @@ ) -@pytest.mark.continuous_benchmarking @pytest.mark.uses_concat_where class TestVerticallyImplicitSolverAtPredictorStep(stencil_tests.StencilTest): PROGRAM = vertically_implicit_solver_at_predictor_step @@ -524,3 +523,28 @@ def input_data( vertical_start_index_model_top=gtx.int32(0), vertical_end_index_model_surface=gtx.int32(grid.num_levels + 1), ) + + +@pytest.mark.continuous_benchmarking +class TestVerticallyImplicitSolverAtPredictorStepContinuousBenchmarking( + TestVerticallyImplicitSolverAtPredictorStep +): + @pytest.fixture( + params=[{"at_first_substep": value} for value in [True, False]], + ids=lambda param: f"at_first_substep[{param['at_first_substep']}]", + ) + def input_data( + self, request: pytest.FixtureRequest, grid: base.Grid + ) -> dict[str, gtx.Field | state_utils.ScalarType]: + assert ( + grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + ), "This test only works with the icon_benchmark grid." + base_data = TestVerticallyImplicitSolverAtPredictorStep.input_data.__wrapped__( + self, request, grid + ) + base_data["at_first_substep"] = request.param["at_first_substep"] + base_data["is_iau_active"] = False + base_data["divdamp_type"] = 32 + base_data["end_index_of_damping_layer"] = 13 + base_data["kstart_moist"] = 0 + return base_data diff --git a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py index 2137f5e587..98c8ce692c 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py @@ -21,7 +21,6 @@ from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest -@pytest.mark.continuous_benchmarking class TestMoIntpRbfRbfVecInterpolVertex(StencilTest): PROGRAM = mo_intp_rbf_rbf_vec_interpol_vertex OUTPUTS = ("p_u_out", "p_v_out") @@ -75,3 +74,13 @@ def input_data(self, grid: base.Grid) -> dict: vertical_start=0, vertical_end=gtx.int32(grid.num_levels), ) + + +@pytest.mark.continuous_benchmarking +class TestMoIntpRbfRbfVecInterpolVertexContinuousBenchmarking(TestMoIntpRbfRbfVecInterpolVertex): + @pytest.fixture + def input_data(self, grid): + assert ( + grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + ), "This test only works with the icon_benchmark grid." + return TestMoIntpRbfRbfVecInterpolVertex.input_data.__wrapped__(self, grid) From 6ee0419d8f5f8883f541b4b25c6cd3ff87a94011 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 13 Oct 2025 15:34:39 +0200 Subject: [PATCH 042/111] Replace UUID of test with class --- ...to_w_and_compute_horizontal_gradients_for_turbulence.py | 3 ++- .../test_calculate_nabla2_and_smag_coefficients_for_vn.py | 4 ++-- .../test_apply_divergence_damping_and_update_vn.py | 3 ++- ...horizontal_winds_and_ke_and_contravariant_correction.py | 4 ++-- .../test_compute_perturbed_quantities_and_interpolation.py | 4 ++-- ..._vertically_implicit_dycore_solver_at_corrector_step.py | 4 ++-- ..._vertically_implicit_dycore_solver_at_predictor_step.py | 4 ++-- .../test_mo_intp_rbf_rbf_vec_interpol_vertex.py | 7 +------ model/testing/src/icon4py/model/testing/definitions.py | 4 ++++ 9 files changed, 19 insertions(+), 18 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index 9b0ebbaaac..504df38f7f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -16,6 +16,7 @@ from icon4py.model.common import dimension as dims from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils.data_allocation import random_field, zero_field +from icon4py.model.testing import definitions from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest from .test_apply_nabla2_to_w import apply_nabla2_to_w_numpy @@ -151,7 +152,7 @@ class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulenceContinuousB @pytest.fixture def input_data(self, grid: base.Grid) -> dict: assert ( - grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 ), "This test only works with the icon_benchmark grid." # Use the parent class's fixture indirectly by calling its method, not the fixture itself base_data = ( diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index 89b447e14a..212215ecb9 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -16,7 +16,7 @@ from icon4py.model.common import dimension as dims, type_alias as ta from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import stencil_tests +from icon4py.model.testing import definitions, stencil_tests class TestCalculateNabla2AndSmagCoefficientsForVn(stencil_tests.StencilTest): @@ -216,7 +216,7 @@ class TestCalculateNabla2AndSmagCoefficientsForVnContinuousBenchmarking( @pytest.fixture def input_data(self, grid: base.Grid) -> dict: assert ( - grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 ), "This test only works with the icon_benchmark grid." base_data = TestCalculateNabla2AndSmagCoefficientsForVn.input_data.__wrapped__(self, grid) edge_domain = h_grid.domain(dims.EdgeDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index 8553a67934..6f8ef30b57 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -21,6 +21,7 @@ from icon4py.model.common import constants, dimension as dims from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils import data_allocation as data_alloc +from icon4py.model.testing import definitions divergence_damp_order = DivergenceDampingOrder() @@ -282,7 +283,7 @@ class TestApplyDivergenceDampingAndUpdateVnContinuousBenchmarking( ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: assert ( - grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 ), "This test only works with the icon_benchmark grid." # Use the parent class's fixture indirectly by calling its method, not the fixture itself base_data = TestApplyDivergenceDampingAndUpdateVn.input_data.__wrapped__( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index b23d9315c4..a9a339c2bb 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -16,7 +16,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import stencil_tests +from icon4py.model.testing import definitions, stencil_tests from .test_compute_contravariant_correction import compute_contravariant_correction_numpy from .test_compute_horizontal_advection_term_for_vertical_velocity import ( @@ -364,7 +364,7 @@ def input_data( self, grid: base.Grid, request: pytest.FixtureRequest ) -> dict[str, gtx.Field | state_utils.ScalarType]: assert ( - grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 ), "This test only works with the icon_benchmark grid." base_data = TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection.input_data.__wrapped__( self, grid, request diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index 64c45e0804..763450ff82 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -32,7 +32,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import stencil_tests +from icon4py.model.testing import definitions, stencil_tests from .test_compute_approx_of_2nd_vertical_derivative_of_exner import ( compute_approx_of_2nd_vertical_derivative_of_exner_numpy, @@ -485,7 +485,7 @@ class TestComputePerturbedQuantitiesAndInterpolationContinuousBenchmarking( @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: assert ( - grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 ), "This test only works with the icon_benchmark grid." base_data = TestComputePerturbedQuantitiesAndInterpolation.input_data.__wrapped__( self, grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 4e5b84ce1f..0702ff5f8c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -19,7 +19,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import stencil_tests +from icon4py.model.testing import definitions, stencil_tests from .test_add_analysis_increments_from_data_assimilation import ( add_analysis_increments_from_data_assimilation_numpy, @@ -557,7 +557,7 @@ def input_data( self, request: pytest.FixtureRequest, grid: base.Grid ) -> dict[str, gtx.Field | state_utils.ScalarType]: assert ( - grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 ), "This test only works with the icon_benchmark grid." base_data = TestVerticallyImplicitSolverAtCorrectorStep.input_data.__wrapped__( self, request, grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 0b1f1f5219..a2510c3e91 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -18,7 +18,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import stencil_tests +from icon4py.model.testing import definitions, stencil_tests from .test_add_analysis_increments_from_data_assimilation import ( add_analysis_increments_from_data_assimilation_numpy, @@ -537,7 +537,7 @@ def input_data( self, request: pytest.FixtureRequest, grid: base.Grid ) -> dict[str, gtx.Field | state_utils.ScalarType]: assert ( - grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" + grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 ), "This test only works with the icon_benchmark grid." base_data = TestVerticallyImplicitSolverAtPredictorStep.input_data.__wrapped__( self, request, grid diff --git a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py index 98c8ce692c..2ddde5d342 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py @@ -78,9 +78,4 @@ def input_data(self, grid: base.Grid) -> dict: @pytest.mark.continuous_benchmarking class TestMoIntpRbfRbfVecInterpolVertexContinuousBenchmarking(TestMoIntpRbfRbfVecInterpolVertex): - @pytest.fixture - def input_data(self, grid): - assert ( - grid.id == "01f00602-c07e-cd84-b894-bd17fffd2720" - ), "This test only works with the icon_benchmark grid." - return TestMoIntpRbfRbfVecInterpolVertex.input_data.__wrapped__(self, grid) + pass diff --git a/model/testing/src/icon4py/model/testing/definitions.py b/model/testing/src/icon4py/model/testing/definitions.py index 29159b1a60..30ef45bbc8 100644 --- a/model/testing/src/icon4py/model/testing/definitions.py +++ b/model/testing/src/icon4py/model/testing/definitions.py @@ -128,6 +128,10 @@ class Grids: ) +class GridUUIDs: + MCH_OPR_R19B08_DOMAIN01: Final = "01f00602-c07e-cd84-b894-bd17fffd2720" + + @dataclasses.dataclass class Experiment: name: str From da6c9ebe9cb3edd8bcf97bb989509e46f476394b Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 13 Oct 2025 15:39:46 +0200 Subject: [PATCH 043/111] Remove TODO --- model/testing/src/icon4py/model/testing/stencil_tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 81a842702d..9066741458 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -251,7 +251,6 @@ def __init_subclass__(cls, **kwargs: Any) -> None: # in case a test inherits from another test avoid running the tests of its parent if cls.__base__ is not None and cls.__base__ != StencilTest: - # TODO(iomaganaris): find a way to hide this instead of using an empty function setattr(cls, f"{pytest_prefix}{cls.__base__.__name__}", pytest.mark.skip(lambda: ())) # decorate `static_variant` with parametrized fixtures, since the From 33149f3d5b4dca346990fd36abee2dc51b4f142d Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 13 Oct 2025 15:43:12 +0200 Subject: [PATCH 044/111] Replace skip_verification with benchmark_only --- model/testing/src/icon4py/model/testing/pytest_hooks.py | 6 +----- model/testing/src/icon4py/model/testing/stencil_tests.py | 6 +++--- pyproject.toml | 1 - 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index 519882c953..14f4153f55 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -35,10 +35,6 @@ def pytest_configure(config): "markers", "level(name): marks test as unit or integration tests, mostly applicable where both are available", ) - config.addinivalue_line( - "markers", - "skip_verification(reason): skips verification for continuous benchmarking tests", - ) # Check if the --enable-mixed-precision option is set and set the environment variable accordingly if config.getoption("--enable-mixed-precision"): @@ -111,7 +107,7 @@ def pytest_collection_modifyitems(config, items): if (marker := item.get_closest_marker("continuous_benchmarking")) is not None: if not config.getoption("--benchmark-only"): item.add_marker( - pytest.mark.skip_verification( + pytest.mark.benchmark_only( reason="Continuous benchmarking tests shouldn't be verified." ) ) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 9066741458..14e8afa79c 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -83,9 +83,9 @@ def test_and_benchmark( _configured_program: Callable[..., None], request: pytest.FixtureRequest, ) -> None: - benchmark_only = request.config.getoption("benchmark_only") - skip_verification = request.node.get_closest_marker("skip_verification") is not None - if (not benchmark_only) and (not skip_verification): + benchmark_only_option = request.config.getoption("benchmark_only") + benchmark_only_mark = request.node.get_closest_marker("benchmark_only") is not None + if (not benchmark_only_option) and (not benchmark_only_mark): reference_outputs = self.reference( _ConnectivityConceptFixer( grid # TODO(havogt): pass as keyword argument (needs fixes in some tests) diff --git a/pyproject.toml b/pyproject.toml index 32e91693f5..062b3dbda1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -184,7 +184,6 @@ markers = [ "infinite_concat_where", "gtfn_too_slow", "continuous_benchmarking", - "skip_verificaion", "benchmark_only: benchmark only tests without verification" ] # add all namespace packages to pythonpath to make them available for pytest From 01d87c39c57fe3314d4c63c9f4c57c3f3248b3f5 Mon Sep 17 00:00:00 2001 From: Christos Kotsalos Date: Tue, 14 Oct 2025 11:27:56 +0300 Subject: [PATCH 045/111] Modifications in TestComputeThetaRhoPressureGradientAndUpdateVn --- ...ues_and_pressure_gradient_and_update_vn.py | 54 ++++++++++++++++--- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index 350d380792..2b84f76ce2 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -13,7 +13,7 @@ import pytest import icon4py.model.common.type_alias as ta -import icon4py.model.testing.stencil_tests as test_helpers +from icon4py.model.testing import definitions, stencil_tests from icon4py.model.atmosphere.dycore.dycore_states import ( HorizontalPressureDiscretizationType, RhoThetaAdvectionType, @@ -124,7 +124,7 @@ def compute_theta_rho_face_value_by_miura_scheme_numpy( @pytest.mark.embedded_remap_error @pytest.mark.skip_value_error @pytest.mark.uses_as_offset -class TestComputeThetaRhoPressureGradientAndUpdateVn(test_helpers.StencilTest): +class TestComputeThetaRhoPressureGradientAndUpdateVn(stencil_tests.StencilTest): PROGRAM = compute_theta_rho_face_values_and_pressure_gradient_and_update_vn OUTPUTS = ( "rho_at_edges_on_model_levels", @@ -132,6 +132,33 @@ class TestComputeThetaRhoPressureGradientAndUpdateVn(test_helpers.StencilTest): "horizontal_pressure_gradient", "next_vn", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: (), + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "iau_wgt_dyn", + "is_iau_active", + "limited_area", + "start_edge_lateral_boundary", + "start_edge_lateral_boundary_level_7", + "start_edge_nudging_level_2", + "end_edge_nudging", + "end_edge_halo", + "nflatlev", + "nflat_gradp", + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "is_iau_active", + "limited_area", + "nflatlev", + "nflat_gradp", + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( @@ -473,8 +500,8 @@ def input_data(self, grid: base.Grid) -> dict: dtime = 0.9 iau_wgt_dyn = 1.0 - is_iau_active = True - limited_area = True + is_iau_active = False + limited_area = False edge_domain = h_grid.domain(dims.EdgeDim) start_edge_lateral_boundary = grid.end_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY)) @@ -484,8 +511,8 @@ def input_data(self, grid: base.Grid) -> dict: start_edge_nudging_level_2 = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) end_edge_nudging = grid.end_index(edge_domain(h_grid.Zone.NUDGING)) end_edge_halo = grid.end_index(edge_domain(h_grid.Zone.HALO)) - nflatlev = 4 - nflat_gradp = 27 + nflatlev = 6 + nflat_gradp = 35 return dict( rho_at_edges_on_model_levels=rho_at_edges_on_model_levels, @@ -537,3 +564,18 @@ def input_data(self, grid: base.Grid) -> dict: vertical_start=0, vertical_end=grid.num_levels, ) + + +@pytest.mark.continuous_benchmarking +class TestComputeThetaRhoPressureGradientAndUpdateVnContinuousBenchmarking( + TestComputeThetaRhoPressureGradientAndUpdateVn +): + @pytest.fixture + def input_data(self, grid: base.Grid) -> dict: + assert ( + grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 + ), "This test only works with the icon_benchmark grid." + base_data = TestComputeThetaRhoPressureGradientAndUpdateVn.input_data.__wrapped__( + self, grid + ) + return base_data From 62ff36cf6d44b647c615cb09492c1a1bfe075302 Mon Sep 17 00:00:00 2001 From: Christos Kotsalos Date: Tue, 14 Oct 2025 15:09:40 +0300 Subject: [PATCH 046/111] Modifications in TestComputeThetaRhoPressureGradientAndUpdateVn --- ...ace_values_and_pressure_gradient_and_update_vn.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index 2b84f76ce2..d4bd4f2977 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -500,8 +500,8 @@ def input_data(self, grid: base.Grid) -> dict: dtime = 0.9 iau_wgt_dyn = 1.0 - is_iau_active = False - limited_area = False + is_iau_active = True + limited_area = True edge_domain = h_grid.domain(dims.EdgeDim) start_edge_lateral_boundary = grid.end_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY)) @@ -511,8 +511,8 @@ def input_data(self, grid: base.Grid) -> dict: start_edge_nudging_level_2 = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) end_edge_nudging = grid.end_index(edge_domain(h_grid.Zone.NUDGING)) end_edge_halo = grid.end_index(edge_domain(h_grid.Zone.HALO)) - nflatlev = 6 - nflat_gradp = 35 + nflatlev = 4 + nflat_gradp = 27 return dict( rho_at_edges_on_model_levels=rho_at_edges_on_model_levels, @@ -578,4 +578,8 @@ def input_data(self, grid: base.Grid) -> dict: base_data = TestComputeThetaRhoPressureGradientAndUpdateVn.input_data.__wrapped__( self, grid ) + base_data["is_iau_active"] = False + base_data["limited_area"] = False + base_data["nflatlev"] = 6 + base_data["nflat_gradp"] = 35 return base_data From f49b74bf63d6b93cf0b9e84e06ac304a8f329fb5 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 15 Oct 2025 09:56:46 +0200 Subject: [PATCH 047/111] Avoid warning: PytestCollectionWarning: cannot collect 'test_*' because it is not a function. --- model/testing/src/icon4py/model/testing/stencil_tests.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 14e8afa79c..e03808a051 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -249,9 +249,14 @@ def __init_subclass__(cls, **kwargs: Any) -> None: setattr(cls, f"{pytest_prefix}{cls.__name__}", test_and_benchmark) - # in case a test inherits from another test avoid running the tests of its parent + # in case a test inherits from another test overload the test function of its parent and skip it + # to avoid running the tests of its parent if cls.__base__ is not None and cls.__base__ != StencilTest: - setattr(cls, f"{pytest_prefix}{cls.__base__.__name__}", pytest.mark.skip(lambda: ())) + + def skipped_test() -> None: + pass + + setattr(cls, f"{pytest_prefix}{cls.__base__.__name__}", pytest.mark.skip(skipped_test)) # decorate `static_variant` with parametrized fixtures, since the # parametrization is only available in the concrete subclass definition From c755cd80aa7a5637dcba3fb7b37f705fa9c8506d Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 15 Oct 2025 10:07:22 +0200 Subject: [PATCH 048/111] Fix formatting --- ...ues_and_pressure_gradient_and_update_vn.py | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index d4bd4f2977..1d21438ee0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -13,7 +13,6 @@ import pytest import icon4py.model.common.type_alias as ta -from icon4py.model.testing import definitions, stencil_tests from icon4py.model.atmosphere.dycore.dycore_states import ( HorizontalPressureDiscretizationType, RhoThetaAdvectionType, @@ -24,6 +23,7 @@ from icon4py.model.common import constants, dimension as dims from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils import data_allocation as data_alloc +from icon4py.model.testing import definitions, stencil_tests rhotheta_avd_type = RhoThetaAdvectionType() @@ -121,8 +121,6 @@ def compute_theta_rho_face_value_by_miura_scheme_numpy( return rho_at_edges_on_model_levels, theta_v_at_edges_on_model_levels -@pytest.mark.embedded_remap_error -@pytest.mark.skip_value_error @pytest.mark.uses_as_offset class TestComputeThetaRhoPressureGradientAndUpdateVn(stencil_tests.StencilTest): PROGRAM = compute_theta_rho_face_values_and_pressure_gradient_and_update_vn @@ -133,32 +131,32 @@ class TestComputeThetaRhoPressureGradientAndUpdateVn(stencil_tests.StencilTest): "next_vn", ) STATIC_PARAMS = { - stencil_tests.StandardStaticVariants.NONE: (), - stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( - "iau_wgt_dyn", - "is_iau_active", - "limited_area", - "start_edge_lateral_boundary", - "start_edge_lateral_boundary_level_7", - "start_edge_nudging_level_2", - "end_edge_nudging", - "end_edge_halo", - "nflatlev", - "nflat_gradp", - "horizontal_start", - "horizontal_end", - "vertical_start", - "vertical_end", - ), - stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( - "is_iau_active", - "limited_area", - "nflatlev", - "nflat_gradp", - "vertical_start", - "vertical_end", - ), - } + stencil_tests.StandardStaticVariants.NONE: (), + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "iau_wgt_dyn", + "is_iau_active", + "limited_area", + "start_edge_lateral_boundary", + "start_edge_lateral_boundary_level_7", + "start_edge_nudging_level_2", + "end_edge_nudging", + "end_edge_halo", + "nflatlev", + "nflat_gradp", + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "is_iau_active", + "limited_area", + "nflatlev", + "nflat_gradp", + "vertical_start", + "vertical_end", + ), + } @staticmethod def reference( From f1a627dab1260f8d690c03d048bbff366561bc10 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 15 Oct 2025 12:01:18 +0200 Subject: [PATCH 049/111] Skip continuous benchmarking tests if grid is not icon_benchmark --- ...o_w_and_compute_horizontal_gradients_for_turbulence.py | 3 --- .../test_calculate_nabla2_and_smag_coefficients_for_vn.py | 3 --- .../test_apply_divergence_damping_and_update_vn.py | 3 --- ...est_compute_advection_in_vertical_momentum_equation.py | 8 ++++++-- ...orizontal_winds_and_ke_and_contravariant_correction.py | 3 --- ...test_compute_perturbed_quantities_and_interpolation.py | 3 --- ...rho_face_values_and_pressure_gradient_and_update_vn.py | 3 --- ...vertically_implicit_dycore_solver_at_corrector_step.py | 3 --- ...vertically_implicit_dycore_solver_at_predictor_step.py | 3 --- model/testing/src/icon4py/model/testing/pytest_hooks.py | 8 ++++++++ 10 files changed, 14 insertions(+), 26 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index 504df38f7f..a25b0e96c3 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -151,9 +151,6 @@ class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulenceContinuousB ): @pytest.fixture def input_data(self, grid: base.Grid) -> dict: - assert ( - grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 - ), "This test only works with the icon_benchmark grid." # Use the parent class's fixture indirectly by calling its method, not the fixture itself base_data = ( TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence.input_data.__wrapped__( diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index 212215ecb9..5d7a01bf01 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -215,9 +215,6 @@ class TestCalculateNabla2AndSmagCoefficientsForVnContinuousBenchmarking( ): @pytest.fixture def input_data(self, grid: base.Grid) -> dict: - assert ( - grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 - ), "This test only works with the icon_benchmark grid." base_data = TestCalculateNabla2AndSmagCoefficientsForVn.input_data.__wrapped__(self, grid) edge_domain = h_grid.domain(dims.EdgeDim) horizontal_start = grid.start_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5)) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index 6f8ef30b57..acf924a10b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -282,9 +282,6 @@ class TestApplyDivergenceDampingAndUpdateVnContinuousBenchmarking( ids=lambda param: f"limited_area[{param['limited_area']}]__divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: - assert ( - grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 - ), "This test only works with the icon_benchmark grid." # Use the parent class's fixture indirectly by calling its method, not the fixture itself base_data = TestApplyDivergenceDampingAndUpdateVn.input_data.__wrapped__( self, request, grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 2a5a8da5f9..b56ae82550 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -19,7 +19,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import stencil_tests +from icon4py.model.testing import definitions, stencil_tests from .test_add_interpolated_horizontal_advection_of_w import ( add_interpolated_horizontal_advection_of_w_numpy, @@ -486,7 +486,11 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala class TestFusedVelocityAdvectionStencilVMomentumContinuousBenchmarking( TestFusedVelocityAdvectionStencilVMomentum ): - pass + @pytest.fixture + def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + base_data = TestFusedVelocityAdvectionStencilVMomentum.input_data.__wrapped__(self, grid) + base_data["end_index_of_damping_layer"] = 12 + return base_data @pytest.mark.embedded_remap_error diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index a9a339c2bb..a8ed6aab2e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -363,9 +363,6 @@ class TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContrava def input_data( self, grid: base.Grid, request: pytest.FixtureRequest ) -> dict[str, gtx.Field | state_utils.ScalarType]: - assert ( - grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 - ), "This test only works with the icon_benchmark grid." base_data = TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection.input_data.__wrapped__( self, grid, request ) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index 1f184e5ffa..8e61987b8a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -474,9 +474,6 @@ class TestComputePerturbedQuantitiesAndInterpolationContinuousBenchmarking( ): @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: - assert ( - grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 - ), "This test only works with the icon_benchmark grid." base_data = TestComputePerturbedQuantitiesAndInterpolation.input_data.__wrapped__( self, grid ) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index 1d21438ee0..8903872bad 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -570,9 +570,6 @@ class TestComputeThetaRhoPressureGradientAndUpdateVnContinuousBenchmarking( ): @pytest.fixture def input_data(self, grid: base.Grid) -> dict: - assert ( - grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 - ), "This test only works with the icon_benchmark grid." base_data = TestComputeThetaRhoPressureGradientAndUpdateVn.input_data.__wrapped__( self, grid ) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 0702ff5f8c..16cc63d8f1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -556,9 +556,6 @@ class TestVerticallyImplicitSolverAtCorrectorStepContinuousBenchmarking( def input_data( self, request: pytest.FixtureRequest, grid: base.Grid ) -> dict[str, gtx.Field | state_utils.ScalarType]: - assert ( - grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 - ), "This test only works with the icon_benchmark grid." base_data = TestVerticallyImplicitSolverAtCorrectorStep.input_data.__wrapped__( self, request, grid ) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index a2510c3e91..1b032bee50 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -536,9 +536,6 @@ class TestVerticallyImplicitSolverAtPredictorStepContinuousBenchmarking( def input_data( self, request: pytest.FixtureRequest, grid: base.Grid ) -> dict[str, gtx.Field | state_utils.ScalarType]: - assert ( - grid.id == definitions.GridUUIDs.MCH_OPR_R19B08_DOMAIN01 - ), "This test only works with the icon_benchmark grid." base_data = TestVerticallyImplicitSolverAtPredictorStep.input_data.__wrapped__( self, request, grid ) diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index 14f4153f55..cc04f1796e 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -103,8 +103,16 @@ def pytest_addoption(parser: pytest.Parser): def pytest_collection_modifyitems(config, items): """Modify collected test items based on command line options.""" + test_grid = config.getoption("--grid") for item in items: if (marker := item.get_closest_marker("continuous_benchmarking")) is not None: + if test_grid != "icon_benchmark": + item.add_marker( + pytest.mark.skip( + reason="Continuous benchmarking tests only run with --grid icon_benchmark" + ) + ) + continue if not config.getoption("--benchmark-only"): item.add_marker( pytest.mark.benchmark_only( From 1e092ba916485e5e16325831817c8b06b9a26f17 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 15 Oct 2025 12:29:19 +0200 Subject: [PATCH 050/111] Fixing tests --- .../test_benchmark_diffusion.py | 6 +----- ..._apply_divergence_damping_and_update_vn.py | 8 +++++--- ..._perturbed_quantities_and_interpolation.py | 19 +++++++------------ 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/integration_tests/test_benchmark_diffusion.py b/model/atmosphere/diffusion/tests/diffusion/integration_tests/test_benchmark_diffusion.py index 60b9fe7a46..1a6d0fbfe9 100644 --- a/model/atmosphere/diffusion/tests/diffusion/integration_tests/test_benchmark_diffusion.py +++ b/model/atmosphere/diffusion/tests/diffusion/integration_tests/test_benchmark_diffusion.py @@ -223,11 +223,7 @@ def test_run_diffusion_benchmark( @pytest.mark.continuous_benchmarking def test_run_diffusion_benchmark_continuous_benchmarking( - grid: definitions.GridDescription, backend: gtx_typing.Backend | None, benchmark: Any, ) -> None: - assert ( - grid == definitions.Grids.MCH_OPR_R19B08_DOMAIN01 - ), "This test only works with the icon_benchmark grid." - test_run_diffusion_benchmark(grid, backend, benchmark) + test_run_diffusion_benchmark(definitions.Grids.MCH_OPR_R19B08_DOMAIN01, backend, benchmark) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index acf924a10b..1ea5d411b5 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -173,7 +173,10 @@ def reference( return dict(next_vn=next_vn) - @pytest.fixture(params=[True, False]) + @pytest.fixture( + params=[{"limited_area": la} for la in [True, False]], + ids=lambda param: f"limited_area[{param['limited_area']}]", + ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) horizontal_mask_for_3d_divdamp = data_alloc.random_field(grid, dims.EdgeDim) @@ -222,7 +225,7 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: and (second_order_divdamp_factor <= (4.0 * fourth_order_divdamp_factor)) ) - limited_area = request.param + limited_area = request.param["limited_area"] edge_domain = h_grid.domain(dims.EdgeDim) start_edge_nudging_level_2 = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) @@ -282,7 +285,6 @@ class TestApplyDivergenceDampingAndUpdateVnContinuousBenchmarking( ids=lambda param: f"limited_area[{param['limited_area']}]__divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: - # Use the parent class's fixture indirectly by calling its method, not the fixture itself base_data = TestApplyDivergenceDampingAndUpdateVn.input_data.__wrapped__( self, request, grid ) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index 8e61987b8a..6e9401fd06 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -83,28 +83,23 @@ class TestComputePerturbedQuantitiesAndInterpolation(stencil_tests.StencilTest): STATIC_PARAMS = { stencil_tests.StandardStaticVariants.NONE: (), stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( - "limited_area", "igradp_method", + "nflatlev", + "nflat_gradp", + "start_cell_lateral_boundary", "start_cell_lateral_boundary_level_3", "start_cell_halo_level_2", - "end_cell_end", "end_cell_halo", "end_cell_halo_level_2", - "start_cell_lateral_boundary", - "horizontal_start", - "horizontal_end", - "vertical_start", - "vertical_end", - "nflatlev", - "nflat_gradp", + "model_top", + "surface_level", ), stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( - "limited_area", "igradp_method", - "vertical_start", - "vertical_end", "nflatlev", "nflat_gradp", + "model_top", + "surface_level", ), } From 28d695acf560c47618a2087d681b419df87bbcd5 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 15 Oct 2025 14:51:30 +0200 Subject: [PATCH 051/111] Fix TestFusedVelocityAdvectionStencilVMomentumAndContravariant --- .../test_compute_advection_in_vertical_momentum_equation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index b56ae82550..22714168dc 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -502,6 +502,9 @@ class TestFusedVelocityAdvectionStencilVMomentumAndContravariant(stencil_tests.S "contravariant_corrected_w_at_cells_on_model_levels", "vertical_cfl", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: (), # For now compile time variants triger error in gt4py + } @staticmethod def reference( @@ -629,7 +632,8 @@ def reference( ) @pytest.fixture( - params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]] + params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], + ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", ) def input_data( self, grid: base.Grid, request: pytest.FixtureRequest From 9cd760af923abe72b024de15095201ac0b4eac3b Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 15 Oct 2025 17:14:41 +0200 Subject: [PATCH 052/111] Skip validation of TestComputeThetaRhoPressureGradientAndUpdateVn --- ...ues_and_pressure_gradient_and_update_vn.py | 3 ++- scripts/compare_icon_icon4py.py | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index 8903872bad..7485b47be4 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -120,7 +120,8 @@ def compute_theta_rho_face_value_by_miura_scheme_numpy( return rho_at_edges_on_model_levels, theta_v_at_edges_on_model_levels - +@pytest.mark.embedded_remap_error +@pytest.mark.skip_value_error @pytest.mark.uses_as_offset class TestComputeThetaRhoPressureGradientAndUpdateVn(stencil_tests.StencilTest): PROGRAM = compute_theta_rho_face_values_and_pressure_gradient_and_update_vn diff --git a/scripts/compare_icon_icon4py.py b/scripts/compare_icon_icon4py.py index 2474e63676..0754ec5305 100644 --- a/scripts/compare_icon_icon4py.py +++ b/scripts/compare_icon_icon4py.py @@ -48,6 +48,7 @@ "apply_diffusion_to_vn": None, "apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence": None, "apply_divergence_damping_and_update_vn": None, + "boundary_halo_cleanup": None, "calculate_diagnostic_quantities_for_turbulence": None, "calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools": None, "calculate_nabla2_and_smag_coefficients_for_vn": None, @@ -201,6 +202,29 @@ def load_gt4py_timers(filename: pathlib.Path, metric: str) -> tuple[dict, dict]: if len(metric_data) >= gt4py_unmatched_ncalls_threshold: unmatched_data[stencil] = metric_data + # Merge 'compute_hydrostatic_correction_term' stencil into 'compute_theta_rho_face_values_and_pressure_gradient_and_update_vn' + assert "compute_hydrostatic_correction_term" in unmatched_data + data["compute_theta_rho_face_values_and_pressure_gradient_and_update_vn"] = [ + a + b + for a, b in zip( + data["compute_theta_rho_face_values_and_pressure_gradient_and_update_vn"], + unmatched_data.pop("compute_hydrostatic_correction_term"), + strict=True, + ) + ] + + # Merge some stencils into 'boundary_halo_cleanup' + assert "boundary_halo_cleanup" not in data + data["boundary_halo_cleanup"] = [ + a + b + c + for a, b, c in zip( + unmatched_data.pop("compute_exner_from_rhotheta"), + unmatched_data.pop("compute_theta_and_exner"), + unmatched_data.pop("update_theta_v"), + strict=True, + ) + ] + diff = set(fortran_to_icon4py.keys()) - set(data.keys()) if len(diff) != 0: raise ValueError(f"Missing icon4py meas for these stencils: {diff}.") From ad3402060a18bda5afbd412d26063ca94720f4e3 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 15 Oct 2025 17:29:04 +0200 Subject: [PATCH 053/111] Remove unrelated changes --- ...ues_and_pressure_gradient_and_update_vn.py | 1 + scripts/compare_icon_icon4py.py | 24 ------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index 7485b47be4..c67b92cf18 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -120,6 +120,7 @@ def compute_theta_rho_face_value_by_miura_scheme_numpy( return rho_at_edges_on_model_levels, theta_v_at_edges_on_model_levels + @pytest.mark.embedded_remap_error @pytest.mark.skip_value_error @pytest.mark.uses_as_offset diff --git a/scripts/compare_icon_icon4py.py b/scripts/compare_icon_icon4py.py index 0754ec5305..2474e63676 100644 --- a/scripts/compare_icon_icon4py.py +++ b/scripts/compare_icon_icon4py.py @@ -48,7 +48,6 @@ "apply_diffusion_to_vn": None, "apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence": None, "apply_divergence_damping_and_update_vn": None, - "boundary_halo_cleanup": None, "calculate_diagnostic_quantities_for_turbulence": None, "calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools": None, "calculate_nabla2_and_smag_coefficients_for_vn": None, @@ -202,29 +201,6 @@ def load_gt4py_timers(filename: pathlib.Path, metric: str) -> tuple[dict, dict]: if len(metric_data) >= gt4py_unmatched_ncalls_threshold: unmatched_data[stencil] = metric_data - # Merge 'compute_hydrostatic_correction_term' stencil into 'compute_theta_rho_face_values_and_pressure_gradient_and_update_vn' - assert "compute_hydrostatic_correction_term" in unmatched_data - data["compute_theta_rho_face_values_and_pressure_gradient_and_update_vn"] = [ - a + b - for a, b in zip( - data["compute_theta_rho_face_values_and_pressure_gradient_and_update_vn"], - unmatched_data.pop("compute_hydrostatic_correction_term"), - strict=True, - ) - ] - - # Merge some stencils into 'boundary_halo_cleanup' - assert "boundary_halo_cleanup" not in data - data["boundary_halo_cleanup"] = [ - a + b + c - for a, b, c in zip( - unmatched_data.pop("compute_exner_from_rhotheta"), - unmatched_data.pop("compute_theta_and_exner"), - unmatched_data.pop("update_theta_v"), - strict=True, - ) - ] - diff = set(fortran_to_icon4py.keys()) - set(data.keys()) if len(diff) != 0: raise ValueError(f"Missing icon4py meas for these stencils: {diff}.") From efa6df477e49cd908df772ab3733cc8c10df33c8 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 15 Oct 2025 18:11:00 +0200 Subject: [PATCH 054/111] Trying to fix test_TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection --- ...ived_horizontal_winds_and_ke_and_contravariant_correction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index a8ed6aab2e..be12bc3ee1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -314,7 +314,7 @@ def input_data( c_intp = data_alloc.random_field(grid, dims.VertexDim, dims.V2CDim) nlev = grid.num_levels - nflatlev = 13 + nflatlev = 11 skip_compute_predictor_vertical_advection = request.param[ "skip_compute_predictor_vertical_advection" From 217333fd6365e2902e4207d7879ec3cc7d20deda Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 15 Oct 2025 18:15:23 +0200 Subject: [PATCH 055/111] Remove unnecessary UUID --- model/testing/src/icon4py/model/testing/definitions.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/definitions.py b/model/testing/src/icon4py/model/testing/definitions.py index fa04c32d41..201c7d13cf 100644 --- a/model/testing/src/icon4py/model/testing/definitions.py +++ b/model/testing/src/icon4py/model/testing/definitions.py @@ -128,10 +128,6 @@ class Grids: ) -class GridUUIDs: - MCH_OPR_R19B08_DOMAIN01: Final = "01f00602-c07e-cd84-b894-bd17fffd2720" - - @dataclasses.dataclass class Experiment: name: str From 05968bb89cd239ae6123ef1ab8c5af24a18f326d Mon Sep 17 00:00:00 2001 From: Christos Kotsalos Date: Thu, 30 Oct 2025 10:29:57 +0100 Subject: [PATCH 056/111] renaming: TestCBApplyDiffusionToVn to TestApplyDiffusionToVnContinuousBenchmarking --- .../tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index 024ad3f775..b85b6a74c3 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -166,5 +166,5 @@ def input_data(self, grid: base.Grid) -> dict: @pytest.mark.continuous_benchmarking -class TestCBApplyDiffusionToVn(TestApplyDiffusionToVn): +class TestApplyDiffusionToVnContinuousBenchmarking(TestApplyDiffusionToVn): pass From 36f54e8e42848e30c8dacfd8fdc7739f81670fda Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 5 Nov 2025 15:42:01 +0100 Subject: [PATCH 057/111] Fix issue with test_grid --- model/testing/src/icon4py/model/testing/pytest_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index f3eaf5d3a2..6e1c2f7b40 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -106,7 +106,7 @@ def pytest_collection_modifyitems(config, items): test_grid = config.getoption("--grid") for item in items: if (marker := item.get_closest_marker("continuous_benchmarking")) is not None: - if not test_grid.startswith("icon_benchmark"): + if test_grid is not None and not test_grid.startswith("icon_benchmark"): item.add_marker( pytest.mark.skip( reason="Continuous benchmarking tests only run with --grid icon_benchmark_{regional,global}." From 94021c05da69dfc80fd6fbb49f87a85a2986c36d Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 6 Nov 2025 10:12:42 +0100 Subject: [PATCH 058/111] Fix data_allocations import in test_calculate_horizontal_gradients_for_turbulence.py --- ..._calculate_horizontal_gradients_for_turbulence.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py index 0c4629f7af..fa6659390b 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py @@ -14,7 +14,7 @@ ) from icon4py.model.common import dimension as dims from icon4py.model.common.type_alias import vpfloat, wpfloat -from icon4py.model.common.utils.data_allocation import random_field, zero_field +from icon4py.model.common.utils import data_allocation as data_alloc from icon4py.model.testing.stencil_tests import StencilTest @@ -53,11 +53,11 @@ def reference( @pytest.fixture def input_data(self, grid): - w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) - geofac_grg_x = random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) - geofac_grg_y = random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) - dwdx = zero_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) - dwdy = zero_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) + w = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) + geofac_grg_x = data_alloc.random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) + geofac_grg_y = data_alloc.random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) + dwdx = data_alloc.zero_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) + dwdy = data_alloc.zero_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) return dict( w=w, From 4407d5c1d5bcbbc946827e15b5f4eb7faadf3291 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 6 Nov 2025 10:12:57 +0100 Subject: [PATCH 059/111] Increase DaCe bencher time limit --- ci/benchmark_bencher.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/benchmark_bencher.yml b/ci/benchmark_bencher.yml index 120c144277..0e2efa29b5 100644 --- a/ci/benchmark_bencher.yml +++ b/ci/benchmark_bencher.yml @@ -27,6 +27,7 @@ include: ICON4PY_ENABLE_TESTDATA_DOWNLOAD: false GT4PY_UNSTRUCTURED_HORIZONTAL_HAS_UNIT_STRIDE: true PYTHONOPTIMIZE: 2 + SLURM_TIMELIMIT: '04:00:00' # DaCe compilation takes long time so we increase the time limit benchmark_bencher_aarch64: extends: [.benchmark_model_stencils, .test_template_aarch64] From 0e26652cc6f32c5d537fd1c03c84266455469ca7 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 6 Nov 2025 11:13:04 +0100 Subject: [PATCH 060/111] Only run none and compile_time_domain in bencher --- ci/benchmark_bencher.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/benchmark_bencher.yml b/ci/benchmark_bencher.yml index 0e2efa29b5..8210af7051 100644 --- a/ci/benchmark_bencher.yml +++ b/ci/benchmark_bencher.yml @@ -17,7 +17,7 @@ include: stage: benchmark script: - !reference [.bencher_setup_env, setup] - - nox -s __bencher_feature_branch_CI-3.10 -- --backend=$BACKEND --grid=$GRID + - nox -s __bencher_feature_branch_CI-3.10 -- --backend=$BACKEND --grid=$GRID -k "none or compile_time_domain" parallel: matrix: - BACKEND: [dace_cpu, dace_gpu, gtfn_cpu, gtfn_gpu] From 565e350fdd7746195d97f7fe271e45a8a3565b51 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 6 Nov 2025 16:46:45 +0100 Subject: [PATCH 061/111] Revert changes in slurm timeout --- ci/benchmark_bencher.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/benchmark_bencher.yml b/ci/benchmark_bencher.yml index 8210af7051..3721309509 100644 --- a/ci/benchmark_bencher.yml +++ b/ci/benchmark_bencher.yml @@ -27,7 +27,6 @@ include: ICON4PY_ENABLE_TESTDATA_DOWNLOAD: false GT4PY_UNSTRUCTURED_HORIZONTAL_HAS_UNIT_STRIDE: true PYTHONOPTIMIZE: 2 - SLURM_TIMELIMIT: '04:00:00' # DaCe compilation takes long time so we increase the time limit benchmark_bencher_aarch64: extends: [.benchmark_model_stencils, .test_template_aarch64] From 05a7fbe35b163b95c82b6b6b2f9ee17fa25faf96 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 6 Nov 2025 17:11:56 +0100 Subject: [PATCH 062/111] Allow TestComputeThetaRhoPressureGradientAndUpdateVnContinuousBenchmarking to run only for benchmarking --- ..._rho_face_values_and_pressure_gradient_and_update_vn.py | 3 ++- model/testing/src/icon4py/model/testing/filters.py | 7 +++++-- model/testing/src/icon4py/model/testing/test_utils.py | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index c67b92cf18..ff2c267b22 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -567,6 +567,7 @@ def input_data(self, grid: base.Grid) -> dict: @pytest.mark.continuous_benchmarking +@pytest.mark.benchmark_only class TestComputeThetaRhoPressureGradientAndUpdateVnContinuousBenchmarking( TestComputeThetaRhoPressureGradientAndUpdateVn ): @@ -576,7 +577,7 @@ def input_data(self, grid: base.Grid) -> dict: self, grid ) base_data["is_iau_active"] = False - base_data["limited_area"] = False + base_data["limited_area"] = grid.limited_area base_data["nflatlev"] = 6 base_data["nflat_gradp"] = 35 return base_data diff --git a/model/testing/src/icon4py/model/testing/filters.py b/model/testing/src/icon4py/model/testing/filters.py index 06b2d22a56..d81f322fc5 100644 --- a/model/testing/src/icon4py/model/testing/filters.py +++ b/model/testing/src/icon4py/model/testing/filters.py @@ -78,8 +78,11 @@ class ItemFilter(NamedTuple): action=functools.partial(pytest.skip, "GTFN compilation is too slow for this test."), ), pytest.mark.skip_value_error.name: ItemFilter( - condition=lambda item: (grid := test_utils.get_fixture_value("grid", item)).limited_area - or grid.geometry_type == base.GeometryType.ICOSAHEDRON, + condition=lambda item: ( + (grid := test_utils.get_fixture_value("grid", item)).limited_area + or grid.geometry_type == base.GeometryType.ICOSAHEDRON + ) + and not test_utils.should_benchmark_only(item), action=functools.partial( pytest.skip, "Stencil does not support domain containing skip values. Consider shrinking domain.", diff --git a/model/testing/src/icon4py/model/testing/test_utils.py b/model/testing/src/icon4py/model/testing/test_utils.py index 0356291b5c..b450f6fbee 100644 --- a/model/testing/src/icon4py/model/testing/test_utils.py +++ b/model/testing/src/icon4py/model/testing/test_utils.py @@ -59,3 +59,10 @@ def is_dace(backend: gtx_typing.Backend | None) -> bool: def is_gtfn_backend(backend: gtx_typing.Backend | None) -> bool: return "gtfn" in backend.name if backend else False + + +def should_benchmark_only(item: pytest.Item) -> bool: + """Check if the test item is marked as benchmark_only.""" + return item.get_closest_marker("benchmark_only") is not None or item._request.getfixturevalue( # type: ignore[attr-defined] + "pytestconfig" + ).getoption("benchmark_only") From 6c3eccb83ab5f7288b8147ded5e2d4322eceb6ff Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 7 Nov 2025 12:12:28 +0100 Subject: [PATCH 063/111] Profile only compile_time_domain in bencher --- ci/benchmark_bencher.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/benchmark_bencher.yml b/ci/benchmark_bencher.yml index 3721309509..e63f3aca02 100644 --- a/ci/benchmark_bencher.yml +++ b/ci/benchmark_bencher.yml @@ -17,7 +17,7 @@ include: stage: benchmark script: - !reference [.bencher_setup_env, setup] - - nox -s __bencher_feature_branch_CI-3.10 -- --backend=$BACKEND --grid=$GRID -k "none or compile_time_domain" + - nox -s __bencher_feature_branch_CI-3.10 -- --backend=$BACKEND --grid=$GRID -k "compile_time_domain" parallel: matrix: - BACKEND: [dace_cpu, dace_gpu, gtfn_cpu, gtfn_gpu] From d1c6a9ebb4a4f8a3df863661897570ee15f80bc1 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 7 Nov 2025 17:49:38 +0100 Subject: [PATCH 064/111] Use proper values for TestComputeThetaRhoPressureGradientAndUpdateVnContinuousBenchmarking --- ..._face_values_and_pressure_gradient_and_update_vn.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index ff2c267b22..4b68543f0b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -295,7 +295,10 @@ def reference( perturbed_rho_at_cells_on_model_levels=perturbed_rho_at_cells_on_model_levels, perturbed_theta_v_at_cells_on_model_levels=perturbed_theta_v_at_cells_on_model_levels, ), - (rho_at_edges_on_model_levels, theta_v_at_edges_on_model_levels), + ( + np.zeros_like(rho_at_edges_on_model_levels), + np.zeros_like(theta_v_at_edges_on_model_levels), + ), ) # Remaining computations at edge points @@ -578,6 +581,7 @@ def input_data(self, grid: base.Grid) -> dict: ) base_data["is_iau_active"] = False base_data["limited_area"] = grid.limited_area - base_data["nflatlev"] = 6 - base_data["nflat_gradp"] = 35 + base_data["nflatlev"] = 5 + base_data["nflat_gradp"] = 34 + base_data["start_edge_lateral_boundary"] = 0 return base_data From 4d6e2d0c6efcf35b74ccf067c0dff52654c910d9 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 10 Nov 2025 11:17:57 +0100 Subject: [PATCH 065/111] Fix ComputeThetaRhoPressureGradientAndUpdateVn stencil test --- ..._rho_face_values_and_pressure_gradient_and_update_vn.py | 2 -- model/testing/src/icon4py/model/testing/filters.py | 7 ++----- model/testing/src/icon4py/model/testing/test_utils.py | 7 ------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index 4b68543f0b..c034d7521d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -122,7 +122,6 @@ def compute_theta_rho_face_value_by_miura_scheme_numpy( @pytest.mark.embedded_remap_error -@pytest.mark.skip_value_error @pytest.mark.uses_as_offset class TestComputeThetaRhoPressureGradientAndUpdateVn(stencil_tests.StencilTest): PROGRAM = compute_theta_rho_face_values_and_pressure_gradient_and_update_vn @@ -570,7 +569,6 @@ def input_data(self, grid: base.Grid) -> dict: @pytest.mark.continuous_benchmarking -@pytest.mark.benchmark_only class TestComputeThetaRhoPressureGradientAndUpdateVnContinuousBenchmarking( TestComputeThetaRhoPressureGradientAndUpdateVn ): diff --git a/model/testing/src/icon4py/model/testing/filters.py b/model/testing/src/icon4py/model/testing/filters.py index 4dead21f99..8886e1a2c2 100644 --- a/model/testing/src/icon4py/model/testing/filters.py +++ b/model/testing/src/icon4py/model/testing/filters.py @@ -70,11 +70,8 @@ class ItemFilter(NamedTuple): action=functools.partial(pytest.skip, "GTFN compilation is too slow for this test."), ), pytest.mark.skip_value_error.name: ItemFilter( - condition=lambda item: ( - (grid := test_utils.get_fixture_value("grid", item)).limited_area - or grid.geometry_type == base.GeometryType.ICOSAHEDRON - ) - and not test_utils.should_benchmark_only(item), + condition=lambda item: (grid := test_utils.get_fixture_value("grid", item)).limited_area + or grid.geometry_type == base.GeometryType.ICOSAHEDRON, action=functools.partial( pytest.skip, "Stencil does not support domain containing skip values. Consider shrinking domain.", diff --git a/model/testing/src/icon4py/model/testing/test_utils.py b/model/testing/src/icon4py/model/testing/test_utils.py index f447d0ad42..8d23824591 100644 --- a/model/testing/src/icon4py/model/testing/test_utils.py +++ b/model/testing/src/icon4py/model/testing/test_utils.py @@ -71,10 +71,3 @@ def is_dace(backend: gtx_typing.Backend | None) -> bool: def is_gtfn_backend(backend: gtx_typing.Backend | None) -> bool: return "gtfn" in backend.name if backend else False - - -def should_benchmark_only(item: pytest.Item) -> bool: - """Check if the test item is marked as benchmark_only.""" - return item.get_closest_marker("benchmark_only") is not None or item._request.getfixturevalue( # type: ignore[attr-defined] - "pytestconfig" - ).getoption("benchmark_only") From 6e60f81eec90d2fbdf29fbea4b501de563d6a27e Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 10 Nov 2025 11:29:41 +0100 Subject: [PATCH 066/111] Remove irrelevant comment --- model/testing/src/icon4py/model/testing/stencil_tests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index db6e4d62fb..fe39659b92 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -125,9 +125,8 @@ def test_and_benchmark( metrics_data = gtx_metrics.sources key = next(iter(metrics_data)) compute_samples = metrics_data[key].metrics["compute"].samples - # emprically exclude first few iterations as warmup + # emprically exclude first few iterations run for warmup initial_program_iterations_to_skip = 2 - # Exclude first sample unless running in benchmark_only mode benchmark.extra_info["gtx_metrics"] = compute_samples[ initial_program_iterations_to_skip: ] From edd7e4f494534d92c1de72bacfc70723c9da19f1 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 10 Nov 2025 12:59:14 +0100 Subject: [PATCH 067/111] Fix TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence --- ...ute_horizontal_gradients_for_turbulence.py | 59 ++++++++++--------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index a25b0e96c3..b1a90e54d5 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -69,12 +69,21 @@ def reference( nrdmax, interior_idx, halo_idx, + horizontal_start, + horizontal_end, + vertical_start, + vertical_end, **kwargs, ) -> dict: k = np.arange(w_old.shape[1]) cell = np.arange(w_old.shape[0]) reshaped_k = k[np.newaxis, :] reshaped_cell = cell[:, np.newaxis] + out_w, out_dwdx, out_dwdy = ( + np.zeros_like(w_old), + dwdx.copy(), + dwdy.copy(), + ) # create output arrays to update only the necessary slices if type_shear == 2: dwdx, dwdy = np.where( reshaped_k > 0, @@ -102,15 +111,32 @@ def reference( apply_nabla2_to_w_in_upper_damping_layer_numpy(w, diff_multfac_n2w, area, z_nabla2_c), w, ) - return dict(w=w, dwdx=dwdx, dwdy=dwdy) + subset = (slice(horizontal_start, horizontal_end), slice(vertical_start, vertical_end)) + out_w[subset] = w[subset] + out_dwdx[subset] = dwdx[subset] + out_dwdy[subset] = dwdy[subset] + return dict(w=out_w, dwdx=out_dwdx, dwdy=out_dwdy) @pytest.fixture def input_data(self, grid: base.Grid) -> dict: nrdmax = 13 - interior_idx = 1 - halo_idx = 5 + cell_domain = h_grid.domain(dims.CellDim) + interior_idx = grid.start_index(cell_domain(h_grid.Zone.INTERIOR)) # 0 for simple grid + halo_idx = grid.end_index( + cell_domain(h_grid.Zone.LOCAL) + ) # same as horizontal_end for simple grid type_shear = 2 + def _get_start_index_for_w_diffusion() -> int32: + return ( + grid.start_index(cell_domain(h_grid.Zone.NUDGING)) + if grid.limited_area + else grid.start_index(cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_4)) + ) + + horizontal_start = _get_start_index_for_w_diffusion() + horizontal_end = grid.end_index(cell_domain(h_grid.Zone.HALO)) + geofac_grg_x = random_field(grid, dims.CellDim, dims.C2E2CODim) geofac_grg_y = random_field(grid, dims.CellDim, dims.C2E2CODim) diff_multfac_n2w = random_field(grid, dims.KDim) @@ -138,8 +164,8 @@ def input_data(self, grid: base.Grid) -> dict: w=w, dwdx=dwdx, dwdy=dwdy, - horizontal_start=0, - horizontal_end=grid.num_cells, + horizontal_start=horizontal_start, + horizontal_end=horizontal_end, vertical_start=0, vertical_end=grid.num_levels, ) @@ -149,25 +175,4 @@ def input_data(self, grid: base.Grid) -> dict: class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulenceContinuousBenchmarking( TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence ): - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict: - # Use the parent class's fixture indirectly by calling its method, not the fixture itself - base_data = ( - TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence.input_data.__wrapped__( - self, grid - ) - ) - cell_domain = h_grid.domain(dims.CellDim) - base_data["interior_idx"] = grid.start_index(cell_domain(h_grid.Zone.INTERIOR)) - base_data["halo_idx"] = grid.end_index(cell_domain(h_grid.Zone.LOCAL)) - - def _get_start_index_for_w_diffusion() -> int32: - return ( - grid.start_index(cell_domain(h_grid.Zone.NUDGING)) - if grid.limited_area - else grid.start_index(cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_4)) - ) - - base_data["horizontal_start"] = _get_start_index_for_w_diffusion() - base_data["horizontal_end"] = grid.end_index(cell_domain(h_grid.Zone.HALO)) - return base_data + pass From 4239768afa1fd0a29ded0ae7e466cddadf8f5f3d Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 10 Nov 2025 15:38:50 +0100 Subject: [PATCH 068/111] Use the test functions of StencilTest only and replace static_variant fixture if necessary --- .../icon4py/model/testing/stencil_tests.py | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index fe39659b92..8610bfa3ed 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -249,23 +249,30 @@ def __init_subclass__(cls, **kwargs: Any) -> None: pytest_prefix = "test_" - setattr(cls, f"{pytest_prefix}{cls.__name__}", test_and_benchmark) - - # in case a test inherits from another test overload the test function of its parent and skip it - # to avoid running the tests of its parent - if cls.__base__ is not None and cls.__base__ != StencilTest: - - def skipped_test() -> None: - pass - - setattr(cls, f"{pytest_prefix}{cls.__base__.__name__}", pytest.mark.skip(skipped_test)) + # only add `test_and_benchmark` to direct subclasses of `StencilTest`. Inherited tests can use the same function. + if cls.__base__ == StencilTest: + setattr(cls, f"{pytest_prefix}{cls.__name__}", test_and_benchmark) # decorate `static_variant` with parametrized fixtures, since the # parametrization is only available in the concrete subclass definition - # Check if cls.static_variant is already a pytest fixture to allow inheriting from other StencilTests + # Check if cls.static_variant has changes in inherited subclasses and update it accordingly if hasattr(cls.static_variant, "_pytestfixturefunction"): - # Already a fixture, do nothing - pass + base_static = getattr(cls.__base__, "STATIC_PARAMS", None) + if base_static != cls.STATIC_PARAMS: + if cls.STATIC_PARAMS is None: + cls.static_variant = staticmethod(pytest.fixture(lambda: ())) # type: ignore[method-assign, assignment] + else: + # copy of `static_variant` + def _new_static_variant(request: pytest.FixtureRequest) -> Sequence[str]: + _, variant = request.param + return () if variant is None else variant + + # replace with new parametrized fixture + cls.static_variant = staticmethod( # type: ignore[method-assign] + pytest.fixture( + params=cls.STATIC_PARAMS.items(), scope="class", ids=lambda p: p[0] + )(_new_static_variant) + ) elif cls.STATIC_PARAMS is None: # not parametrized, return an empty tuple cls.static_variant = staticmethod(pytest.fixture(lambda: ())) # type: ignore[method-assign, assignment] # we override with a non-parametrized function From bd0359955e4c044871f3d7c4b67f6b4743e696c8 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 12 Nov 2025 11:15:29 +0100 Subject: [PATCH 069/111] Add apply_extra_diffusion_on_vn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Philip Müller <147368808+philip-paul-mueller@users.noreply.github.com> --- .../test_compute_advection_in_horizontal_momentum_equation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index 70c6a4d051..86409be231 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -146,11 +146,13 @@ class TestFusedVelocityAdvectionStencilsHMomentum(stencil_tests.StencilTest): "end_index_of_damping_layer", "vertical_start", "vertical_end", + "apply_extra_diffusion_on_vn", ), stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( "end_index_of_damping_layer", "vertical_start", "vertical_end", + "apply_extra_diffusion_on_vn", ), } From 91e6e3fb717a4bf579ab803d76a8adf70de42411 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 10:50:14 +0100 Subject: [PATCH 070/111] Removed ContinuousBenchmarking flavors of simple stencil tests --- .../test_apply_diffusion_to_vn.py | 6 +---- ...ute_horizontal_gradients_for_turbulence.py | 8 +----- ...ate_nabla2_and_smag_coefficients_for_vn.py | 26 ++++++------------- .../stencil_tests/test_calculate_nabla4.py | 6 +---- ...advection_in_vertical_momentum_equation.py | 8 +----- ...est_compute_hydrostatic_correction_term.py | 8 +----- .../test_init_cell_kdim_field_with_zero_wp.py | 6 +---- ...d_compute_temperature_vertical_gradient.py | 8 +----- .../test_update_mass_flux_weighted.py | 6 +---- ...est_mo_intp_rbf_rbf_vec_interpol_vertex.py | 6 +---- 10 files changed, 17 insertions(+), 71 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index b85b6a74c3..debdae974f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -26,6 +26,7 @@ @pytest.mark.uses_concat_where +@pytest.mark.continuous_benchmarking class TestApplyDiffusionToVn(StencilTest): PROGRAM = apply_diffusion_to_vn OUTPUTS = ("vn",) @@ -163,8 +164,3 @@ def input_data(self, grid: base.Grid) -> dict: vertical_start=0, vertical_end=grid.num_levels, ) - - -@pytest.mark.continuous_benchmarking -class TestApplyDiffusionToVnContinuousBenchmarking(TestApplyDiffusionToVn): - pass diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index b1a90e54d5..4e9652ac76 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -30,6 +30,7 @@ @pytest.mark.embedded_remap_error +@pytest.mark.continuous_benchmarking class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence(StencilTest): PROGRAM = apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence OUTPUTS = ("w", "dwdx", "dwdy") @@ -169,10 +170,3 @@ def _get_start_index_for_w_diffusion() -> int32: vertical_start=0, vertical_end=grid.num_levels, ) - - -@pytest.mark.continuous_benchmarking -class TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulenceContinuousBenchmarking( - TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence -): - pass diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index 5d7a01bf01..1c60fe97c3 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -19,6 +19,7 @@ from icon4py.model.testing import definitions, stencil_tests +@pytest.mark.continuous_benchmarking class TestCalculateNabla2AndSmagCoefficientsForVn(stencil_tests.StencilTest): PROGRAM = calculate_nabla2_and_smag_coefficients_for_vn OUTPUTS = ("kh_smag_e", "kh_smag_ec", "z_nabla2_e") @@ -185,6 +186,11 @@ def input_data(self, grid: base.Grid) -> dict: kh_smag_e = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) kh_smag_ec = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) + edge_domain = h_grid.domain(dims.EdgeDim) + horizontal_start = grid.start_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5)) + horizontal_end = grid.end_index(edge_domain(h_grid.Zone.HALO_LEVEL_2)) + assert horizontal_start < horizontal_end + return dict( diff_multfac_smag=diff_multfac_smag, tangent_orientation=tangent_orientation, @@ -202,24 +208,8 @@ def input_data(self, grid: base.Grid) -> dict: kh_smag_ec=kh_smag_ec, z_nabla2_e=z_nabla2_e, smag_offset=smag_offset, - horizontal_start=0, - horizontal_end=grid.num_edges, + horizontal_start=horizontal_start, + horizontal_end=horizontal_end, vertical_start=0, vertical_end=grid.num_levels, ) - - -@pytest.mark.continuous_benchmarking -class TestCalculateNabla2AndSmagCoefficientsForVnContinuousBenchmarking( - TestCalculateNabla2AndSmagCoefficientsForVn -): - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict: - base_data = TestCalculateNabla2AndSmagCoefficientsForVn.input_data.__wrapped__(self, grid) - edge_domain = h_grid.domain(dims.EdgeDim) - horizontal_start = grid.start_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5)) - horizontal_end = grid.end_index(edge_domain(h_grid.Zone.HALO_LEVEL_2)) - assert horizontal_start < horizontal_end - base_data["horizontal_start"] = 0 - base_data["horizontal_end"] = grid.num_edges - return base_data diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py index 064c59e23f..dc8f9ac4ba 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py @@ -55,6 +55,7 @@ def calculate_nabla4_numpy( return z_nabla4_e2 +@pytest.mark.continuous_benchmarking class TestCalculateNabla4(StencilTest): PROGRAM = calculate_nabla4 OUTPUTS = ("z_nabla4_e2",) @@ -128,8 +129,3 @@ def input_data(self, grid) -> dict: vertical_start=0, vertical_end=gtx.int32(grid.num_levels), ) - - -@pytest.mark.continuous_benchmarking -class TestCalculateNabla4ContinuousBenchmarking(TestCalculateNabla4): - pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 22714168dc..ee9855b69d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -494,6 +494,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala @pytest.mark.embedded_remap_error +@pytest.mark.continuous_benchmarking class TestFusedVelocityAdvectionStencilVMomentumAndContravariant(stencil_tests.StencilTest): PROGRAM = compute_contravariant_correction_and_advection_in_vertical_momentum_equation OUTPUTS = ( @@ -709,10 +710,3 @@ def input_data( vertical_start=vertical_start, vertical_end=vertical_end, ) - - -@pytest.mark.continuous_benchmarking -class TestFusedVelocityAdvectionStencilVMomentumAndContravariantContinuousBenchmarking( - TestFusedVelocityAdvectionStencilVMomentumAndContravariant -): - pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py index 8a615067f9..7eed5b8929 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py @@ -88,6 +88,7 @@ def _apply_index_field( @pytest.mark.uses_as_offset +@pytest.mark.continuous_benchmarking class TestComputeHydrostaticCorrectionTerm(StencilTest): OUTPUTS = ("z_hydro_corr",) PROGRAM = compute_hydrostatic_correction_term @@ -176,10 +177,3 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala vertical_start=gtx.int32(grid.num_levels - 1), vertical_end=gtx.int32(grid.num_levels), ) - - -@pytest.mark.continuous_benchmarking -class TestComputeHydrostaticCorrectionTermContinuousBenchmarking( - TestComputeHydrostaticCorrectionTerm -): - pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py index 943d0419d0..a0c2e0f902 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py @@ -22,6 +22,7 @@ from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest +@pytest.mark.continuous_benchmarking class TestInitCellKdimFieldWithZeroWp(StencilTest): PROGRAM = init_cell_kdim_field_with_zero_wp OUTPUTS = ("field_with_zero_wp",) @@ -59,8 +60,3 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala vertical_start=0, vertical_end=gtx.int32(grid.num_levels), ) - - -@pytest.mark.continuous_benchmarking -class TestInitCellKdimFieldWithZeroWpContinuousBenchmarking(TestInitCellKdimFieldWithZeroWp): - pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py index 58e876c9da..e9ab186490 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py @@ -34,6 +34,7 @@ from icon4py.model.testing import stencil_tests +@pytest.mark.continuous_benchmarking class TestInterpolateRhoThetaVToHalfLevelsAndComputePressureBuoyancyAcceleration( stencil_tests.StencilTest ): @@ -249,10 +250,3 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala vertical_start=1, vertical_end=grid.num_levels, ) - - -@pytest.mark.continuous_benchmarking -class TestInterpolateRhoThetaVToHalfLevelsAndComputePressureBuoyancyAccelerationContinuousBenchmarking( - TestInterpolateRhoThetaVToHalfLevelsAndComputePressureBuoyancyAcceleration -): - pass diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py index 0013e7e1da..5a0e5422da 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py @@ -22,6 +22,7 @@ from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest +@pytest.mark.continuous_benchmarking class TestUpdateMassFluxWeighted(StencilTest): PROGRAM = update_mass_flux_weighted OUTPUTS = ("mass_flx_ic",) @@ -84,8 +85,3 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala vertical_start=0, vertical_end=gtx.int32(grid.num_levels), ) - - -@pytest.mark.continuous_benchmarking -class TestUpdateMassFluxWeightedContinuousBenchmarking(TestUpdateMassFluxWeighted): - pass diff --git a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py index 2ddde5d342..2137f5e587 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py @@ -21,6 +21,7 @@ from icon4py.model.testing.stencil_tests import StandardStaticVariants, StencilTest +@pytest.mark.continuous_benchmarking class TestMoIntpRbfRbfVecInterpolVertex(StencilTest): PROGRAM = mo_intp_rbf_rbf_vec_interpol_vertex OUTPUTS = ("p_u_out", "p_v_out") @@ -74,8 +75,3 @@ def input_data(self, grid: base.Grid) -> dict: vertical_start=0, vertical_end=gtx.int32(grid.num_levels), ) - - -@pytest.mark.continuous_benchmarking -class TestMoIntpRbfRbfVecInterpolVertexContinuousBenchmarking(TestMoIntpRbfRbfVecInterpolVertex): - pass From fa5cd9f66d0b953c7cc5c8d58eae14b11bd0d229 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 11:10:27 +0100 Subject: [PATCH 071/111] Clean up TestApplyDivergenceDampingAndUpdateVn --- ..._apply_divergence_damping_and_update_vn.py | 65 +++++-------------- 1 file changed, 18 insertions(+), 47 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index 1ea5d411b5..c8da2677b6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -28,6 +28,7 @@ @pytest.mark.embedded_remap_error +@pytest.mark.continuous_benchmarking class TestApplyDivergenceDampingAndUpdateVn(test_helpers.StencilTest): PROGRAM = apply_divergence_damping_and_update_vn OUTPUTS = ("next_vn",) @@ -174,8 +175,18 @@ def reference( return dict(next_vn=next_vn) @pytest.fixture( - params=[{"limited_area": la} for la in [True, False]], - ids=lambda param: f"limited_area[{param['limited_area']}]", + params=[ + {"divdamp_order": do, "is_iau_active": ia} + for do, ia in itertools.product( + [ + DivergenceDampingOrder.SECOND_ORDER, + DivergenceDampingOrder.FOURTH_ORDER, + DivergenceDampingOrder.COMBINED, + ], + [True, False], + ) + ], + ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) @@ -210,11 +221,11 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: advection_implicit_weight_parameter = 0.75 advection_explicit_weight_parameter = 0.25 iau_wgt_dyn = 1.0 - is_iau_active = True + is_iau_active = request.param["is_iau_active"] fourth_order_divdamp_factor = 0.004 - second_order_divdamp_factor = 0.012 - divdamp_order = 24 - second_order_divdamp_scaling_coeff = 194588.14247428576 + second_order_divdamp_factor = 0.032 + divdamp_order = request.param["divdamp_order"] + second_order_divdamp_scaling_coeff = 34497.62082646618 # for icon-ch1(_medium) apply_2nd_order_divergence_damping = (divdamp_order == divergence_damp_order.COMBINED) and ( second_order_divdamp_scaling_coeff > 1.0e-6 ) @@ -225,7 +236,7 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: and (second_order_divdamp_factor <= (4.0 * fourth_order_divdamp_factor)) ) - limited_area = request.param["limited_area"] + limited_area = grid.limited_area if hasattr(grid, "limited_area") else True edge_domain = h_grid.domain(dims.EdgeDim) start_edge_nudging_level_2 = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) @@ -263,43 +274,3 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: vertical_start=0, vertical_end=grid.num_levels, ) - - -@pytest.mark.continuous_benchmarking -class TestApplyDivergenceDampingAndUpdateVnContinuousBenchmarking( - TestApplyDivergenceDampingAndUpdateVn -): - @pytest.fixture( - params=[ - {"limited_area": la, "divdamp_order": do, "is_iau_active": ia} - for la, do, ia in itertools.product( - [True, False], - [ - DivergenceDampingOrder.SECOND_ORDER, - DivergenceDampingOrder.FOURTH_ORDER, - DivergenceDampingOrder.COMBINED, - ], - [True, False], - ) - ], - ids=lambda param: f"limited_area[{param['limited_area']}]__divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]", - ) - def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: - base_data = TestApplyDivergenceDampingAndUpdateVn.input_data.__wrapped__( - self, request, grid - ) - base_data["is_iau_active"] = False - fourth_order_divdamp_factor = 0.004 - second_order_divdamp_factor = 0.032 - divdamp_order = request.param["divdamp_order"] - base_data["second_order_divdamp_scaling_coeff"] = 34497.62082646618 # for icon-ch1(_medium) - base_data["apply_2nd_order_divergence_damping"] = ( - divdamp_order == divergence_damp_order.COMBINED - ) and (base_data["second_order_divdamp_scaling_coeff"] > 1.0e-6) - base_data["apply_4th_order_divergence_damping"] = ( - divdamp_order == divergence_damp_order.FOURTH_ORDER - ) or ( - (divdamp_order == divergence_damp_order.COMBINED) - and (second_order_divdamp_factor <= (4.0 * fourth_order_divdamp_factor)) - ) - return base_data From 20def74a6c83ca710f92d43e8fab4490bc827120 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 11:19:08 +0100 Subject: [PATCH 072/111] Fix end_index_of_damping_layer value in TestFusedVelocityAdvectionStencilVMomentum --- ..._advection_in_vertical_momentum_equation.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index ee9855b69d..11a899f28f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -269,6 +269,7 @@ def compute_advective_vertical_wind_tendency_and_apply_diffusion_numpy( @pytest.mark.embedded_remap_error +@pytest.mark.continuous_benchmarking class TestFusedVelocityAdvectionStencilVMomentum(stencil_tests.StencilTest): PROGRAM = compute_advection_in_vertical_momentum_equation OUTPUTS = ( @@ -444,7 +445,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala dtime = 2.0 cfl_w_limit = 0.65 / dtime - end_index_of_damping_layer = 5 + end_index_of_damping_layer = 12 cell_domain = h_grid.domain(dims.CellDim) horizontal_start = grid.start_index(cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_4)) @@ -482,17 +483,6 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala ) -@pytest.mark.continuous_benchmarking -class TestFusedVelocityAdvectionStencilVMomentumContinuousBenchmarking( - TestFusedVelocityAdvectionStencilVMomentum -): - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: - base_data = TestFusedVelocityAdvectionStencilVMomentum.input_data.__wrapped__(self, grid) - base_data["end_index_of_damping_layer"] = 12 - return base_data - - @pytest.mark.embedded_remap_error @pytest.mark.continuous_benchmarking class TestFusedVelocityAdvectionStencilVMomentumAndContravariant(stencil_tests.StencilTest): @@ -674,8 +664,8 @@ def input_data( "skip_compute_predictor_vertical_advection" ] - nflatlev = 3 - end_index_of_damping_layer = 5 + nflatlev = 5 + end_index_of_damping_layer = 12 cell_domain = h_grid.domain(dims.CellDim) horizontal_start = grid.start_index(cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_4)) From 69fb25b9ef4b4013d747c43f55cb023154232fed Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 11:29:57 +0100 Subject: [PATCH 073/111] Cleaned up TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection --- ...nds_and_ke_and_contravariant_correction.py | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index be12bc3ee1..928a7d0304 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -142,6 +142,7 @@ def extrapolate_to_surface_numpy(wgtfacq_e: np.ndarray, vn: np.ndarray) -> np.nd @pytest.mark.embedded_remap_error +@pytest.mark.continuous_benchmarking class TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection( stencil_tests.StencilTest ): @@ -314,14 +315,17 @@ def input_data( c_intp = data_alloc.random_field(grid, dims.VertexDim, dims.V2CDim) nlev = grid.num_levels - nflatlev = 11 + nflatlev = 5 skip_compute_predictor_vertical_advection = request.param[ "skip_compute_predictor_vertical_advection" ] - horizontal_start = 0 - horizontal_end = grid.num_edges + edge_domain = h_grid.domain(dims.EdgeDim) + horizontal_start = grid.start_index( + edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5) + ) + horizontal_end = grid.end_index(edge_domain(h_grid.Zone.HALO_LEVEL_2)) vertical_start = 0 vertical_end = nlev + 1 @@ -350,31 +354,3 @@ def input_data( vertical_start=vertical_start, vertical_end=vertical_end, ) - - -@pytest.mark.continuous_benchmarking -class TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrectionContinuousBenchmarking( - TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection -): - @pytest.fixture( - params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], - ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", - ) - def input_data( - self, grid: base.Grid, request: pytest.FixtureRequest - ) -> dict[str, gtx.Field | state_utils.ScalarType]: - base_data = TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection.input_data.__wrapped__( - self, grid, request - ) - base_data["skip_compute_predictor_vertical_advection"] = request.param[ - "skip_compute_predictor_vertical_advection" - ] - base_data["nflatlev"] = 6 - edge_domain = h_grid.domain(dims.EdgeDim) - base_data["horizontal_start"] = grid.start_index( - edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5) - ) - base_data["horizontal_end"] = grid.end_index(edge_domain(h_grid.Zone.HALO_LEVEL_2)) - base_data["vertical_start"] = 0 - base_data["vertical_end"] = grid.num_levels + 1 - return base_data From a67afb9f0583448c6354426e3bdf457f8a1fac8a Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 11:59:08 +0100 Subject: [PATCH 074/111] Cleaned up TestComputePerturbedQuantitiesAndInterpolation --- ..._perturbed_quantities_and_interpolation.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index 6e9401fd06..29f45e9bb1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -65,6 +65,7 @@ def compute_first_vertical_derivative_numpy( @pytest.mark.uses_concat_where +@pytest.mark.continuous_benchmarking class TestComputePerturbedQuantitiesAndInterpolation(stencil_tests.StencilTest): PROGRAM = compute_perturbed_quantities_and_interpolation OUTPUTS = ( @@ -419,8 +420,8 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala start_cell_halo_level_2 = grid.start_index(cell_domain(h_grid.Zone.HALO_LEVEL_2)) end_cell_halo_level_2 = grid.end_index(cell_domain(h_grid.Zone.HALO_LEVEL_2)) - nflatlev = 4 - nflat_gradp = 27 + nflatlev = 5 + nflat_gradp = 35 return dict( temporal_extrapolation_of_perturbed_exner=temporal_extrapolation_of_perturbed_exner, @@ -461,17 +462,3 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala model_top=0, surface_level=grid.num_levels + 1, ) - - -@pytest.mark.continuous_benchmarking -class TestComputePerturbedQuantitiesAndInterpolationContinuousBenchmarking( - TestComputePerturbedQuantitiesAndInterpolation -): - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: - base_data = TestComputePerturbedQuantitiesAndInterpolation.input_data.__wrapped__( - self, grid - ) - base_data["nflatlev"] = 6 - base_data["nflat_gradp"] = 35 - return base_data From 9f34e1c04a5f1eb85980ef97c18b186094e22aba Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 14:16:20 +0100 Subject: [PATCH 075/111] Clean up TestComputeThetaRhoPressureGradientAndUpdateVn --- ...ues_and_pressure_gradient_and_update_vn.py | 37 +++++++------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index c034d7521d..a4b04c451c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -123,6 +123,7 @@ def compute_theta_rho_face_value_by_miura_scheme_numpy( @pytest.mark.embedded_remap_error @pytest.mark.uses_as_offset +@pytest.mark.continuous_benchmarking class TestComputeThetaRhoPressureGradientAndUpdateVn(stencil_tests.StencilTest): PROGRAM = compute_theta_rho_face_values_and_pressure_gradient_and_update_vn OUTPUTS = ( @@ -433,8 +434,11 @@ def at_neighbor(i: int) -> np.ndarray: next_vn=next_vn, ) - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict: + @pytest.fixture( + params=[{"is_iau_active": value} for value in [True, False]], + ids=lambda param: f"is_iau_active[{param['is_iau_active']}]", + ) + def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: geofac_grg_x = data_alloc.random_field(grid, dims.CellDim, dims.C2E2CODim) geofac_grg_y = data_alloc.random_field(grid, dims.CellDim, dims.C2E2CODim) current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) @@ -502,19 +506,21 @@ def input_data(self, grid: base.Grid) -> dict: dtime = 0.9 iau_wgt_dyn = 1.0 - is_iau_active = True - limited_area = True + is_iau_active = request.param["is_iau_active"] + limited_area = limited_area = grid.limited_area if hasattr(grid, "limited_area") else True edge_domain = h_grid.domain(dims.EdgeDim) - start_edge_lateral_boundary = grid.end_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY)) + start_edge_lateral_boundary = grid.start_index( + edge_domain(h_grid.Zone.LATERAL_BOUNDARY) + ) start_edge_lateral_boundary_level_7 = grid.start_index( edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_7) ) start_edge_nudging_level_2 = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) end_edge_nudging = grid.end_index(edge_domain(h_grid.Zone.NUDGING)) end_edge_halo = grid.end_index(edge_domain(h_grid.Zone.HALO)) - nflatlev = 4 - nflat_gradp = 27 + nflatlev = 5 + nflat_gradp = 34 return dict( rho_at_edges_on_model_levels=rho_at_edges_on_model_levels, @@ -566,20 +572,3 @@ def input_data(self, grid: base.Grid) -> dict: vertical_start=0, vertical_end=grid.num_levels, ) - - -@pytest.mark.continuous_benchmarking -class TestComputeThetaRhoPressureGradientAndUpdateVnContinuousBenchmarking( - TestComputeThetaRhoPressureGradientAndUpdateVn -): - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict: - base_data = TestComputeThetaRhoPressureGradientAndUpdateVn.input_data.__wrapped__( - self, grid - ) - base_data["is_iau_active"] = False - base_data["limited_area"] = grid.limited_area - base_data["nflatlev"] = 5 - base_data["nflat_gradp"] = 34 - base_data["start_edge_lateral_boundary"] = 0 - return base_data From 5e777090e34ed760f0913fd0b1f5d5a6c31838e6 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 14:17:16 +0100 Subject: [PATCH 076/111] Fix values of end_index_of_damping_layer and nflat_gradp --- .../test_compute_perturbed_quantities_and_interpolation.py | 2 +- .../test_vertically_implicit_dycore_solver_at_corrector_step.py | 2 +- .../test_vertically_implicit_dycore_solver_at_predictor_step.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index 29f45e9bb1..aa633e9407 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -421,7 +421,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala end_cell_halo_level_2 = grid.end_index(cell_domain(h_grid.Zone.HALO_LEVEL_2)) nflatlev = 5 - nflat_gradp = 35 + nflat_gradp = 34 return dict( temporal_extrapolation_of_perturbed_exner=temporal_extrapolation_of_perturbed_exner, diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 16cc63d8f1..bde8840bed 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -563,6 +563,6 @@ def input_data( base_data["at_last_substep"] = request.param["at_last_substep"] base_data["lprep_adv"] = request.param["lprep_adv"] base_data["is_iau_active"] = False - base_data["end_index_of_damping_layer"] = 13 + base_data["end_index_of_damping_layer"] = 12 base_data["kstart_moist"] = 0 return base_data diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 1b032bee50..572831c504 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -542,6 +542,6 @@ def input_data( base_data["at_first_substep"] = request.param["at_first_substep"] base_data["is_iau_active"] = False base_data["divdamp_type"] = 32 - base_data["end_index_of_damping_layer"] = 13 + base_data["end_index_of_damping_layer"] = 12 base_data["kstart_moist"] = 0 return base_data From 748cd678a3942d61cb9176444bea42d172b8bd84 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 15:23:11 +0100 Subject: [PATCH 077/111] Clean up vertically implicit solvers --- ...mplicit_dycore_solver_at_corrector_step.py | 45 ++++--------------- ...mplicit_dycore_solver_at_predictor_step.py | 45 +++++++------------ 2 files changed, 24 insertions(+), 66 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index bde8840bed..bf61cbaeb2 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -52,6 +52,7 @@ @pytest.mark.uses_concat_where +@pytest.mark.continuous_benchmarking class TestVerticallyImplicitSolverAtCorrectorStep(stencil_tests.StencilTest): PROGRAM = vertically_implicit_solver_at_corrector_step OUTPUTS = ( @@ -400,14 +401,15 @@ def reference( @pytest.fixture( params=[ - {"at_first_substep": afs, "at_last_substep": als, "lprep_adv": la} - for afs, als, la in itertools.product(*([(True, False)] * 3)) + {"at_first_substep": afs, "at_last_substep": als, "lprep_adv": la, "is_iau_active": ia} + for afs, als, la, ia in itertools.product(*([(True, False)] * 4)) if not (afs and als) ], ids=lambda p: ( f"at_first_substep[{p['at_first_substep']}]__" f"at_last_substep[{p['at_last_substep']}]__" - f"lprep_adv[{p['lprep_adv']}]" + f"lprep_adv[{p['lprep_adv']}]__" + f"is_iau_active[{p['is_iau_active']}]" ), ) def input_data( @@ -469,12 +471,12 @@ def input_data( lprep_adv = request.param["lprep_adv"] r_nsubsteps = 0.5 - is_iau_active = True + is_iau_active = request.param["is_iau_active"] at_first_substep = request.param["at_first_substep"] rayleigh_type = 2 - end_index_of_damping_layer = 3 + end_index_of_damping_layer = 12 at_last_substep = request.param["at_last_substep"] - kstart_moist = 1 + kstart_moist = 0 dtime = 0.001 veladv_offctr = 0.25 advection_explicit_weight_parameter = 0.5 - veladv_offctr @@ -535,34 +537,3 @@ def input_data( vertical_start_index_model_top=gtx.int32(0), vertical_end_index_model_surface=gtx.int32(grid.num_levels + 1), ) - - -@pytest.mark.continuous_benchmarking -class TestVerticallyImplicitSolverAtCorrectorStepContinuousBenchmarking( - TestVerticallyImplicitSolverAtCorrectorStep -): - @pytest.fixture( - params=[ - {"at_first_substep": afs, "at_last_substep": als, "lprep_adv": la} - for afs, als, la in itertools.product(*([(True, False)] * 3)) - if not (afs and als) - ], - ids=lambda p: ( - f"at_first_substep[{p['at_first_substep']}]__" - f"at_last_substep[{p['at_last_substep']}]__" - f"lprep_adv[{p['lprep_adv']}]" - ), - ) - def input_data( - self, request: pytest.FixtureRequest, grid: base.Grid - ) -> dict[str, gtx.Field | state_utils.ScalarType]: - base_data = TestVerticallyImplicitSolverAtCorrectorStep.input_data.__wrapped__( - self, request, grid - ) - base_data["at_first_substep"] = request.param["at_first_substep"] - base_data["at_last_substep"] = request.param["at_last_substep"] - base_data["lprep_adv"] = request.param["lprep_adv"] - base_data["is_iau_active"] = False - base_data["end_index_of_damping_layer"] = 12 - base_data["kstart_moist"] = 0 - return base_data diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 572831c504..842c51a973 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -5,6 +5,7 @@ # # Please, refer to the LICENSE file in the root directory. # SPDX-License-Identifier: BSD-3-Clause +import itertools from typing import Any import gt4py.next as gtx @@ -54,6 +55,7 @@ @pytest.mark.uses_concat_where +@pytest.mark.continuous_benchmarking class TestVerticallyImplicitSolverAtPredictorStep(stencil_tests.StencilTest): PROGRAM = vertically_implicit_solver_at_predictor_step OUTPUTS = ( @@ -396,8 +398,15 @@ def reference( ) @pytest.fixture( - params=[{"at_first_substep": value} for value in [True, False]], - ids=lambda param: f"at_first_substep[{param['at_first_substep']}]", + params=[ + {"at_first_substep": afs, "is_iau_active": ia, "divdamp_type": dvdmpt} + for afs, ia, dvdmpt in itertools.product( + [True, False], + [True, False], + [3,32] + ) + ], + ids=lambda param: f"at_first_substep[{param['at_first_substep']}]__is_iau_active[{param['is_iau_active']}]__divdamp_type[{param['divdamp_type']}]", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid @@ -456,13 +465,13 @@ def input_data( dwdz_at_cells_on_model_levels = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) exner_dynamical_increment = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) - is_iau_active = True + is_iau_active = request.param["is_iau_active"] at_first_substep = request.param["at_first_substep"] rayleigh_type = 2 - divdamp_type = 3 - end_index_of_damping_layer = 3 - kstart_moist = 1 - flat_level_index_plus1 = 3 + divdamp_type = request.param["divdamp_type"] + end_index_of_damping_layer = 12 + kstart_moist = 0 + flat_level_index_plus1 = 6 dtime = 0.001 iau_wgt_dyn = 1.0 @@ -523,25 +532,3 @@ def input_data( vertical_start_index_model_top=gtx.int32(0), vertical_end_index_model_surface=gtx.int32(grid.num_levels + 1), ) - - -@pytest.mark.continuous_benchmarking -class TestVerticallyImplicitSolverAtPredictorStepContinuousBenchmarking( - TestVerticallyImplicitSolverAtPredictorStep -): - @pytest.fixture( - params=[{"at_first_substep": value} for value in [True, False]], - ids=lambda param: f"at_first_substep[{param['at_first_substep']}]", - ) - def input_data( - self, request: pytest.FixtureRequest, grid: base.Grid - ) -> dict[str, gtx.Field | state_utils.ScalarType]: - base_data = TestVerticallyImplicitSolverAtPredictorStep.input_data.__wrapped__( - self, request, grid - ) - base_data["at_first_substep"] = request.param["at_first_substep"] - base_data["is_iau_active"] = False - base_data["divdamp_type"] = 32 - base_data["end_index_of_damping_layer"] = 12 - base_data["kstart_moist"] = 0 - return base_data From 1303aa5175a0ef9040724d8a0f8cd99979517166 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 15:23:31 +0100 Subject: [PATCH 078/111] Set DEFAULT_NUM_LEVELS due to nflat_gradp being 34 --- .../testing/src/icon4py/model/testing/fixtures/stencil_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/testing/src/icon4py/model/testing/fixtures/stencil_tests.py b/model/testing/src/icon4py/model/testing/fixtures/stencil_tests.py index 4d3c4da937..93f479da0b 100644 --- a/model/testing/src/icon4py/model/testing/fixtures/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/fixtures/stencil_tests.py @@ -21,7 +21,7 @@ DEFAULT_GRID: Final[str] = "simple" DEFAULT_NUM_LEVELS: Final[int] = ( - 10 # the number matters for performance measurements, but otherwise is arbitrary + 40 # the number matters for performance measurements, but otherwise is arbitrary. Set to 40 since some tests use `nflat_gradp` which is typically set to 34. ) VALID_GRID_PRESETS: tuple[str, ...] = ( "simple", From 50d3f73992f99d942513a6b05f3df871d494d463 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 15:23:48 +0100 Subject: [PATCH 079/111] Allow verification with -m continuous_benchmarking --- .../src/icon4py/model/testing/pytest_hooks.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index 6e1c2f7b40..03a597f520 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -103,22 +103,6 @@ def pytest_addoption(parser: pytest.Parser): def pytest_collection_modifyitems(config, items): """Modify collected test items based on command line options.""" - test_grid = config.getoption("--grid") - for item in items: - if (marker := item.get_closest_marker("continuous_benchmarking")) is not None: - if test_grid is not None and not test_grid.startswith("icon_benchmark"): - item.add_marker( - pytest.mark.skip( - reason="Continuous benchmarking tests only run with --grid icon_benchmark_{regional,global}." - ) - ) - continue - if not config.getoption("--benchmark-only"): - item.add_marker( - pytest.mark.benchmark_only( - reason="Continuous benchmarking tests shouldn't be verified." - ) - ) test_level = config.getoption("--level") if test_level == "any": return From cca59c70ee121dae49653bf3016b20789782ce81 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 17:49:15 +0100 Subject: [PATCH 080/111] Make formating happy --- ..._horizontal_winds_and_ke_and_contravariant_correction.py | 4 +--- ...a_rho_face_values_and_pressure_gradient_and_update_vn.py | 6 ++---- ...t_vertically_implicit_dycore_solver_at_predictor_step.py | 6 +----- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 928a7d0304..348e8e8520 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -322,9 +322,7 @@ def input_data( ] edge_domain = h_grid.domain(dims.EdgeDim) - horizontal_start = grid.start_index( - edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5) - ) + horizontal_start = grid.start_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5)) horizontal_end = grid.end_index(edge_domain(h_grid.Zone.HALO_LEVEL_2)) vertical_start = 0 vertical_end = nlev + 1 diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index a4b04c451c..951d7b4c5a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -507,12 +507,10 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: dtime = 0.9 iau_wgt_dyn = 1.0 is_iau_active = request.param["is_iau_active"] - limited_area = limited_area = grid.limited_area if hasattr(grid, "limited_area") else True + limited_area = grid.limited_area if hasattr(grid, "limited_area") else True edge_domain = h_grid.domain(dims.EdgeDim) - start_edge_lateral_boundary = grid.start_index( - edge_domain(h_grid.Zone.LATERAL_BOUNDARY) - ) + start_edge_lateral_boundary = grid.start_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY)) start_edge_lateral_boundary_level_7 = grid.start_index( edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_7) ) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 842c51a973..aba91fa02e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -400,11 +400,7 @@ def reference( @pytest.fixture( params=[ {"at_first_substep": afs, "is_iau_active": ia, "divdamp_type": dvdmpt} - for afs, ia, dvdmpt in itertools.product( - [True, False], - [True, False], - [3,32] - ) + for afs, ia, dvdmpt in itertools.product([True, False], [True, False], [3, 32]) ], ids=lambda param: f"at_first_substep[{param['at_first_substep']}]__is_iau_active[{param['is_iau_active']}]__divdamp_type[{param['divdamp_type']}]", ) From d116b8b2145dadec11931c8556cca8e89970e769 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 17:52:17 +0100 Subject: [PATCH 081/111] Added comments regarding vertical level values related to benchmarks and tests --- ...est_compute_advection_in_horizontal_momentum_equation.py | 2 +- .../test_compute_advection_in_vertical_momentum_equation.py | 6 +++--- ..._horizontal_winds_and_ke_and_contravariant_correction.py | 2 +- ...est_compute_horizontal_velocity_quantities_and_fluxes.py | 2 +- .../test_compute_perturbed_quantities_and_interpolation.py | 4 ++-- ...a_rho_face_values_and_pressure_gradient_and_update_vn.py | 4 ++-- ...t_vertically_implicit_dycore_solver_at_corrector_step.py | 4 ++-- ...t_vertically_implicit_dycore_solver_at_predictor_step.py | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index 86409be231..ab253b8e40 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -281,7 +281,7 @@ def input_data( cfl_w_limit = 0.65 / dtime apply_extra_diffusion_on_vn = request.param["apply_extra_diffusion_on_vn"] - end_index_of_damping_layer = 5 + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime edge_domain = h_grid.domain(dims.EdgeDim) horizontal_start = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) horizontal_end = grid.end_index(edge_domain(h_grid.Zone.LOCAL)) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 11a899f28f..50acbf763a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -445,7 +445,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala dtime = 2.0 cfl_w_limit = 0.65 / dtime - end_index_of_damping_layer = 12 + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime cell_domain = h_grid.domain(dims.CellDim) horizontal_start = grid.start_index(cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_4)) @@ -664,8 +664,8 @@ def input_data( "skip_compute_predictor_vertical_advection" ] - nflatlev = 5 - end_index_of_damping_layer = 12 + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime cell_domain = h_grid.domain(dims.CellDim) horizontal_start = grid.start_index(cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_4)) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 348e8e8520..e76aa6b7b3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -315,7 +315,7 @@ def input_data( c_intp = data_alloc.random_field(grid, dims.VertexDim, dims.V2CDim) nlev = grid.num_levels - nflatlev = 5 + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime skip_compute_predictor_vertical_advection = request.param[ "skip_compute_predictor_vertical_advection" diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py index 15ca05c477..46afe5202e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py @@ -291,7 +291,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala ddxn_z_full = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) ddxt_z_full = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) - nflatlev = 5 + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime edge_domain = h_grid.domain(dims.EdgeDim) horizontal_start = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index aa633e9407..fede118e44 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -420,8 +420,8 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala start_cell_halo_level_2 = grid.start_index(cell_domain(h_grid.Zone.HALO_LEVEL_2)) end_cell_halo_level_2 = grid.end_index(cell_domain(h_grid.Zone.HALO_LEVEL_2)) - nflatlev = 5 - nflat_gradp = 34 + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + nflat_gradp = 34 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime return dict( temporal_extrapolation_of_perturbed_exner=temporal_extrapolation_of_perturbed_exner, diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index 951d7b4c5a..baa82b4e64 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -517,8 +517,8 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: start_edge_nudging_level_2 = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) end_edge_nudging = grid.end_index(edge_domain(h_grid.Zone.NUDGING)) end_edge_halo = grid.end_index(edge_domain(h_grid.Zone.HALO)) - nflatlev = 5 - nflat_gradp = 34 + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + nflat_gradp = 34 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime return dict( rho_at_edges_on_model_levels=rho_at_edges_on_model_levels, diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index bf61cbaeb2..89ab7628b2 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -474,9 +474,9 @@ def input_data( is_iau_active = request.param["is_iau_active"] at_first_substep = request.param["at_first_substep"] rayleigh_type = 2 - end_index_of_damping_layer = 12 + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime at_last_substep = request.param["at_last_substep"] - kstart_moist = 0 + kstart_moist = 0 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime dtime = 0.001 veladv_offctr = 0.25 advection_explicit_weight_parameter = 0.5 - veladv_offctr diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index aba91fa02e..78cbc7788b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -465,7 +465,7 @@ def input_data( at_first_substep = request.param["at_first_substep"] rayleigh_type = 2 divdamp_type = request.param["divdamp_type"] - end_index_of_damping_layer = 12 + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime kstart_moist = 0 flat_level_index_plus1 = 6 dtime = 0.001 From 4a66e4a7d6b0562bef0512a0b0f0db1917d0540f Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 17:53:06 +0100 Subject: [PATCH 082/111] Use pytest-pedantic to set the number of warmup iterations and the iterations of the benchmark --- .../icon4py/model/testing/stencil_tests.py | 24 ++++++++++--------- noxfile.py | 1 - 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index bdbd4d1905..d7127ade9e 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -84,9 +84,8 @@ def test_and_benchmark( _configured_program: Callable[..., None], request: pytest.FixtureRequest, ) -> None: - benchmark_only_option = request.config.getoption("benchmark_only") - benchmark_only_mark = request.node.get_closest_marker("benchmark_only") is not None - if (not benchmark_only_option) and (not benchmark_only_mark): + benchmark_only_option = request.config.getoption("benchmark_only") # skip verification if `--benchmark-only` CLI option is set + if (not benchmark_only_option): reference_outputs = self.reference( _ConnectivityConceptFixer( grid # TODO(havogt): pass as keyword argument (needs fixes in some tests) @@ -103,17 +102,20 @@ def test_and_benchmark( ) if benchmark is not None and benchmark.enabled: - warmup_enabled = request.config.getoption("benchmark_warmup") - if warmup_enabled: - print("[WARNING] Benchmark warmup enabled, GT4Py timers include warmup iterations.") # Clean up GT4Py metrics from previous runs if gtx_config.COLLECT_METRICS_LEVEL > 0: gtx_metrics.sources.clear() - benchmark( + warmup_rounds = 1 + iterations = 10 + + benchmark.pedantic( _configured_program, - **_properly_allocated_input_data, - offset_provider=grid.connectivities, + args=(), + kwargs=dict(**_properly_allocated_input_data, offset_provider=grid.connectivities), + rounds=3, # 30 iterations in total should be stable enough + warmup_rounds=warmup_rounds, + iterations=iterations, ) # Collect GT4Py runtime metrics if enabled @@ -125,8 +127,8 @@ def test_and_benchmark( metrics_data = gtx_metrics.sources key = next(iter(metrics_data)) compute_samples = metrics_data[key].metrics["compute"].samples - # emprically exclude first few iterations run for warmup - initial_program_iterations_to_skip = 2 + # exclude warmup iterations and one extra iteration for calibrating pytest-benchmark + initial_program_iterations_to_skip = warmup_rounds * iterations + 1 benchmark.extra_info["gtx_metrics"] = compute_samples[ initial_program_iterations_to_skip: ] diff --git a/noxfile.py b/noxfile.py index 49634aa15b..9fe868bde3 100644 --- a/noxfile.py +++ b/noxfile.py @@ -61,7 +61,6 @@ def benchmark_model(session: nox.Session) -> None: -m continuous_benchmarking \ --benchmark-only \ --benchmark-warmup=on \ - --benchmark-warmup-iterations=30 \ --benchmark-json=pytest_benchmark_results_{session.python}.json \ ./model".split(), *session.posargs, From 4106772ed1160ccbbf42bac90fa59a1cd908e82d Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 17:53:48 +0100 Subject: [PATCH 083/111] Replace in the json file generated by pytest benchmarks the values read by bencher to the ones coming from gt4py timers --- ci/benchmark_bencher_baseline.yml | 1 + .../src/icon4py/model/testing/pytest_hooks.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/ci/benchmark_bencher_baseline.yml b/ci/benchmark_bencher_baseline.yml index 9d6c910a98..548c762627 100644 --- a/ci/benchmark_bencher_baseline.yml +++ b/ci/benchmark_bencher_baseline.yml @@ -13,6 +13,7 @@ include: ICON4PY_ENABLE_GRID_DOWNLOAD: false ICON4PY_ENABLE_TESTDATA_DOWNLOAD: false GT4PY_UNSTRUCTURED_HORIZONTAL_HAS_UNIT_STRIDE: true + GT4PY_COLLECT_METRICS_LEVEL: 10 PYTHONOPTIMIZE: 2 # benchmark_bencher_baseline_x86_64: diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index 03a597f520..d794816fe4 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -9,11 +9,13 @@ import os import re +import numpy as np import pytest from icon4py.model.common import model_backends from icon4py.model.testing import filters +from gt4py.next import config as gtx_config __all__ = [ "pytest_addoption", @@ -162,6 +164,17 @@ def pytest_benchmark_update_json(output_json): for bench in output_json["benchmarks"]: bench["fullname"] = _name_from_fullname(bench["fullname"]) + # if GT4Py metrics collection is enabled, replace the benchmark stats used by `bencher` with the GT4Py metrics stats + # to avoid reporting python overheads in `bencher` so that the results are comparable to the Fortran stencil benchmarks + if gtx_config.COLLECT_METRICS_LEVEL > 0: + gt4py_metrics_runtimes = bench.get("extra_info", {}).get("gtx_metrics", []) + assert len(gt4py_metrics_runtimes) > 0, "No GT4Py metrics collected despite COLLECT_METRICS_LEVEL > 0" + bench["stats"]["mean"] = np.mean(gt4py_metrics_runtimes) + bench["stats"]["median"] = np.median(gt4py_metrics_runtimes) + bench["stats"]["stddev"] = np.std(gt4py_metrics_runtimes) + bench["stats"]["q1"] = np.percentile(gt4py_metrics_runtimes, 25) + bench["stats"]["q3"] = np.percentile(gt4py_metrics_runtimes, 75) + bench["stats"]["iqr"] = bench["stats"]["q3"] - bench["stats"]["q1"] @pytest.hookimpl(hookwrapper=True) From e9bacd38f054a232ed8299f4fdee7a4dfbda5d4a Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 17:54:03 +0100 Subject: [PATCH 084/111] Revert changes in stencil test class initialization --- .../icon4py/model/testing/stencil_tests.py | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index d7127ade9e..35f490b6e5 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -249,33 +249,11 @@ def static_variant(request: pytest.FixtureRequest) -> Sequence[str]: def __init_subclass__(cls, **kwargs: Any) -> None: super().__init_subclass__(**kwargs) - pytest_prefix = "test_" - - # only add `test_and_benchmark` to direct subclasses of `StencilTest`. Inherited tests can use the same function. - if cls.__base__ == StencilTest: - setattr(cls, f"{pytest_prefix}{cls.__name__}", test_and_benchmark) + setattr(cls, f"test_{cls.__name__}", test_and_benchmark) # decorate `static_variant` with parametrized fixtures, since the # parametrization is only available in the concrete subclass definition - # Check if cls.static_variant has changes in inherited subclasses and update it accordingly - if hasattr(cls.static_variant, "_pytestfixturefunction"): - base_static = getattr(cls.__base__, "STATIC_PARAMS", None) - if base_static != cls.STATIC_PARAMS: - if cls.STATIC_PARAMS is None: - cls.static_variant = staticmethod(pytest.fixture(lambda: ())) # type: ignore[method-assign, assignment] - else: - # copy of `static_variant` - def _new_static_variant(request: pytest.FixtureRequest) -> Sequence[str]: - _, variant = request.param - return () if variant is None else variant - - # replace with new parametrized fixture - cls.static_variant = staticmethod( # type: ignore[method-assign] - pytest.fixture( - params=cls.STATIC_PARAMS.items(), scope="class", ids=lambda p: p[0] - )(_new_static_variant) - ) - elif cls.STATIC_PARAMS is None: + if cls.STATIC_PARAMS is None: # not parametrized, return an empty tuple cls.static_variant = staticmethod(pytest.fixture(lambda: ())) # type: ignore[method-assign, assignment] # we override with a non-parametrized function else: From e9294c2d71c07d2942d4b54ee023a79342e834a7 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 18:02:18 +0100 Subject: [PATCH 085/111] Make formatting happy --- ...t_compute_advection_in_horizontal_momentum_equation.py | 2 +- ...est_compute_advection_in_vertical_momentum_equation.py | 6 +++--- ...orizontal_winds_and_ke_and_contravariant_correction.py | 2 +- ...t_compute_horizontal_velocity_quantities_and_fluxes.py | 2 +- ...test_compute_perturbed_quantities_and_interpolation.py | 4 ++-- ...rho_face_values_and_pressure_gradient_and_update_vn.py | 4 ++-- ...vertically_implicit_dycore_solver_at_corrector_step.py | 4 ++-- ...vertically_implicit_dycore_solver_at_predictor_step.py | 2 +- model/testing/src/icon4py/model/testing/pytest_hooks.py | 6 ++++-- model/testing/src/icon4py/model/testing/stencil_tests.py | 8 +++++--- 10 files changed, 22 insertions(+), 18 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index ab253b8e40..af0c72a428 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -281,7 +281,7 @@ def input_data( cfl_w_limit = 0.65 / dtime apply_extra_diffusion_on_vn = request.param["apply_extra_diffusion_on_vn"] - end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime edge_domain = h_grid.domain(dims.EdgeDim) horizontal_start = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) horizontal_end = grid.end_index(edge_domain(h_grid.Zone.LOCAL)) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 50acbf763a..5eb1bb7afd 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -445,7 +445,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala dtime = 2.0 cfl_w_limit = 0.65 / dtime - end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime cell_domain = h_grid.domain(dims.CellDim) horizontal_start = grid.start_index(cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_4)) @@ -664,8 +664,8 @@ def input_data( "skip_compute_predictor_vertical_advection" ] - nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime - end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime cell_domain = h_grid.domain(dims.CellDim) horizontal_start = grid.start_index(cell_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_4)) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index e76aa6b7b3..966d04f983 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -315,7 +315,7 @@ def input_data( c_intp = data_alloc.random_field(grid, dims.VertexDim, dims.V2CDim) nlev = grid.num_levels - nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime skip_compute_predictor_vertical_advection = request.param[ "skip_compute_predictor_vertical_advection" diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py index 46afe5202e..7405e97638 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py @@ -291,7 +291,7 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala ddxn_z_full = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) ddxt_z_full = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) - nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime edge_domain = h_grid.domain(dims.EdgeDim) horizontal_start = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index fede118e44..fa550e3a61 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -420,8 +420,8 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala start_cell_halo_level_2 = grid.start_index(cell_domain(h_grid.Zone.HALO_LEVEL_2)) end_cell_halo_level_2 = grid.end_index(cell_domain(h_grid.Zone.HALO_LEVEL_2)) - nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime - nflat_gradp = 34 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + nflat_gradp = 34 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime return dict( temporal_extrapolation_of_perturbed_exner=temporal_extrapolation_of_perturbed_exner, diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index baa82b4e64..efe2f76210 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -517,8 +517,8 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: start_edge_nudging_level_2 = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) end_edge_nudging = grid.end_index(edge_domain(h_grid.Zone.NUDGING)) end_edge_halo = grid.end_index(edge_domain(h_grid.Zone.HALO)) - nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime - nflat_gradp = 34 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + nflat_gradp = 34 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime return dict( rho_at_edges_on_model_levels=rho_at_edges_on_model_levels, diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 89ab7628b2..91daaa1c47 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -474,9 +474,9 @@ def input_data( is_iau_active = request.param["is_iau_active"] at_first_substep = request.param["at_first_substep"] rayleigh_type = 2 - end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime at_last_substep = request.param["at_last_substep"] - kstart_moist = 0 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + kstart_moist = 0 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime dtime = 0.001 veladv_offctr = 0.25 advection_explicit_weight_parameter = 0.5 - veladv_offctr diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 78cbc7788b..16c7b0033f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -465,7 +465,7 @@ def input_data( at_first_substep = request.param["at_first_substep"] rayleigh_type = 2 divdamp_type = request.param["divdamp_type"] - end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime + end_index_of_damping_layer = 12 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime kstart_moist = 0 flat_level_index_plus1 = 6 dtime = 0.001 diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index d794816fe4..0392037745 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -11,11 +11,11 @@ import numpy as np import pytest +from gt4py.next import config as gtx_config from icon4py.model.common import model_backends from icon4py.model.testing import filters -from gt4py.next import config as gtx_config __all__ = [ "pytest_addoption", @@ -168,7 +168,9 @@ def pytest_benchmark_update_json(output_json): # to avoid reporting python overheads in `bencher` so that the results are comparable to the Fortran stencil benchmarks if gtx_config.COLLECT_METRICS_LEVEL > 0: gt4py_metrics_runtimes = bench.get("extra_info", {}).get("gtx_metrics", []) - assert len(gt4py_metrics_runtimes) > 0, "No GT4Py metrics collected despite COLLECT_METRICS_LEVEL > 0" + assert ( + len(gt4py_metrics_runtimes) > 0 + ), "No GT4Py metrics collected despite COLLECT_METRICS_LEVEL > 0" bench["stats"]["mean"] = np.mean(gt4py_metrics_runtimes) bench["stats"]["median"] = np.median(gt4py_metrics_runtimes) bench["stats"]["stddev"] = np.std(gt4py_metrics_runtimes) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 35f490b6e5..d389e7252e 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -84,8 +84,10 @@ def test_and_benchmark( _configured_program: Callable[..., None], request: pytest.FixtureRequest, ) -> None: - benchmark_only_option = request.config.getoption("benchmark_only") # skip verification if `--benchmark-only` CLI option is set - if (not benchmark_only_option): + benchmark_only_option = request.config.getoption( + "benchmark_only" + ) # skip verification if `--benchmark-only` CLI option is set + if not benchmark_only_option: reference_outputs = self.reference( _ConnectivityConceptFixer( grid # TODO(havogt): pass as keyword argument (needs fixes in some tests) @@ -113,7 +115,7 @@ def test_and_benchmark( _configured_program, args=(), kwargs=dict(**_properly_allocated_input_data, offset_provider=grid.connectivities), - rounds=3, # 30 iterations in total should be stable enough + rounds=3, # 30 iterations in total should be stable enough warmup_rounds=warmup_rounds, iterations=iterations, ) From ec1596566c85a04851f3fdea308dca1d73aaf2cb Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 18:18:48 +0100 Subject: [PATCH 086/111] Use necessary parameters for stencil testing and benchmarking --- ...t_apply_divergence_damping_and_update_vn.py | 18 +++++++----------- ...dvection_in_horizontal_momentum_equation.py | 5 +++-- ..._advection_in_vertical_momentum_equation.py | 2 +- ...inds_and_ke_and_contravariant_correction.py | 2 +- ...lues_and_pressure_gradient_and_update_vn.py | 2 +- ...implicit_dycore_solver_at_corrector_step.py | 8 ++++++-- ...implicit_dycore_solver_at_predictor_step.py | 6 +++++- 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index c8da2677b6..2f0c21d77a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -176,17 +176,13 @@ def reference( @pytest.fixture( params=[ - {"divdamp_order": do, "is_iau_active": ia} - for do, ia in itertools.product( - [ - DivergenceDampingOrder.SECOND_ORDER, - DivergenceDampingOrder.FOURTH_ORDER, - DivergenceDampingOrder.COMBINED, - ], - [True, False], - ) + {"divdamp_order": do, "is_iau_active": ia, "second_order_divdamp_factor": sodf} + for do, ia, sodf in [ + (DivergenceDampingOrder.COMBINED, True, 0.012), # For testing the whole functionality of the stencil + (DivergenceDampingOrder.COMBINED, False, 0.032), # For benchmarking against MCH experiments + ] ], - ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]", + ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}__second_order_divdamp_factor[{param['second_order_divdamp_factor']}]", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) @@ -223,7 +219,7 @@ def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: iau_wgt_dyn = 1.0 is_iau_active = request.param["is_iau_active"] fourth_order_divdamp_factor = 0.004 - second_order_divdamp_factor = 0.032 + second_order_divdamp_factor = request.param["second_order_divdamp_factor"] divdamp_order = request.param["divdamp_order"] second_order_divdamp_scaling_coeff = 34497.62082646618 # for icon-ch1(_medium) apply_2nd_order_divergence_damping = (divdamp_order == divergence_damp_order.COMBINED) and ( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index af0c72a428..6085c36e47 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -135,6 +135,7 @@ def _add_extra_diffusion_for_normal_wind_tendency_approaching_cfl_without_levelm @pytest.mark.embedded_remap_error +@pytest.mark.continuous_benchmarking class TestFusedVelocityAdvectionStencilsHMomentum(stencil_tests.StencilTest): PROGRAM = compute_advection_in_horizontal_momentum_equation OUTPUTS = ("normal_wind_advective_tendency",) @@ -245,8 +246,8 @@ def reference( return dict(normal_wind_advective_tendency=normal_wind_advective_tendency) @pytest.fixture( - params=[{"apply_extra_diffusion_on_vn": value} for value in [True, False]], - ids=lambda param: f"apply_extra_diffusion_on_vn[{param['apply_extra_diffusion_on_vn']}]", + params=[{"apply_extra_diffusion_on_vn": value} for value in [True, False]], # True for testing, False for benchmarking + ids=lambda param: f"/[{param['apply_extra_diffusion_on_vn']}]", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 5eb1bb7afd..1e1533853f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -623,7 +623,7 @@ def reference( ) @pytest.fixture( - params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], + params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", ) def input_data( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 966d04f983..60ca7ecf09 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -282,7 +282,7 @@ def reference( ) @pytest.fixture( - params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], + params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", ) def input_data( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index efe2f76210..b159300b24 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -435,7 +435,7 @@ def at_neighbor(i: int) -> np.ndarray: ) @pytest.fixture( - params=[{"is_iau_active": value} for value in [True, False]], + params=[{"is_iau_active": value} for value in [True, False]], # True for testing, False for benchmarking ids=lambda param: f"is_iau_active[{param['is_iau_active']}]", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 91daaa1c47..0ce967b898 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -402,8 +402,12 @@ def reference( @pytest.fixture( params=[ {"at_first_substep": afs, "at_last_substep": als, "lprep_adv": la, "is_iau_active": ia} - for afs, als, la, ia in itertools.product(*([(True, False)] * 4)) - if not (afs and als) + for afs, als, la, ia in [ + (True, True, True, True), # For testing the whole functionality of the stencil + (True, False, True, False), # For benchmarking against MCH experiments + (False, True, True, False), # For benchmarking against MCH experiments + (False, False, True, False), # For benchmarking against MCH experiments + ] ], ids=lambda p: ( f"at_first_substep[{p['at_first_substep']}]__" diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 16c7b0033f..cb11292614 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -400,7 +400,11 @@ def reference( @pytest.fixture( params=[ {"at_first_substep": afs, "is_iau_active": ia, "divdamp_type": dvdmpt} - for afs, ia, dvdmpt in itertools.product([True, False], [True, False], [3, 32]) + for afs, ia, dvdmpt in [ #itertools.product([True, False], [True, False], [3, 32]) + (True, True, 3), # For testing the whole functionality of the stencil + (True, False, 32), # For benchmarking against MCH experiments + (False, False, 32) # For benchmarking against MCH experiments + ] ], ids=lambda param: f"at_first_substep[{param['at_first_substep']}]__is_iau_active[{param['is_iau_active']}]__divdamp_type[{param['divdamp_type']}]", ) From 568f4ebd9c78837bd1a8f9fd3482249c2030dd15 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 18:32:00 +0100 Subject: [PATCH 087/111] Make parameters reasonable for testing and benchmarking --- .../test_apply_divergence_damping_and_update_vn.py | 12 ++++++++++-- ...pute_advection_in_horizontal_momentum_equation.py | 4 +++- ...ompute_advection_in_vertical_momentum_equation.py | 4 +++- ...ntal_winds_and_ke_and_contravariant_correction.py | 4 +++- ...ace_values_and_pressure_gradient_and_update_vn.py | 4 +++- ...cally_implicit_dycore_solver_at_predictor_step.py | 8 ++++---- 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index 2f0c21d77a..df933f771c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -178,8 +178,16 @@ def reference( params=[ {"divdamp_order": do, "is_iau_active": ia, "second_order_divdamp_factor": sodf} for do, ia, sodf in [ - (DivergenceDampingOrder.COMBINED, True, 0.012), # For testing the whole functionality of the stencil - (DivergenceDampingOrder.COMBINED, False, 0.032), # For benchmarking against MCH experiments + ( + DivergenceDampingOrder.COMBINED, + True, + 0.012, + ), # For testing the whole functionality of the stencil + ( + DivergenceDampingOrder.COMBINED, + False, + 0.032, + ), # For benchmarking against MCH experiments ] ], ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}__second_order_divdamp_factor[{param['second_order_divdamp_factor']}]", diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index 6085c36e47..608af55537 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -246,7 +246,9 @@ def reference( return dict(normal_wind_advective_tendency=normal_wind_advective_tendency) @pytest.fixture( - params=[{"apply_extra_diffusion_on_vn": value} for value in [True, False]], # True for testing, False for benchmarking + params=[ + {"apply_extra_diffusion_on_vn": value} for value in [True, False] + ], # True for testing, False for benchmarking ids=lambda param: f"/[{param['apply_extra_diffusion_on_vn']}]", ) def input_data( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 1e1533853f..b7060189c8 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -623,7 +623,9 @@ def reference( ) @pytest.fixture( - params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], # True for benchmarking, False for testing + params=[ + {"skip_compute_predictor_vertical_advection": value} for value in [True, False] + ], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", ) def input_data( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 60ca7ecf09..b165cd19ba 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -282,7 +282,9 @@ def reference( ) @pytest.fixture( - params=[{"skip_compute_predictor_vertical_advection": value} for value in [True, False]], # True for benchmarking, False for testing + params=[ + {"skip_compute_predictor_vertical_advection": value} for value in [True, False] + ], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", ) def input_data( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index b159300b24..d636074698 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -435,7 +435,9 @@ def at_neighbor(i: int) -> np.ndarray: ) @pytest.fixture( - params=[{"is_iau_active": value} for value in [True, False]], # True for testing, False for benchmarking + params=[ + {"is_iau_active": value} for value in [True, False] + ], # True for testing, False for benchmarking ids=lambda param: f"is_iau_active[{param['is_iau_active']}]", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index cb11292614..a764c266fa 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -400,10 +400,10 @@ def reference( @pytest.fixture( params=[ {"at_first_substep": afs, "is_iau_active": ia, "divdamp_type": dvdmpt} - for afs, ia, dvdmpt in [ #itertools.product([True, False], [True, False], [3, 32]) - (True, True, 3), # For testing the whole functionality of the stencil - (True, False, 32), # For benchmarking against MCH experiments - (False, False, 32) # For benchmarking against MCH experiments + for afs, ia, dvdmpt in [ + (True, True, 3), # For testing the whole functionality of the stencil + (True, False, 32), # For benchmarking against MCH experiments + (False, False, 32), # For benchmarking against MCH experiments ] ], ids=lambda param: f"at_first_substep[{param['at_first_substep']}]__is_iau_active[{param['is_iau_active']}]__divdamp_type[{param['divdamp_type']}]", From 9e0774917674661b2ae31120ee72301795fa1893 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 19:01:43 +0100 Subject: [PATCH 088/111] Remove unnecessary imports --- .../test_apply_divergence_damping_and_update_vn.py | 3 --- .../test_compute_advection_in_vertical_momentum_equation.py | 2 +- ...ved_horizontal_winds_and_ke_and_contravariant_correction.py | 2 +- .../test_compute_perturbed_quantities_and_interpolation.py | 2 +- ...heta_rho_face_values_and_pressure_gradient_and_update_vn.py | 2 +- ...test_vertically_implicit_dycore_solver_at_corrector_step.py | 3 +-- ...test_vertically_implicit_dycore_solver_at_predictor_step.py | 3 +-- 7 files changed, 6 insertions(+), 11 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index df933f771c..277909f97e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -6,8 +6,6 @@ # Please, refer to the LICENSE file in the root directory. # SPDX-License-Identifier: BSD-3-Clause -import itertools - import gt4py.next as gtx import numpy as np import pytest @@ -21,7 +19,6 @@ from icon4py.model.common import constants, dimension as dims from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import definitions divergence_damp_order = DivergenceDampingOrder() diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index b7060189c8..29e097491d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -19,7 +19,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import definitions, stencil_tests +from icon4py.model.testing import stencil_tests from .test_add_interpolated_horizontal_advection_of_w import ( add_interpolated_horizontal_advection_of_w_numpy, diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index b165cd19ba..e9335d2476 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -16,7 +16,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import definitions, stencil_tests +from icon4py.model.testing import stencil_tests from .test_compute_contravariant_correction import compute_contravariant_correction_numpy from .test_compute_horizontal_advection_term_for_vertical_velocity import ( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index fa550e3a61..a173e626f1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -32,7 +32,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import definitions, stencil_tests +from icon4py.model.testing import stencil_tests from .test_compute_approx_of_2nd_vertical_derivative_of_exner import ( compute_approx_of_2nd_vertical_derivative_of_exner_numpy, diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index d636074698..a06e067c04 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -23,7 +23,7 @@ from icon4py.model.common import constants, dimension as dims from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import definitions, stencil_tests +from icon4py.model.testing import stencil_tests rhotheta_avd_type = RhoThetaAdvectionType() diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 0ce967b898..bc69978318 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -5,7 +5,6 @@ # # Please, refer to the LICENSE file in the root directory. # SPDX-License-Identifier: BSD-3-Clause -import itertools from typing import Any import gt4py.next as gtx @@ -19,7 +18,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import definitions, stencil_tests +from icon4py.model.testing import stencil_tests from .test_add_analysis_increments_from_data_assimilation import ( add_analysis_increments_from_data_assimilation_numpy, diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index a764c266fa..97ad07ae63 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -5,7 +5,6 @@ # # Please, refer to the LICENSE file in the root directory. # SPDX-License-Identifier: BSD-3-Clause -import itertools from typing import Any import gt4py.next as gtx @@ -19,7 +18,7 @@ from icon4py.model.common.grid import base, horizontal as h_grid from icon4py.model.common.states import utils as state_utils from icon4py.model.common.utils import data_allocation as data_alloc -from icon4py.model.testing import definitions, stencil_tests +from icon4py.model.testing import stencil_tests from .test_add_analysis_increments_from_data_assimilation import ( add_analysis_increments_from_data_assimilation_numpy, From d0baf83424f7838b21b3caad0c272b45de74dcae Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 19:01:56 +0100 Subject: [PATCH 089/111] Fix missing ] --- .../test_apply_divergence_damping_and_update_vn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index 277909f97e..ba5d783c5d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -187,7 +187,7 @@ def reference( ), # For benchmarking against MCH experiments ] ], - ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}__second_order_divdamp_factor[{param['second_order_divdamp_factor']}]", + ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]__second_order_divdamp_factor[{param['second_order_divdamp_factor']}]", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) From 4d8ddd842e8670c220e396593ab223b9fd9727d1 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 19:02:13 +0100 Subject: [PATCH 090/111] Allow [ and ] inside params of _name_from_fullname_pattern --- model/testing/src/icon4py/model/testing/pytest_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index 0392037745..a5a9875b45 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -136,7 +136,7 @@ def pytest_runtest_setup(item: pytest.Item) -> None: r""" ::(?P[A-Za-z_]\w*) # capture class name (?::: [A-Za-z_]\w* # skip method name - (?:\[(?P[^\]]+)\])? ) # optional parameterization + (?:\[(?P.+)\])? ) # optional parameterization; allow '[' and ']' inside params """, re.VERBOSE, ) From e7ccfad46e669e58514d791258f7c11199b119e7 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 19:02:28 +0100 Subject: [PATCH 091/111] Replace min and max from gt4py timers in json benchmark output --- model/testing/src/icon4py/model/testing/pytest_hooks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model/testing/src/icon4py/model/testing/pytest_hooks.py b/model/testing/src/icon4py/model/testing/pytest_hooks.py index a5a9875b45..8e22f404db 100644 --- a/model/testing/src/icon4py/model/testing/pytest_hooks.py +++ b/model/testing/src/icon4py/model/testing/pytest_hooks.py @@ -177,6 +177,8 @@ def pytest_benchmark_update_json(output_json): bench["stats"]["q1"] = np.percentile(gt4py_metrics_runtimes, 25) bench["stats"]["q3"] = np.percentile(gt4py_metrics_runtimes, 75) bench["stats"]["iqr"] = bench["stats"]["q3"] - bench["stats"]["q1"] + bench["stats"]["min"] = np.min(gt4py_metrics_runtimes) + bench["stats"]["max"] = np.max(gt4py_metrics_runtimes) @pytest.hookimpl(hookwrapper=True) From 5116a280ae5ab9690e4bb3ab4bed38511408f45f Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 14 Nov 2025 19:42:15 +0100 Subject: [PATCH 092/111] SKip test that fails with embedded --- .../test_calculate_nabla2_and_smag_coefficients_for_vn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index 1c60fe97c3..195a45db9f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -19,6 +19,7 @@ from icon4py.model.testing import definitions, stencil_tests +@pytest.mark.embedded_remap_error @pytest.mark.continuous_benchmarking class TestCalculateNabla2AndSmagCoefficientsForVn(stencil_tests.StencilTest): PROGRAM = calculate_nabla2_and_smag_coefficients_for_vn From 8b0fd6f8d9f87573382c152bc680b3dc3941d692 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 17 Nov 2025 11:24:59 +0100 Subject: [PATCH 093/111] Trying to increase github actions timeout --- .github/workflows/icon4py-test-model.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/icon4py-test-model.yml b/.github/workflows/icon4py-test-model.yml index c3293e03a1..7dc7209bce 100644 --- a/.github/workflows/icon4py-test-model.yml +++ b/.github/workflows/icon4py-test-model.yml @@ -11,6 +11,7 @@ on: jobs: test-model: runs-on: ubuntu-latest + timeout-minutes: 5 strategy: matrix: python-version: ["3.10", "3.11"] From b01b5d8412c3102b6d01d9bb87367f93389139bf Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 17 Nov 2025 11:33:07 +0100 Subject: [PATCH 094/111] Trying running the stencil test with only 1 process --- .github/workflows/icon4py-test-model.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/icon4py-test-model.yml b/.github/workflows/icon4py-test-model.yml index 7dc7209bce..e979f9c737 100644 --- a/.github/workflows/icon4py-test-model.yml +++ b/.github/workflows/icon4py-test-model.yml @@ -11,7 +11,6 @@ on: jobs: test-model: runs-on: ubuntu-latest - timeout-minutes: 5 strategy: matrix: python-version: ["3.10", "3.11"] @@ -63,7 +62,7 @@ jobs: - name: run nox session - stencil tests shell: bash env: - NUM_PROCESSES: auto + NUM_PROCESSES: 1 ICON4PY_ENABLE_GRID_DOWNLOAD: false ICON4PY_ENABLE_TESTDATA_DOWNLOAD: false run: | From 44d1eee85e61a121f8e199a1ccf2718e9bd5a23b Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 17 Nov 2025 11:55:34 +0100 Subject: [PATCH 095/111] Fix TestCalculateNabla2AndSmagCoefficientsForVn --- ...ate_nabla2_and_smag_coefficients_for_vn.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index 195a45db9f..e9cd84bde4 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -19,7 +19,6 @@ from icon4py.model.testing import definitions, stencil_tests -@pytest.mark.embedded_remap_error @pytest.mark.continuous_benchmarking class TestCalculateNabla2AndSmagCoefficientsForVn(stencil_tests.StencilTest): PROGRAM = calculate_nabla2_and_smag_coefficients_for_vn @@ -54,6 +53,10 @@ def reference( vn: np.ndarray, smag_limit: np.ndarray, smag_offset: float, + horizontal_start: int, + horizontal_end: int, + vertical_start: int, + vertical_end: int, **kwargs, ) -> dict: e2c2v = connectivities[dims.E2C2VDim] @@ -155,8 +158,20 @@ def reference( kh_smag_ec = kh_smag_e kh_smag_e = np.maximum(0.0, kh_smag_e - smag_offset) kh_smag_e = np.minimum(kh_smag_e, smag_limit) - - return dict(kh_smag_e=kh_smag_e, kh_smag_ec=kh_smag_ec, z_nabla2_e=z_nabla2_e) + kh_smag_e_out = np.zeros_like(kh_smag_e) + kh_smag_ec_out = np.zeros_like(kh_smag_ec) + z_nabla2_e_out = np.zeros_like(z_nabla2_e) + kh_smag_e_out[horizontal_start:horizontal_end, vertical_start:vertical_end] = kh_smag_e[ + horizontal_start:horizontal_end, vertical_start:vertical_end + ] + kh_smag_ec_out[horizontal_start:horizontal_end, vertical_start:vertical_end] = kh_smag_ec[ + horizontal_start:horizontal_end, vertical_start:vertical_end + ] + z_nabla2_e_out[horizontal_start:horizontal_end, vertical_start:vertical_end] = z_nabla2_e[ + horizontal_start:horizontal_end, vertical_start:vertical_end + ] + + return dict(kh_smag_e=kh_smag_e_out, kh_smag_ec=kh_smag_ec_out, z_nabla2_e=z_nabla2_e_out) @pytest.fixture def input_data(self, grid: base.Grid) -> dict: From d20f088d94e7ebb57726c3246e875b8623899d15 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 17 Nov 2025 19:04:53 +0100 Subject: [PATCH 096/111] Fix memory leaks and unnecessary reference in StencilTests --- ...test_apply_horizontal_density_increment.py | 2 +- ...apply_interpolated_tracer_time_tendency.py | 2 +- .../test_apply_vertical_density_increment.py | 2 +- ...st_average_horizontal_flux_subcycling_2.py | 2 +- ...st_average_horizontal_flux_subcycling_3.py | 2 +- ...e_antidiffusive_cell_fluxes_and_min_max.py | 2 +- ...test_compute_barycentric_backtrajectory.py | 2 +- ..._compute_barycentric_backtrajectory_alt.py | 2 +- .../test_compute_ffsl_backtrajectory.py | 2 +- ...cktrajectory_counterclockwise_indicator.py | 2 +- ...te_ffsl_backtrajectory_length_indicator.py | 2 +- ...tal_tracer_flux_from_cubic_coefficients.py | 2 +- ...al_tracer_flux_from_linear_coefficients.py | 2 +- ...racer_flux_from_linear_coefficients_alt.py | 2 +- ...e_horizontal_multiplicative_flux_factor.py | 2 +- ...t_compute_ppm4gpu_parabola_coefficients.py | 2 +- .../test_compute_ppm_all_face_values.py | 2 +- .../test_compute_ppm_quadratic_face_values.py | 2 +- .../test_compute_ppm_quartic_face_values.py | 2 +- .../stencil_tests/test_compute_ppm_slope.py | 2 +- .../stencil_tests/test_compute_tendency.py | 2 +- ...ute_vertical_parabola_limiter_condition.py | 2 +- ...est_compute_vertical_tracer_flux_upwind.py | 2 +- ...t_integrate_tracer_density_horizontally.py | 2 +- .../test_integrate_tracer_horizontally.py | 2 +- .../test_integrate_tracer_vertically.py | 2 +- ...it_vertical_parabola_semi_monotonically.py | 2 +- ...limit_vertical_slope_semi_monotonically.py | 2 +- ...s_antidiffusive_cell_fluxes_and_min_max.py | 2 +- ...est_prepare_ffsl_flux_area_patches_list.py | 2 +- ...cal_quadrature_for_cubic_reconstruction.py | 2 +- ...uadrature_list_for_cubic_reconstruction.py | 2 +- ...test_reconstruct_cubic_coefficients_svd.py | 2 +- ...test_apply_diffusion_to_theta_and_exner.py | 2 +- .../test_apply_diffusion_to_vn.py | 2 +- ...ute_horizontal_gradients_for_turbulence.py | 2 +- ...st_apply_nabla2_and_nabla4_global_to_vn.py | 2 +- .../test_apply_nabla2_and_nabla4_to_vn.py | 2 +- ..._apply_nabla2_to_vn_in_lateral_boundary.py | 2 +- .../stencil_tests/test_apply_nabla2_to_w.py | 2 +- ...pply_nabla2_to_w_in_upper_damping_layer.py | 2 +- ...st_calculate_diagnostics_for_turbulence.py | 2 +- ...ate_horizontal_gradients_for_turbulence.py | 2 +- ...ate_nabla2_and_smag_coefficients_for_vn.py | 2 +- .../test_calculate_nabla2_for_w.py | 2 +- .../test_calculate_nabla2_for_z.py | 2 +- .../test_calculate_nabla2_of_theta.py | 2 +- .../stencil_tests/test_calculate_nabla4.py | 2 +- ...n_coefficient_for_grid_point_cold_pools.py | 2 +- ...d_for_grid_point_cold_pools_enhancement.py | 2 +- ...orary_fields_for_turbulence_diagnostics.py | 2 +- ...fusion_nabla_of_theta_over_steep_points.py | 2 +- .../test_update_theta_and_exner.py | 2 +- .../test_accumulate_prep_adv_fields.py | 2 +- ...lysis_increments_from_data_assimilation.py | 2 +- .../test_add_analysis_increments_to_vn.py | 2 +- ...or_normal_wind_tendency_approaching_cfl.py | 2 +- ...tra_diffusion_for_w_con_approaching_cfl.py | 2 +- ..._interpolated_horizontal_advection_of_w.py | 2 +- .../test_add_temporal_tendencies_to_vn.py | 2 +- ...vn_by_interpolating_between_time_levels.py | 2 +- ...l_wind_derivative_to_divergence_damping.py | 2 +- ...test_apply_2nd_order_divergence_damping.py | 2 +- ...test_apply_4th_order_divergence_damping.py | 2 +- ..._apply_divergence_damping_and_update_vn.py | 1 + ...o_horizontal_gradient_of_exner_pressure.py | 2 +- .../test_apply_rayleigh_damping_mechanism.py | 2 +- ...ed_2nd_and_4th_order_divergence_damping.py | 2 +- ...vection_in_horizontal_momentum_equation.py | 1 + ...advection_in_vertical_momentum_equation.py | 3 ++- ...ompute_advective_vertical_wind_tendency.py | 2 +- .../stencil_tests/test_compute_airmass.py | 2 +- ...rox_of_2nd_vertical_derivative_of_exner.py | 2 +- ...and_fluxes_and_prepare_tracer_advection.py | 2 +- ...st_compute_avg_vn_and_graddiv_vn_and_vt.py | 2 +- .../test_compute_contravariant_correction.py | 2 +- ...t_compute_contravariant_correction_of_w.py | 2 +- ...iant_correction_of_w_for_lower_boundary.py | 2 +- ...nds_and_ke_and_contravariant_correction.py | 1 + ...e_divergence_of_fluxes_of_rho_and_theta.py | 2 +- ...est_compute_dwdz_for_divergence_damping.py | 2 +- .../test_compute_exner_from_rhotheta.py | 2 +- ...compute_explicit_part_for_rho_and_exner.py | 2 +- ...rom_advection_and_vertical_wind_density.py | 2 +- ...d_speed_and_vertical_wind_times_density.py | 2 +- .../test_compute_graddiv2_of_vn.py | 2 +- ...e_horizontal_advection_of_rho_and_theta.py | 2 +- ...al_advection_term_for_vertical_velocity.py | 2 +- ..._of_exner_pressure_for_flat_coordinates.py | 2 +- ...t_of_exner_pressure_for_multiple_levels.py | 2 +- ..._exner_pressure_for_nonflat_coordinates.py | 2 +- .../test_compute_horizontal_kinetic_energy.py | 2 +- ...rizontal_velocity_quantities_and_fluxes.py | 2 +- ...est_compute_hydrostatic_correction_term.py | 2 +- .../stencil_tests/test_compute_mass_flux.py | 2 +- ...nd_clip_contravariant_vertical_velocity.py | 2 +- ...t_compute_perturbation_of_rho_and_theta.py | 2 +- ...nd_theta_and_rho_interface_cell_centers.py | 2 +- ..._perturbed_quantities_and_interpolation.py | 2 +- ...ute_results_for_thermodynamic_variables.py | 2 +- ...tial_temperatures_and_pressure_gradient.py | 2 +- ...test_compute_solver_coefficients_matrix.py | 2 +- .../test_compute_tangential_wind.py | 2 +- .../test_compute_theta_and_exner.py | 2 +- ...tial_temperatures_and_pressure_gradient.py | 2 +- .../test_compute_vn_on_lateral_boundary.py | 2 +- .../test_copy_cell_kdim_field_to_vp.py | 2 +- .../stencil_tests/test_extrapolate_at_top.py | 2 +- ...t_extrapolate_temporally_exner_pressure.py | 2 +- .../test_init_cell_kdim_field_with_zero_vp.py | 2 +- .../test_init_cell_kdim_field_with_zero_wp.py | 2 +- ..._init_two_cell_kdim_fields_with_zero_vp.py | 2 +- ..._init_two_edge_kdim_fields_with_zero_wp.py | 2 +- ...nterpolate_cell_field_to_half_levels_vp.py | 2 +- ...ariant_vertical_velocity_to_full_levels.py | 2 +- ...d_compute_temperature_vertical_gradient.py | 2 +- .../test_interpolate_to_cell_center.py | 2 +- .../test_interpolate_to_surface.py | 2 +- ..._and_vt_to_ie_and_compute_ekin_on_edges.py | 2 +- ...els_and_compute_kinetic_energy_on_edges.py | 2 +- .../test_interpolate_vt_to_interface_edges.py | 2 +- ...lation_scalar_cells2verts_scalar_ri_dsl.py | 2 +- .../test_mo_math_divrot_rot_vertex_ri_dsl.py | 2 +- ...tion_for_w_and_contravariant_correction.py | 2 +- ..._set_theta_v_prime_ic_at_lower_boundary.py | 2 +- ...diagonal_matrix_for_w_back_substitution.py | 2 +- ..._tridiagonal_matrix_for_w_forward_sweep.py | 2 +- ...test_spatially_average_flux_or_velocity.py | 2 +- .../test_update_density_exner_wind.py | 2 +- ...t_update_dynamical_exner_time_increment.py | 2 +- .../test_update_mass_flux_weighted.py | 2 +- .../test_update_mass_volume_flux.py | 2 +- .../stencil_tests/test_update_theta_v.py | 2 +- .../dycore/stencil_tests/test_update_wind.py | 2 +- ...mplicit_dycore_solver_at_corrector_step.py | 1 + ...mplicit_dycore_solver_at_predictor_step.py | 1 + .../test_T_from_internal_energy.py | 2 +- .../stencil_tests/test_cloud_to_graupel.py | 2 +- .../test_cloud_to_graupel_default.py | 2 +- .../stencil_tests/test_cloud_to_rain.py | 2 +- .../test_cloud_to_rain_default.py | 2 +- .../stencil_tests/test_cloud_to_snow.py | 2 +- .../test_cloud_to_snow_default.py | 2 +- .../muphys/stencil_tests/test_cloud_x_ice.py | 2 +- .../stencil_tests/test_cloud_x_ice_default.py | 2 +- .../test_deposition_auto_conversion.py | 2 +- ...test_deposition_auto_conversion_default.py | 2 +- .../stencil_tests/test_deposition_factor.py | 2 +- .../muphys/stencil_tests/test_dqsatdT_rho.py | 2 +- .../muphys/stencil_tests/test_fall_speed.py | 2 +- .../stencil_tests/test_graupel_to_rain.py | 2 +- .../test_graupel_to_rain_default.py | 2 +- .../test_ice_deposition_nucleation.py | 2 +- .../test_ice_deposition_nucleation_default.py | 2 +- .../muphys/stencil_tests/test_ice_mass.py | 2 +- .../muphys/stencil_tests/test_ice_number.py | 2 +- .../muphys/stencil_tests/test_ice_sticking.py | 2 +- .../stencil_tests/test_ice_to_graupel.py | 2 +- .../test_ice_to_graupel_default.py | 2 +- .../muphys/stencil_tests/test_ice_to_snow.py | 2 +- .../stencil_tests/test_ice_to_snow_default.py | 2 +- .../stencil_tests/test_internal_energy.py | 2 +- .../muphys/stencil_tests/test_qsat_ice_rho.py | 2 +- .../muphys/stencil_tests/test_qsat_rho.py | 2 +- .../stencil_tests/test_qsat_rho_tmelt.py | 2 +- .../stencil_tests/test_rain_to_graupel_1.py | 2 +- .../stencil_tests/test_rain_to_graupel_2.py | 2 +- .../stencil_tests/test_rain_to_graupel_3.py | 2 +- .../test_rain_to_graupel_default.py | 2 +- .../stencil_tests/test_rain_to_vapor.py | 2 +- .../test_rain_to_vapor_default.py | 2 +- .../muphys/stencil_tests/test_sat_pres_ice.py | 2 +- .../stencil_tests/test_sat_pres_water.py | 2 +- .../test_saturation_adjustment.py | 2 +- .../test_saturation_adjustment2.py | 2 +- .../muphys/stencil_tests/test_snow_lambda.py | 2 +- .../muphys/stencil_tests/test_snow_number.py | 2 +- .../stencil_tests/test_snow_number_default.py | 2 +- .../stencil_tests/test_snow_to_graupel.py | 2 +- .../test_snow_to_graupel_default.py | 2 +- .../muphys/stencil_tests/test_snow_to_rain.py | 2 +- .../test_snow_to_rain_default.py | 2 +- .../stencil_tests/test_vapor_x_graupel.py | 2 +- .../test_vapor_x_graupel_default.py | 2 +- .../muphys/stencil_tests/test_vapor_x_ice.py | 2 +- .../stencil_tests/test_vapor_x_ice_default.py | 2 +- .../muphys/stencil_tests/test_vapor_x_snow.py | 2 +- .../test_vapor_x_snow_default.py | 2 +- .../test_vel_scale_factor_ice.py | 2 +- .../test_vel_scale_factor_snow.py | 2 +- .../test_cell_2_edge_interpolation.py | 2 +- ...est_compute_cell_2_vertex_interpolation.py | 2 +- .../stencil_tests/test_diagnose_pressure.py | 2 +- .../test_diagnose_surface_pressure.py | 2 +- .../test_diagnose_temperature.py | 2 +- ...st_edge_2_cell_vector_rbf_interpolation.py | 2 +- ...nterpolate_edge_field_to_half_levels_vp.py | 2 +- ...est_mo_intp_rbf_rbf_vec_interpol_vertex.py | 2 +- ...izontal_gradients_by_green_gauss_method.py | 2 +- .../test_compute_first_vertical_derivative.py | 2 +- .../common/math/unit_tests/test_helpers.py | 4 ++-- .../common/math/unit_tests/test_operators.py | 4 ++-- .../icon4py/model/testing/stencil_tests.py | 19 +++++++++++-------- 203 files changed, 216 insertions(+), 207 deletions(-) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py index 2b82a73a20..06f0cd2c1b 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py @@ -43,7 +43,7 @@ def reference( rhodz_ast2 = np.maximum(0.1 * p_rhodz_new, p_rhodz_new) - p_dtime * tmp return dict(rhodz_ast2=rhodz_ast2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_rhodz_new = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_mflx_contra_v = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py index 4484a4159a..a639500264 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py @@ -37,7 +37,7 @@ def reference( return dict(p_tracer_new=p_tracer_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_grf_tend_tracer = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py index 9c428c9c60..ea5b270230 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py @@ -47,7 +47,7 @@ def reference( return dict(rhodz_ast2=rhodz_ast2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: rhodz_ast = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_mflx_contra_v = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py index d73e3354ac..ca6db686bd 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py @@ -34,7 +34,7 @@ def reference( p_out_e = (z_tracer_mflx_1_dsl + z_tracer_mflx_2_dsl) / float(2) return dict(p_out_e=p_out_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_tracer_mflx_1_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) z_tracer_mflx_2_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py index 9883b6fc5a..82fe0ae467 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py @@ -35,7 +35,7 @@ def reference( p_out_e = (z_tracer_mflx_1_dsl + z_tracer_mflx_2_dsl + z_tracer_mflx_3_dsl) / float(3) return dict(p_out_e=p_out_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_tracer_mflx_1_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) z_tracer_mflx_2_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py index 63dc972850..757a0fcee2 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py @@ -77,7 +77,7 @@ def reference( z_tracer_min=z_tracer_min, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) p_rhodz_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py index 63054b2a19..9351816d16 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py @@ -79,7 +79,7 @@ def reference( p_distv_bary_2=p_distv_bary_2, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py index 1adb8af3aa..38bb95e49b 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py @@ -72,7 +72,7 @@ def reference( p_distv_bary_2=p_distv_bary_2, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py index 60bb15e9cf..1b65e483ec 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py @@ -145,7 +145,7 @@ def reference( "p_coords_dreg_v_4_lat_dsl": p_coords_dreg_v_4_lat_dsl, } - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py index 064c915c6c..ce90d0e9b5 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py @@ -44,7 +44,7 @@ def reference( return dict(lvn_sys_pos=lvn_sys_pos) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) tangent_orientation = data_alloc.random_field(grid, dims.EdgeDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py index 326d040463..cacb408cbb 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py @@ -46,7 +46,7 @@ def reference( return dict(opt_famask_dsl=opt_famask_dsl) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py index cdf27e4979..94fc3b8e84 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py @@ -34,7 +34,7 @@ def reference( return dict(p_out_e_hybrid_2=p_out_e_hybrid_2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_out_e_hybrid_2 = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_mass_flx_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py index 51e4cc49d2..29eaaba61c 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py @@ -57,7 +57,7 @@ def reference( return dict(p_out_e=p_out_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_lsq_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_lsq_coeff_2 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py index f490a7bf82..d9bc8813bf 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py @@ -57,7 +57,7 @@ def reference( return dict(p_out_e=p_out_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_lsq_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_lsq_coeff_2 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py index c6ee1ad78e..902d8d3ae9 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py @@ -53,7 +53,7 @@ def reference( return dict(r_m=r_m) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py index ffaeefc5c6..11f06165a8 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py @@ -36,7 +36,7 @@ def reference( z_a1 = p_cc - 0.5 * (z_face_up + z_face_low) return dict(z_delta_q=z_delta_q, z_a1=z_a1) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_face_up = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_face_low = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py index 054cb659fe..1b84c3debe 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py @@ -49,7 +49,7 @@ def reference( p_face[:, 1:] = np.where((k[1:] == elevp1), p_cc[:, :-1], p_face[:, 1:]) return dict(p_face=p_face) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_cellhgt_mc_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py index 98095dc0f1..22d8be854e 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py @@ -42,7 +42,7 @@ def reference( ) return dict(p_face=p_face) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_face = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py index b6192bf216..691dc715b8 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py @@ -68,7 +68,7 @@ def reference( ) return dict(p_face=p_face) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_cellhgt_mc_now = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py index d875fd8f2c..3585651cfb 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py @@ -64,7 +64,7 @@ def reference( z_slope = np.where(k[1:-1] < elev, z_slope_a, z_slope_b) return dict(z_slope=z_slope) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_slope = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py index 88810d6269..17f4aea803 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py @@ -34,7 +34,7 @@ def reference( return dict(opt_ddt_tracer_adv=opt_ddt_tracer_adv) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_tracer_new = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py index e881c1f702..f308571140 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py @@ -36,7 +36,7 @@ def reference( l_limit = np.where(np.abs(z_delta) < -1 * z_a6i, 1, 0) return dict(l_limit=l_limit) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_face = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py index 03d40aaa52..1835f18619 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py @@ -41,7 +41,7 @@ def reference( ) return dict(p_upflux=p_upflux) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_mflx_contra_v = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py index 6bb07ba7cb..ec40232a0f 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py @@ -61,7 +61,7 @@ def reference( z_tracer_new_dsl=z_tracer_new_dsl, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_mass_flx_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py index f1f1134f66..2621e1db67 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py @@ -45,7 +45,7 @@ def reference( ) / rhodz_new return dict(tracer_new_hor=tracer_new_hor) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_mflx_tracer_h = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) deepatmo_divh = data_alloc.random_field(grid, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py index 6ab7a36d13..c6b02ab378 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py @@ -58,7 +58,7 @@ def reference( return dict(tracer_new=tracer_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) rhodz_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py index b7079d0aca..937fe35fc0 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py @@ -47,7 +47,7 @@ def reference( ) return dict(p_face_up=q_face_up, p_face_low=q_face_low) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: l_limit = data_alloc.random_mask(grid, dims.CellDim, dims.KDim, dtype=gtx.int32) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py index fb32ae1f24..624eeb8703 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py @@ -39,7 +39,7 @@ def reference( slope = np.where(z_slope[:, 1:-1] >= 0.0, slope_l, -slope_l) return dict(z_slope=slope) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_slope = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py index 9fe005d986..30fcccd0f8 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py @@ -54,7 +54,7 @@ def reference( z_tracer_min=z_tracer_min_out, ) - @pytest.fixture() + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: hi_bound, lo_bound = 3, 1 refin_ctrl = data_alloc.constant_field(grid, 2, dims.CellDim, dtype=gtx.int32) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py index bc2d3c6933..8a696d961d 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py @@ -1470,7 +1470,7 @@ def reference( dreg_patch2_4_lat_vmask=dreg_patch2_4_lat_vmask, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: famask_int = data_alloc.random_mask(grid, dims.EdgeDim, dims.KDim, dtype=gtx.int32) p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py index efe12e6b23..3664cdc0d9 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py @@ -485,7 +485,7 @@ def reference( p_dreg_area_out=p_dreg_area_out, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_coords_dreg_v_1_x = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_coords_dreg_v_2_x = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py index 66b376c37a..1ede54c31b 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py @@ -519,7 +519,7 @@ def reference( p_dreg_area=p_dreg_area, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: famask_int = data_alloc.constant_field(grid, 1, dims.EdgeDim, dims.KDim, dtype=gtx.int32) p_coords_dreg_v_1_x = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py index ed85115d46..7736363941 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py @@ -304,7 +304,7 @@ def reference( p_coeff_10_dsl=p_coeff_10_dsl, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) lsq_pseudoinv_1_field = data_alloc.random_field(grid, dims.CellDim, dims.C2E2C2E2CDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py index 29d880a8f7..89d878db3f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py @@ -75,7 +75,7 @@ def reference( return dict(theta_v=theta_v, exner=exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): pytest.xfail( "stencil segfaults with GTFN and it is not used in diffusion: it is missing an if condition" diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index debdae974f..743cb7934f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -115,7 +115,7 @@ def reference( return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index 4e9652ac76..dc81503657 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -118,7 +118,7 @@ def reference( out_dwdy[subset] = dwdy[subset] return dict(w=out_w, dwdx=out_dwdx, dwdy=out_dwdy) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: nrdmax = 13 cell_domain = h_grid.domain(dims.CellDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py index c2ef62b392..97717a64d2 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py @@ -34,7 +34,7 @@ class TestApplyNabla2AndNabla4GlobalToVn(StencilTest): PROGRAM = apply_nabla2_and_nabla4_global_to_vn OUTPUTS = ("vn",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): area_edge = random_field(grid, dims.EdgeDim, dtype=wpfloat) kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py index 3b60be5291..ae71aea8c4 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py @@ -42,7 +42,7 @@ class TestApplyNabla2AndNabla4ToVn(StencilTest): PROGRAM = apply_nabla2_and_nabla4_to_vn OUTPUTS = ("vn",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): area_edge = random_field(grid, dims.EdgeDim, dtype=wpfloat) kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py index 0de1666efd..580c54e3aa 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py @@ -33,7 +33,7 @@ class TestApplyNabla2ToVnInLateralBoundary(StencilTest): PROGRAM = apply_nabla2_to_vn_in_lateral_boundary OUTPUTS = ("vn",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): fac_bdydiff_v = wpfloat("5.0") z_nabla2_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py index cf505ee6ca..816ac25e07 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py @@ -51,7 +51,7 @@ def reference( w = apply_nabla2_to_w_numpy(connectivities, area, z_nabla2_c, geofac_n2s, w, diff_multfac_w) return dict(w=w) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): area = random_field(grid, dims.CellDim, dtype=wpfloat) z_nabla2_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py index 74d532867b..82876600d8 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py @@ -34,7 +34,7 @@ class TestApplyNabla2ToWInUpperDampingLayer(StencilTest): PROGRAM = apply_nabla2_to_w_in_upper_damping_layer OUTPUTS = ("w",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff_multfac_n2w = random_field(grid, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py index 142ee4d36a..05f4ca81d1 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py @@ -47,7 +47,7 @@ def reference( ) return dict(div_ic=div_ic, hdef_ic=hdef_ic) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) div = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py index fa6659390b..10d4e43ce2 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py @@ -51,7 +51,7 @@ def reference( ) return dict(dwdx=dwdx, dwdy=dwdy) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): w = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) geofac_grg_x = data_alloc.random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index e9cd84bde4..d115d6deb3 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -173,7 +173,7 @@ def reference( return dict(kh_smag_e=kh_smag_e_out, kh_smag_ec=kh_smag_ec_out, z_nabla2_e=z_nabla2_e_out) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py index eb405afab2..09a36b58bc 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py @@ -44,7 +44,7 @@ def reference( z_nabla2_c = calculate_nabla2_for_w_numpy(connectivities, w, geofac_n2s) return dict(z_nabla2_c=z_nabla2_c) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: w = constant_field(grid, 1.0, dims.CellDim, dims.KDim) geofac_n2s = constant_field(grid, 2.0, dims.CellDim, dims.C2E2CODim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py index f3934007e0..bdff00e5ca 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py @@ -59,7 +59,7 @@ def reference( ) return dict(z_nabla2_e=z_nabla2_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py index 5355ee6371..065366e934 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py @@ -41,7 +41,7 @@ def reference( z_temp = calculate_nabla2_of_theta_numpy(connectivities, z_nabla2_e, geofac_div) return dict(z_temp=z_temp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_nabla2_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py index dc8f9ac4ba..0a73f1c3c8 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py @@ -97,7 +97,7 @@ def reference( ) return dict(z_nabla4_e2=z_nabla4_e2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py index 50524d92d4..89b28bb42b 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py @@ -42,7 +42,7 @@ def reference( ) return dict(kh_smag_e=kh_smag_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) enh_diffu_3d = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py index fd0b4563a9..4e61c5703e 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py @@ -52,7 +52,7 @@ def reference( return dict(enh_diffu_3d=enh_diffu_3d) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: theta_v = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) theta_ref_mc = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py index 0352652ad2..6cea5e6a00 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py @@ -46,7 +46,7 @@ def reference( return dict(div=div, kh_c=kh_c) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py index 93f47096d6..0ce06ce981 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py @@ -88,7 +88,7 @@ def reference( ) return dict(z_temp=z_temp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): mask = random_mask(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py index d7bce46e8a..0c84a6487d 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py @@ -50,7 +50,7 @@ def reference( theta_v, exner = update_theta_and_exner_numpy(z_temp, area, theta_v, exner, rd_o_cvd) return dict(theta_v=theta_v, exner=exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_temp = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) area = random_field(grid, dims.CellDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py index c58454e15d..58b32d5d15 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py @@ -60,7 +60,7 @@ def reference( return dict(vn_traj=vn_traj, mass_flx_me=mass_flx_me) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: mass_fl_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) mass_flx_me = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py index 5bf6bf9525..c4e248313f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py @@ -58,7 +58,7 @@ def reference( ) return dict(z_rho_expl=z_rho_expl, z_exner_expl=z_exner_expl) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_exner_expl = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) exner_incr = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py index 8f67332647..3f80d216c6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py @@ -45,7 +45,7 @@ def reference( vn = add_analysis_increments_to_vn_numpy(vn_incr, vn, iau_wgt_dyn) return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn_incr = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py index 6c69b6b94e..8cac1ad9d0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py @@ -102,7 +102,7 @@ class TestAddExtraDiffusionForNormalWindTendencyApproachingCfl(StencilTest): PROGRAM = add_extra_diffusion_for_normal_wind_tendency_approaching_cfl OUTPUTS = ("ddt_vn_apc",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: levelmask = data_alloc.random_mask(grid, dims.KDim, extend={dims.KDim: 1}) c_lin_e = data_alloc.random_field(grid, dims.EdgeDim, dims.E2CDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py index 1e855f11ac..720511cb0b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py @@ -107,7 +107,7 @@ def reference( ) return dict(ddt_w_adv=ddt_w_adv) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: cfl_clipping = random_mask(grid, dims.CellDim, dims.KDim) owner_mask = random_mask(grid, dims.CellDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py index e27f6d9ee7..54ba2b1100 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py @@ -55,7 +55,7 @@ def reference( ) return dict(ddt_w_adv=ddt_w_adv) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_v_grad_w = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) e_bln_c_s = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py index 861d66d4ba..1a0d714fe8 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py @@ -59,7 +59,7 @@ def reference( ) return dict(vn_nnew=vn_nnew) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = wpfloat("10.0") vn_nnow = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py index b84b1bbc74..641cb6a4e0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py @@ -76,7 +76,7 @@ def reference( ) return dict(vn_nnew=vn_nnew) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn_nnow = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) ddt_vn_apc_ntl1 = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py index 723e7952e6..68877d563f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py @@ -68,7 +68,7 @@ def reference( ) return dict(z_graddiv_vn=z_graddiv_vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: hmask_dd3d = data_alloc.random_field(grid, dims.EdgeDim, dtype=ta.wpfloat) scalfac_dd3d = data_alloc.random_field(grid, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py index 08bd2c8d73..253fe9bd2b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py @@ -45,7 +45,7 @@ def reference( vn = apply_2nd_order_divergence_damping_numpy(z_graddiv_vn, vn, scal_divdamp_o2) return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_graddiv_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py index 82148b6461..6f0cb4140a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py @@ -47,7 +47,7 @@ def reference( vn = apply_4th_order_divergence_damping_numpy(scal_divdamp, z_graddiv2_vn, vn) return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: scal_divdamp = random_field(grid, dims.KDim, dtype=wpfloat) z_graddiv2_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index ba5d783c5d..601a6c10cb 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -188,6 +188,7 @@ def reference( ] ], ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]__second_order_divdamp_factor[{param['second_order_divdamp_factor']}]", + scope="class", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py index 7189d02661..7396f64890 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py @@ -54,7 +54,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ipeidx_dsl = random_mask(grid, dims.EdgeDim, dims.KDim) pg_exdist = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py index 05270e43f2..90f8042e35 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py @@ -49,7 +49,7 @@ def reference( w = apply_rayleigh_damping_mechanism_numpy(connectivities, z_raylfac, w_1, w) return dict(w=w) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_raylfac = random_field(grid, dims.KDim, dtype=wpfloat) w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py index 31de7f151f..937383be01 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py @@ -57,7 +57,7 @@ def reference( ) return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: scal_divdamp = random_field(grid, dims.KDim, dtype=wpfloat) bdy_divdamp = random_field(grid, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index 608af55537..bf502f935b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -250,6 +250,7 @@ def reference( {"apply_extra_diffusion_on_vn": value} for value in [True, False] ], # True for testing, False for benchmarking ids=lambda param: f"/[{param['apply_extra_diffusion_on_vn']}]", + scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 29e097491d..6a0e7f5f83 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -409,7 +409,7 @@ def reference( vertical_cfl=vertical_cfl_ret, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: contravariant_corrected_w_at_cells_on_model_levels = data_alloc.zero_field( grid, dims.CellDim, dims.KDim @@ -627,6 +627,7 @@ def reference( {"skip_compute_predictor_vertical_advection": value} for value in [True, False] ], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", + scope="class", ) def input_data( self, grid: base.Grid, request: pytest.FixtureRequest diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py index 21fdb8c7ef..b02d3f84e7 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py @@ -56,7 +56,7 @@ def reference( ) return dict(ddt_w_adv=ddt_w_adv) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_w_con_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) w = random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py index 61445dcf1e..6566146ace 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py @@ -35,7 +35,7 @@ def reference( airmass_out = rho_in * ddqz_z_full_in * deepatmo_t1mc_in return dict(airmass_out=airmass_out) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rho_in = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) ddqz_z_full_in = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py index d842690914..1e308955fd 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py @@ -57,7 +57,7 @@ def reference( ) return dict(z_dexner_dz_c_2=z_dexner_dz_c_2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_theta_v_pr_ic = random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=vpfloat diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py index 11a52a0744..96904cc9cb 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py @@ -134,7 +134,7 @@ def reference( substep_averaged_mass_flux=substep_averaged_mass_flux, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: spatially_averaged_vn = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) mass_fl_e = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py index 5cf3efa33b..fc9664a2cc 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py @@ -65,7 +65,7 @@ def reference( ) return dict(z_vn_avg=z_vn_avg, z_graddiv_vn=z_graddiv_vn, vt=vt) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_flx_avg = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) geofac_grdiv = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py index e557ec551d..c18b8bffeb 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py @@ -45,7 +45,7 @@ def reference( z_w_concorr_me = compute_contravariant_correction_numpy(vn, ddxn_z_full, ddxt_z_full, vt) return dict(z_w_concorr_me=z_w_concorr_me) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) ddxn_z_full = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py index 6a7d916250..7de0fb6249 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py @@ -56,7 +56,7 @@ def reference( ) return dict(w_concorr_c=w_concorr_c) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_bln_c_s = random_field(grid, dims.CellDim, dims.C2EDim, dtype=wpfloat) z_w_concorr_me = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py index 1723d907a5..c899c092d5 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py @@ -65,7 +65,7 @@ def reference( ) return dict(w_concorr_c=w_concorr_c) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_bln_c_s = random_field(grid, dims.CellDim, dims.C2EDim, dtype=wpfloat) z_w_concorr_me = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index e9335d2476..a3fe973074 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -286,6 +286,7 @@ def reference( {"skip_compute_predictor_vertical_advection": value} for value in [True, False] ], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", + scope="class", ) def input_data( self, grid: base.Grid, request: pytest.FixtureRequest diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py index d009a74d8d..124ab43ba1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py @@ -57,7 +57,7 @@ def reference( ) return dict(z_flxdiv_mass=z_flxdiv_mass, z_flxdiv_theta=z_flxdiv_theta) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) z_theta_v_fl_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py index a14d93aca1..5d5f07155c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py @@ -50,7 +50,7 @@ def reference( ) return dict(out=z_dwdz_dd) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, Any]: inv_ddqz_z_full = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) w = random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py index 582a4ef0d3..693bd5fef3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py @@ -38,7 +38,7 @@ def reference( exner = np.exp(rd_o_cvd * np.log(rd_o_p0ref * rho * theta_v)) return dict(out=(theta_v, exner)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, Any]: rd_o_cvd = wpfloat("10.0") rd_o_p0ref = wpfloat("20.0") diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py index 347299fd46..9d6624d00f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py @@ -85,7 +85,7 @@ def reference( ) return dict(z_rho_expl=z_rho_expl, z_exner_expl=z_exner_expl) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = ta.wpfloat("1.0") rho_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py index efd3ba9a10..fd6e7eb72e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py @@ -82,7 +82,7 @@ def reference( ) return dict(z_w_expl=z_w_expl, z_contr_w_fl_l=z_contr_w_fl_l) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) ddt_w_adv_ntl1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py index bdaf78fbc3..3cbf36e98d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py @@ -72,7 +72,7 @@ def reference( ) return dict(z_w_expl=z_w_expl, z_contr_w_fl_l=z_contr_w_fl_l) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w_nnow = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) ddt_w_adv_ntl1 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py index 3f9eca2afc..9df4526221 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py @@ -49,7 +49,7 @@ def reference( z_graddiv2_vn = compute_graddiv2_of_vn_numpy(connectivities, geofac_grdiv, z_graddiv_vn) return dict(z_graddiv2_vn=z_graddiv2_vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_graddiv_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) geofac_grdiv = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py index ad61d07c8a..07aab9f9b3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py @@ -251,7 +251,7 @@ def reference( ) return dict(out=(z_rho_e, z_theta_v_e)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py index 0c47cf433c..c6d80e8216 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py @@ -82,7 +82,7 @@ def reference( )[horizontal_start:horizontal_end, :] return dict(z_v_grad_w=z_v_grad_w) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn_ie = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py index 09ade5f64b..530e9e7e67 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py @@ -53,7 +53,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) z_exner_ex_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py index 53555a19e6..373361c042 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py @@ -91,7 +91,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=ta.wpfloat) z_exner_ex_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py index 0369fc2b9c..c07e738947 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py @@ -68,7 +68,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) z_exner_ex_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py index a81376ec23..a97d8d7a1c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py @@ -43,7 +43,7 @@ def reference( vn_ie, z_vt_ie, z_kin_hor_e = compute_horizontal_kinetic_energy_numpy(vn, vt) return dict(vn_ie=vn_ie, z_vt_ie=z_vt_ie, z_kin_hor_e=z_kin_hor_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) vt = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py index 7405e97638..305b0e0013 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py @@ -259,7 +259,7 @@ def reference( contravariant_correction_at_edges_on_model_levels=contravariant_correction_at_edges_on_model_levels, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: spatially_averaged_vn = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) horizontal_gradient_of_normal_wind_divergence = data_alloc.zero_field( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py index 7eed5b8929..0eb6d71696 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py @@ -130,7 +130,7 @@ def reference( ) return dict(z_hydro_corr=z_hydro_corr) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ikoffset = data_alloc.zero_field( grid, dims.EdgeDim, dims.E2CDim, dims.KDim, dtype=gtx.int32 diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py index 330d0410a0..63121c1961 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py @@ -54,7 +54,7 @@ def reference( return dict(mass_fl_e=mass_fl_e, z_theta_v_fl_e=z_theta_v_fl_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_rho_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) z_vn_avg = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py index 2cd2a83c8f..84cbf72c48 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py @@ -70,7 +70,7 @@ def reference( z_w_con_c=z_w_con_c, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ddqz_z_half = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) z_w_con_c = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py index 79d910c5b9..9c3bc1fc47 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py @@ -51,7 +51,7 @@ def reference( ) return dict(z_rth_pr_1=z_rth_pr_1, z_rth_pr_2=z_rth_pr_2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rho = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) rho_ref_mc = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py index e224318650..cab2d5ca4c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py @@ -66,7 +66,7 @@ def reference( ) return dict(rho_ic=rho_ic, z_rth_pr_1=z_rth_pr_1, z_rth_pr_2=z_rth_pr_2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) rho = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index a173e626f1..14089fbaac 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -347,7 +347,7 @@ def reference( d2dz2_of_temporal_extrapolation_of_perturbed_exner_on_model_levels=d2dz2_of_temporal_extrapolation_of_perturbed_exner_on_model_levels, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: reference_rho_at_cells_on_model_levels = data_alloc.random_field( grid, dims.CellDim, dims.KDim diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py index 2efbdbddd9..6345bc6d8b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py @@ -102,7 +102,7 @@ def reference( ) return dict(rho_new=rho_new, exner_new=exner_new, theta_v_new=theta_v_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_rho_expl = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) vwind_impl_wgt = data_alloc.random_field(grid, dims.CellDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py index 6f71a1f98a..721e38564e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py @@ -128,7 +128,7 @@ def reference( z_th_ddz_exner_c=z_th_ddz_exner_c, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = ta.wpfloat("1.0") wgt_nnow_rth = ta.wpfloat("2.0") diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py index da06853a0a..120347b429 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py @@ -74,7 +74,7 @@ def reference( ) return dict(z_beta=z_beta, z_alpha=z_alpha) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: exner_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) rho_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py index fbcc397990..4655ee9780 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py @@ -44,7 +44,7 @@ def reference( vt = compute_tangential_wind_numpy(connectivities, vn, rbf_vec_coeff_e) return dict(vt=vt) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) rbf_vec_coeff_e = random_field(grid, dims.EdgeDim, dims.E2C2EDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py index ff5bc26e71..b5d49fccae 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py @@ -43,7 +43,7 @@ def reference( return dict(theta_v=theta_v, exner=exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rd_o_cvd = ta.wpfloat("10.0") rd_o_p0ref = ta.wpfloat("20.0") diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py index 4ef0d53930..2d3eb8fd2a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py @@ -92,7 +92,7 @@ def reference( z_th_ddz_exner_c=z_th_ddz_exner_c, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) z_rth_pr_2 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py index 50aec37834..55ee685d0c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py @@ -36,7 +36,7 @@ def reference( vn_new = vn_now + dtime * grf_tend_vn return dict(vn_new=vn_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: grf_tend_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) vn_now = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py index e1408308a9..7f4d22ee23 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py @@ -38,7 +38,7 @@ def reference( field_copy = copy_cell_kdim_field_to_vp_numpy(field) return dict(field_copy=field_copy) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: field = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) field_copy = zero_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py index 74c9b6845d..e35da36b5c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py @@ -51,7 +51,7 @@ def reference( vn_ie = extrapolate_at_top_numpy(wgtfacq_e, vn) return dict(vn_ie=vn_ie) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfacq_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py index a87d532ff4..aa18002e4a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py @@ -57,7 +57,7 @@ def reference( return dict(z_exner_ex_pr=z_exner_ex_pr, exner_pr=exner_pr) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: exner = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) exner_ref_mc = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py index 01438aa31d..9e4270b4d1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py @@ -42,7 +42,7 @@ def reference( ) return dict(field_with_zero_vp=field_with_zero_vp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: field_with_zero_vp = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py index a0c2e0f902..814b9a7ba8 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py @@ -49,7 +49,7 @@ def reference( field_with_zero_wp = np.zeros_like(field_with_zero_wp) return dict(field_with_zero_wp=field_with_zero_wp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: field_with_zero_wp = zero_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py index b893924387..1ce19f3a56 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py @@ -40,7 +40,7 @@ def reference( cell_kdim_field_with_zero_vp_2=cell_kdim_field_with_zero_vp_2, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: cell_kdim_field_with_zero_vp_1 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) cell_kdim_field_with_zero_vp_2 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py index 77c5de7055..080bac1441 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py @@ -40,7 +40,7 @@ def reference( edge_kdim_field_with_zero_wp_2=edge_kdim_field_with_zero_wp_2, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: edge_kdim_field_with_zero_wp_1 = zero_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) edge_kdim_field_with_zero_wp_2 = zero_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py index 4cc48fd101..b23f88234f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py @@ -50,7 +50,7 @@ def reference( ) return dict(interpolation_to_half_levels_vp=interpolation_to_half_levels_vp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: interpolant = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py index 12f5fd8506..dfbcc454d3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py @@ -40,7 +40,7 @@ def reference( z_w_con_c_full = interpolate_contravariant_vertical_velocity_to_full_levels_numpy(z_w_con_c) return dict(z_w_con_c_full=z_w_con_c_full) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_w_con_c = random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=vpfloat diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py index e9ab186490..ac6a273aae 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py @@ -182,7 +182,7 @@ def reference( pressure_buoyancy_acceleration_at_cells_on_half_levels=pressure_buoyancy_acceleration_at_cells_on_half_levels, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w = data_alloc.random_field(grid, dims.CellDim, dims.KDim) contravariant_correction_at_cells_on_half_levels = data_alloc.random_field( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py index 8f018db9ca..5c0602bd22 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py @@ -51,7 +51,7 @@ def reference( interpolation = interpolate_to_cell_center_numpy(connectivities, interpolant, e_bln_c_s) return dict(interpolation=interpolation) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: interpolant = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) e_bln_c_s = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py index 2dc775909d..875d6f728e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py @@ -51,7 +51,7 @@ def reference( ) return dict(interpolation_to_surface=interpolation_to_surface) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: interpolant = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) wgtfacq_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py index b998025020..42502132b3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py @@ -45,7 +45,7 @@ def reference( z_kin_hor_e[:, 0] = 0 return dict(vn_ie=vn_ie, z_vt_ie=z_vt_ie, z_kin_hor_e=z_kin_hor_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_e = zero_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py index b2a19e3566..1c179606de 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py @@ -84,7 +84,7 @@ def reference( z_kin_hor_e=z_kin_hor_e, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py index 4fc1660fb6..88a3c4b887 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py @@ -50,7 +50,7 @@ def reference( z_vt_ie[subset] = interpolate_vt_to_interface_edges_numpy(wgtfac_e, vt)[subset] return dict(z_vt_ie=z_vt_ie) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py index 3ca6d13109..a251f10706 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py @@ -49,7 +49,7 @@ def reference( p_vert_out=p_vert_out, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: p_cell_in = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) c_intp = random_field(grid, dims.VertexDim, dims.V2CDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py index b819687c83..27cf49018d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py @@ -45,7 +45,7 @@ def reference( rot_vec = mo_math_divrot_rot_vertex_ri_dsl_numpy(connectivities, vec_e, geofac_rot) return dict(rot_vec=rot_vec) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vec_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) geofac_rot = random_field(grid, dims.VertexDim, dims.V2EDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py index af727d761e..61a19e760a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py @@ -51,7 +51,7 @@ def reference( ) return dict(w_nnew=w_nnew, z_contr_w_fl_l=z_contr_w_fl_l) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w_concorr_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) z_contr_w_fl_l = zero_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py index 122f1913ef..bd115a4409 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py @@ -63,7 +63,7 @@ def reference( ) return dict(z_theta_v_pr_ic=z_theta_v_pr_ic, theta_v_ic=theta_v_ic) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfacq_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) z_rth_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py index 076e84b767..aca2b603b2 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py @@ -52,7 +52,7 @@ def reference( w_new = solve_tridiagonal_matrix_for_w_back_substitution_numpy(connectivities, z_q=z_q, w=w) return dict(w=w_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_q = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py index 7bd38f9619..3a9ad4037b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py @@ -92,7 +92,7 @@ def reference( ) return dict(z_q=z_q_ref, w=w_ref) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base_grid.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vwind_impl_wgt = data_alloc.random_field(grid, dims.CellDim, dtype=ta.wpfloat) theta_v_ic = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py index d9d8ae062c..f09acf69b3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py @@ -53,7 +53,7 @@ def reference( return dict(spatially_averaged_flux_or_velocity=spatially_averaged_flux_or_velocity) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_flx_avg = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) flux_or_velocity = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py index 612a940991..2fc3e61d21 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py @@ -42,7 +42,7 @@ def reference( w_new = w_now + dtime * grf_tend_w return dict(rho_new=rho_new, exner_new=exner_new, w_new=w_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rho_now = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) grf_tend_rho = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py index ffcb582b55..456828fed6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py @@ -58,7 +58,7 @@ def reference( ) return dict(exner_dyn_incr=exner_dyn_incr) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ndyn_substeps_var, dtime = wpfloat("10.0"), wpfloat("12.0") exner = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py index 5a0e5422da..f63b88cfe2 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py @@ -60,7 +60,7 @@ def reference( ) return dict(mass_flx_ic=mass_flx_ic) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: r_nsubsteps = wpfloat("10.0") rho_ic = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py index 64cd7fab4f..b0a497719d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py @@ -67,7 +67,7 @@ def reference( ) return dict(mass_flx_ic=mass_flx_ic, vol_flx_ic=vol_flx_ic) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_contr_w_fl_l = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) rho_ic = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py index 3aaaf1d99f..47777ce620 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py @@ -51,7 +51,7 @@ def reference( ) return dict(theta_v_new=theta_v_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: mask_prog_halo_c = random_mask(grid, dims.CellDim) rho_now = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py index 32f31fe859..087dba1111 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py @@ -35,7 +35,7 @@ def reference( w_new = w_now + dtime * grf_tend_w return dict(w_new=w_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = wpfloat("10.0") w_now = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index bc69978318..d71987f39d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -414,6 +414,7 @@ def reference( f"lprep_adv[{p['lprep_adv']}]__" f"is_iau_active[{p['is_iau_active']}]" ), + scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 97ad07ae63..76b39d5cb7 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -406,6 +406,7 @@ def reference( ] ], ids=lambda param: f"at_first_substep[{param['at_first_substep']}]__is_iau_active[{param['is_iau_active']}]__divdamp_type[{param['divdamp_type']}]", + scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py index 1dddcb000c..ac21d6e87f 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(temperature=np.full(u.shape, 255.75599999999997)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( u=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py index c362dd7ece..92e4f31efd 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(riming_graupel_rate=np.full(t.shape, 2.7054723496793982e-10)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 256.983, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py index 9000f55ab3..0a443a32d5 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(riming_graupel_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py index 4a6b064888..604c7e5e84 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0045484481075162512)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 267.25, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py index 820355c8c2..aec955d9a1 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py index 90a9f18d34..499a1a2ead 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(riming_snow_rate=np.full(t.shape, 9.5431874564438999e-10)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 256.571, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py index 701a03e949..434535c60a 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(riming_snow_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py index ae897cab44..92365821d5 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(freezing_rate=np.full(t.shape, -1.5008166666666666e-08)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py index 2a09f91f90..dfa1d12cf7 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(freezing_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 256.835, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py index 377c940ed3..cc57f67b89 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py @@ -26,7 +26,7 @@ class TestDepositionAutoConversion(StencilTest): def reference(grid, qi: np.ndarray, m_ice: np.ndarray, ice_dep: np.ndarray, **kwargs) -> dict: return dict(conversion_rate=np.full(qi.shape, 6.6430804299795412e-08)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py index 971bc9c76b..213dfae725 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py @@ -25,7 +25,7 @@ class TestDepositionAutoConversionDefault(StencilTest): def reference(grid, qi: np.ndarray, m_ice: np.ndarray, ice_dep: np.ndarray, **kwargs) -> dict: return dict(conversion_rate=np.full(qi.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 2.02422e-23, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py index d89b8452a9..477099fde9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py @@ -23,7 +23,7 @@ class TestDepositionFactor(StencilTest): def reference(grid, t: np.ndarray, qvsi: np.ndarray, **kwargs) -> dict: return dict(deposition_rate=np.full(t.shape, 1.3234329478493952e-05)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py index 65522326e2..3fbcd9fd1b 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py @@ -23,7 +23,7 @@ class TestQsatRho(StencilTest): def reference(grid, qs: np.ndarray, t: np.ndarray, **kwargs) -> dict: return dict(derivative=np.full(t.shape, 0.00030825070286492049)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qs=data_alloc.constant_field(grid, 0.00448941, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py index 162ad4c301..e76ba68ce9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py @@ -26,7 +26,7 @@ def reference( ) -> dict: return dict(speed=np.full(density.shape, 0.67882452435647411)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( density=data_alloc.zero_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py index 6f52329dc9..163cc8c4f0 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(rain_rate=np.full(t.shape, 5.9748142538569357e-13)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 280.156, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py index bd8b18b74e..967ae71bc7 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(rain_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 280.156, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py index 374b5c738e..7bf89f923a 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, 1.6836299999999999e-13)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 160.9, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py index b18697e349..0c5c8bab80 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py index bb9bdf1a45..e41fd42a79 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py @@ -23,7 +23,7 @@ class TestIceNumber(StencilTest): def reference(grid, qi: np.ndarray, ni: np.ndarray, **kwargs) -> dict: return dict(mass=np.full(qi.shape, 1.0e-12)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 2.02422e-23, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py index 05b5fa336c..6e5d64554f 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py @@ -23,7 +23,7 @@ class TestIceNumber(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, **kwargs) -> dict: return dict(number=np.full(t.shape, 5.0507995893464388)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py index 52532333b9..fdf3c129f9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py @@ -23,7 +23,7 @@ class TestIceSticking(StencilTest): def reference(grid, t: np.ndarray, **kwargs) -> dict: return dict(sticking_factor=np.full(t.shape, 0.8697930232044021)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 271.6, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py index 4f2bff9e32..51442a70bb 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(aggregation=np.full(rho.shape, 7.1049436957697864e-19)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.04848, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py index 4f2bff9e32..51442a70bb 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(aggregation=np.full(rho.shape, 7.1049436957697864e-19)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.04848, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py index 7072fc1c8c..149db77c98 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(qi.shape, 3.3262745200740486e-11)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 6.43223e-08, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py index bf6ad46db8..5640ad38f1 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(qi.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 7.95122e-25, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py index 3da5d59413..bf72e66b00 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(energy=np.full(t.shape, 38265357.270336017)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 255.756, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py index e29dc9911a..22fc1080b5 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py @@ -23,7 +23,7 @@ class TestQsatIceRho(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 0.0074981245870634101)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py index 8e29622ff0..9125f0a9c0 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py @@ -23,7 +23,7 @@ class TestQsatRho(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 0.0069027592942577506)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py index 6e13021be7..3c07dd56a3 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py @@ -23,7 +23,7 @@ class TestQsatRho(StencilTest): def reference(grid, rho: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(rho.shape, 0.0038828182695875113)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.24783, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py index bc1c75ce0d..dd54512f8d 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 5.1570340525841922e-17)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py index 1a26ea9b2e..072ae7a88c 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 1.0044914238516472e-12)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 230.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py index 0d6a3dc0a5..9cc0e37897 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 5.1423851647153399e-17)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py index 00ece8df68..b07e864fce 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py index c5528bc37a..fe66e7d746 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 2.8556697055499901e-19)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py index fb681877af..7aa1a3af79 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py index d56e9a0a01..382e3863ba 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py @@ -23,7 +23,7 @@ class TestSatPresIce(StencilTest): def reference(grid, t: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 1216.7746246067475)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py index 6bde29be18..c38dfbc385 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py @@ -23,7 +23,7 @@ class TestSatPresWater(StencilTest): def reference(grid, t: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 1120.1604149806028)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py index d83df25624..f79134b775 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py @@ -38,7 +38,7 @@ def reference( mask_out=np.full(te.shape, False), ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( te=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py index b8b685e11b..44b92a6895 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py @@ -43,7 +43,7 @@ def reference( qce_out=np.full(te.shape, 9.5724552280369163e-007), ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( te=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py index 3c30334f90..3a1e32a4de 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py @@ -24,7 +24,7 @@ class TestSnowLambda(StencilTest): def reference(grid, rho: np.ndarray, qs: np.ndarray, ns: np.ndarray, **kwargs) -> dict: return dict(riming_snow_rate=np.full(rho.shape, 1.0e10)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.12204, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py index 0887fae8c9..a23b2824df 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py @@ -23,7 +23,7 @@ class TestSnowNumber(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, qs: np.ndarray, **kwargs) -> dict: return dict(number=np.full(t.shape, 3813750.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 276.302, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py index 86c5a7aacd..82c8236ce3 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py @@ -23,7 +23,7 @@ class TestSnowNumberDefault(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, qs: np.ndarray, **kwargs) -> dict: return dict(number=np.full(t.shape, 8.00e5)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 276.302, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py index e69fc05ae6..4a0fda7d1c 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 6.2696154545048011e-10)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 265.85, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py index 1614d1aa14..1c16f82ba5 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.157, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py index 4b25992492..4641f61415 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 3.7268547760462804e-07)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 275.83, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py index b3a6b6ff6c..b8c9be3a7b 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 265.83, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py index 318c53c90e..fd3935b94a 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(exchange_rate=np.full(t.shape, -6.8498666666666675e-13)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.026, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py index 8420bd7063..c58e8456e3 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(exchange_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.026, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py index e76dc730df..78b5f03800 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(qi.shape, 2.2106162342610385e-09)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 9.53048e-07, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py index e45648728a..7a0a4bb672 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(qi.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 2.02422e-23, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py index bb074808aa..5aad429eea 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py @@ -38,7 +38,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, -8.6584296264775935e-13)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.748, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py index 26b02e3dee..4804b68423 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py @@ -38,7 +38,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.748, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py index 8b9f9795e8..cd84439f51 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py @@ -25,7 +25,7 @@ class TestVelScaleFactorIce(StencilTest): def reference(grid, xrho: np.ndarray, **kwargs) -> dict: return dict(scale_factor=np.full(xrho.shape, 1.1158596098981044)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( xrho=data_alloc.constant_field(grid, 1.17873, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py index 18e7048ab7..4848eaaeed 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py @@ -27,7 +27,7 @@ def reference( ) -> dict: return dict(scale_factor=np.full(xrho.shape, 0.06633230453931642)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( xrho=data_alloc.constant_field(grid, 1.17787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py b/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py index eb8ad994c6..c37509a11d 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py @@ -40,7 +40,7 @@ def reference( out_field=out_field, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: in_field = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) coeff = data_alloc.random_field(grid, dims.EdgeDim, dims.E2CDim, dtype=ta.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py b/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py index b68124bbda..e5e71acb1d 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py @@ -41,7 +41,7 @@ def reference( vert_out=out_field, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: cell_in = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=types.wpfloat) c_int = data_alloc.random_field(grid, dims.VertexDim, dims.V2CDim, dtype=types.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py index 2f0471e4fe..8f21503c83 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py @@ -52,7 +52,7 @@ def reference( pressure_ifc=pressure_ifc, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: ddqz_z_full = data_alloc.random_field( grid, dims.CellDim, dims.KDim, low=1.0, dtype=ta.wpfloat diff --git a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py index 55e0967f6a..175f289bff 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py @@ -47,7 +47,7 @@ def reference( surface_pressure=surface_pressure, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: low = 1.0e-2 exner = data_alloc.random_field(grid, dims.CellDim, dims.KDim, low=1.0e-6, dtype=ta.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py index 1e03d6b648..cdb20d25d3 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py @@ -45,7 +45,7 @@ def reference( temperature=temperature, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: theta_v = data_alloc.random_field( grid, dims.CellDim, dims.KDim, low=1.0e-4, high=1.0, dtype=ta.wpfloat diff --git a/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py b/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py index a4dea61823..dfd7a87175 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py @@ -41,7 +41,7 @@ def reference( return dict(p_v_out=p_v_out, p_u_out=p_u_out) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_e_in = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) ptr_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.C2E2C2EDim, dtype=ta.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py b/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py index 027b0ab492..37ddca6117 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py @@ -46,7 +46,7 @@ def reference( ) return dict(interpolation_to_half_levels_vp=interpolation_to_half_levels_vp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base_grid.Grid) -> dict: interpolant = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) wgtfac_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py index 2137f5e587..7d5f2867e2 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py @@ -56,7 +56,7 @@ def reference( return dict(p_v_out=p_v_out, p_u_out=p_u_out) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_e_in = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) ptr_coeff_1 = data_alloc.random_field(grid, dims.VertexDim, dims.V2EDim, dtype=wpfloat) diff --git a/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py b/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py index bf5d44ebd2..22835eb2a0 100644 --- a/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py +++ b/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py @@ -66,7 +66,7 @@ def reference( out=(p_grad_1_u, p_grad_1_v), ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: scalar_field = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) geofac_grg_x = random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) diff --git a/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py b/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py index 5cd46b15ff..8859a03c84 100644 --- a/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py +++ b/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py @@ -43,7 +43,7 @@ def reference( ) return dict(first_vertical_derivative=first_vertical_derivative) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: cell_kdim_field = random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=vpfloat diff --git a/model/common/tests/common/math/unit_tests/test_helpers.py b/model/common/tests/common/math/unit_tests/test_helpers.py index e1de50194d..1b1c85c67b 100644 --- a/model/common/tests/common/math/unit_tests/test_helpers.py +++ b/model/common/tests/common/math/unit_tests/test_helpers.py @@ -66,7 +66,7 @@ def reference( average = 0.5 * (input_field + offset) return dict(average=average) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: input_field = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim, extend={dims.KDim: 1}) result = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, extend={dims.KDim: 1}) @@ -100,7 +100,7 @@ def reference( res = 0.5 * (input_field + np.roll(input_field, shift=-1, axis=1))[:, : shp[1] - 1] return dict(average=res) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: input_field = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) result = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) diff --git a/model/common/tests/common/math/unit_tests/test_operators.py b/model/common/tests/common/math/unit_tests/test_operators.py index b487d1a50b..ed12104b56 100644 --- a/model/common/tests/common/math/unit_tests/test_operators.py +++ b/model/common/tests/common/math/unit_tests/test_operators.py @@ -37,7 +37,7 @@ def reference( nabla2_psi_c_np = reference_funcs.nabla2_on_cell_numpy(connectivities, psi_c, geofac_n2s) return dict(nabla2_psi_c=nabla2_psi_c_np) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base_grid.Grid) -> dict: psi_c = constant_field(grid, 1.0, dims.CellDim) geofac_n2s = constant_field(grid, 2.0, dims.CellDim, dims.C2E2CODim) @@ -66,7 +66,7 @@ def reference( nabla2_psi_c_np = reference_funcs.nabla2_on_cell_k_numpy(connectivities, psi_c, geofac_n2s) return dict(nabla2_psi_c=nabla2_psi_c_np) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: psi_c = constant_field(grid, 1.0, dims.CellDim, dims.KDim) geofac_n2s = constant_field(grid, 2.0, dims.CellDim, dims.C2E2CODim) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index d389e7252e..518e633c6e 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -9,7 +9,7 @@ from __future__ import annotations import dataclasses -from collections.abc import Callable, Mapping, Sequence +from collections.abc import Callable, Generator, Mapping, Sequence from typing import Any, ClassVar import gt4py.next as gtx @@ -36,7 +36,7 @@ def allocate_data( input_data: dict[str, gtx.Field | tuple[gtx.Field, ...]], ) -> dict[str, gtx.Field | tuple[gtx.Field, ...]]: _allocate_field = constructors.as_field.partial(allocator=allocator) # type:ignore[attr-defined] # TODO(havogt): check why it doesn't understand the fluid_partial - input_data = { + gtx_input_data = { k: tuple(_allocate_field(domain=field.domain, data=field.ndarray) for field in v) if isinstance(v, tuple) else _allocate_field(domain=v.domain, data=v.ndarray) @@ -44,7 +44,7 @@ def allocate_data( else v for k, v in input_data.items() } - return input_data + return gtx_input_data @dataclasses.dataclass(frozen=True) @@ -147,7 +147,9 @@ class StencilTest: ... OUTPUTS = ("some_output",) ... STATIC_PARAMS = {"category_a": ["flag0"], "category_b": ["flag0", "flag1"]} ... - ... @pytest.fixture + ... @pytest.fixture( + ... scope="class" + ... ) # make sure that input data are not allocated multiple times ... def input_data(self): ... return {"some_input": ..., "some_output": ...} ... @@ -162,7 +164,7 @@ class StencilTest: reference: ClassVar[Callable[..., Mapping[str, np.ndarray | tuple[np.ndarray, ...]]]] - @pytest.fixture + @pytest.fixture(scope="class") def _configured_program( self, backend_like: model_backends.BackendLike, @@ -194,17 +196,18 @@ def _configured_program( test_func = device_utils.synchronized_function(program, allocator=backend) return test_func - @pytest.fixture + @pytest.fixture(scope="class") def _properly_allocated_input_data( self, input_data: dict[str, gtx.Field | tuple[gtx.Field, ...]], backend_like: model_backends.BackendLike, - ) -> dict[str, gtx.Field | tuple[gtx.Field, ...]]: + ) -> Generator[dict[str, gtx.Field | tuple[gtx.Field, ...]], None, None]: # TODO(havogt): this is a workaround, # because in the `input_data` fixture provided by the user # it does not allocate for the correct device. allocator = model_backends.get_allocator(backend_like) - return allocate_data(allocator=allocator, input_data=input_data) + yield allocate_data(allocator=allocator, input_data=input_data) + input_data.clear() def _verify_stencil_test( self, From 32175056dd1b894a696ade6e0411211d54a1ec36 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 17 Nov 2025 19:44:28 +0100 Subject: [PATCH 097/111] Revert number of process of github actions to auto --- .github/workflows/icon4py-test-model.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/icon4py-test-model.yml b/.github/workflows/icon4py-test-model.yml index e979f9c737..c3293e03a1 100644 --- a/.github/workflows/icon4py-test-model.yml +++ b/.github/workflows/icon4py-test-model.yml @@ -62,7 +62,7 @@ jobs: - name: run nox session - stencil tests shell: bash env: - NUM_PROCESSES: 1 + NUM_PROCESSES: auto ICON4PY_ENABLE_GRID_DOWNLOAD: false ICON4PY_ENABLE_TESTDATA_DOWNLOAD: false run: | From cd7c23a51501f8d52ede0187ddda059170a810ef Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 17 Nov 2025 19:54:23 +0100 Subject: [PATCH 098/111] Fix tests that don't have static params --- model/testing/src/icon4py/model/testing/stencil_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 518e633c6e..02e38b018e 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -260,7 +260,7 @@ def __init_subclass__(cls, **kwargs: Any) -> None: # parametrization is only available in the concrete subclass definition if cls.STATIC_PARAMS is None: # not parametrized, return an empty tuple - cls.static_variant = staticmethod(pytest.fixture(lambda: ())) # type: ignore[method-assign, assignment] # we override with a non-parametrized function + cls.static_variant = staticmethod(pytest.fixture(lambda: (), scope="class")) # type: ignore[method-assign, assignment] # we override with a non-parametrized function else: cls.static_variant = staticmethod( # type: ignore[method-assign] pytest.fixture(params=cls.STATIC_PARAMS.items(), scope="class", ids=lambda p: p[0])( From ad2eddde249ae6856800649d396a89010e3150e0 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 17 Nov 2025 19:59:23 +0100 Subject: [PATCH 099/111] Fix name of test --- .../test_compute_advection_in_horizontal_momentum_equation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index bf502f935b..6eb5c81ea4 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -249,7 +249,7 @@ def reference( params=[ {"apply_extra_diffusion_on_vn": value} for value in [True, False] ], # True for testing, False for benchmarking - ids=lambda param: f"/[{param['apply_extra_diffusion_on_vn']}]", + ids=lambda param: f"apply_extra_diffusion_on_vn[{param['apply_extra_diffusion_on_vn']}]", scope="class", ) def input_data( From 5000d777f495d23474b54a446362dd8bb363137e Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 17 Nov 2025 20:05:42 +0100 Subject: [PATCH 100/111] Fixed test without scope class --- ..._theta_rho_face_values_and_pressure_gradient_and_update_vn.py | 1 + 1 file changed, 1 insertion(+) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py index a06e067c04..887d6a15f9 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_rho_face_values_and_pressure_gradient_and_update_vn.py @@ -439,6 +439,7 @@ def at_neighbor(i: int) -> np.ndarray: {"is_iau_active": value} for value in [True, False] ], # True for testing, False for benchmarking ids=lambda param: f"is_iau_active[{param['is_iau_active']}]", + scope="class", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: geofac_grg_x = data_alloc.random_field(grid, dims.CellDim, dims.C2E2CODim) From c71d02901a0c2b412b6239a14e85cda01f15bbb5 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Tue, 18 Nov 2025 09:41:17 +0100 Subject: [PATCH 101/111] Fix TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection --- ...ived_horizontal_winds_and_ke_and_contravariant_correction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index a3fe973074..038bf54871 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -238,7 +238,7 @@ def reference( tangent_orientation=tangent_orientation, skip_compute_predictor_vertical_advection=skip_compute_predictor_vertical_advection, nflatlev=nflatlev, - nlevp1=nflatlev, + nlevp1=vertical_end, vertical_start=vertical_start, ) From 69876898dc19322317800f90af03cc5bc70b8036 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Tue, 18 Nov 2025 12:18:13 +0100 Subject: [PATCH 102/111] Fix vertically implicit dycore corrector because field fails if it's set with 0. Some elements are set to 1e-19 instead of 0 --- .../test_vertically_implicit_dycore_solver_at_corrector_step.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index d71987f39d..1afb564317 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -465,7 +465,7 @@ def input_data( next_rho = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) next_exner = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) next_theta_v = data_alloc.constant_field(grid, 1.0e-5, dims.CellDim, dims.KDim) - exner_dynamical_increment = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) + exner_dynamical_increment = data_alloc.random_field(grid, dims.CellDim, dims.KDim) dynamical_vertical_mass_flux_at_cells_on_half_levels = data_alloc.zero_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1} ) From f3538c57cea91310ed5496cf5f7a5cd216c45ad0 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 19 Nov 2025 14:58:06 +0100 Subject: [PATCH 103/111] Revert "Fix memory leaks and unnecessary reference in StencilTests" This reverts commit d20f088d94e7ebb57726c3246e875b8623899d15. --- ...test_apply_horizontal_density_increment.py | 2 +- ...apply_interpolated_tracer_time_tendency.py | 2 +- .../test_apply_vertical_density_increment.py | 2 +- ...st_average_horizontal_flux_subcycling_2.py | 2 +- ...st_average_horizontal_flux_subcycling_3.py | 2 +- ...e_antidiffusive_cell_fluxes_and_min_max.py | 2 +- ...test_compute_barycentric_backtrajectory.py | 2 +- ..._compute_barycentric_backtrajectory_alt.py | 2 +- .../test_compute_ffsl_backtrajectory.py | 2 +- ...cktrajectory_counterclockwise_indicator.py | 2 +- ...te_ffsl_backtrajectory_length_indicator.py | 2 +- ...tal_tracer_flux_from_cubic_coefficients.py | 2 +- ...al_tracer_flux_from_linear_coefficients.py | 2 +- ...racer_flux_from_linear_coefficients_alt.py | 2 +- ...e_horizontal_multiplicative_flux_factor.py | 2 +- ...t_compute_ppm4gpu_parabola_coefficients.py | 2 +- .../test_compute_ppm_all_face_values.py | 2 +- .../test_compute_ppm_quadratic_face_values.py | 2 +- .../test_compute_ppm_quartic_face_values.py | 2 +- .../stencil_tests/test_compute_ppm_slope.py | 2 +- .../stencil_tests/test_compute_tendency.py | 2 +- ...ute_vertical_parabola_limiter_condition.py | 2 +- ...est_compute_vertical_tracer_flux_upwind.py | 2 +- ...t_integrate_tracer_density_horizontally.py | 2 +- .../test_integrate_tracer_horizontally.py | 2 +- .../test_integrate_tracer_vertically.py | 2 +- ...it_vertical_parabola_semi_monotonically.py | 2 +- ...limit_vertical_slope_semi_monotonically.py | 2 +- ...s_antidiffusive_cell_fluxes_and_min_max.py | 2 +- ...est_prepare_ffsl_flux_area_patches_list.py | 2 +- ...cal_quadrature_for_cubic_reconstruction.py | 2 +- ...uadrature_list_for_cubic_reconstruction.py | 2 +- ...test_reconstruct_cubic_coefficients_svd.py | 2 +- ...test_apply_diffusion_to_theta_and_exner.py | 2 +- .../test_apply_diffusion_to_vn.py | 2 +- ...ute_horizontal_gradients_for_turbulence.py | 2 +- ...st_apply_nabla2_and_nabla4_global_to_vn.py | 2 +- .../test_apply_nabla2_and_nabla4_to_vn.py | 2 +- ..._apply_nabla2_to_vn_in_lateral_boundary.py | 2 +- .../stencil_tests/test_apply_nabla2_to_w.py | 2 +- ...pply_nabla2_to_w_in_upper_damping_layer.py | 2 +- ...st_calculate_diagnostics_for_turbulence.py | 2 +- ...ate_horizontal_gradients_for_turbulence.py | 2 +- ...ate_nabla2_and_smag_coefficients_for_vn.py | 2 +- .../test_calculate_nabla2_for_w.py | 2 +- .../test_calculate_nabla2_for_z.py | 2 +- .../test_calculate_nabla2_of_theta.py | 2 +- .../stencil_tests/test_calculate_nabla4.py | 2 +- ...n_coefficient_for_grid_point_cold_pools.py | 2 +- ...d_for_grid_point_cold_pools_enhancement.py | 2 +- ...orary_fields_for_turbulence_diagnostics.py | 2 +- ...fusion_nabla_of_theta_over_steep_points.py | 2 +- .../test_update_theta_and_exner.py | 2 +- .../test_accumulate_prep_adv_fields.py | 2 +- ...lysis_increments_from_data_assimilation.py | 2 +- .../test_add_analysis_increments_to_vn.py | 2 +- ...or_normal_wind_tendency_approaching_cfl.py | 2 +- ...tra_diffusion_for_w_con_approaching_cfl.py | 2 +- ..._interpolated_horizontal_advection_of_w.py | 2 +- .../test_add_temporal_tendencies_to_vn.py | 2 +- ...vn_by_interpolating_between_time_levels.py | 2 +- ...l_wind_derivative_to_divergence_damping.py | 2 +- ...test_apply_2nd_order_divergence_damping.py | 2 +- ...test_apply_4th_order_divergence_damping.py | 2 +- ..._apply_divergence_damping_and_update_vn.py | 1 - ...o_horizontal_gradient_of_exner_pressure.py | 2 +- .../test_apply_rayleigh_damping_mechanism.py | 2 +- ...ed_2nd_and_4th_order_divergence_damping.py | 2 +- ...vection_in_horizontal_momentum_equation.py | 1 - ...advection_in_vertical_momentum_equation.py | 3 +-- ...ompute_advective_vertical_wind_tendency.py | 2 +- .../stencil_tests/test_compute_airmass.py | 2 +- ...rox_of_2nd_vertical_derivative_of_exner.py | 2 +- ...and_fluxes_and_prepare_tracer_advection.py | 2 +- ...st_compute_avg_vn_and_graddiv_vn_and_vt.py | 2 +- .../test_compute_contravariant_correction.py | 2 +- ...t_compute_contravariant_correction_of_w.py | 2 +- ...iant_correction_of_w_for_lower_boundary.py | 2 +- ...nds_and_ke_and_contravariant_correction.py | 1 - ...e_divergence_of_fluxes_of_rho_and_theta.py | 2 +- ...est_compute_dwdz_for_divergence_damping.py | 2 +- .../test_compute_exner_from_rhotheta.py | 2 +- ...compute_explicit_part_for_rho_and_exner.py | 2 +- ...rom_advection_and_vertical_wind_density.py | 2 +- ...d_speed_and_vertical_wind_times_density.py | 2 +- .../test_compute_graddiv2_of_vn.py | 2 +- ...e_horizontal_advection_of_rho_and_theta.py | 2 +- ...al_advection_term_for_vertical_velocity.py | 2 +- ..._of_exner_pressure_for_flat_coordinates.py | 2 +- ...t_of_exner_pressure_for_multiple_levels.py | 2 +- ..._exner_pressure_for_nonflat_coordinates.py | 2 +- .../test_compute_horizontal_kinetic_energy.py | 2 +- ...rizontal_velocity_quantities_and_fluxes.py | 2 +- ...est_compute_hydrostatic_correction_term.py | 2 +- .../stencil_tests/test_compute_mass_flux.py | 2 +- ...nd_clip_contravariant_vertical_velocity.py | 2 +- ...t_compute_perturbation_of_rho_and_theta.py | 2 +- ...nd_theta_and_rho_interface_cell_centers.py | 2 +- ..._perturbed_quantities_and_interpolation.py | 2 +- ...ute_results_for_thermodynamic_variables.py | 2 +- ...tial_temperatures_and_pressure_gradient.py | 2 +- ...test_compute_solver_coefficients_matrix.py | 2 +- .../test_compute_tangential_wind.py | 2 +- .../test_compute_theta_and_exner.py | 2 +- ...tial_temperatures_and_pressure_gradient.py | 2 +- .../test_compute_vn_on_lateral_boundary.py | 2 +- .../test_copy_cell_kdim_field_to_vp.py | 2 +- .../stencil_tests/test_extrapolate_at_top.py | 2 +- ...t_extrapolate_temporally_exner_pressure.py | 2 +- .../test_init_cell_kdim_field_with_zero_vp.py | 2 +- .../test_init_cell_kdim_field_with_zero_wp.py | 2 +- ..._init_two_cell_kdim_fields_with_zero_vp.py | 2 +- ..._init_two_edge_kdim_fields_with_zero_wp.py | 2 +- ...nterpolate_cell_field_to_half_levels_vp.py | 2 +- ...ariant_vertical_velocity_to_full_levels.py | 2 +- ...d_compute_temperature_vertical_gradient.py | 2 +- .../test_interpolate_to_cell_center.py | 2 +- .../test_interpolate_to_surface.py | 2 +- ..._and_vt_to_ie_and_compute_ekin_on_edges.py | 2 +- ...els_and_compute_kinetic_energy_on_edges.py | 2 +- .../test_interpolate_vt_to_interface_edges.py | 2 +- ...lation_scalar_cells2verts_scalar_ri_dsl.py | 2 +- .../test_mo_math_divrot_rot_vertex_ri_dsl.py | 2 +- ...tion_for_w_and_contravariant_correction.py | 2 +- ..._set_theta_v_prime_ic_at_lower_boundary.py | 2 +- ...diagonal_matrix_for_w_back_substitution.py | 2 +- ..._tridiagonal_matrix_for_w_forward_sweep.py | 2 +- ...test_spatially_average_flux_or_velocity.py | 2 +- .../test_update_density_exner_wind.py | 2 +- ...t_update_dynamical_exner_time_increment.py | 2 +- .../test_update_mass_flux_weighted.py | 2 +- .../test_update_mass_volume_flux.py | 2 +- .../stencil_tests/test_update_theta_v.py | 2 +- .../dycore/stencil_tests/test_update_wind.py | 2 +- ...mplicit_dycore_solver_at_corrector_step.py | 1 - ...mplicit_dycore_solver_at_predictor_step.py | 1 - .../test_T_from_internal_energy.py | 2 +- .../stencil_tests/test_cloud_to_graupel.py | 2 +- .../test_cloud_to_graupel_default.py | 2 +- .../stencil_tests/test_cloud_to_rain.py | 2 +- .../test_cloud_to_rain_default.py | 2 +- .../stencil_tests/test_cloud_to_snow.py | 2 +- .../test_cloud_to_snow_default.py | 2 +- .../muphys/stencil_tests/test_cloud_x_ice.py | 2 +- .../stencil_tests/test_cloud_x_ice_default.py | 2 +- .../test_deposition_auto_conversion.py | 2 +- ...test_deposition_auto_conversion_default.py | 2 +- .../stencil_tests/test_deposition_factor.py | 2 +- .../muphys/stencil_tests/test_dqsatdT_rho.py | 2 +- .../muphys/stencil_tests/test_fall_speed.py | 2 +- .../stencil_tests/test_graupel_to_rain.py | 2 +- .../test_graupel_to_rain_default.py | 2 +- .../test_ice_deposition_nucleation.py | 2 +- .../test_ice_deposition_nucleation_default.py | 2 +- .../muphys/stencil_tests/test_ice_mass.py | 2 +- .../muphys/stencil_tests/test_ice_number.py | 2 +- .../muphys/stencil_tests/test_ice_sticking.py | 2 +- .../stencil_tests/test_ice_to_graupel.py | 2 +- .../test_ice_to_graupel_default.py | 2 +- .../muphys/stencil_tests/test_ice_to_snow.py | 2 +- .../stencil_tests/test_ice_to_snow_default.py | 2 +- .../stencil_tests/test_internal_energy.py | 2 +- .../muphys/stencil_tests/test_qsat_ice_rho.py | 2 +- .../muphys/stencil_tests/test_qsat_rho.py | 2 +- .../stencil_tests/test_qsat_rho_tmelt.py | 2 +- .../stencil_tests/test_rain_to_graupel_1.py | 2 +- .../stencil_tests/test_rain_to_graupel_2.py | 2 +- .../stencil_tests/test_rain_to_graupel_3.py | 2 +- .../test_rain_to_graupel_default.py | 2 +- .../stencil_tests/test_rain_to_vapor.py | 2 +- .../test_rain_to_vapor_default.py | 2 +- .../muphys/stencil_tests/test_sat_pres_ice.py | 2 +- .../stencil_tests/test_sat_pres_water.py | 2 +- .../test_saturation_adjustment.py | 2 +- .../test_saturation_adjustment2.py | 2 +- .../muphys/stencil_tests/test_snow_lambda.py | 2 +- .../muphys/stencil_tests/test_snow_number.py | 2 +- .../stencil_tests/test_snow_number_default.py | 2 +- .../stencil_tests/test_snow_to_graupel.py | 2 +- .../test_snow_to_graupel_default.py | 2 +- .../muphys/stencil_tests/test_snow_to_rain.py | 2 +- .../test_snow_to_rain_default.py | 2 +- .../stencil_tests/test_vapor_x_graupel.py | 2 +- .../test_vapor_x_graupel_default.py | 2 +- .../muphys/stencil_tests/test_vapor_x_ice.py | 2 +- .../stencil_tests/test_vapor_x_ice_default.py | 2 +- .../muphys/stencil_tests/test_vapor_x_snow.py | 2 +- .../test_vapor_x_snow_default.py | 2 +- .../test_vel_scale_factor_ice.py | 2 +- .../test_vel_scale_factor_snow.py | 2 +- .../test_cell_2_edge_interpolation.py | 2 +- ...est_compute_cell_2_vertex_interpolation.py | 2 +- .../stencil_tests/test_diagnose_pressure.py | 2 +- .../test_diagnose_surface_pressure.py | 2 +- .../test_diagnose_temperature.py | 2 +- ...st_edge_2_cell_vector_rbf_interpolation.py | 2 +- ...nterpolate_edge_field_to_half_levels_vp.py | 2 +- ...est_mo_intp_rbf_rbf_vec_interpol_vertex.py | 2 +- ...izontal_gradients_by_green_gauss_method.py | 2 +- .../test_compute_first_vertical_derivative.py | 2 +- .../common/math/unit_tests/test_helpers.py | 4 ++-- .../common/math/unit_tests/test_operators.py | 4 ++-- .../icon4py/model/testing/stencil_tests.py | 19 ++++++++----------- 203 files changed, 207 insertions(+), 216 deletions(-) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py index 06f0cd2c1b..2b82a73a20 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py @@ -43,7 +43,7 @@ def reference( rhodz_ast2 = np.maximum(0.1 * p_rhodz_new, p_rhodz_new) - p_dtime * tmp return dict(rhodz_ast2=rhodz_ast2) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: p_rhodz_new = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_mflx_contra_v = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py index a639500264..4484a4159a 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py @@ -37,7 +37,7 @@ def reference( return dict(p_tracer_new=p_tracer_new) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_grf_tend_tracer = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py index ea5b270230..9c428c9c60 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py @@ -47,7 +47,7 @@ def reference( return dict(rhodz_ast2=rhodz_ast2) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: rhodz_ast = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_mflx_contra_v = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py index ca6db686bd..d73e3354ac 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py @@ -34,7 +34,7 @@ def reference( p_out_e = (z_tracer_mflx_1_dsl + z_tracer_mflx_2_dsl) / float(2) return dict(p_out_e=p_out_e) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: z_tracer_mflx_1_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) z_tracer_mflx_2_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py index 82fe0ae467..9883b6fc5a 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py @@ -35,7 +35,7 @@ def reference( p_out_e = (z_tracer_mflx_1_dsl + z_tracer_mflx_2_dsl + z_tracer_mflx_3_dsl) / float(3) return dict(p_out_e=p_out_e) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: z_tracer_mflx_1_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) z_tracer_mflx_2_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py index 757a0fcee2..63dc972850 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py @@ -77,7 +77,7 @@ def reference( z_tracer_min=z_tracer_min, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) p_rhodz_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py index 9351816d16..63054b2a19 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py @@ -79,7 +79,7 @@ def reference( p_distv_bary_2=p_distv_bary_2, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py index 38bb95e49b..1adb8af3aa 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py @@ -72,7 +72,7 @@ def reference( p_distv_bary_2=p_distv_bary_2, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py index 1b65e483ec..60bb15e9cf 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py @@ -145,7 +145,7 @@ def reference( "p_coords_dreg_v_4_lat_dsl": p_coords_dreg_v_4_lat_dsl, } - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py index ce90d0e9b5..064c915c6c 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py @@ -44,7 +44,7 @@ def reference( return dict(lvn_sys_pos=lvn_sys_pos) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) tangent_orientation = data_alloc.random_field(grid, dims.EdgeDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py index cacb408cbb..326d040463 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py @@ -46,7 +46,7 @@ def reference( return dict(opt_famask_dsl=opt_famask_dsl) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py index 94fc3b8e84..cdf27e4979 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py @@ -34,7 +34,7 @@ def reference( return dict(p_out_e_hybrid_2=p_out_e_hybrid_2) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: p_out_e_hybrid_2 = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_mass_flx_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py index 29eaaba61c..51e4cc49d2 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py @@ -57,7 +57,7 @@ def reference( return dict(p_out_e=p_out_e) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: z_lsq_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_lsq_coeff_2 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py index d9bc8813bf..f490a7bf82 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py @@ -57,7 +57,7 @@ def reference( return dict(p_out_e=p_out_e) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: z_lsq_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_lsq_coeff_2 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py index 902d8d3ae9..c6ee1ad78e 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py @@ -53,7 +53,7 @@ def reference( return dict(r_m=r_m) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py index 11f06165a8..ffaeefc5c6 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py @@ -36,7 +36,7 @@ def reference( z_a1 = p_cc - 0.5 * (z_face_up + z_face_low) return dict(z_delta_q=z_delta_q, z_a1=z_a1) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: z_face_up = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_face_low = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py index 1b84c3debe..054cb659fe 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py @@ -49,7 +49,7 @@ def reference( p_face[:, 1:] = np.where((k[1:] == elevp1), p_cc[:, :-1], p_face[:, 1:]) return dict(p_face=p_face) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_cellhgt_mc_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py index 22d8be854e..98095dc0f1 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py @@ -42,7 +42,7 @@ def reference( ) return dict(p_face=p_face) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_face = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py index 691dc715b8..b6192bf216 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py @@ -68,7 +68,7 @@ def reference( ) return dict(p_face=p_face) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_cellhgt_mc_now = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py index 3585651cfb..d875fd8f2c 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py @@ -64,7 +64,7 @@ def reference( z_slope = np.where(k[1:-1] < elev, z_slope_a, z_slope_b) return dict(z_slope=z_slope) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: z_slope = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py index 17f4aea803..88810d6269 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py @@ -34,7 +34,7 @@ def reference( return dict(opt_ddt_tracer_adv=opt_ddt_tracer_adv) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_tracer_new = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py index f308571140..e881c1f702 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py @@ -36,7 +36,7 @@ def reference( l_limit = np.where(np.abs(z_delta) < -1 * z_a6i, 1, 0) return dict(l_limit=l_limit) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_face = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py index 1835f18619..03d40aaa52 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py @@ -41,7 +41,7 @@ def reference( ) return dict(p_upflux=p_upflux) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_mflx_contra_v = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py index ec40232a0f..6bb07ba7cb 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py @@ -61,7 +61,7 @@ def reference( z_tracer_new_dsl=z_tracer_new_dsl, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_mass_flx_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py index 2621e1db67..f1f1134f66 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py @@ -45,7 +45,7 @@ def reference( ) / rhodz_new return dict(tracer_new_hor=tracer_new_hor) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_mflx_tracer_h = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) deepatmo_divh = data_alloc.random_field(grid, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py index c6b02ab378..6ab7a36d13 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py @@ -58,7 +58,7 @@ def reference( return dict(tracer_new=tracer_new) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) rhodz_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py index 937fe35fc0..b7079d0aca 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py @@ -47,7 +47,7 @@ def reference( ) return dict(p_face_up=q_face_up, p_face_low=q_face_low) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: l_limit = data_alloc.random_mask(grid, dims.CellDim, dims.KDim, dtype=gtx.int32) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py index 624eeb8703..fb32ae1f24 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py @@ -39,7 +39,7 @@ def reference( slope = np.where(z_slope[:, 1:-1] >= 0.0, slope_l, -slope_l) return dict(z_slope=slope) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_slope = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py index 30fcccd0f8..9fe005d986 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py @@ -54,7 +54,7 @@ def reference( z_tracer_min=z_tracer_min_out, ) - @pytest.fixture(scope="class") + @pytest.fixture() def input_data(self, grid: base.Grid) -> dict: hi_bound, lo_bound = 3, 1 refin_ctrl = data_alloc.constant_field(grid, 2, dims.CellDim, dtype=gtx.int32) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py index 8a696d961d..bc2d3c6933 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py @@ -1470,7 +1470,7 @@ def reference( dreg_patch2_4_lat_vmask=dreg_patch2_4_lat_vmask, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: famask_int = data_alloc.random_mask(grid, dims.EdgeDim, dims.KDim, dtype=gtx.int32) p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py index 3664cdc0d9..efe12e6b23 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py @@ -485,7 +485,7 @@ def reference( p_dreg_area_out=p_dreg_area_out, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_coords_dreg_v_1_x = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_coords_dreg_v_2_x = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py index 1ede54c31b..66b376c37a 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py @@ -519,7 +519,7 @@ def reference( p_dreg_area=p_dreg_area, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: famask_int = data_alloc.constant_field(grid, 1, dims.EdgeDim, dims.KDim, dtype=gtx.int32) p_coords_dreg_v_1_x = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py index 7736363941..ed85115d46 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py @@ -304,7 +304,7 @@ def reference( p_coeff_10_dsl=p_coeff_10_dsl, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) lsq_pseudoinv_1_field = data_alloc.random_field(grid, dims.CellDim, dims.C2E2C2E2CDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py index 89d878db3f..29d880a8f7 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py @@ -75,7 +75,7 @@ def reference( return dict(theta_v=theta_v, exner=exner) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid): pytest.xfail( "stencil segfaults with GTFN and it is not used in diffusion: it is missing an if condition" diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index 743cb7934f..debdae974f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -115,7 +115,7 @@ def reference( return dict(vn=vn) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index dc81503657..4e9652ac76 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -118,7 +118,7 @@ def reference( out_dwdy[subset] = dwdy[subset] return dict(w=out_w, dwdx=out_dwdx, dwdy=out_dwdy) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: nrdmax = 13 cell_domain = h_grid.domain(dims.CellDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py index 97717a64d2..c2ef62b392 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py @@ -34,7 +34,7 @@ class TestApplyNabla2AndNabla4GlobalToVn(StencilTest): PROGRAM = apply_nabla2_and_nabla4_global_to_vn OUTPUTS = ("vn",) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid): area_edge = random_field(grid, dims.EdgeDim, dtype=wpfloat) kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py index ae71aea8c4..3b60be5291 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py @@ -42,7 +42,7 @@ class TestApplyNabla2AndNabla4ToVn(StencilTest): PROGRAM = apply_nabla2_and_nabla4_to_vn OUTPUTS = ("vn",) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): area_edge = random_field(grid, dims.EdgeDim, dtype=wpfloat) kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py index 580c54e3aa..0de1666efd 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py @@ -33,7 +33,7 @@ class TestApplyNabla2ToVnInLateralBoundary(StencilTest): PROGRAM = apply_nabla2_to_vn_in_lateral_boundary OUTPUTS = ("vn",) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid): fac_bdydiff_v = wpfloat("5.0") z_nabla2_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py index 816ac25e07..cf505ee6ca 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py @@ -51,7 +51,7 @@ def reference( w = apply_nabla2_to_w_numpy(connectivities, area, z_nabla2_c, geofac_n2s, w, diff_multfac_w) return dict(w=w) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): area = random_field(grid, dims.CellDim, dtype=wpfloat) z_nabla2_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py index 82876600d8..74d532867b 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py @@ -34,7 +34,7 @@ class TestApplyNabla2ToWInUpperDampingLayer(StencilTest): PROGRAM = apply_nabla2_to_w_in_upper_damping_layer OUTPUTS = ("w",) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid): w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff_multfac_n2w = random_field(grid, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py index 05f4ca81d1..142ee4d36a 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py @@ -47,7 +47,7 @@ def reference( ) return dict(div_ic=div_ic, hdef_ic=hdef_ic) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) div = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py index 10d4e43ce2..fa6659390b 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py @@ -51,7 +51,7 @@ def reference( ) return dict(dwdx=dwdx, dwdy=dwdy) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): w = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) geofac_grg_x = data_alloc.random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index d115d6deb3..e9cd84bde4 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -173,7 +173,7 @@ def reference( return dict(kh_smag_e=kh_smag_e_out, kh_smag_ec=kh_smag_ec_out, z_nabla2_e=z_nabla2_e_out) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py index 09a36b58bc..eb405afab2 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py @@ -44,7 +44,7 @@ def reference( z_nabla2_c = calculate_nabla2_for_w_numpy(connectivities, w, geofac_n2s) return dict(z_nabla2_c=z_nabla2_c) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: w = constant_field(grid, 1.0, dims.CellDim, dims.KDim) geofac_n2s = constant_field(grid, 2.0, dims.CellDim, dims.C2E2CODim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py index bdff00e5ca..f3934007e0 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py @@ -59,7 +59,7 @@ def reference( ) return dict(z_nabla2_e=z_nabla2_e) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py index 065366e934..5355ee6371 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py @@ -41,7 +41,7 @@ def reference( z_temp = calculate_nabla2_of_theta_numpy(connectivities, z_nabla2_e, geofac_div) return dict(z_temp=z_temp) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: z_nabla2_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py index 0a73f1c3c8..dc8f9ac4ba 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py @@ -97,7 +97,7 @@ def reference( ) return dict(z_nabla4_e2=z_nabla4_e2) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py index 89b28bb42b..50524d92d4 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py @@ -42,7 +42,7 @@ def reference( ) return dict(kh_smag_e=kh_smag_e) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) enh_diffu_3d = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py index 4e61c5703e..fd0b4563a9 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py @@ -52,7 +52,7 @@ def reference( return dict(enh_diffu_3d=enh_diffu_3d) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: theta_v = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) theta_ref_mc = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py index 6cea5e6a00..0352652ad2 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py @@ -46,7 +46,7 @@ def reference( return dict(div=div, kh_c=kh_c) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid): vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py index 0ce06ce981..93f47096d6 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py @@ -88,7 +88,7 @@ def reference( ) return dict(z_temp=z_temp) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): mask = random_mask(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py index 0c84a6487d..d7bce46e8a 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py @@ -50,7 +50,7 @@ def reference( theta_v, exner = update_theta_and_exner_numpy(z_temp, area, theta_v, exner, rd_o_cvd) return dict(theta_v=theta_v, exner=exner) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: z_temp = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) area = random_field(grid, dims.CellDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py index 58b32d5d15..c58454e15d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py @@ -60,7 +60,7 @@ def reference( return dict(vn_traj=vn_traj, mass_flx_me=mass_flx_me) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: mass_fl_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) mass_flx_me = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py index c4e248313f..5bf6bf9525 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py @@ -58,7 +58,7 @@ def reference( ) return dict(z_rho_expl=z_rho_expl, z_exner_expl=z_exner_expl) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_exner_expl = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) exner_incr = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py index 3f80d216c6..8f67332647 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py @@ -45,7 +45,7 @@ def reference( vn = add_analysis_increments_to_vn_numpy(vn_incr, vn, iau_wgt_dyn) return dict(vn=vn) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn_incr = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py index 8cac1ad9d0..6c69b6b94e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py @@ -102,7 +102,7 @@ class TestAddExtraDiffusionForNormalWindTendencyApproachingCfl(StencilTest): PROGRAM = add_extra_diffusion_for_normal_wind_tendency_approaching_cfl OUTPUTS = ("ddt_vn_apc",) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: levelmask = data_alloc.random_mask(grid, dims.KDim, extend={dims.KDim: 1}) c_lin_e = data_alloc.random_field(grid, dims.EdgeDim, dims.E2CDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py index 720511cb0b..1e855f11ac 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py @@ -107,7 +107,7 @@ def reference( ) return dict(ddt_w_adv=ddt_w_adv) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: cfl_clipping = random_mask(grid, dims.CellDim, dims.KDim) owner_mask = random_mask(grid, dims.CellDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py index 54ba2b1100..e27f6d9ee7 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py @@ -55,7 +55,7 @@ def reference( ) return dict(ddt_w_adv=ddt_w_adv) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_v_grad_w = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) e_bln_c_s = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py index 1a0d714fe8..861d66d4ba 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py @@ -59,7 +59,7 @@ def reference( ) return dict(vn_nnew=vn_nnew) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = wpfloat("10.0") vn_nnow = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py index 641cb6a4e0..b84b1bbc74 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py @@ -76,7 +76,7 @@ def reference( ) return dict(vn_nnew=vn_nnew) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn_nnow = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) ddt_vn_apc_ntl1 = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py index 68877d563f..723e7952e6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py @@ -68,7 +68,7 @@ def reference( ) return dict(z_graddiv_vn=z_graddiv_vn) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: hmask_dd3d = data_alloc.random_field(grid, dims.EdgeDim, dtype=ta.wpfloat) scalfac_dd3d = data_alloc.random_field(grid, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py index 253fe9bd2b..08bd2c8d73 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py @@ -45,7 +45,7 @@ def reference( vn = apply_2nd_order_divergence_damping_numpy(z_graddiv_vn, vn, scal_divdamp_o2) return dict(vn=vn) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_graddiv_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py index 6f0cb4140a..82148b6461 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py @@ -47,7 +47,7 @@ def reference( vn = apply_4th_order_divergence_damping_numpy(scal_divdamp, z_graddiv2_vn, vn) return dict(vn=vn) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: scal_divdamp = random_field(grid, dims.KDim, dtype=wpfloat) z_graddiv2_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index 601a6c10cb..ba5d783c5d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -188,7 +188,6 @@ def reference( ] ], ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]__second_order_divdamp_factor[{param['second_order_divdamp_factor']}]", - scope="class", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py index 7396f64890..7189d02661 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py @@ -54,7 +54,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ipeidx_dsl = random_mask(grid, dims.EdgeDim, dims.KDim) pg_exdist = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py index 90f8042e35..05270e43f2 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py @@ -49,7 +49,7 @@ def reference( w = apply_rayleigh_damping_mechanism_numpy(connectivities, z_raylfac, w_1, w) return dict(w=w) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_raylfac = random_field(grid, dims.KDim, dtype=wpfloat) w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py index 937383be01..31de7f151f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py @@ -57,7 +57,7 @@ def reference( ) return dict(vn=vn) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: scal_divdamp = random_field(grid, dims.KDim, dtype=wpfloat) bdy_divdamp = random_field(grid, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index 6eb5c81ea4..8af66a07d7 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -250,7 +250,6 @@ def reference( {"apply_extra_diffusion_on_vn": value} for value in [True, False] ], # True for testing, False for benchmarking ids=lambda param: f"apply_extra_diffusion_on_vn[{param['apply_extra_diffusion_on_vn']}]", - scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 6a0e7f5f83..29e097491d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -409,7 +409,7 @@ def reference( vertical_cfl=vertical_cfl_ret, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: contravariant_corrected_w_at_cells_on_model_levels = data_alloc.zero_field( grid, dims.CellDim, dims.KDim @@ -627,7 +627,6 @@ def reference( {"skip_compute_predictor_vertical_advection": value} for value in [True, False] ], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", - scope="class", ) def input_data( self, grid: base.Grid, request: pytest.FixtureRequest diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py index b02d3f84e7..21fdb8c7ef 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py @@ -56,7 +56,7 @@ def reference( ) return dict(ddt_w_adv=ddt_w_adv) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_w_con_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) w = random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py index 6566146ace..61445dcf1e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py @@ -35,7 +35,7 @@ def reference( airmass_out = rho_in * ddqz_z_full_in * deepatmo_t1mc_in return dict(airmass_out=airmass_out) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rho_in = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) ddqz_z_full_in = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py index 1e308955fd..d842690914 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py @@ -57,7 +57,7 @@ def reference( ) return dict(z_dexner_dz_c_2=z_dexner_dz_c_2) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_theta_v_pr_ic = random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=vpfloat diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py index 96904cc9cb..11a52a0744 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py @@ -134,7 +134,7 @@ def reference( substep_averaged_mass_flux=substep_averaged_mass_flux, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: spatially_averaged_vn = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) mass_fl_e = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py index fc9664a2cc..5cf3efa33b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py @@ -65,7 +65,7 @@ def reference( ) return dict(z_vn_avg=z_vn_avg, z_graddiv_vn=z_graddiv_vn, vt=vt) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_flx_avg = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) geofac_grdiv = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py index c18b8bffeb..e557ec551d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py @@ -45,7 +45,7 @@ def reference( z_w_concorr_me = compute_contravariant_correction_numpy(vn, ddxn_z_full, ddxt_z_full, vt) return dict(z_w_concorr_me=z_w_concorr_me) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) ddxn_z_full = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py index 7de0fb6249..6a7d916250 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py @@ -56,7 +56,7 @@ def reference( ) return dict(w_concorr_c=w_concorr_c) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_bln_c_s = random_field(grid, dims.CellDim, dims.C2EDim, dtype=wpfloat) z_w_concorr_me = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py index c899c092d5..1723d907a5 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py @@ -65,7 +65,7 @@ def reference( ) return dict(w_concorr_c=w_concorr_c) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_bln_c_s = random_field(grid, dims.CellDim, dims.C2EDim, dtype=wpfloat) z_w_concorr_me = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 038bf54871..814a2dfcb7 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -286,7 +286,6 @@ def reference( {"skip_compute_predictor_vertical_advection": value} for value in [True, False] ], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", - scope="class", ) def input_data( self, grid: base.Grid, request: pytest.FixtureRequest diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py index 124ab43ba1..d009a74d8d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py @@ -57,7 +57,7 @@ def reference( ) return dict(z_flxdiv_mass=z_flxdiv_mass, z_flxdiv_theta=z_flxdiv_theta) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) z_theta_v_fl_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py index 5d5f07155c..a14d93aca1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py @@ -50,7 +50,7 @@ def reference( ) return dict(out=z_dwdz_dd) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, Any]: inv_ddqz_z_full = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) w = random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py index 693bd5fef3..582a4ef0d3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py @@ -38,7 +38,7 @@ def reference( exner = np.exp(rd_o_cvd * np.log(rd_o_p0ref * rho * theta_v)) return dict(out=(theta_v, exner)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, Any]: rd_o_cvd = wpfloat("10.0") rd_o_p0ref = wpfloat("20.0") diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py index 9d6624d00f..347299fd46 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py @@ -85,7 +85,7 @@ def reference( ) return dict(z_rho_expl=z_rho_expl, z_exner_expl=z_exner_expl) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = ta.wpfloat("1.0") rho_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py index fd6e7eb72e..efd3ba9a10 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py @@ -82,7 +82,7 @@ def reference( ) return dict(z_w_expl=z_w_expl, z_contr_w_fl_l=z_contr_w_fl_l) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) ddt_w_adv_ntl1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py index 3cbf36e98d..bdaf78fbc3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py @@ -72,7 +72,7 @@ def reference( ) return dict(z_w_expl=z_w_expl, z_contr_w_fl_l=z_contr_w_fl_l) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w_nnow = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) ddt_w_adv_ntl1 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py index 9df4526221..3f9eca2afc 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py @@ -49,7 +49,7 @@ def reference( z_graddiv2_vn = compute_graddiv2_of_vn_numpy(connectivities, geofac_grdiv, z_graddiv_vn) return dict(z_graddiv2_vn=z_graddiv2_vn) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_graddiv_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) geofac_grdiv = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py index 07aab9f9b3..ad61d07c8a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py @@ -251,7 +251,7 @@ def reference( ) return dict(out=(z_rho_e, z_theta_v_e)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py index c6d80e8216..0c47cf433c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py @@ -82,7 +82,7 @@ def reference( )[horizontal_start:horizontal_end, :] return dict(z_v_grad_w=z_v_grad_w) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn_ie = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py index 530e9e7e67..09ade5f64b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py @@ -53,7 +53,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) z_exner_ex_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py index 373361c042..53555a19e6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py @@ -91,7 +91,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=ta.wpfloat) z_exner_ex_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py index c07e738947..0369fc2b9c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py @@ -68,7 +68,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) z_exner_ex_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py index a97d8d7a1c..a81376ec23 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py @@ -43,7 +43,7 @@ def reference( vn_ie, z_vt_ie, z_kin_hor_e = compute_horizontal_kinetic_energy_numpy(vn, vt) return dict(vn_ie=vn_ie, z_vt_ie=z_vt_ie, z_kin_hor_e=z_kin_hor_e) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) vt = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py index 305b0e0013..7405e97638 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py @@ -259,7 +259,7 @@ def reference( contravariant_correction_at_edges_on_model_levels=contravariant_correction_at_edges_on_model_levels, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: spatially_averaged_vn = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) horizontal_gradient_of_normal_wind_divergence = data_alloc.zero_field( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py index 0eb6d71696..7eed5b8929 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py @@ -130,7 +130,7 @@ def reference( ) return dict(z_hydro_corr=z_hydro_corr) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ikoffset = data_alloc.zero_field( grid, dims.EdgeDim, dims.E2CDim, dims.KDim, dtype=gtx.int32 diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py index 63121c1961..330d0410a0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py @@ -54,7 +54,7 @@ def reference( return dict(mass_fl_e=mass_fl_e, z_theta_v_fl_e=z_theta_v_fl_e) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_rho_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) z_vn_avg = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py index 84cbf72c48..2cd2a83c8f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py @@ -70,7 +70,7 @@ def reference( z_w_con_c=z_w_con_c, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ddqz_z_half = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) z_w_con_c = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py index 9c3bc1fc47..79d910c5b9 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py @@ -51,7 +51,7 @@ def reference( ) return dict(z_rth_pr_1=z_rth_pr_1, z_rth_pr_2=z_rth_pr_2) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rho = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) rho_ref_mc = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py index cab2d5ca4c..e224318650 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py @@ -66,7 +66,7 @@ def reference( ) return dict(rho_ic=rho_ic, z_rth_pr_1=z_rth_pr_1, z_rth_pr_2=z_rth_pr_2) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) rho = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index 14089fbaac..a173e626f1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -347,7 +347,7 @@ def reference( d2dz2_of_temporal_extrapolation_of_perturbed_exner_on_model_levels=d2dz2_of_temporal_extrapolation_of_perturbed_exner_on_model_levels, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: reference_rho_at_cells_on_model_levels = data_alloc.random_field( grid, dims.CellDim, dims.KDim diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py index 6345bc6d8b..2efbdbddd9 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py @@ -102,7 +102,7 @@ def reference( ) return dict(rho_new=rho_new, exner_new=exner_new, theta_v_new=theta_v_new) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_rho_expl = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) vwind_impl_wgt = data_alloc.random_field(grid, dims.CellDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py index 721e38564e..6f71a1f98a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py @@ -128,7 +128,7 @@ def reference( z_th_ddz_exner_c=z_th_ddz_exner_c, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = ta.wpfloat("1.0") wgt_nnow_rth = ta.wpfloat("2.0") diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py index 120347b429..da06853a0a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py @@ -74,7 +74,7 @@ def reference( ) return dict(z_beta=z_beta, z_alpha=z_alpha) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: exner_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) rho_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py index 4655ee9780..fbcc397990 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py @@ -44,7 +44,7 @@ def reference( vt = compute_tangential_wind_numpy(connectivities, vn, rbf_vec_coeff_e) return dict(vt=vt) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) rbf_vec_coeff_e = random_field(grid, dims.EdgeDim, dims.E2C2EDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py index b5d49fccae..ff5bc26e71 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py @@ -43,7 +43,7 @@ def reference( return dict(theta_v=theta_v, exner=exner) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rd_o_cvd = ta.wpfloat("10.0") rd_o_p0ref = ta.wpfloat("20.0") diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py index 2d3eb8fd2a..4ef0d53930 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py @@ -92,7 +92,7 @@ def reference( z_th_ddz_exner_c=z_th_ddz_exner_c, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) z_rth_pr_2 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py index 55ee685d0c..50aec37834 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py @@ -36,7 +36,7 @@ def reference( vn_new = vn_now + dtime * grf_tend_vn return dict(vn_new=vn_new) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: grf_tend_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) vn_now = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py index 7f4d22ee23..e1408308a9 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py @@ -38,7 +38,7 @@ def reference( field_copy = copy_cell_kdim_field_to_vp_numpy(field) return dict(field_copy=field_copy) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: field = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) field_copy = zero_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py index e35da36b5c..74c9b6845d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py @@ -51,7 +51,7 @@ def reference( vn_ie = extrapolate_at_top_numpy(wgtfacq_e, vn) return dict(vn_ie=vn_ie) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfacq_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py index aa18002e4a..a87d532ff4 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py @@ -57,7 +57,7 @@ def reference( return dict(z_exner_ex_pr=z_exner_ex_pr, exner_pr=exner_pr) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: exner = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) exner_ref_mc = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py index 9e4270b4d1..01438aa31d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py @@ -42,7 +42,7 @@ def reference( ) return dict(field_with_zero_vp=field_with_zero_vp) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: field_with_zero_vp = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py index 814b9a7ba8..a0c2e0f902 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py @@ -49,7 +49,7 @@ def reference( field_with_zero_wp = np.zeros_like(field_with_zero_wp) return dict(field_with_zero_wp=field_with_zero_wp) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: field_with_zero_wp = zero_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py index 1ce19f3a56..b893924387 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py @@ -40,7 +40,7 @@ def reference( cell_kdim_field_with_zero_vp_2=cell_kdim_field_with_zero_vp_2, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: cell_kdim_field_with_zero_vp_1 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) cell_kdim_field_with_zero_vp_2 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py index 080bac1441..77c5de7055 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py @@ -40,7 +40,7 @@ def reference( edge_kdim_field_with_zero_wp_2=edge_kdim_field_with_zero_wp_2, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: edge_kdim_field_with_zero_wp_1 = zero_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) edge_kdim_field_with_zero_wp_2 = zero_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py index b23f88234f..4cc48fd101 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py @@ -50,7 +50,7 @@ def reference( ) return dict(interpolation_to_half_levels_vp=interpolation_to_half_levels_vp) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: interpolant = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py index dfbcc454d3..12f5fd8506 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py @@ -40,7 +40,7 @@ def reference( z_w_con_c_full = interpolate_contravariant_vertical_velocity_to_full_levels_numpy(z_w_con_c) return dict(z_w_con_c_full=z_w_con_c_full) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_w_con_c = random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=vpfloat diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py index ac6a273aae..e9ab186490 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py @@ -182,7 +182,7 @@ def reference( pressure_buoyancy_acceleration_at_cells_on_half_levels=pressure_buoyancy_acceleration_at_cells_on_half_levels, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w = data_alloc.random_field(grid, dims.CellDim, dims.KDim) contravariant_correction_at_cells_on_half_levels = data_alloc.random_field( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py index 5c0602bd22..8f018db9ca 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py @@ -51,7 +51,7 @@ def reference( interpolation = interpolate_to_cell_center_numpy(connectivities, interpolant, e_bln_c_s) return dict(interpolation=interpolation) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: interpolant = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) e_bln_c_s = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py index 875d6f728e..2dc775909d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py @@ -51,7 +51,7 @@ def reference( ) return dict(interpolation_to_surface=interpolation_to_surface) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: interpolant = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) wgtfacq_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py index 42502132b3..b998025020 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py @@ -45,7 +45,7 @@ def reference( z_kin_hor_e[:, 0] = 0 return dict(vn_ie=vn_ie, z_vt_ie=z_vt_ie, z_kin_hor_e=z_kin_hor_e) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_e = zero_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py index 1c179606de..b2a19e3566 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py @@ -84,7 +84,7 @@ def reference( z_kin_hor_e=z_kin_hor_e, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py index 88a3c4b887..4fc1660fb6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py @@ -50,7 +50,7 @@ def reference( z_vt_ie[subset] = interpolate_vt_to_interface_edges_numpy(wgtfac_e, vt)[subset] return dict(z_vt_ie=z_vt_ie) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py index a251f10706..3ca6d13109 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py @@ -49,7 +49,7 @@ def reference( p_vert_out=p_vert_out, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: p_cell_in = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) c_intp = random_field(grid, dims.VertexDim, dims.V2CDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py index 27cf49018d..b819687c83 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py @@ -45,7 +45,7 @@ def reference( rot_vec = mo_math_divrot_rot_vertex_ri_dsl_numpy(connectivities, vec_e, geofac_rot) return dict(rot_vec=rot_vec) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vec_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) geofac_rot = random_field(grid, dims.VertexDim, dims.V2EDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py index 61a19e760a..af727d761e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py @@ -51,7 +51,7 @@ def reference( ) return dict(w_nnew=w_nnew, z_contr_w_fl_l=z_contr_w_fl_l) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w_concorr_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) z_contr_w_fl_l = zero_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py index bd115a4409..122f1913ef 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py @@ -63,7 +63,7 @@ def reference( ) return dict(z_theta_v_pr_ic=z_theta_v_pr_ic, theta_v_ic=theta_v_ic) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfacq_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) z_rth_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py index aca2b603b2..076e84b767 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py @@ -52,7 +52,7 @@ def reference( w_new = solve_tridiagonal_matrix_for_w_back_substitution_numpy(connectivities, z_q=z_q, w=w) return dict(w=w_new) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_q = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py index 3a9ad4037b..7bd38f9619 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py @@ -92,7 +92,7 @@ def reference( ) return dict(z_q=z_q_ref, w=w_ref) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base_grid.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vwind_impl_wgt = data_alloc.random_field(grid, dims.CellDim, dtype=ta.wpfloat) theta_v_ic = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py index f09acf69b3..d9d8ae062c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py @@ -53,7 +53,7 @@ def reference( return dict(spatially_averaged_flux_or_velocity=spatially_averaged_flux_or_velocity) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_flx_avg = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) flux_or_velocity = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py index 2fc3e61d21..612a940991 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py @@ -42,7 +42,7 @@ def reference( w_new = w_now + dtime * grf_tend_w return dict(rho_new=rho_new, exner_new=exner_new, w_new=w_new) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rho_now = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) grf_tend_rho = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py index 456828fed6..ffcb582b55 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py @@ -58,7 +58,7 @@ def reference( ) return dict(exner_dyn_incr=exner_dyn_incr) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ndyn_substeps_var, dtime = wpfloat("10.0"), wpfloat("12.0") exner = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py index f63b88cfe2..5a0e5422da 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py @@ -60,7 +60,7 @@ def reference( ) return dict(mass_flx_ic=mass_flx_ic) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: r_nsubsteps = wpfloat("10.0") rho_ic = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py index b0a497719d..64cd7fab4f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py @@ -67,7 +67,7 @@ def reference( ) return dict(mass_flx_ic=mass_flx_ic, vol_flx_ic=vol_flx_ic) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_contr_w_fl_l = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) rho_ic = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py index 47777ce620..3aaaf1d99f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py @@ -51,7 +51,7 @@ def reference( ) return dict(theta_v_new=theta_v_new) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: mask_prog_halo_c = random_mask(grid, dims.CellDim) rho_now = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py index 087dba1111..32f31fe859 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py @@ -35,7 +35,7 @@ def reference( w_new = w_now + dtime * grf_tend_w return dict(w_new=w_new) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = wpfloat("10.0") w_now = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 1afb564317..88a9336687 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -414,7 +414,6 @@ def reference( f"lprep_adv[{p['lprep_adv']}]__" f"is_iau_active[{p['is_iau_active']}]" ), - scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 76b39d5cb7..97ad07ae63 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -406,7 +406,6 @@ def reference( ] ], ids=lambda param: f"at_first_substep[{param['at_first_substep']}]__is_iau_active[{param['is_iau_active']}]__divdamp_type[{param['divdamp_type']}]", - scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py index ac21d6e87f..1dddcb000c 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(temperature=np.full(u.shape, 255.75599999999997)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( u=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py index 92e4f31efd..c362dd7ece 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(riming_graupel_rate=np.full(t.shape, 2.7054723496793982e-10)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 256.983, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py index 0a443a32d5..9000f55ab3 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(riming_graupel_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py index 604c7e5e84..4a6b064888 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0045484481075162512)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 267.25, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py index aec955d9a1..820355c8c2 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py index 499a1a2ead..90a9f18d34 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(riming_snow_rate=np.full(t.shape, 9.5431874564438999e-10)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 256.571, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py index 434535c60a..701a03e949 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(riming_snow_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py index 92365821d5..ae897cab44 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(freezing_rate=np.full(t.shape, -1.5008166666666666e-08)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py index dfa1d12cf7..2a09f91f90 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(freezing_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 256.835, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py index cc57f67b89..377c940ed3 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py @@ -26,7 +26,7 @@ class TestDepositionAutoConversion(StencilTest): def reference(grid, qi: np.ndarray, m_ice: np.ndarray, ice_dep: np.ndarray, **kwargs) -> dict: return dict(conversion_rate=np.full(qi.shape, 6.6430804299795412e-08)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( qi=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py index 213dfae725..971bc9c76b 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py @@ -25,7 +25,7 @@ class TestDepositionAutoConversionDefault(StencilTest): def reference(grid, qi: np.ndarray, m_ice: np.ndarray, ice_dep: np.ndarray, **kwargs) -> dict: return dict(conversion_rate=np.full(qi.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 2.02422e-23, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py index 477099fde9..d89b8452a9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py @@ -23,7 +23,7 @@ class TestDepositionFactor(StencilTest): def reference(grid, t: np.ndarray, qvsi: np.ndarray, **kwargs) -> dict: return dict(deposition_rate=np.full(t.shape, 1.3234329478493952e-05)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py index 3fbcd9fd1b..65522326e2 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py @@ -23,7 +23,7 @@ class TestQsatRho(StencilTest): def reference(grid, qs: np.ndarray, t: np.ndarray, **kwargs) -> dict: return dict(derivative=np.full(t.shape, 0.00030825070286492049)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( qs=data_alloc.constant_field(grid, 0.00448941, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py index e76ba68ce9..162ad4c301 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py @@ -26,7 +26,7 @@ def reference( ) -> dict: return dict(speed=np.full(density.shape, 0.67882452435647411)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( density=data_alloc.zero_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py index 163cc8c4f0..6f52329dc9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(rain_rate=np.full(t.shape, 5.9748142538569357e-13)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 280.156, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py index 967ae71bc7..bd8b18b74e 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(rain_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 280.156, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py index 7bf89f923a..374b5c738e 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, 1.6836299999999999e-13)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 160.9, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py index 0c5c8bab80..b18697e349 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py index e41fd42a79..bb9bdf1a45 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py @@ -23,7 +23,7 @@ class TestIceNumber(StencilTest): def reference(grid, qi: np.ndarray, ni: np.ndarray, **kwargs) -> dict: return dict(mass=np.full(qi.shape, 1.0e-12)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 2.02422e-23, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py index 6e5d64554f..05b5fa336c 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py @@ -23,7 +23,7 @@ class TestIceNumber(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, **kwargs) -> dict: return dict(number=np.full(t.shape, 5.0507995893464388)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py index fdf3c129f9..52532333b9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py @@ -23,7 +23,7 @@ class TestIceSticking(StencilTest): def reference(grid, t: np.ndarray, **kwargs) -> dict: return dict(sticking_factor=np.full(t.shape, 0.8697930232044021)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 271.6, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py index 51442a70bb..4f2bff9e32 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(aggregation=np.full(rho.shape, 7.1049436957697864e-19)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.04848, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py index 51442a70bb..4f2bff9e32 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(aggregation=np.full(rho.shape, 7.1049436957697864e-19)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.04848, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py index 149db77c98..7072fc1c8c 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(qi.shape, 3.3262745200740486e-11)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 6.43223e-08, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py index 5640ad38f1..bf6ad46db8 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(qi.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 7.95122e-25, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py index bf72e66b00..3da5d59413 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(energy=np.full(t.shape, 38265357.270336017)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 255.756, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py index 22fc1080b5..e29dc9911a 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py @@ -23,7 +23,7 @@ class TestQsatIceRho(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 0.0074981245870634101)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py index 9125f0a9c0..8e29622ff0 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py @@ -23,7 +23,7 @@ class TestQsatRho(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 0.0069027592942577506)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py index 3c07dd56a3..6e13021be7 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py @@ -23,7 +23,7 @@ class TestQsatRho(StencilTest): def reference(grid, rho: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(rho.shape, 0.0038828182695875113)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.24783, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py index dd54512f8d..bc1c75ce0d 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 5.1570340525841922e-17)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py index 072ae7a88c..1a26ea9b2e 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 1.0044914238516472e-12)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 230.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py index 9cc0e37897..0d6a3dc0a5 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 5.1423851647153399e-17)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py index b07e864fce..00ece8df68 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py index fe66e7d746..c5528bc37a 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 2.8556697055499901e-19)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py index 7aa1a3af79..fb681877af 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py index 382e3863ba..d56e9a0a01 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py @@ -23,7 +23,7 @@ class TestSatPresIce(StencilTest): def reference(grid, t: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 1216.7746246067475)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py index c38dfbc385..6bde29be18 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py @@ -23,7 +23,7 @@ class TestSatPresWater(StencilTest): def reference(grid, t: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 1120.1604149806028)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py index f79134b775..d83df25624 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py @@ -38,7 +38,7 @@ def reference( mask_out=np.full(te.shape, False), ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( te=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py index 44b92a6895..b8b685e11b 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py @@ -43,7 +43,7 @@ def reference( qce_out=np.full(te.shape, 9.5724552280369163e-007), ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( te=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py index 3a1e32a4de..3c30334f90 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py @@ -24,7 +24,7 @@ class TestSnowLambda(StencilTest): def reference(grid, rho: np.ndarray, qs: np.ndarray, ns: np.ndarray, **kwargs) -> dict: return dict(riming_snow_rate=np.full(rho.shape, 1.0e10)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.12204, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py index a23b2824df..0887fae8c9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py @@ -23,7 +23,7 @@ class TestSnowNumber(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, qs: np.ndarray, **kwargs) -> dict: return dict(number=np.full(t.shape, 3813750.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 276.302, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py index 82c8236ce3..86c5a7aacd 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py @@ -23,7 +23,7 @@ class TestSnowNumberDefault(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, qs: np.ndarray, **kwargs) -> dict: return dict(number=np.full(t.shape, 8.00e5)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 276.302, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py index 4a0fda7d1c..e69fc05ae6 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 6.2696154545048011e-10)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 265.85, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py index 1c16f82ba5..1614d1aa14 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.157, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py index 4641f61415..4b25992492 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 3.7268547760462804e-07)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 275.83, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py index b8c9be3a7b..b3a6b6ff6c 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 265.83, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py index fd3935b94a..318c53c90e 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(exchange_rate=np.full(t.shape, -6.8498666666666675e-13)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.026, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py index c58e8456e3..8420bd7063 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(exchange_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.026, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py index 78b5f03800..e76dc730df 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(qi.shape, 2.2106162342610385e-09)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 9.53048e-07, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py index 7a0a4bb672..e45648728a 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(qi.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 2.02422e-23, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py index 5aad429eea..bb074808aa 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py @@ -38,7 +38,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, -8.6584296264775935e-13)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.748, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py index 4804b68423..26b02e3dee 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py @@ -38,7 +38,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, 0.0)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.748, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py index cd84439f51..8b9f9795e8 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py @@ -25,7 +25,7 @@ class TestVelScaleFactorIce(StencilTest): def reference(grid, xrho: np.ndarray, **kwargs) -> dict: return dict(scale_factor=np.full(xrho.shape, 1.1158596098981044)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( xrho=data_alloc.constant_field(grid, 1.17873, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py index 4848eaaeed..18e7048ab7 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py @@ -27,7 +27,7 @@ def reference( ) -> dict: return dict(scale_factor=np.full(xrho.shape, 0.06633230453931642)) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid): return dict( xrho=data_alloc.constant_field(grid, 1.17787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py b/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py index c37509a11d..eb8ad994c6 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py @@ -40,7 +40,7 @@ def reference( out_field=out_field, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: in_field = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) coeff = data_alloc.random_field(grid, dims.EdgeDim, dims.E2CDim, dtype=ta.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py b/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py index e5e71acb1d..b68124bbda 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py @@ -41,7 +41,7 @@ def reference( vert_out=out_field, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: cell_in = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=types.wpfloat) c_int = data_alloc.random_field(grid, dims.VertexDim, dims.V2CDim, dtype=types.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py index 8f21503c83..2f0471e4fe 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py @@ -52,7 +52,7 @@ def reference( pressure_ifc=pressure_ifc, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: ddqz_z_full = data_alloc.random_field( grid, dims.CellDim, dims.KDim, low=1.0, dtype=ta.wpfloat diff --git a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py index 175f289bff..55e0967f6a 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py @@ -47,7 +47,7 @@ def reference( surface_pressure=surface_pressure, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: low = 1.0e-2 exner = data_alloc.random_field(grid, dims.CellDim, dims.KDim, low=1.0e-6, dtype=ta.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py index cdb20d25d3..1e03d6b648 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py @@ -45,7 +45,7 @@ def reference( temperature=temperature, ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: theta_v = data_alloc.random_field( grid, dims.CellDim, dims.KDim, low=1.0e-4, high=1.0, dtype=ta.wpfloat diff --git a/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py b/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py index dfd7a87175..a4dea61823 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py @@ -41,7 +41,7 @@ def reference( return dict(p_v_out=p_v_out, p_u_out=p_u_out) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_e_in = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) ptr_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.C2E2C2EDim, dtype=ta.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py b/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py index 37ddca6117..027b0ab492 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py @@ -46,7 +46,7 @@ def reference( ) return dict(interpolation_to_half_levels_vp=interpolation_to_half_levels_vp) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base_grid.Grid) -> dict: interpolant = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) wgtfac_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py index 7d5f2867e2..2137f5e587 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py @@ -56,7 +56,7 @@ def reference( return dict(p_v_out=p_v_out, p_u_out=p_u_out) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: p_e_in = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) ptr_coeff_1 = data_alloc.random_field(grid, dims.VertexDim, dims.V2EDim, dtype=wpfloat) diff --git a/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py b/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py index 22835eb2a0..bf5d44ebd2 100644 --- a/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py +++ b/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py @@ -66,7 +66,7 @@ def reference( out=(p_grad_1_u, p_grad_1_v), ) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: scalar_field = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) geofac_grg_x = random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) diff --git a/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py b/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py index 8859a03c84..5cd46b15ff 100644 --- a/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py +++ b/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py @@ -43,7 +43,7 @@ def reference( ) return dict(first_vertical_derivative=first_vertical_derivative) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: cell_kdim_field = random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=vpfloat diff --git a/model/common/tests/common/math/unit_tests/test_helpers.py b/model/common/tests/common/math/unit_tests/test_helpers.py index 1b1c85c67b..e1de50194d 100644 --- a/model/common/tests/common/math/unit_tests/test_helpers.py +++ b/model/common/tests/common/math/unit_tests/test_helpers.py @@ -66,7 +66,7 @@ def reference( average = 0.5 * (input_field + offset) return dict(average=average) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: input_field = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim, extend={dims.KDim: 1}) result = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, extend={dims.KDim: 1}) @@ -100,7 +100,7 @@ def reference( res = 0.5 * (input_field + np.roll(input_field, shift=-1, axis=1))[:, : shp[1] - 1] return dict(average=res) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: input_field = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) result = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) diff --git a/model/common/tests/common/math/unit_tests/test_operators.py b/model/common/tests/common/math/unit_tests/test_operators.py index ed12104b56..b487d1a50b 100644 --- a/model/common/tests/common/math/unit_tests/test_operators.py +++ b/model/common/tests/common/math/unit_tests/test_operators.py @@ -37,7 +37,7 @@ def reference( nabla2_psi_c_np = reference_funcs.nabla2_on_cell_numpy(connectivities, psi_c, geofac_n2s) return dict(nabla2_psi_c=nabla2_psi_c_np) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base_grid.Grid) -> dict: psi_c = constant_field(grid, 1.0, dims.CellDim) geofac_n2s = constant_field(grid, 2.0, dims.CellDim, dims.C2E2CODim) @@ -66,7 +66,7 @@ def reference( nabla2_psi_c_np = reference_funcs.nabla2_on_cell_k_numpy(connectivities, psi_c, geofac_n2s) return dict(nabla2_psi_c=nabla2_psi_c_np) - @pytest.fixture(scope="class") + @pytest.fixture def input_data(self, grid: base.Grid) -> dict: psi_c = constant_field(grid, 1.0, dims.CellDim, dims.KDim) geofac_n2s = constant_field(grid, 2.0, dims.CellDim, dims.C2E2CODim) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 02e38b018e..1dc2fdf068 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -9,7 +9,7 @@ from __future__ import annotations import dataclasses -from collections.abc import Callable, Generator, Mapping, Sequence +from collections.abc import Callable, Mapping, Sequence from typing import Any, ClassVar import gt4py.next as gtx @@ -36,7 +36,7 @@ def allocate_data( input_data: dict[str, gtx.Field | tuple[gtx.Field, ...]], ) -> dict[str, gtx.Field | tuple[gtx.Field, ...]]: _allocate_field = constructors.as_field.partial(allocator=allocator) # type:ignore[attr-defined] # TODO(havogt): check why it doesn't understand the fluid_partial - gtx_input_data = { + input_data = { k: tuple(_allocate_field(domain=field.domain, data=field.ndarray) for field in v) if isinstance(v, tuple) else _allocate_field(domain=v.domain, data=v.ndarray) @@ -44,7 +44,7 @@ def allocate_data( else v for k, v in input_data.items() } - return gtx_input_data + return input_data @dataclasses.dataclass(frozen=True) @@ -147,9 +147,7 @@ class StencilTest: ... OUTPUTS = ("some_output",) ... STATIC_PARAMS = {"category_a": ["flag0"], "category_b": ["flag0", "flag1"]} ... - ... @pytest.fixture( - ... scope="class" - ... ) # make sure that input data are not allocated multiple times + ... @pytest.fixture ... def input_data(self): ... return {"some_input": ..., "some_output": ...} ... @@ -164,7 +162,7 @@ class StencilTest: reference: ClassVar[Callable[..., Mapping[str, np.ndarray | tuple[np.ndarray, ...]]]] - @pytest.fixture(scope="class") + @pytest.fixture def _configured_program( self, backend_like: model_backends.BackendLike, @@ -196,18 +194,17 @@ def _configured_program( test_func = device_utils.synchronized_function(program, allocator=backend) return test_func - @pytest.fixture(scope="class") + @pytest.fixture def _properly_allocated_input_data( self, input_data: dict[str, gtx.Field | tuple[gtx.Field, ...]], backend_like: model_backends.BackendLike, - ) -> Generator[dict[str, gtx.Field | tuple[gtx.Field, ...]], None, None]: + ) -> dict[str, gtx.Field | tuple[gtx.Field, ...]]: # TODO(havogt): this is a workaround, # because in the `input_data` fixture provided by the user # it does not allocate for the correct device. allocator = model_backends.get_allocator(backend_like) - yield allocate_data(allocator=allocator, input_data=input_data) - input_data.clear() + return allocate_data(allocator=allocator, input_data=input_data) def _verify_stencil_test( self, From 424919e0c0d237e6c1cc7ba6d6ca297dadee3ef9 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 19 Nov 2025 14:58:17 +0100 Subject: [PATCH 104/111] Revert "Fix tests that don't have static params" This reverts commit cd7c23a51501f8d52ede0187ddda059170a810ef. --- model/testing/src/icon4py/model/testing/stencil_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 1dc2fdf068..d389e7252e 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -257,7 +257,7 @@ def __init_subclass__(cls, **kwargs: Any) -> None: # parametrization is only available in the concrete subclass definition if cls.STATIC_PARAMS is None: # not parametrized, return an empty tuple - cls.static_variant = staticmethod(pytest.fixture(lambda: (), scope="class")) # type: ignore[method-assign, assignment] # we override with a non-parametrized function + cls.static_variant = staticmethod(pytest.fixture(lambda: ())) # type: ignore[method-assign, assignment] # we override with a non-parametrized function else: cls.static_variant = staticmethod( # type: ignore[method-assign] pytest.fixture(params=cls.STATIC_PARAMS.items(), scope="class", ids=lambda p: p[0])( From ef8708ddec27eebd4e967102c8af9aed19656088 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 20 Nov 2025 10:06:52 +0100 Subject: [PATCH 105/111] Fix TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection for gtfn_gpu --- ...rizontal_winds_and_ke_and_contravariant_correction.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 814a2dfcb7..2a35b45ff1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -58,12 +58,16 @@ def compute_derived_horizontal_winds_and_ke_and_contravariant_correction_numpy( skip_compute_predictor_vertical_advection: bool, nflatlev: int, nlevp1: int, + horizontal_start: int, + horizontal_end: int, vertical_start: int, ) -> tuple[np.ndarray, ...]: k: np.ndarray = np.arange(nlevp1) k = k[np.newaxis, :] k_nlev = k[:, :-1] + initial_vn_on_half_levels = vn_on_half_levels.copy() + tangential_wind = np.where( k_nlev >= vertical_start, compute_tangential_wind_numpy(connectivities, vn, rbf_vec_coeff_e), @@ -116,6 +120,9 @@ def compute_derived_horizontal_winds_and_ke_and_contravariant_correction_numpy( vn_on_half_levels[:, -1] = extrapolate_to_surface_numpy(wgtfacq_e, vn) + vn_on_half_levels[:horizontal_start, :] = initial_vn_on_half_levels[:horizontal_start, :] + vn_on_half_levels[horizontal_end:, :] = initial_vn_on_half_levels[horizontal_end:, :] + return ( tangential_wind, tangential_wind_on_half_levels, @@ -239,6 +246,8 @@ def reference( skip_compute_predictor_vertical_advection=skip_compute_predictor_vertical_advection, nflatlev=nflatlev, nlevp1=vertical_end, + horizontal_start=horizontal_start, + horizontal_end=horizontal_end, vertical_start=vertical_start, ) From fcf873cae76b4603d5544231e7d84b460121a07a Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 20 Nov 2025 13:38:41 +0100 Subject: [PATCH 106/111] Added class TestComputeAveragedVnAndFluxesAndPrepareTracerAdvection --- ...and_fluxes_and_prepare_tracer_advection.py | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py index 11a52a0744..dae97a2da6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py @@ -26,6 +26,7 @@ @pytest.mark.embedded_remap_error +@pytest.mark.continuous_benchmarking class TestComputeAveragedVnAndFluxesAndPrepareTracerAdvection(stencil_tests.StencilTest): PROGRAM = compute_averaged_vn_and_fluxes_and_prepare_tracer_advection OUTPUTS = ( @@ -35,6 +36,25 @@ class TestComputeAveragedVnAndFluxesAndPrepareTracerAdvection(stencil_tests.Sten "substep_and_spatially_averaged_vn", "substep_averaged_mass_flux", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: (), + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + "prepare_advection", + "at_first_substep", + "r_nsubsteps", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + "prepare_advection", + "at_first_substep", + "r_nsubsteps", + ), + } @staticmethod def reference( @@ -134,8 +154,16 @@ def reference( substep_averaged_mass_flux=substep_averaged_mass_flux, ) - @pytest.fixture - def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + @pytest.fixture( + params=[{"prepare_advection": pa, "at_first_substep": afs} + for pa, afs in [ + (True, True), + (True, False), + ] + ], + ids=lambda p: f"prepare_advection[{p['prepare_advection']}]__at_first_substep[{p['at_first_substep']}]", + ) + def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: spatially_averaged_vn = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) mass_fl_e = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) z_theta_v_fl_e = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) @@ -147,13 +175,13 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala z_rho_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) ddqz_z_full_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) z_theta_v_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) - prepare_advection = True - at_first_substep = True - r_nsubsteps = 0.2 + prepare_advection = request.param["prepare_advection"] + at_first_substep = request.param["at_first_substep"] + r_nsubsteps = 0.5 edge_domain = h_grid.domain(dims.EdgeDim) - horizontal_start = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) - horizontal_end = grid.end_index(edge_domain(h_grid.Zone.LOCAL)) + horizontal_start = grid.start_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5)) + horizontal_end = grid.end_index(edge_domain(h_grid.Zone.HALO_LEVEL_2)) return dict( spatially_averaged_vn=spatially_averaged_vn, From a974f65748e8d2d8de5cd5a1b384e40229a54eb1 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 20 Nov 2025 13:43:15 +0100 Subject: [PATCH 107/111] Added TestComputeHorizontalVelocityQuantitiesAndFluxes --- ...rizontal_velocity_quantities_and_fluxes.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py index 7405e97638..3990a90e9d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py @@ -85,6 +85,7 @@ def compute_vt_vn_on_half_levels_and_kinetic_energy_numpy( @pytest.mark.embedded_remap_error +@pytest.mark.continuous_benchmarking class TestComputeHorizontalVelocityQuantitiesAndFluxes(stencil_tests.StencilTest): PROGRAM = compute_horizontal_velocity_quantities_and_fluxes OUTPUTS = ( @@ -98,6 +99,21 @@ class TestComputeHorizontalVelocityQuantitiesAndFluxes(stencil_tests.StencilTest "horizontal_kinetic_energy_at_edges_on_model_levels", "contravariant_correction_at_edges_on_model_levels", ) + STATIC_PARAMS = { + stencil_tests.StandardStaticVariants.NONE: (), + stencil_tests.StandardStaticVariants.COMPILE_TIME_DOMAIN: ( + "horizontal_start", + "horizontal_end", + "vertical_start", + "vertical_end", + "nflatlev", + ), + stencil_tests.StandardStaticVariants.COMPILE_TIME_VERTICAL: ( + "vertical_start", + "vertical_end", + "nflatlev", + ), + } @staticmethod def reference( @@ -294,8 +310,8 @@ def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.Scala nflatlev = 5 # value is set to reflect the MCH ch1 experiment. Changing this value will change the expected runtime edge_domain = h_grid.domain(dims.EdgeDim) - horizontal_start = grid.start_index(edge_domain(h_grid.Zone.NUDGING_LEVEL_2)) - horizontal_end = grid.end_index(edge_domain(h_grid.Zone.LOCAL)) + horizontal_start = grid.start_index(edge_domain(h_grid.Zone.LATERAL_BOUNDARY_LEVEL_5)) + horizontal_end = grid.end_index(edge_domain(h_grid.Zone.HALO_LEVEL_2)) return dict( spatially_averaged_vn=spatially_averaged_vn, From c757eac215a9b736e3d177a098ce81d962ae6a5f Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 20 Nov 2025 13:46:26 +0100 Subject: [PATCH 108/111] Make formatting happy --- ..._averaged_vn_and_fluxes_and_prepare_tracer_advection.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py index dae97a2da6..20073ddcec 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py @@ -155,7 +155,8 @@ def reference( ) @pytest.fixture( - params=[{"prepare_advection": pa, "at_first_substep": afs} + params=[ + {"prepare_advection": pa, "at_first_substep": afs} for pa, afs in [ (True, True), (True, False), @@ -163,7 +164,9 @@ def reference( ], ids=lambda p: f"prepare_advection[{p['prepare_advection']}]__at_first_substep[{p['at_first_substep']}]", ) - def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: + def input_data( + self, request: pytest.FixtureRequest, grid: base.Grid + ) -> dict[str, gtx.Field | state_utils.ScalarType]: spatially_averaged_vn = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) mass_fl_e = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) z_theta_v_fl_e = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) From b4f73b173008b238108d1ddc67bc135f0de02c3e Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 17 Nov 2025 19:04:53 +0100 Subject: [PATCH 109/111] Fix memory leaks and unnecessary reference in StencilTests --- ...test_apply_horizontal_density_increment.py | 2 +- ...apply_interpolated_tracer_time_tendency.py | 2 +- .../test_apply_vertical_density_increment.py | 2 +- ...st_average_horizontal_flux_subcycling_2.py | 2 +- ...st_average_horizontal_flux_subcycling_3.py | 2 +- ...e_antidiffusive_cell_fluxes_and_min_max.py | 2 +- ...test_compute_barycentric_backtrajectory.py | 2 +- ..._compute_barycentric_backtrajectory_alt.py | 2 +- .../test_compute_ffsl_backtrajectory.py | 2 +- ...cktrajectory_counterclockwise_indicator.py | 2 +- ...te_ffsl_backtrajectory_length_indicator.py | 2 +- ...tal_tracer_flux_from_cubic_coefficients.py | 2 +- ...al_tracer_flux_from_linear_coefficients.py | 2 +- ...racer_flux_from_linear_coefficients_alt.py | 2 +- ...e_horizontal_multiplicative_flux_factor.py | 2 +- ...t_compute_ppm4gpu_parabola_coefficients.py | 2 +- .../test_compute_ppm_all_face_values.py | 2 +- .../test_compute_ppm_quadratic_face_values.py | 2 +- .../test_compute_ppm_quartic_face_values.py | 2 +- .../stencil_tests/test_compute_ppm_slope.py | 2 +- .../stencil_tests/test_compute_tendency.py | 2 +- ...ute_vertical_parabola_limiter_condition.py | 2 +- ...est_compute_vertical_tracer_flux_upwind.py | 2 +- ...t_integrate_tracer_density_horizontally.py | 2 +- .../test_integrate_tracer_horizontally.py | 2 +- .../test_integrate_tracer_vertically.py | 2 +- ...it_vertical_parabola_semi_monotonically.py | 2 +- ...limit_vertical_slope_semi_monotonically.py | 2 +- ...s_antidiffusive_cell_fluxes_and_min_max.py | 2 +- ...est_prepare_ffsl_flux_area_patches_list.py | 2 +- ...cal_quadrature_for_cubic_reconstruction.py | 2 +- ...uadrature_list_for_cubic_reconstruction.py | 2 +- ...test_reconstruct_cubic_coefficients_svd.py | 2 +- ...test_apply_diffusion_to_theta_and_exner.py | 2 +- .../test_apply_diffusion_to_vn.py | 2 +- ...ute_horizontal_gradients_for_turbulence.py | 2 +- ...st_apply_nabla2_and_nabla4_global_to_vn.py | 2 +- .../test_apply_nabla2_and_nabla4_to_vn.py | 2 +- ..._apply_nabla2_to_vn_in_lateral_boundary.py | 2 +- .../stencil_tests/test_apply_nabla2_to_w.py | 2 +- ...pply_nabla2_to_w_in_upper_damping_layer.py | 2 +- ...st_calculate_diagnostics_for_turbulence.py | 2 +- ...ate_horizontal_gradients_for_turbulence.py | 2 +- ...ate_nabla2_and_smag_coefficients_for_vn.py | 2 +- .../test_calculate_nabla2_for_w.py | 2 +- .../test_calculate_nabla2_for_z.py | 2 +- .../test_calculate_nabla2_of_theta.py | 2 +- .../stencil_tests/test_calculate_nabla4.py | 2 +- ...n_coefficient_for_grid_point_cold_pools.py | 2 +- ...d_for_grid_point_cold_pools_enhancement.py | 2 +- ...orary_fields_for_turbulence_diagnostics.py | 2 +- ...fusion_nabla_of_theta_over_steep_points.py | 2 +- .../test_update_theta_and_exner.py | 2 +- .../test_accumulate_prep_adv_fields.py | 2 +- ...lysis_increments_from_data_assimilation.py | 2 +- .../test_add_analysis_increments_to_vn.py | 2 +- ...or_normal_wind_tendency_approaching_cfl.py | 2 +- ...tra_diffusion_for_w_con_approaching_cfl.py | 2 +- ..._interpolated_horizontal_advection_of_w.py | 2 +- .../test_add_temporal_tendencies_to_vn.py | 2 +- ...vn_by_interpolating_between_time_levels.py | 2 +- ...l_wind_derivative_to_divergence_damping.py | 2 +- ...test_apply_2nd_order_divergence_damping.py | 2 +- ...test_apply_4th_order_divergence_damping.py | 2 +- ..._apply_divergence_damping_and_update_vn.py | 1 + ...o_horizontal_gradient_of_exner_pressure.py | 2 +- .../test_apply_rayleigh_damping_mechanism.py | 2 +- ...ed_2nd_and_4th_order_divergence_damping.py | 2 +- ...vection_in_horizontal_momentum_equation.py | 1 + ...advection_in_vertical_momentum_equation.py | 3 ++- ...ompute_advective_vertical_wind_tendency.py | 2 +- .../stencil_tests/test_compute_airmass.py | 2 +- ...rox_of_2nd_vertical_derivative_of_exner.py | 2 +- ...and_fluxes_and_prepare_tracer_advection.py | 1 + ...st_compute_avg_vn_and_graddiv_vn_and_vt.py | 2 +- .../test_compute_contravariant_correction.py | 2 +- ...t_compute_contravariant_correction_of_w.py | 2 +- ...iant_correction_of_w_for_lower_boundary.py | 2 +- ...nds_and_ke_and_contravariant_correction.py | 1 + ...e_divergence_of_fluxes_of_rho_and_theta.py | 2 +- ...est_compute_dwdz_for_divergence_damping.py | 2 +- .../test_compute_exner_from_rhotheta.py | 2 +- ...compute_explicit_part_for_rho_and_exner.py | 2 +- ...rom_advection_and_vertical_wind_density.py | 2 +- ...d_speed_and_vertical_wind_times_density.py | 2 +- .../test_compute_graddiv2_of_vn.py | 2 +- ...e_horizontal_advection_of_rho_and_theta.py | 2 +- ...al_advection_term_for_vertical_velocity.py | 2 +- ..._of_exner_pressure_for_flat_coordinates.py | 2 +- ...t_of_exner_pressure_for_multiple_levels.py | 2 +- ..._exner_pressure_for_nonflat_coordinates.py | 2 +- .../test_compute_horizontal_kinetic_energy.py | 2 +- ...rizontal_velocity_quantities_and_fluxes.py | 2 +- ...est_compute_hydrostatic_correction_term.py | 2 +- .../stencil_tests/test_compute_mass_flux.py | 2 +- ...nd_clip_contravariant_vertical_velocity.py | 2 +- ...t_compute_perturbation_of_rho_and_theta.py | 2 +- ...nd_theta_and_rho_interface_cell_centers.py | 2 +- ..._perturbed_quantities_and_interpolation.py | 2 +- ...ute_results_for_thermodynamic_variables.py | 2 +- ...tial_temperatures_and_pressure_gradient.py | 2 +- ...test_compute_solver_coefficients_matrix.py | 2 +- .../test_compute_tangential_wind.py | 2 +- .../test_compute_theta_and_exner.py | 2 +- ...tial_temperatures_and_pressure_gradient.py | 2 +- .../test_compute_vn_on_lateral_boundary.py | 2 +- .../test_copy_cell_kdim_field_to_vp.py | 2 +- .../stencil_tests/test_extrapolate_at_top.py | 2 +- ...t_extrapolate_temporally_exner_pressure.py | 2 +- .../test_init_cell_kdim_field_with_zero_vp.py | 2 +- .../test_init_cell_kdim_field_with_zero_wp.py | 2 +- ..._init_two_cell_kdim_fields_with_zero_vp.py | 2 +- ..._init_two_edge_kdim_fields_with_zero_wp.py | 2 +- ...nterpolate_cell_field_to_half_levels_vp.py | 2 +- ...ariant_vertical_velocity_to_full_levels.py | 2 +- ...d_compute_temperature_vertical_gradient.py | 2 +- .../test_interpolate_to_cell_center.py | 2 +- .../test_interpolate_to_surface.py | 2 +- ..._and_vt_to_ie_and_compute_ekin_on_edges.py | 2 +- ...els_and_compute_kinetic_energy_on_edges.py | 2 +- .../test_interpolate_vt_to_interface_edges.py | 2 +- ...lation_scalar_cells2verts_scalar_ri_dsl.py | 2 +- .../test_mo_math_divrot_rot_vertex_ri_dsl.py | 2 +- ...tion_for_w_and_contravariant_correction.py | 2 +- ..._set_theta_v_prime_ic_at_lower_boundary.py | 2 +- ...diagonal_matrix_for_w_back_substitution.py | 2 +- ..._tridiagonal_matrix_for_w_forward_sweep.py | 2 +- ...test_spatially_average_flux_or_velocity.py | 2 +- .../test_update_density_exner_wind.py | 2 +- ...t_update_dynamical_exner_time_increment.py | 2 +- .../test_update_mass_flux_weighted.py | 2 +- .../test_update_mass_volume_flux.py | 2 +- .../stencil_tests/test_update_theta_v.py | 2 +- .../dycore/stencil_tests/test_update_wind.py | 2 +- ...mplicit_dycore_solver_at_corrector_step.py | 1 + ...mplicit_dycore_solver_at_predictor_step.py | 1 + .../test_T_from_internal_energy.py | 2 +- .../stencil_tests/test_cloud_to_graupel.py | 2 +- .../test_cloud_to_graupel_default.py | 2 +- .../stencil_tests/test_cloud_to_rain.py | 2 +- .../test_cloud_to_rain_default.py | 2 +- .../stencil_tests/test_cloud_to_snow.py | 2 +- .../test_cloud_to_snow_default.py | 2 +- .../muphys/stencil_tests/test_cloud_x_ice.py | 2 +- .../stencil_tests/test_cloud_x_ice_default.py | 2 +- .../test_deposition_auto_conversion.py | 2 +- ...test_deposition_auto_conversion_default.py | 2 +- .../stencil_tests/test_deposition_factor.py | 2 +- .../muphys/stencil_tests/test_dqsatdT_rho.py | 2 +- .../muphys/stencil_tests/test_fall_speed.py | 2 +- .../stencil_tests/test_graupel_to_rain.py | 2 +- .../test_graupel_to_rain_default.py | 2 +- .../test_ice_deposition_nucleation.py | 2 +- .../test_ice_deposition_nucleation_default.py | 2 +- .../muphys/stencil_tests/test_ice_mass.py | 2 +- .../muphys/stencil_tests/test_ice_number.py | 2 +- .../muphys/stencil_tests/test_ice_sticking.py | 2 +- .../stencil_tests/test_ice_to_graupel.py | 2 +- .../test_ice_to_graupel_default.py | 2 +- .../muphys/stencil_tests/test_ice_to_snow.py | 2 +- .../stencil_tests/test_ice_to_snow_default.py | 2 +- .../stencil_tests/test_internal_energy.py | 2 +- .../muphys/stencil_tests/test_qsat_ice_rho.py | 2 +- .../muphys/stencil_tests/test_qsat_rho.py | 2 +- .../stencil_tests/test_qsat_rho_tmelt.py | 2 +- .../stencil_tests/test_rain_to_graupel_1.py | 2 +- .../stencil_tests/test_rain_to_graupel_2.py | 2 +- .../stencil_tests/test_rain_to_graupel_3.py | 2 +- .../test_rain_to_graupel_default.py | 2 +- .../stencil_tests/test_rain_to_vapor.py | 2 +- .../test_rain_to_vapor_default.py | 2 +- .../muphys/stencil_tests/test_sat_pres_ice.py | 2 +- .../stencil_tests/test_sat_pres_water.py | 2 +- .../test_saturation_adjustment.py | 2 +- .../test_saturation_adjustment2.py | 2 +- .../muphys/stencil_tests/test_snow_lambda.py | 2 +- .../muphys/stencil_tests/test_snow_number.py | 2 +- .../stencil_tests/test_snow_number_default.py | 2 +- .../stencil_tests/test_snow_to_graupel.py | 2 +- .../test_snow_to_graupel_default.py | 2 +- .../muphys/stencil_tests/test_snow_to_rain.py | 2 +- .../test_snow_to_rain_default.py | 2 +- .../stencil_tests/test_vapor_x_graupel.py | 2 +- .../test_vapor_x_graupel_default.py | 2 +- .../muphys/stencil_tests/test_vapor_x_ice.py | 2 +- .../stencil_tests/test_vapor_x_ice_default.py | 2 +- .../muphys/stencil_tests/test_vapor_x_snow.py | 2 +- .../test_vapor_x_snow_default.py | 2 +- .../test_vel_scale_factor_ice.py | 2 +- .../test_vel_scale_factor_snow.py | 2 +- .../test_cell_2_edge_interpolation.py | 2 +- ...est_compute_cell_2_vertex_interpolation.py | 2 +- .../stencil_tests/test_diagnose_pressure.py | 2 +- .../test_diagnose_surface_pressure.py | 2 +- .../test_diagnose_temperature.py | 2 +- ...st_edge_2_cell_vector_rbf_interpolation.py | 2 +- ...nterpolate_edge_field_to_half_levels_vp.py | 2 +- ...est_mo_intp_rbf_rbf_vec_interpol_vertex.py | 2 +- ...izontal_gradients_by_green_gauss_method.py | 2 +- .../test_compute_first_vertical_derivative.py | 2 +- .../common/math/unit_tests/test_helpers.py | 4 ++-- .../common/math/unit_tests/test_operators.py | 4 ++-- .../icon4py/model/testing/stencil_tests.py | 19 +++++++++++-------- 203 files changed, 216 insertions(+), 206 deletions(-) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py index 2b82a73a20..06f0cd2c1b 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_horizontal_density_increment.py @@ -43,7 +43,7 @@ def reference( rhodz_ast2 = np.maximum(0.1 * p_rhodz_new, p_rhodz_new) - p_dtime * tmp return dict(rhodz_ast2=rhodz_ast2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_rhodz_new = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_mflx_contra_v = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py index 4484a4159a..a639500264 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_interpolated_tracer_time_tendency.py @@ -37,7 +37,7 @@ def reference( return dict(p_tracer_new=p_tracer_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_grf_tend_tracer = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py index 9c428c9c60..ea5b270230 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_apply_vertical_density_increment.py @@ -47,7 +47,7 @@ def reference( return dict(rhodz_ast2=rhodz_ast2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: rhodz_ast = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_mflx_contra_v = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py index d73e3354ac..ca6db686bd 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_2.py @@ -34,7 +34,7 @@ def reference( p_out_e = (z_tracer_mflx_1_dsl + z_tracer_mflx_2_dsl) / float(2) return dict(p_out_e=p_out_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_tracer_mflx_1_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) z_tracer_mflx_2_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py index 9883b6fc5a..82fe0ae467 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_average_horizontal_flux_subcycling_3.py @@ -35,7 +35,7 @@ def reference( p_out_e = (z_tracer_mflx_1_dsl + z_tracer_mflx_2_dsl + z_tracer_mflx_3_dsl) / float(3) return dict(p_out_e=p_out_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_tracer_mflx_1_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) z_tracer_mflx_2_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py index 63dc972850..757a0fcee2 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_antidiffusive_cell_fluxes_and_min_max.py @@ -77,7 +77,7 @@ def reference( z_tracer_min=z_tracer_min, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) p_rhodz_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py index 63054b2a19..9351816d16 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory.py @@ -79,7 +79,7 @@ def reference( p_distv_bary_2=p_distv_bary_2, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py index 1adb8af3aa..38bb95e49b 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_barycentric_backtrajectory_alt.py @@ -72,7 +72,7 @@ def reference( p_distv_bary_2=p_distv_bary_2, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py index 60bb15e9cf..1b65e483ec 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory.py @@ -145,7 +145,7 @@ def reference( "p_coords_dreg_v_4_lat_dsl": p_coords_dreg_v_4_lat_dsl, } - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py index 064c915c6c..ce90d0e9b5 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_counterclockwise_indicator.py @@ -44,7 +44,7 @@ def reference( return dict(lvn_sys_pos=lvn_sys_pos) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) tangent_orientation = data_alloc.random_field(grid, dims.EdgeDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py index 326d040463..cacb408cbb 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ffsl_backtrajectory_length_indicator.py @@ -46,7 +46,7 @@ def reference( return dict(opt_famask_dsl=opt_famask_dsl) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py index cdf27e4979..94fc3b8e84 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_cubic_coefficients.py @@ -34,7 +34,7 @@ def reference( return dict(p_out_e_hybrid_2=p_out_e_hybrid_2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: p_out_e_hybrid_2 = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_mass_flx_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py index 51e4cc49d2..29eaaba61c 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients.py @@ -57,7 +57,7 @@ def reference( return dict(p_out_e=p_out_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_lsq_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_lsq_coeff_2 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py index f490a7bf82..d9bc8813bf 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_horizontal_tracer_flux_from_linear_coefficients_alt.py @@ -57,7 +57,7 @@ def reference( return dict(p_out_e=p_out_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_lsq_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_lsq_coeff_2 = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py index c6ee1ad78e..902d8d3ae9 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_positive_definite_horizontal_multiplicative_flux_factor.py @@ -53,7 +53,7 @@ def reference( return dict(r_m=r_m) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py index ffaeefc5c6..11f06165a8 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm4gpu_parabola_coefficients.py @@ -36,7 +36,7 @@ def reference( z_a1 = p_cc - 0.5 * (z_face_up + z_face_low) return dict(z_delta_q=z_delta_q, z_a1=z_a1) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_face_up = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_face_low = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py index 054cb659fe..1b84c3debe 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_all_face_values.py @@ -49,7 +49,7 @@ def reference( p_face[:, 1:] = np.where((k[1:] == elevp1), p_cc[:, :-1], p_face[:, 1:]) return dict(p_face=p_face) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_cellhgt_mc_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py index 98095dc0f1..22d8be854e 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quadratic_face_values.py @@ -42,7 +42,7 @@ def reference( ) return dict(p_face=p_face) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_face = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py index b6192bf216..691dc715b8 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_quartic_face_values.py @@ -68,7 +68,7 @@ def reference( ) return dict(p_face=p_face) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_cellhgt_mc_now = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py index d875fd8f2c..3585651cfb 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_ppm_slope.py @@ -64,7 +64,7 @@ def reference( z_slope = np.where(k[1:-1] < elev, z_slope_a, z_slope_b) return dict(z_slope=z_slope) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_slope = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py index 88810d6269..17f4aea803 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_tendency.py @@ -34,7 +34,7 @@ def reference( return dict(opt_ddt_tracer_adv=opt_ddt_tracer_adv) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_tracer_new = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py index e881c1f702..f308571140 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_parabola_limiter_condition.py @@ -36,7 +36,7 @@ def reference( l_limit = np.where(np.abs(z_delta) < -1 * z_a6i, 1, 0) return dict(l_limit=l_limit) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_face = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py index 03d40aaa52..1835f18619 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_compute_vertical_tracer_flux_upwind.py @@ -41,7 +41,7 @@ def reference( ) return dict(p_upflux=p_upflux) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) p_mflx_contra_v = data_alloc.random_field( diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py index 6bb07ba7cb..ec40232a0f 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_density_horizontally.py @@ -61,7 +61,7 @@ def reference( z_tracer_new_dsl=z_tracer_new_dsl, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_mass_flx_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py index f1f1134f66..2621e1db67 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_horizontally.py @@ -45,7 +45,7 @@ def reference( ) / rhodz_new return dict(tracer_new_hor=tracer_new_hor) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_mflx_tracer_h = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) deepatmo_divh = data_alloc.random_field(grid, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py index 6ab7a36d13..c6b02ab378 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_integrate_tracer_vertically.py @@ -58,7 +58,7 @@ def reference( return dict(tracer_new=tracer_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) rhodz_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py index b7079d0aca..937fe35fc0 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_parabola_semi_monotonically.py @@ -47,7 +47,7 @@ def reference( ) return dict(p_face_up=q_face_up, p_face_low=q_face_low) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: l_limit = data_alloc.random_mask(grid, dims.CellDim, dims.KDim, dtype=gtx.int32) p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py index fb32ae1f24..624eeb8703 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_limit_vertical_slope_semi_monotonically.py @@ -39,7 +39,7 @@ def reference( slope = np.where(z_slope[:, 1:-1] >= 0.0, slope_l, -slope_l) return dict(z_slope=slope) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) z_slope = data_alloc.random_field(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py index 9fe005d986..30fcccd0f8 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_postprocess_antidiffusive_cell_fluxes_and_min_max.py @@ -54,7 +54,7 @@ def reference( z_tracer_min=z_tracer_min_out, ) - @pytest.fixture() + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: hi_bound, lo_bound = 3, 1 refin_ctrl = data_alloc.constant_field(grid, 2, dims.CellDim, dtype=gtx.int32) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py index bc2d3c6933..8a696d961d 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_ffsl_flux_area_patches_list.py @@ -1470,7 +1470,7 @@ def reference( dreg_patch2_4_lat_vmask=dreg_patch2_4_lat_vmask, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: famask_int = data_alloc.random_mask(grid, dims.EdgeDim, dims.KDim, dtype=gtx.int32) p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py index efe12e6b23..3664cdc0d9 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_for_cubic_reconstruction.py @@ -485,7 +485,7 @@ def reference( p_dreg_area_out=p_dreg_area_out, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_coords_dreg_v_1_x = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) p_coords_dreg_v_2_x = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py index 66b376c37a..1ede54c31b 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_prepare_numerical_quadrature_list_for_cubic_reconstruction.py @@ -519,7 +519,7 @@ def reference( p_dreg_area=p_dreg_area, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: famask_int = data_alloc.constant_field(grid, 1, dims.EdgeDim, dims.KDim, dtype=gtx.int32) p_coords_dreg_v_1_x = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py b/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py index ed85115d46..7736363941 100644 --- a/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py +++ b/model/atmosphere/advection/tests/advection/stencil_tests/test_reconstruct_cubic_coefficients_svd.py @@ -304,7 +304,7 @@ def reference( p_coeff_10_dsl=p_coeff_10_dsl, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim) lsq_pseudoinv_1_field = data_alloc.random_field(grid, dims.CellDim, dims.C2E2C2E2CDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py index 29d880a8f7..89d878db3f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_theta_and_exner.py @@ -75,7 +75,7 @@ def reference( return dict(theta_v=theta_v, exner=exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): pytest.xfail( "stencil segfaults with GTFN and it is not used in diffusion: it is missing an if condition" diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py index debdae974f..743cb7934f 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_vn.py @@ -115,7 +115,7 @@ def reference( return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py index 4e9652ac76..dc81503657 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence.py @@ -118,7 +118,7 @@ def reference( out_dwdy[subset] = dwdy[subset] return dict(w=out_w, dwdx=out_dwdx, dwdy=out_dwdy) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: nrdmax = 13 cell_domain = h_grid.domain(dims.CellDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py index c2ef62b392..97717a64d2 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_global_to_vn.py @@ -34,7 +34,7 @@ class TestApplyNabla2AndNabla4GlobalToVn(StencilTest): PROGRAM = apply_nabla2_and_nabla4_global_to_vn OUTPUTS = ("vn",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): area_edge = random_field(grid, dims.EdgeDim, dtype=wpfloat) kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py index 3b60be5291..ae71aea8c4 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_and_nabla4_to_vn.py @@ -42,7 +42,7 @@ class TestApplyNabla2AndNabla4ToVn(StencilTest): PROGRAM = apply_nabla2_and_nabla4_to_vn OUTPUTS = ("vn",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): area_edge = random_field(grid, dims.EdgeDim, dtype=wpfloat) kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py index 0de1666efd..580c54e3aa 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_vn_in_lateral_boundary.py @@ -33,7 +33,7 @@ class TestApplyNabla2ToVnInLateralBoundary(StencilTest): PROGRAM = apply_nabla2_to_vn_in_lateral_boundary OUTPUTS = ("vn",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): fac_bdydiff_v = wpfloat("5.0") z_nabla2_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py index cf505ee6ca..816ac25e07 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w.py @@ -51,7 +51,7 @@ def reference( w = apply_nabla2_to_w_numpy(connectivities, area, z_nabla2_c, geofac_n2s, w, diff_multfac_w) return dict(w=w) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): area = random_field(grid, dims.CellDim, dtype=wpfloat) z_nabla2_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py index 74d532867b..82876600d8 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_apply_nabla2_to_w_in_upper_damping_layer.py @@ -34,7 +34,7 @@ class TestApplyNabla2ToWInUpperDampingLayer(StencilTest): PROGRAM = apply_nabla2_to_w_in_upper_damping_layer OUTPUTS = ("w",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff_multfac_n2w = random_field(grid, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py index 142ee4d36a..05f4ca81d1 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_diagnostics_for_turbulence.py @@ -47,7 +47,7 @@ def reference( ) return dict(div_ic=div_ic, hdef_ic=hdef_ic) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) div = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py index fa6659390b..10d4e43ce2 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_horizontal_gradients_for_turbulence.py @@ -51,7 +51,7 @@ def reference( ) return dict(dwdx=dwdx, dwdy=dwdy) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): w = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) geofac_grg_x = data_alloc.random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py index e9cd84bde4..d115d6deb3 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py @@ -173,7 +173,7 @@ def reference( return dict(kh_smag_e=kh_smag_e_out, kh_smag_ec=kh_smag_ec_out, z_nabla2_e=z_nabla2_e_out) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py index eb405afab2..09a36b58bc 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_w.py @@ -44,7 +44,7 @@ def reference( z_nabla2_c = calculate_nabla2_for_w_numpy(connectivities, w, geofac_n2s) return dict(z_nabla2_c=z_nabla2_c) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: w = constant_field(grid, 1.0, dims.CellDim, dims.KDim) geofac_n2s = constant_field(grid, 2.0, dims.CellDim, dims.C2E2CODim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py index f3934007e0..bdff00e5ca 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_for_z.py @@ -59,7 +59,7 @@ def reference( ) return dict(z_nabla2_e=z_nabla2_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py index 5355ee6371..065366e934 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla2_of_theta.py @@ -41,7 +41,7 @@ def reference( z_temp = calculate_nabla2_of_theta_numpy(connectivities, z_nabla2_e, geofac_div) return dict(z_temp=z_temp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_nabla2_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py index dc8f9ac4ba..0a73f1c3c8 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_calculate_nabla4.py @@ -97,7 +97,7 @@ def reference( ) return dict(z_nabla4_e2=z_nabla4_e2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid) -> dict: u_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) v_vert = data_alloc.random_field(grid, dims.VertexDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py index 50524d92d4..89b28bb42b 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_enhance_diffusion_coefficient_for_grid_point_cold_pools.py @@ -42,7 +42,7 @@ def reference( ) return dict(kh_smag_e=kh_smag_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: kh_smag_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) enh_diffu_3d = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py index fd0b4563a9..4e61c5703e 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_field_for_grid_point_cold_pools_enhancement.py @@ -52,7 +52,7 @@ def reference( return dict(enh_diffu_3d=enh_diffu_3d) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: theta_v = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) theta_ref_mc = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py index 0352652ad2..6cea5e6a00 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_temporary_fields_for_turbulence_diagnostics.py @@ -46,7 +46,7 @@ def reference( return dict(div=div, kh_c=kh_c) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid): vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py index 93f47096d6..0ce06ce981 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_truly_horizontal_diffusion_nabla_of_theta_over_steep_points.py @@ -88,7 +88,7 @@ def reference( ) return dict(z_temp=z_temp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): mask = random_mask(grid, dims.CellDim, dims.KDim) diff --git a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py index d7bce46e8a..0c84a6487d 100644 --- a/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py +++ b/model/atmosphere/diffusion/tests/diffusion/stencil_tests/test_update_theta_and_exner.py @@ -50,7 +50,7 @@ def reference( theta_v, exner = update_theta_and_exner_numpy(z_temp, area, theta_v, exner, rd_o_cvd) return dict(theta_v=theta_v, exner=exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: z_temp = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) area = random_field(grid, dims.CellDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py index c58454e15d..58b32d5d15 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_accumulate_prep_adv_fields.py @@ -60,7 +60,7 @@ def reference( return dict(vn_traj=vn_traj, mass_flx_me=mass_flx_me) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: mass_fl_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) mass_flx_me = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py index 5bf6bf9525..c4e248313f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_from_data_assimilation.py @@ -58,7 +58,7 @@ def reference( ) return dict(z_rho_expl=z_rho_expl, z_exner_expl=z_exner_expl) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_exner_expl = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) exner_incr = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py index 8f67332647..3f80d216c6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_analysis_increments_to_vn.py @@ -45,7 +45,7 @@ def reference( vn = add_analysis_increments_to_vn_numpy(vn_incr, vn, iau_wgt_dyn) return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn_incr = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py index 6c69b6b94e..8cac1ad9d0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_normal_wind_tendency_approaching_cfl.py @@ -102,7 +102,7 @@ class TestAddExtraDiffusionForNormalWindTendencyApproachingCfl(StencilTest): PROGRAM = add_extra_diffusion_for_normal_wind_tendency_approaching_cfl OUTPUTS = ("ddt_vn_apc",) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: levelmask = data_alloc.random_mask(grid, dims.KDim, extend={dims.KDim: 1}) c_lin_e = data_alloc.random_field(grid, dims.EdgeDim, dims.E2CDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py index 1e855f11ac..720511cb0b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_extra_diffusion_for_w_con_approaching_cfl.py @@ -107,7 +107,7 @@ def reference( ) return dict(ddt_w_adv=ddt_w_adv) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: cfl_clipping = random_mask(grid, dims.CellDim, dims.KDim) owner_mask = random_mask(grid, dims.CellDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py index e27f6d9ee7..54ba2b1100 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_interpolated_horizontal_advection_of_w.py @@ -55,7 +55,7 @@ def reference( ) return dict(ddt_w_adv=ddt_w_adv) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_v_grad_w = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) e_bln_c_s = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py index 861d66d4ba..1a0d714fe8 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn.py @@ -59,7 +59,7 @@ def reference( ) return dict(vn_nnew=vn_nnew) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = wpfloat("10.0") vn_nnow = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py index b84b1bbc74..641cb6a4e0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_temporal_tendencies_to_vn_by_interpolating_between_time_levels.py @@ -76,7 +76,7 @@ def reference( ) return dict(vn_nnew=vn_nnew) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn_nnow = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) ddt_vn_apc_ntl1 = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py index 723e7952e6..68877d563f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_add_vertical_wind_derivative_to_divergence_damping.py @@ -68,7 +68,7 @@ def reference( ) return dict(z_graddiv_vn=z_graddiv_vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: hmask_dd3d = data_alloc.random_field(grid, dims.EdgeDim, dtype=ta.wpfloat) scalfac_dd3d = data_alloc.random_field(grid, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py index 08bd2c8d73..253fe9bd2b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_2nd_order_divergence_damping.py @@ -45,7 +45,7 @@ def reference( vn = apply_2nd_order_divergence_damping_numpy(z_graddiv_vn, vn, scal_divdamp_o2) return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_graddiv_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py index 82148b6461..6f0cb4140a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_4th_order_divergence_damping.py @@ -47,7 +47,7 @@ def reference( vn = apply_4th_order_divergence_damping_numpy(scal_divdamp, z_graddiv2_vn, vn) return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: scal_divdamp = random_field(grid, dims.KDim, dtype=wpfloat) z_graddiv2_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py index ba5d783c5d..601a6c10cb 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_divergence_damping_and_update_vn.py @@ -188,6 +188,7 @@ def reference( ] ], ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]__second_order_divdamp_factor[{param['second_order_divdamp_factor']}]", + scope="class", ) def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict: current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py index 7189d02661..7396f64890 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_hydrostatic_correction_to_horizontal_gradient_of_exner_pressure.py @@ -54,7 +54,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ipeidx_dsl = random_mask(grid, dims.EdgeDim, dims.KDim) pg_exdist = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py index 05270e43f2..90f8042e35 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_rayleigh_damping_mechanism.py @@ -49,7 +49,7 @@ def reference( w = apply_rayleigh_damping_mechanism_numpy(connectivities, z_raylfac, w_1, w) return dict(w=w) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_raylfac = random_field(grid, dims.KDim, dtype=wpfloat) w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py index 31de7f151f..937383be01 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_apply_weighted_2nd_and_4th_order_divergence_damping.py @@ -57,7 +57,7 @@ def reference( ) return dict(vn=vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: scal_divdamp = random_field(grid, dims.KDim, dtype=wpfloat) bdy_divdamp = random_field(grid, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py index 8af66a07d7..6eb5c81ea4 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_horizontal_momentum_equation.py @@ -250,6 +250,7 @@ def reference( {"apply_extra_diffusion_on_vn": value} for value in [True, False] ], # True for testing, False for benchmarking ids=lambda param: f"apply_extra_diffusion_on_vn[{param['apply_extra_diffusion_on_vn']}]", + scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py index 29e097491d..6a0e7f5f83 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advection_in_vertical_momentum_equation.py @@ -409,7 +409,7 @@ def reference( vertical_cfl=vertical_cfl_ret, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: contravariant_corrected_w_at_cells_on_model_levels = data_alloc.zero_field( grid, dims.CellDim, dims.KDim @@ -627,6 +627,7 @@ def reference( {"skip_compute_predictor_vertical_advection": value} for value in [True, False] ], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", + scope="class", ) def input_data( self, grid: base.Grid, request: pytest.FixtureRequest diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py index 21fdb8c7ef..b02d3f84e7 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_advective_vertical_wind_tendency.py @@ -56,7 +56,7 @@ def reference( ) return dict(ddt_w_adv=ddt_w_adv) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_w_con_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) w = random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py index 61445dcf1e..6566146ace 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_airmass.py @@ -35,7 +35,7 @@ def reference( airmass_out = rho_in * ddqz_z_full_in * deepatmo_t1mc_in return dict(airmass_out=airmass_out) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rho_in = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) ddqz_z_full_in = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py index d842690914..1e308955fd 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_approx_of_2nd_vertical_derivative_of_exner.py @@ -57,7 +57,7 @@ def reference( ) return dict(z_dexner_dz_c_2=z_dexner_dz_c_2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_theta_v_pr_ic = random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=vpfloat diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py index 20073ddcec..d1ad0a24f7 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_averaged_vn_and_fluxes_and_prepare_tracer_advection.py @@ -163,6 +163,7 @@ def reference( ] ], ids=lambda p: f"prepare_advection[{p['prepare_advection']}]__at_first_substep[{p['at_first_substep']}]", + scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py index 5cf3efa33b..fc9664a2cc 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_avg_vn_and_graddiv_vn_and_vt.py @@ -65,7 +65,7 @@ def reference( ) return dict(z_vn_avg=z_vn_avg, z_graddiv_vn=z_graddiv_vn, vt=vt) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_flx_avg = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) geofac_grdiv = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py index e557ec551d..c18b8bffeb 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction.py @@ -45,7 +45,7 @@ def reference( z_w_concorr_me = compute_contravariant_correction_numpy(vn, ddxn_z_full, ddxt_z_full, vt) return dict(z_w_concorr_me=z_w_concorr_me) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) ddxn_z_full = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py index 6a7d916250..7de0fb6249 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w.py @@ -56,7 +56,7 @@ def reference( ) return dict(w_concorr_c=w_concorr_c) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_bln_c_s = random_field(grid, dims.CellDim, dims.C2EDim, dtype=wpfloat) z_w_concorr_me = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py index 1723d907a5..c899c092d5 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_contravariant_correction_of_w_for_lower_boundary.py @@ -65,7 +65,7 @@ def reference( ) return dict(w_concorr_c=w_concorr_c) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_bln_c_s = random_field(grid, dims.CellDim, dims.C2EDim, dtype=wpfloat) z_w_concorr_me = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py index 2a35b45ff1..28b80dd4df 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py @@ -295,6 +295,7 @@ def reference( {"skip_compute_predictor_vertical_advection": value} for value in [True, False] ], # True for benchmarking, False for testing ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]", + scope="class", ) def input_data( self, grid: base.Grid, request: pytest.FixtureRequest diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py index d009a74d8d..124ab43ba1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_divergence_of_fluxes_of_rho_and_theta.py @@ -57,7 +57,7 @@ def reference( ) return dict(z_flxdiv_mass=z_flxdiv_mass, z_flxdiv_theta=z_flxdiv_theta) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) z_theta_v_fl_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py index a14d93aca1..5d5f07155c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_dwdz_for_divergence_damping.py @@ -50,7 +50,7 @@ def reference( ) return dict(out=z_dwdz_dd) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, Any]: inv_ddqz_z_full = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) w = random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py index 582a4ef0d3..693bd5fef3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_exner_from_rhotheta.py @@ -38,7 +38,7 @@ def reference( exner = np.exp(rd_o_cvd * np.log(rd_o_p0ref * rho * theta_v)) return dict(out=(theta_v, exner)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, Any]: rd_o_cvd = wpfloat("10.0") rd_o_p0ref = wpfloat("20.0") diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py index 347299fd46..9d6624d00f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_part_for_rho_and_exner.py @@ -85,7 +85,7 @@ def reference( ) return dict(z_rho_expl=z_rho_expl, z_exner_expl=z_exner_expl) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = ta.wpfloat("1.0") rho_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py index efd3ba9a10..fd6e7eb72e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_from_advection_and_vertical_wind_density.py @@ -82,7 +82,7 @@ def reference( ) return dict(z_w_expl=z_w_expl, z_contr_w_fl_l=z_contr_w_fl_l) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) ddt_w_adv_ntl1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py index bdaf78fbc3..3cbf36e98d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_explicit_vertical_wind_speed_and_vertical_wind_times_density.py @@ -72,7 +72,7 @@ def reference( ) return dict(z_w_expl=z_w_expl, z_contr_w_fl_l=z_contr_w_fl_l) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w_nnow = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) ddt_w_adv_ntl1 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py index 3f9eca2afc..9df4526221 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_graddiv2_of_vn.py @@ -49,7 +49,7 @@ def reference( z_graddiv2_vn = compute_graddiv2_of_vn_numpy(connectivities, geofac_grdiv, z_graddiv_vn) return dict(z_graddiv2_vn=z_graddiv2_vn) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_graddiv_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) geofac_grdiv = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py index ad61d07c8a..07aab9f9b3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_of_rho_and_theta.py @@ -251,7 +251,7 @@ def reference( ) return dict(out=(z_rho_e, z_theta_v_e)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py index 0c47cf433c..c6d80e8216 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_advection_term_for_vertical_velocity.py @@ -82,7 +82,7 @@ def reference( )[horizontal_start:horizontal_end, :] return dict(z_v_grad_w=z_v_grad_w) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn_ie = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py index 09ade5f64b..530e9e7e67 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_flat_coordinates.py @@ -53,7 +53,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) z_exner_ex_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py index 53555a19e6..373361c042 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_multiple_levels.py @@ -91,7 +91,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=ta.wpfloat) z_exner_ex_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py index 0369fc2b9c..c07e738947 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_gradient_of_exner_pressure_for_nonflat_coordinates.py @@ -68,7 +68,7 @@ def reference( ) return dict(z_gradh_exner=z_gradh_exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: inv_dual_edge_length = random_field(grid, dims.EdgeDim, dtype=wpfloat) z_exner_ex_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py index a81376ec23..a97d8d7a1c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_kinetic_energy.py @@ -43,7 +43,7 @@ def reference( vn_ie, z_vt_ie, z_kin_hor_e = compute_horizontal_kinetic_energy_numpy(vn, vt) return dict(vn_ie=vn_ie, z_vt_ie=z_vt_ie, z_kin_hor_e=z_kin_hor_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) vt = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py index 3990a90e9d..32cde480f0 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_horizontal_velocity_quantities_and_fluxes.py @@ -275,7 +275,7 @@ def reference( contravariant_correction_at_edges_on_model_levels=contravariant_correction_at_edges_on_model_levels, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: spatially_averaged_vn = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim) horizontal_gradient_of_normal_wind_divergence = data_alloc.zero_field( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py index 7eed5b8929..0eb6d71696 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_hydrostatic_correction_term.py @@ -130,7 +130,7 @@ def reference( ) return dict(z_hydro_corr=z_hydro_corr) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ikoffset = data_alloc.zero_field( grid, dims.EdgeDim, dims.E2CDim, dims.KDim, dtype=gtx.int32 diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py index 330d0410a0..63121c1961 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_mass_flux.py @@ -54,7 +54,7 @@ def reference( return dict(mass_fl_e=mass_fl_e, z_theta_v_fl_e=z_theta_v_fl_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_rho_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) z_vn_avg = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py index 2cd2a83c8f..84cbf72c48 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_maximum_cfl_and_clip_contravariant_vertical_velocity.py @@ -70,7 +70,7 @@ def reference( z_w_con_c=z_w_con_c, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ddqz_z_half = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) z_w_con_c = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py index 79d910c5b9..9c3bc1fc47 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta.py @@ -51,7 +51,7 @@ def reference( ) return dict(z_rth_pr_1=z_rth_pr_1, z_rth_pr_2=z_rth_pr_2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rho = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) rho_ref_mc = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py index e224318650..cab2d5ca4c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbation_of_rho_and_theta_and_rho_interface_cell_centers.py @@ -66,7 +66,7 @@ def reference( ) return dict(rho_ic=rho_ic, z_rth_pr_1=z_rth_pr_1, z_rth_pr_2=z_rth_pr_2) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) rho = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py index a173e626f1..14089fbaac 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py @@ -347,7 +347,7 @@ def reference( d2dz2_of_temporal_extrapolation_of_perturbed_exner_on_model_levels=d2dz2_of_temporal_extrapolation_of_perturbed_exner_on_model_levels, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: reference_rho_at_cells_on_model_levels = data_alloc.random_field( grid, dims.CellDim, dims.KDim diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py index 2efbdbddd9..6345bc6d8b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_results_for_thermodynamic_variables.py @@ -102,7 +102,7 @@ def reference( ) return dict(rho_new=rho_new, exner_new=exner_new, theta_v_new=theta_v_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_rho_expl = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) vwind_impl_wgt = data_alloc.random_field(grid, dims.CellDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py index 6f71a1f98a..721e38564e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_rho_virtual_potential_temperatures_and_pressure_gradient.py @@ -128,7 +128,7 @@ def reference( z_th_ddz_exner_c=z_th_ddz_exner_c, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = ta.wpfloat("1.0") wgt_nnow_rth = ta.wpfloat("2.0") diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py index da06853a0a..120347b429 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_solver_coefficients_matrix.py @@ -74,7 +74,7 @@ def reference( ) return dict(z_beta=z_beta, z_alpha=z_alpha) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: exner_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) rho_nnow = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py index fbcc397990..4655ee9780 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_tangential_wind.py @@ -44,7 +44,7 @@ def reference( vt = compute_tangential_wind_numpy(connectivities, vn, rbf_vec_coeff_e) return dict(vt=vt) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) rbf_vec_coeff_e = random_field(grid, dims.EdgeDim, dims.E2C2EDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py index ff5bc26e71..b5d49fccae 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_theta_and_exner.py @@ -43,7 +43,7 @@ def reference( return dict(theta_v=theta_v, exner=exner) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rd_o_cvd = ta.wpfloat("10.0") rd_o_p0ref = ta.wpfloat("20.0") diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py index 4ef0d53930..2d3eb8fd2a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_virtual_potential_temperatures_and_pressure_gradient.py @@ -92,7 +92,7 @@ def reference( z_th_ddz_exner_c=z_th_ddz_exner_c, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) z_rth_pr_2 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py index 50aec37834..55ee685d0c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_compute_vn_on_lateral_boundary.py @@ -36,7 +36,7 @@ def reference( vn_new = vn_now + dtime * grf_tend_vn return dict(vn_new=vn_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: grf_tend_vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) vn_now = random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py index e1408308a9..7f4d22ee23 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_copy_cell_kdim_field_to_vp.py @@ -38,7 +38,7 @@ def reference( field_copy = copy_cell_kdim_field_to_vp_numpy(field) return dict(field_copy=field_copy) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: field = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) field_copy = zero_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py index 74c9b6845d..e35da36b5c 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_at_top.py @@ -51,7 +51,7 @@ def reference( vn_ie = extrapolate_at_top_numpy(wgtfacq_e, vn) return dict(vn_ie=vn_ie) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfacq_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py index a87d532ff4..aa18002e4a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_extrapolate_temporally_exner_pressure.py @@ -57,7 +57,7 @@ def reference( return dict(z_exner_ex_pr=z_exner_ex_pr, exner_pr=exner_pr) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: exner = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) exner_ref_mc = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py index 01438aa31d..9e4270b4d1 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py @@ -42,7 +42,7 @@ def reference( ) return dict(field_with_zero_vp=field_with_zero_vp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: field_with_zero_vp = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py index a0c2e0f902..814b9a7ba8 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_wp.py @@ -49,7 +49,7 @@ def reference( field_with_zero_wp = np.zeros_like(field_with_zero_wp) return dict(field_with_zero_wp=field_with_zero_wp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: field_with_zero_wp = zero_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py index b893924387..1ce19f3a56 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py @@ -40,7 +40,7 @@ def reference( cell_kdim_field_with_zero_vp_2=cell_kdim_field_with_zero_vp_2, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: cell_kdim_field_with_zero_vp_1 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) cell_kdim_field_with_zero_vp_2 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py index 77c5de7055..080bac1441 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_edge_kdim_fields_with_zero_wp.py @@ -40,7 +40,7 @@ def reference( edge_kdim_field_with_zero_wp_2=edge_kdim_field_with_zero_wp_2, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: edge_kdim_field_with_zero_wp_1 = zero_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) edge_kdim_field_with_zero_wp_2 = zero_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py index 4cc48fd101..b23f88234f 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_cell_field_to_half_levels_vp.py @@ -50,7 +50,7 @@ def reference( ) return dict(interpolation_to_half_levels_vp=interpolation_to_half_levels_vp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: interpolant = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) wgtfac_c = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py index 12f5fd8506..dfbcc454d3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_contravariant_vertical_velocity_to_full_levels.py @@ -40,7 +40,7 @@ def reference( z_w_con_c_full = interpolate_contravariant_vertical_velocity_to_full_levels_numpy(z_w_con_c) return dict(z_w_con_c_full=z_w_con_c_full) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_w_con_c = random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=vpfloat diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py index e9ab186490..ac6a273aae 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_rho_theta_v_to_half_levels_and_compute_temperature_vertical_gradient.py @@ -182,7 +182,7 @@ def reference( pressure_buoyancy_acceleration_at_cells_on_half_levels=pressure_buoyancy_acceleration_at_cells_on_half_levels, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w = data_alloc.random_field(grid, dims.CellDim, dims.KDim) contravariant_correction_at_cells_on_half_levels = data_alloc.random_field( diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py index 8f018db9ca..5c0602bd22 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_cell_center.py @@ -51,7 +51,7 @@ def reference( interpolation = interpolate_to_cell_center_numpy(connectivities, interpolant, e_bln_c_s) return dict(interpolation=interpolation) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: interpolant = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) e_bln_c_s = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py index 2dc775909d..875d6f728e 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_to_surface.py @@ -51,7 +51,7 @@ def reference( ) return dict(interpolation_to_surface=interpolation_to_surface) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: interpolant = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) wgtfacq_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py index b998025020..42502132b3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_and_vt_to_ie_and_compute_ekin_on_edges.py @@ -45,7 +45,7 @@ def reference( z_kin_hor_e[:, 0] = 0 return dict(vn_ie=vn_ie, z_vt_ie=z_vt_ie, z_kin_hor_e=z_kin_hor_e) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_e = zero_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py index b2a19e3566..1c179606de 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vn_to_half_levels_and_compute_kinetic_energy_on_edges.py @@ -84,7 +84,7 @@ def reference( z_kin_hor_e=z_kin_hor_e, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) vn = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py index 4fc1660fb6..88a3c4b887 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_interpolate_vt_to_interface_edges.py @@ -50,7 +50,7 @@ def reference( z_vt_ie[subset] = interpolate_vt_to_interface_edges_numpy(wgtfac_e, vt)[subset] return dict(z_vt_ie=z_vt_ie) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfac_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py index 3ca6d13109..a251f10706 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl.py @@ -49,7 +49,7 @@ def reference( p_vert_out=p_vert_out, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: p_cell_in = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) c_intp = random_field(grid, dims.VertexDim, dims.V2CDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py index b819687c83..27cf49018d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_mo_math_divrot_rot_vertex_ri_dsl.py @@ -45,7 +45,7 @@ def reference( rot_vec = mo_math_divrot_rot_vertex_ri_dsl_numpy(connectivities, vec_e, geofac_rot) return dict(rot_vec=rot_vec) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vec_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) geofac_rot = random_field(grid, dims.VertexDim, dims.V2EDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py index af727d761e..61a19e760a 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_lower_boundary_condition_for_w_and_contravariant_correction.py @@ -51,7 +51,7 @@ def reference( ) return dict(w_nnew=w_nnew, z_contr_w_fl_l=z_contr_w_fl_l) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: w_concorr_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) z_contr_w_fl_l = zero_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py index 122f1913ef..bd115a4409 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_set_theta_v_prime_ic_at_lower_boundary.py @@ -63,7 +63,7 @@ def reference( ) return dict(z_theta_v_pr_ic=z_theta_v_pr_ic, theta_v_ic=theta_v_ic) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: wgtfacq_c = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) z_rth_pr = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py index 076e84b767..aca2b603b2 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_back_substitution.py @@ -52,7 +52,7 @@ def reference( w_new = solve_tridiagonal_matrix_for_w_back_substitution_numpy(connectivities, z_q=z_q, w=w) return dict(w=w_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_q = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) w = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py index 7bd38f9619..3a9ad4037b 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_solve_tridiagonal_matrix_for_w_forward_sweep.py @@ -92,7 +92,7 @@ def reference( ) return dict(z_q=z_q_ref, w=w_ref) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base_grid.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: vwind_impl_wgt = data_alloc.random_field(grid, dims.CellDim, dtype=ta.wpfloat) theta_v_ic = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py index d9d8ae062c..f09acf69b3 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_spatially_average_flux_or_velocity.py @@ -53,7 +53,7 @@ def reference( return dict(spatially_averaged_flux_or_velocity=spatially_averaged_flux_or_velocity) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: e_flx_avg = random_field(grid, dims.EdgeDim, dims.E2C2EODim, dtype=wpfloat) flux_or_velocity = random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py index 612a940991..2fc3e61d21 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_density_exner_wind.py @@ -42,7 +42,7 @@ def reference( w_new = w_now + dtime * grf_tend_w return dict(rho_new=rho_new, exner_new=exner_new, w_new=w_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: rho_now = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) grf_tend_rho = random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py index ffcb582b55..456828fed6 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_dynamical_exner_time_increment.py @@ -58,7 +58,7 @@ def reference( ) return dict(exner_dyn_incr=exner_dyn_incr) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: ndyn_substeps_var, dtime = wpfloat("10.0"), wpfloat("12.0") exner = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py index 5a0e5422da..f63b88cfe2 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_flux_weighted.py @@ -60,7 +60,7 @@ def reference( ) return dict(mass_flx_ic=mass_flx_ic) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: r_nsubsteps = wpfloat("10.0") rho_ic = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py index 64cd7fab4f..b0a497719d 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_mass_volume_flux.py @@ -67,7 +67,7 @@ def reference( ) return dict(mass_flx_ic=mass_flx_ic, vol_flx_ic=vol_flx_ic) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: z_contr_w_fl_l = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) rho_ic = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py index 3aaaf1d99f..47777ce620 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_theta_v.py @@ -51,7 +51,7 @@ def reference( ) return dict(theta_v_new=theta_v_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: mask_prog_halo_c = random_mask(grid, dims.CellDim) rho_now = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py index 32f31fe859..087dba1111 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_update_wind.py @@ -35,7 +35,7 @@ def reference( w_new = w_now + dtime * grf_tend_w return dict(w_new=w_new) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: dtime = wpfloat("10.0") w_now = random_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py index 88a9336687..1afb564317 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_corrector_step.py @@ -414,6 +414,7 @@ def reference( f"lprep_adv[{p['lprep_adv']}]__" f"is_iau_active[{p['is_iau_active']}]" ), + scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py index 97ad07ae63..76b39d5cb7 100644 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py +++ b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_vertically_implicit_dycore_solver_at_predictor_step.py @@ -406,6 +406,7 @@ def reference( ] ], ids=lambda param: f"at_first_substep[{param['at_first_substep']}]__is_iau_active[{param['is_iau_active']}]__divdamp_type[{param['divdamp_type']}]", + scope="class", ) def input_data( self, request: pytest.FixtureRequest, grid: base.Grid diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py index 1dddcb000c..ac21d6e87f 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_T_from_internal_energy.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(temperature=np.full(u.shape, 255.75599999999997)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( u=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py index c362dd7ece..92e4f31efd 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(riming_graupel_rate=np.full(t.shape, 2.7054723496793982e-10)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 256.983, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py index 9000f55ab3..0a443a32d5 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_graupel_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(riming_graupel_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py index 4a6b064888..604c7e5e84 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0045484481075162512)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 267.25, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py index 820355c8c2..aec955d9a1 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_rain_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py index 90a9f18d34..499a1a2ead 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(riming_snow_rate=np.full(t.shape, 9.5431874564438999e-10)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 256.571, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py index 701a03e949..434535c60a 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_to_snow_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(riming_snow_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py index ae897cab44..92365821d5 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(freezing_rate=np.full(t.shape, -1.5008166666666666e-08)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py index 2a09f91f90..dfa1d12cf7 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_cloud_x_ice_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(freezing_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 256.835, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py index 377c940ed3..cc57f67b89 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion.py @@ -26,7 +26,7 @@ class TestDepositionAutoConversion(StencilTest): def reference(grid, qi: np.ndarray, m_ice: np.ndarray, ice_dep: np.ndarray, **kwargs) -> dict: return dict(conversion_rate=np.full(qi.shape, 6.6430804299795412e-08)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py index 971bc9c76b..213dfae725 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_auto_conversion_default.py @@ -25,7 +25,7 @@ class TestDepositionAutoConversionDefault(StencilTest): def reference(grid, qi: np.ndarray, m_ice: np.ndarray, ice_dep: np.ndarray, **kwargs) -> dict: return dict(conversion_rate=np.full(qi.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 2.02422e-23, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py index d89b8452a9..477099fde9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_deposition_factor.py @@ -23,7 +23,7 @@ class TestDepositionFactor(StencilTest): def reference(grid, t: np.ndarray, qvsi: np.ndarray, **kwargs) -> dict: return dict(deposition_rate=np.full(t.shape, 1.3234329478493952e-05)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py index 65522326e2..3fbcd9fd1b 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_dqsatdT_rho.py @@ -23,7 +23,7 @@ class TestQsatRho(StencilTest): def reference(grid, qs: np.ndarray, t: np.ndarray, **kwargs) -> dict: return dict(derivative=np.full(t.shape, 0.00030825070286492049)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qs=data_alloc.constant_field(grid, 0.00448941, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py index 162ad4c301..e76ba68ce9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_fall_speed.py @@ -26,7 +26,7 @@ def reference( ) -> dict: return dict(speed=np.full(density.shape, 0.67882452435647411)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( density=data_alloc.zero_field(grid, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py index 6f52329dc9..163cc8c4f0 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(rain_rate=np.full(t.shape, 5.9748142538569357e-13)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 280.156, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py index bd8b18b74e..967ae71bc7 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_graupel_to_rain_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(rain_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 280.156, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py index 374b5c738e..7bf89f923a 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, 1.6836299999999999e-13)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 160.9, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py index b18697e349..0c5c8bab80 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_deposition_nucleation_default.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py index bb9bdf1a45..e41fd42a79 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_mass.py @@ -23,7 +23,7 @@ class TestIceNumber(StencilTest): def reference(grid, qi: np.ndarray, ni: np.ndarray, **kwargs) -> dict: return dict(mass=np.full(qi.shape, 1.0e-12)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 2.02422e-23, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py index 05b5fa336c..6e5d64554f 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_number.py @@ -23,7 +23,7 @@ class TestIceNumber(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, **kwargs) -> dict: return dict(number=np.full(t.shape, 5.0507995893464388)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py index 52532333b9..fdf3c129f9 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_sticking.py @@ -23,7 +23,7 @@ class TestIceSticking(StencilTest): def reference(grid, t: np.ndarray, **kwargs) -> dict: return dict(sticking_factor=np.full(t.shape, 0.8697930232044021)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 271.6, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py index 4f2bff9e32..51442a70bb 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(aggregation=np.full(rho.shape, 7.1049436957697864e-19)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.04848, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py index 4f2bff9e32..51442a70bb 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_graupel_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(aggregation=np.full(rho.shape, 7.1049436957697864e-19)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.04848, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py index 7072fc1c8c..149db77c98 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(qi.shape, 3.3262745200740486e-11)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 6.43223e-08, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py index bf6ad46db8..5640ad38f1 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_ice_to_snow_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(qi.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 7.95122e-25, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py index 3da5d59413..bf72e66b00 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_internal_energy.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(energy=np.full(t.shape, 38265357.270336017)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 255.756, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py index e29dc9911a..22fc1080b5 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_ice_rho.py @@ -23,7 +23,7 @@ class TestQsatIceRho(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 0.0074981245870634101)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py index 8e29622ff0..9125f0a9c0 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho.py @@ -23,7 +23,7 @@ class TestQsatRho(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 0.0069027592942577506)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py index 6e13021be7..3c07dd56a3 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_qsat_rho_tmelt.py @@ -23,7 +23,7 @@ class TestQsatRho(StencilTest): def reference(grid, rho: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(rho.shape, 0.0038828182695875113)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.24783, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py index bc1c75ce0d..dd54512f8d 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_1.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 5.1570340525841922e-17)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py index 1a26ea9b2e..072ae7a88c 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_2.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 1.0044914238516472e-12)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 230.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py index 0d6a3dc0a5..9cc0e37897 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_3.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 5.1423851647153399e-17)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py index 00ece8df68..b07e864fce 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_graupel_default.py @@ -35,7 +35,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 272.731, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py index c5528bc37a..fe66e7d746 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 2.8556697055499901e-19)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py index fb681877af..7aa1a3af79 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_rain_to_vapor_default.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 258.542, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py index d56e9a0a01..382e3863ba 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_ice.py @@ -23,7 +23,7 @@ class TestSatPresIce(StencilTest): def reference(grid, t: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 1216.7746246067475)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py index 6bde29be18..c38dfbc385 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_sat_pres_water.py @@ -23,7 +23,7 @@ class TestSatPresWater(StencilTest): def reference(grid, t: np.ndarray, **kwargs) -> dict: return dict(pressure=np.full(t.shape, 1120.1604149806028)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py index d83df25624..f79134b775 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment.py @@ -38,7 +38,7 @@ def reference( mask_out=np.full(te.shape, False), ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( te=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py index b8b685e11b..44b92a6895 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_saturation_adjustment2.py @@ -43,7 +43,7 @@ def reference( qce_out=np.full(te.shape, 9.5724552280369163e-007), ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( te=data_alloc.constant_field( diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py index 3c30334f90..3a1e32a4de 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_lambda.py @@ -24,7 +24,7 @@ class TestSnowLambda(StencilTest): def reference(grid, rho: np.ndarray, qs: np.ndarray, ns: np.ndarray, **kwargs) -> dict: return dict(riming_snow_rate=np.full(rho.shape, 1.0e10)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( rho=data_alloc.constant_field(grid, 1.12204, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py index 0887fae8c9..a23b2824df 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number.py @@ -23,7 +23,7 @@ class TestSnowNumber(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, qs: np.ndarray, **kwargs) -> dict: return dict(number=np.full(t.shape, 3813750.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 276.302, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py index 86c5a7aacd..82c8236ce3 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_number_default.py @@ -23,7 +23,7 @@ class TestSnowNumberDefault(StencilTest): def reference(grid, t: np.ndarray, rho: np.ndarray, qs: np.ndarray, **kwargs) -> dict: return dict(number=np.full(t.shape, 8.00e5)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 276.302, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py index e69fc05ae6..4a0fda7d1c 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 6.2696154545048011e-10)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 265.85, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py index 1614d1aa14..1c16f82ba5 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_graupel_default.py @@ -25,7 +25,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 281.157, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py index 4b25992492..4641f61415 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 3.7268547760462804e-07)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 275.83, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py index b3a6b6ff6c..b8c9be3a7b 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_snow_to_rain_default.py @@ -31,7 +31,7 @@ def reference( ) -> dict: return dict(conversion_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 265.83, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py index 318c53c90e..fd3935b94a 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(exchange_rate=np.full(t.shape, -6.8498666666666675e-13)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.026, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py index 8420bd7063..c58e8456e3 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_graupel_default.py @@ -34,7 +34,7 @@ def reference( ) -> dict: return dict(exchange_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.026, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py index e76dc730df..78b5f03800 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(qi.shape, 2.2106162342610385e-09)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 9.53048e-07, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py index e45648728a..7a0a4bb672 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_ice_default.py @@ -32,7 +32,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(qi.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( qi=data_alloc.constant_field(grid, 2.02422e-23, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py index bb074808aa..5aad429eea 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow.py @@ -38,7 +38,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, -8.6584296264775935e-13)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.748, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py index 26b02e3dee..4804b68423 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vapor_x_snow_default.py @@ -38,7 +38,7 @@ def reference( ) -> dict: return dict(vapor_deposition_rate=np.full(t.shape, 0.0)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( t=data_alloc.constant_field(grid, 278.748, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py index 8b9f9795e8..cd84439f51 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_ice.py @@ -25,7 +25,7 @@ class TestVelScaleFactorIce(StencilTest): def reference(grid, xrho: np.ndarray, **kwargs) -> dict: return dict(scale_factor=np.full(xrho.shape, 1.1158596098981044)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( xrho=data_alloc.constant_field(grid, 1.17873, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py index 18e7048ab7..4848eaaeed 100644 --- a/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py +++ b/model/atmosphere/subgrid_scale_physics/muphys/tests/muphys/stencil_tests/test_vel_scale_factor_snow.py @@ -27,7 +27,7 @@ def reference( ) -> dict: return dict(scale_factor=np.full(xrho.shape, 0.06633230453931642)) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid): return dict( xrho=data_alloc.constant_field(grid, 1.17787, dims.CellDim, dims.KDim, dtype=wpfloat), diff --git a/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py b/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py index eb8ad994c6..c37509a11d 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_cell_2_edge_interpolation.py @@ -40,7 +40,7 @@ def reference( out_field=out_field, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: in_field = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=ta.wpfloat) coeff = data_alloc.random_field(grid, dims.EdgeDim, dims.E2CDim, dtype=ta.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py b/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py index b68124bbda..e5e71acb1d 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_compute_cell_2_vertex_interpolation.py @@ -41,7 +41,7 @@ def reference( vert_out=out_field, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: cell_in = data_alloc.random_field(grid, dims.CellDim, dims.KDim, dtype=types.wpfloat) c_int = data_alloc.random_field(grid, dims.VertexDim, dims.V2CDim, dtype=types.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py index 2f0471e4fe..8f21503c83 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_pressure.py @@ -52,7 +52,7 @@ def reference( pressure_ifc=pressure_ifc, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: ddqz_z_full = data_alloc.random_field( grid, dims.CellDim, dims.KDim, low=1.0, dtype=ta.wpfloat diff --git a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py index 55e0967f6a..175f289bff 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_surface_pressure.py @@ -47,7 +47,7 @@ def reference( surface_pressure=surface_pressure, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: low = 1.0e-2 exner = data_alloc.random_field(grid, dims.CellDim, dims.KDim, low=1.0e-6, dtype=ta.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py index 1e03d6b648..cdb20d25d3 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_diagnose_temperature.py @@ -45,7 +45,7 @@ def reference( temperature=temperature, ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: theta_v = data_alloc.random_field( grid, dims.CellDim, dims.KDim, low=1.0e-4, high=1.0, dtype=ta.wpfloat diff --git a/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py b/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py index a4dea61823..dfd7a87175 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_edge_2_cell_vector_rbf_interpolation.py @@ -41,7 +41,7 @@ def reference( return dict(p_v_out=p_v_out, p_u_out=p_u_out) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_e_in = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=ta.wpfloat) ptr_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.C2E2C2EDim, dtype=ta.wpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py b/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py index 027b0ab492..37ddca6117 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_interpolate_edge_field_to_half_levels_vp.py @@ -46,7 +46,7 @@ def reference( ) return dict(interpolation_to_half_levels_vp=interpolation_to_half_levels_vp) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base_grid.Grid) -> dict: interpolant = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) wgtfac_e = random_field(grid, dims.EdgeDim, dims.KDim, dtype=vpfloat) diff --git a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py index 2137f5e587..7d5f2867e2 100644 --- a/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py +++ b/model/common/tests/common/interpolation/stencil_tests/test_mo_intp_rbf_rbf_vec_interpol_vertex.py @@ -56,7 +56,7 @@ def reference( return dict(p_v_out=p_v_out, p_u_out=p_u_out) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: p_e_in = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, dtype=wpfloat) ptr_coeff_1 = data_alloc.random_field(grid, dims.VertexDim, dims.V2EDim, dtype=wpfloat) diff --git a/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py b/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py index bf5d44ebd2..22835eb2a0 100644 --- a/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py +++ b/model/common/tests/common/math/stencil_tests/test_cell_horizontal_gradients_by_green_gauss_method.py @@ -66,7 +66,7 @@ def reference( out=(p_grad_1_u, p_grad_1_v), ) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: scalar_field = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) geofac_grg_x = random_field(grid, dims.CellDim, dims.C2E2CODim, dtype=wpfloat) diff --git a/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py b/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py index 5cd46b15ff..8859a03c84 100644 --- a/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py +++ b/model/common/tests/common/math/stencil_tests/test_compute_first_vertical_derivative.py @@ -43,7 +43,7 @@ def reference( ) return dict(first_vertical_derivative=first_vertical_derivative) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: cell_kdim_field = random_field( grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}, dtype=vpfloat diff --git a/model/common/tests/common/math/unit_tests/test_helpers.py b/model/common/tests/common/math/unit_tests/test_helpers.py index e1de50194d..1b1c85c67b 100644 --- a/model/common/tests/common/math/unit_tests/test_helpers.py +++ b/model/common/tests/common/math/unit_tests/test_helpers.py @@ -66,7 +66,7 @@ def reference( average = 0.5 * (input_field + offset) return dict(average=average) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: input_field = data_alloc.zero_field(grid, dims.EdgeDim, dims.KDim, extend={dims.KDim: 1}) result = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim, extend={dims.KDim: 1}) @@ -100,7 +100,7 @@ def reference( res = 0.5 * (input_field + np.roll(input_field, shift=-1, axis=1))[:, : shp[1] - 1] return dict(average=res) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: input_field = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1}) result = data_alloc.zero_field(grid, dims.CellDim, dims.KDim) diff --git a/model/common/tests/common/math/unit_tests/test_operators.py b/model/common/tests/common/math/unit_tests/test_operators.py index b487d1a50b..ed12104b56 100644 --- a/model/common/tests/common/math/unit_tests/test_operators.py +++ b/model/common/tests/common/math/unit_tests/test_operators.py @@ -37,7 +37,7 @@ def reference( nabla2_psi_c_np = reference_funcs.nabla2_on_cell_numpy(connectivities, psi_c, geofac_n2s) return dict(nabla2_psi_c=nabla2_psi_c_np) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base_grid.Grid) -> dict: psi_c = constant_field(grid, 1.0, dims.CellDim) geofac_n2s = constant_field(grid, 2.0, dims.CellDim, dims.C2E2CODim) @@ -66,7 +66,7 @@ def reference( nabla2_psi_c_np = reference_funcs.nabla2_on_cell_k_numpy(connectivities, psi_c, geofac_n2s) return dict(nabla2_psi_c=nabla2_psi_c_np) - @pytest.fixture + @pytest.fixture(scope="class") def input_data(self, grid: base.Grid) -> dict: psi_c = constant_field(grid, 1.0, dims.CellDim, dims.KDim) geofac_n2s = constant_field(grid, 2.0, dims.CellDim, dims.C2E2CODim) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index d389e7252e..518e633c6e 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -9,7 +9,7 @@ from __future__ import annotations import dataclasses -from collections.abc import Callable, Mapping, Sequence +from collections.abc import Callable, Generator, Mapping, Sequence from typing import Any, ClassVar import gt4py.next as gtx @@ -36,7 +36,7 @@ def allocate_data( input_data: dict[str, gtx.Field | tuple[gtx.Field, ...]], ) -> dict[str, gtx.Field | tuple[gtx.Field, ...]]: _allocate_field = constructors.as_field.partial(allocator=allocator) # type:ignore[attr-defined] # TODO(havogt): check why it doesn't understand the fluid_partial - input_data = { + gtx_input_data = { k: tuple(_allocate_field(domain=field.domain, data=field.ndarray) for field in v) if isinstance(v, tuple) else _allocate_field(domain=v.domain, data=v.ndarray) @@ -44,7 +44,7 @@ def allocate_data( else v for k, v in input_data.items() } - return input_data + return gtx_input_data @dataclasses.dataclass(frozen=True) @@ -147,7 +147,9 @@ class StencilTest: ... OUTPUTS = ("some_output",) ... STATIC_PARAMS = {"category_a": ["flag0"], "category_b": ["flag0", "flag1"]} ... - ... @pytest.fixture + ... @pytest.fixture( + ... scope="class" + ... ) # make sure that input data are not allocated multiple times ... def input_data(self): ... return {"some_input": ..., "some_output": ...} ... @@ -162,7 +164,7 @@ class StencilTest: reference: ClassVar[Callable[..., Mapping[str, np.ndarray | tuple[np.ndarray, ...]]]] - @pytest.fixture + @pytest.fixture(scope="class") def _configured_program( self, backend_like: model_backends.BackendLike, @@ -194,17 +196,18 @@ def _configured_program( test_func = device_utils.synchronized_function(program, allocator=backend) return test_func - @pytest.fixture + @pytest.fixture(scope="class") def _properly_allocated_input_data( self, input_data: dict[str, gtx.Field | tuple[gtx.Field, ...]], backend_like: model_backends.BackendLike, - ) -> dict[str, gtx.Field | tuple[gtx.Field, ...]]: + ) -> Generator[dict[str, gtx.Field | tuple[gtx.Field, ...]], None, None]: # TODO(havogt): this is a workaround, # because in the `input_data` fixture provided by the user # it does not allocate for the correct device. allocator = model_backends.get_allocator(backend_like) - return allocate_data(allocator=allocator, input_data=input_data) + yield allocate_data(allocator=allocator, input_data=input_data) + input_data.clear() def _verify_stencil_test( self, From bf8ed3bd9f9d66db0f4730924f64c134e90c218f Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 20 Nov 2025 15:08:13 +0100 Subject: [PATCH 110/111] Improve handling of input_data in stencil tests --- .../icon4py/model/testing/stencil_tests.py | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/model/testing/src/icon4py/model/testing/stencil_tests.py b/model/testing/src/icon4py/model/testing/stencil_tests.py index 518e633c6e..77d4d4a1e9 100644 --- a/model/testing/src/icon4py/model/testing/stencil_tests.py +++ b/model/testing/src/icon4py/model/testing/stencil_tests.py @@ -9,6 +9,7 @@ from __future__ import annotations import dataclasses +import gc from collections.abc import Callable, Generator, Mapping, Sequence from typing import Any, ClassVar @@ -33,17 +34,22 @@ def allocate_data( allocator: gtx_typing.FieldBufferAllocationUtil | None, - input_data: dict[str, gtx.Field | tuple[gtx.Field, ...]], -) -> dict[str, gtx.Field | tuple[gtx.Field, ...]]: + input_data: dict[str, gtx.Field | tuple[gtx.Field, ...] | None], +) -> dict[str, gtx.Field | tuple[gtx.Field, ...] | None]: _allocate_field = constructors.as_field.partial(allocator=allocator) # type:ignore[attr-defined] # TODO(havogt): check why it doesn't understand the fluid_partial - gtx_input_data = { - k: tuple(_allocate_field(domain=field.domain, data=field.ndarray) for field in v) - if isinstance(v, tuple) - else _allocate_field(domain=v.domain, data=v.ndarray) - if not gtx.is_scalar_type(v) and k != "domain" - else v - for k, v in input_data.items() - } + gtx_input_data: dict[str, gtx.Field | tuple[gtx.Field, ...] | None] = {} + for k, v in input_data.items(): + if not gtx.is_scalar_type(v) and k != "domain" and v is not None: + if isinstance(v, tuple): + gtx_input_data[k] = tuple( + _allocate_field(domain=field.domain, data=field.ndarray) for field in v + ) + else: + gtx_input_data[k] = _allocate_field(domain=v.domain, data=v.ndarray) + input_data[k] = None # free original allocation in input_data + else: + gtx_input_data[k] = v + gc.collect() return gtx_input_data @@ -164,7 +170,7 @@ class StencilTest: reference: ClassVar[Callable[..., Mapping[str, np.ndarray | tuple[np.ndarray, ...]]]] - @pytest.fixture(scope="class") + @pytest.fixture def _configured_program( self, backend_like: model_backends.BackendLike, @@ -199,15 +205,17 @@ def _configured_program( @pytest.fixture(scope="class") def _properly_allocated_input_data( self, - input_data: dict[str, gtx.Field | tuple[gtx.Field, ...]], + input_data: dict[str, gtx.Field | tuple[gtx.Field, ...] | None], backend_like: model_backends.BackendLike, - ) -> Generator[dict[str, gtx.Field | tuple[gtx.Field, ...]], None, None]: + ) -> Generator[dict[str, gtx.Field | tuple[gtx.Field, ...] | None]]: # TODO(havogt): this is a workaround, # because in the `input_data` fixture provided by the user # it does not allocate for the correct device. allocator = model_backends.get_allocator(backend_like) - yield allocate_data(allocator=allocator, input_data=input_data) - input_data.clear() + gtx_allocated_data = allocate_data(allocator=allocator, input_data=input_data) + yield gtx_allocated_data + del gtx_allocated_data + gc.collect() def _verify_stencil_test( self, @@ -260,7 +268,7 @@ def __init_subclass__(cls, **kwargs: Any) -> None: # parametrization is only available in the concrete subclass definition if cls.STATIC_PARAMS is None: # not parametrized, return an empty tuple - cls.static_variant = staticmethod(pytest.fixture(lambda: ())) # type: ignore[method-assign, assignment] # we override with a non-parametrized function + cls.static_variant = staticmethod(pytest.fixture(lambda: (), scope="class")) # type: ignore[method-assign, assignment] # we override with a non-parametrized function else: cls.static_variant = staticmethod( # type: ignore[method-assign] pytest.fixture(params=cls.STATIC_PARAMS.items(), scope="class", ids=lambda p: p[0])( From 19fdbe96be55f6a0d8dcee90c8b144d371c1a636 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Mon, 12 Jan 2026 10:27:52 +0100 Subject: [PATCH 111/111] Remove deleted files from main --- .../test_init_cell_kdim_field_with_zero_vp.py | 55 ------------------- ..._init_two_cell_kdim_fields_with_zero_vp.py | 55 ------------------- 2 files changed, 110 deletions(-) delete mode 100644 model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py delete mode 100644 model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py deleted file mode 100644 index 9e4270b4d1..0000000000 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_cell_kdim_field_with_zero_vp.py +++ /dev/null @@ -1,55 +0,0 @@ -# ICON4Py - ICON inspired code in Python and GT4Py -# -# Copyright (c) 2022-2024, ETH Zurich and MeteoSwiss -# All rights reserved. -# -# Please, refer to the LICENSE file in the root directory. -# SPDX-License-Identifier: BSD-3-Clause -from typing import Any - -import gt4py.next as gtx -import numpy as np -import pytest - -from icon4py.model.atmosphere.dycore.stencils.init_cell_kdim_field_with_zero_vp import ( - init_cell_kdim_field_with_zero_vp, -) -from icon4py.model.common import dimension as dims -from icon4py.model.common.grid import base -from icon4py.model.common.states import utils as state_utils -from icon4py.model.common.type_alias import vpfloat -from icon4py.model.common.utils.data_allocation import random_field -from icon4py.model.testing.stencil_tests import StencilTest - - -def init_cell_kdim_field_with_zero_vp_numpy(field_with_zero_vp: np.ndarray) -> np.ndarray: - field_with_zero_vp = np.zeros_like(field_with_zero_vp) - return field_with_zero_vp - - -class TestInitCellKdimFieldWithZeroVp(StencilTest): - PROGRAM = init_cell_kdim_field_with_zero_vp - OUTPUTS = ("field_with_zero_vp",) - - @staticmethod - def reference( - connectivities: dict[gtx.Dimension, np.ndarray], - field_with_zero_vp: np.ndarray, - **kwargs: Any, - ) -> dict: - field_with_zero_vp = init_cell_kdim_field_with_zero_vp_numpy( - field_with_zero_vp=field_with_zero_vp - ) - return dict(field_with_zero_vp=field_with_zero_vp) - - @pytest.fixture(scope="class") - def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: - field_with_zero_vp = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) - - return dict( - field_with_zero_vp=field_with_zero_vp, - horizontal_start=0, - horizontal_end=gtx.int32(grid.num_cells), - vertical_start=0, - vertical_end=gtx.int32(grid.num_levels), - ) diff --git a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py b/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py deleted file mode 100644 index 1ce19f3a56..0000000000 --- a/model/atmosphere/dycore/tests/dycore/stencil_tests/test_init_two_cell_kdim_fields_with_zero_vp.py +++ /dev/null @@ -1,55 +0,0 @@ -# ICON4Py - ICON inspired code in Python and GT4Py -# -# Copyright (c) 2022-2024, ETH Zurich and MeteoSwiss -# All rights reserved. -# -# Please, refer to the LICENSE file in the root directory. -# SPDX-License-Identifier: BSD-3-Clause -from typing import Any - -import gt4py.next as gtx -import numpy as np -import pytest - -from icon4py.model.atmosphere.dycore.stencils.init_two_cell_kdim_fields_with_zero_vp import ( - init_two_cell_kdim_fields_with_zero_vp, -) -from icon4py.model.common import dimension as dims -from icon4py.model.common.grid import base -from icon4py.model.common.states import utils as state_utils -from icon4py.model.common.type_alias import vpfloat -from icon4py.model.common.utils.data_allocation import random_field -from icon4py.model.testing.stencil_tests import StencilTest - - -class TestInitTwoCellKdimFieldsWithZeroVp(StencilTest): - PROGRAM = init_two_cell_kdim_fields_with_zero_vp - OUTPUTS = ("cell_kdim_field_with_zero_vp_1", "cell_kdim_field_with_zero_vp_2") - - @staticmethod - def reference( - connectivities: dict[gtx.Dimension, np.ndarray], - cell_kdim_field_with_zero_vp_1: np.ndarray, - cell_kdim_field_with_zero_vp_2: np.ndarray, - **kwargs: Any, - ) -> dict: - cell_kdim_field_with_zero_vp_1 = np.zeros_like(cell_kdim_field_with_zero_vp_1) - cell_kdim_field_with_zero_vp_2 = np.zeros_like(cell_kdim_field_with_zero_vp_2) - return dict( - cell_kdim_field_with_zero_vp_1=cell_kdim_field_with_zero_vp_1, - cell_kdim_field_with_zero_vp_2=cell_kdim_field_with_zero_vp_2, - ) - - @pytest.fixture(scope="class") - def input_data(self, grid: base.Grid) -> dict[str, gtx.Field | state_utils.ScalarType]: - cell_kdim_field_with_zero_vp_1 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) - cell_kdim_field_with_zero_vp_2 = random_field(grid, dims.CellDim, dims.KDim, dtype=vpfloat) - - return dict( - cell_kdim_field_with_zero_vp_1=cell_kdim_field_with_zero_vp_1, - cell_kdim_field_with_zero_vp_2=cell_kdim_field_with_zero_vp_2, - horizontal_start=0, - horizontal_end=gtx.int32(grid.num_cells), - vertical_start=0, - vertical_end=gtx.int32(grid.num_levels), - )