From a06d3035b899548b60547950c6ae1bb310bee144 Mon Sep 17 00:00:00 2001 From: Nicoletta Farabullini <41536517+nfarabullini@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:26:22 +0100 Subject: [PATCH] Update test_compute_antidiffusive_cell_fluxes_and_min_max.py --- ...e_antidiffusive_cell_fluxes_and_min_max.py | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) 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 2d8c57a758..cbb500b6f3 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 @@ -14,7 +14,7 @@ compute_antidiffusive_cell_fluxes_and_min_max, ) from icon4py.model.common import dimension as dims -from icon4py.model.common.settings import xp +import numpy as np class TestComputeAntidiffusiveCellFluxesAndMinMax(helpers.StencilTest): @@ -30,44 +30,44 @@ class TestComputeAntidiffusiveCellFluxesAndMinMax(helpers.StencilTest): @staticmethod def reference( grid, - geofac_div: xp.ndarray, - p_rhodz_now: xp.ndarray, - p_rhodz_new: xp.ndarray, - z_mflx_low: xp.ndarray, - z_anti: xp.ndarray, - p_cc: xp.ndarray, + geofac_div: np.ndarray, + p_rhodz_now: np.ndarray, + p_rhodz_new: np.ndarray, + z_mflx_low: np.ndarray, + z_anti: np.ndarray, + p_cc: np.ndarray, p_dtime: float, **kwargs, ) -> dict: - c2e = xp.asarray(grid.connectivities[dims.C2EDim]) + c2e = grid.connectivities[dims.C2EDim] z_anti_c2e = z_anti[c2e] geofac_div = helpers.reshape(geofac_div, c2e.shape) - geofac_div = xp.expand_dims(xp.asarray(geofac_div), axis=-1) + geofac_div = np.expand_dims(geofac_div, axis=-1) - zero_array = xp.zeros(p_rhodz_now.shape) + zero_array = np.zeros(p_rhodz_now.shape) z_mflx_anti_1 = p_dtime * geofac_div[:, 0] / p_rhodz_new * z_anti_c2e[:, 0] z_mflx_anti_2 = p_dtime * geofac_div[:, 1] / p_rhodz_new * z_anti_c2e[:, 1] z_mflx_anti_3 = p_dtime * geofac_div[:, 2] / p_rhodz_new * z_anti_c2e[:, 2] z_mflx_anti_in = -1.0 * ( - xp.minimum(zero_array, z_mflx_anti_1) - + xp.minimum(zero_array, z_mflx_anti_2) - + xp.minimum(zero_array, z_mflx_anti_3) + np.minimum(zero_array, z_mflx_anti_1) + + np.minimum(zero_array, z_mflx_anti_2) + + np.minimum(zero_array, z_mflx_anti_3) ) z_mflx_anti_out = ( - xp.maximum(zero_array, z_mflx_anti_1) - + xp.maximum(zero_array, z_mflx_anti_2) - + xp.maximum(zero_array, z_mflx_anti_3) + np.maximum(zero_array, z_mflx_anti_1) + + np.maximum(zero_array, z_mflx_anti_2) + + np.maximum(zero_array, z_mflx_anti_3) ) - z_fluxdiv_c = xp.sum(z_mflx_low[c2e] * geofac_div, axis=1) + z_fluxdiv_c = np.sum(z_mflx_low[c2e] * geofac_div, axis=1) z_tracer_new_low = (p_cc * p_rhodz_now - p_dtime * z_fluxdiv_c) / p_rhodz_new - z_tracer_max = xp.maximum(p_cc, z_tracer_new_low) - z_tracer_min = xp.minimum(p_cc, z_tracer_new_low) + z_tracer_max = np.maximum(p_cc, z_tracer_new_low) + z_tracer_min = np.minimum(p_cc, z_tracer_new_low) return dict( z_mflx_anti_in=z_mflx_anti_in,