From a85e3cef7bf81654153503448f2f9198a95b281d Mon Sep 17 00:00:00 2001 From: Chia Rui Ong Date: Fri, 17 Nov 2023 14:23:02 +0100 Subject: [PATCH] Resolving issues brought up in review --- dummy_dycore_driver_2021-06-20T12:00:00.log | 67 +++++++ .../dycore/nh_solve/solve_nonhydro.py | 3 +- .../tests/dycore_tests/test_solve_nonhydro.py | 12 +- .../dycore_tests/test_velocity_advection.py | 12 +- model/driver/pyproject.toml | 1 - .../src/icon4py/model/driver/dycore_driver.py | 105 ++++------- .../model/driver/icon_configuration.py | 27 +-- .../src/icon4py/model/driver/io_utils.py | 6 +- model/driver/tests/conftest.py | 139 +++----------- model/driver/tests/test_io_utils.py | 173 ------------------ model/driver/tests/test_timeloop.py | 35 ++-- 11 files changed, 178 insertions(+), 402 deletions(-) create mode 100644 dummy_dycore_driver_2021-06-20T12:00:00.log delete mode 100644 model/driver/tests/test_io_utils.py diff --git a/dummy_dycore_driver_2021-06-20T12:00:00.log b/dummy_dycore_driver_2021-06-20T12:00:00.log new file mode 100644 index 0000000000..78232b6580 --- /dev/null +++ b/dummy_dycore_driver_2021-06-20T12:00:00.log @@ -0,0 +1,67 @@ +2023-11-09 15:37:52,502 dycore_driver.py (433 ) : main : INFO Starting ICON dycore run: 2021-06-20T12:00:00 +2023-11-09 15:37:52,502 dycore_driver.py (434 ) : main : INFO input args: input_path=testdata/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data, n_time_steps=1, ending date=2021-06-20 12:00:10 +2023-11-09 15:37:52,502 dycore_driver.py (438 ) : main : INFO input args: input_path=testdata/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data, n_time_steps=1 +2023-11-09 15:37:52,502 dycore_driver.py (440 ) : main : INFO dycore configuring: DONE +2023-11-09 15:37:52,503 dycore_driver.py (441 ) : main : INFO timeloop: START +2023-11-09 15:37:52,503 dycore_driver.py (155 ) : time_integration : INFO starting time loop for dtime=10.0 n_timesteps=1 +2023-11-09 15:37:52,503 dycore_driver.py (158 ) : time_integration : INFO apply_to_horizontal_wind=True linit=True apply_horizontal_diffusion_at_large_dt=True dtime=10.0 substep_timestep=5.0 +2023-11-09 15:37:52,503 dycore_driver.py (162 ) : time_integration : INFO running initial step to diffuse fields before timeloop starts +2023-11-09 15:37:55,008 diffusion.py (603 ) : _do_diffusion_step : DEBUG rbf interpolation 1: start +2023-11-09 15:37:59,215 diffusion.py (616 ) : _do_diffusion_step : DEBUG rbf interpolation 1: end +2023-11-09 15:37:59,218 diffusion.py (619 ) : _do_diffusion_step : DEBUG communication rbf extrapolation of vn - start +2023-11-09 15:37:59,218 diffusion.py (621 ) : _do_diffusion_step : DEBUG communication rbf extrapolation of vn - end +2023-11-09 15:37:59,218 diffusion.py (623 ) : _do_diffusion_step : DEBUG running stencil 01(calculate_nabla2_and_smag_coefficients_for_vn): start +2023-11-09 15:38:09,923 diffusion.py (650 ) : _do_diffusion_step : DEBUG running stencil 01 (calculate_nabla2_and_smag_coefficients_for_vn): end +2023-11-09 15:38:09,923 diffusion.py (651 ) : _do_diffusion_step : DEBUG running stencils 02 03 (calculate_diagnostic_quantities_for_turbulence): start +2023-11-09 15:38:14,813 diffusion.py (671 ) : _do_diffusion_step : DEBUG running stencils 02 03 (calculate_diagnostic_quantities_for_turbulence): end +2023-11-09 15:38:14,814 diffusion.py (680 ) : _do_diffusion_step : DEBUG 2nd rbf interpolation: start +2023-11-09 15:38:16,419 diffusion.py (693 ) : _do_diffusion_step : DEBUG 2nd rbf interpolation: end +2023-11-09 15:38:16,420 diffusion.py (696 ) : _do_diffusion_step : DEBUG communication rbf extrapolation of z_nable2_e - start +2023-11-09 15:38:16,420 diffusion.py (698 ) : _do_diffusion_step : DEBUG communication rbf extrapolation of z_nable2_e - end +2023-11-09 15:38:16,420 diffusion.py (700 ) : _do_diffusion_step : DEBUG running stencils 04 05 06 (apply_diffusion_to_vn): start +2023-11-09 15:38:27,303 diffusion.py (728 ) : _do_diffusion_step : DEBUG running stencils 04 05 06 (apply_diffusion_to_vn): end +2023-11-09 15:38:27,303 diffusion.py (729 ) : _do_diffusion_step : DEBUG communication of prognistic.vn : start +2023-11-09 15:38:27,303 diffusion.py (732 ) : _do_diffusion_step : DEBUG running stencils 07 08 09 10 (apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulance): start +2023-11-09 15:38:45,458 diffusion.py (763 ) : _do_diffusion_step : DEBUG running stencils 07 08 09 10 (apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulance): end +2023-11-09 15:38:45,458 diffusion.py (767 ) : _do_diffusion_step : DEBUG running fused stencils 11 12 (calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools): start +2023-11-09 15:38:48,481 diffusion.py (784 ) : _do_diffusion_step : DEBUG running stencils 11 12 (calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools): end +2023-11-09 15:38:48,481 diffusion.py (787 ) : _do_diffusion_step : DEBUG running stencils 13 14 (calculate_nabla2_for_theta): start +2023-11-09 15:38:51,332 diffusion.py (804 ) : _do_diffusion_step : DEBUG running stencils 13_14 (calculate_nabla2_for_theta): end +2023-11-09 15:38:51,332 diffusion.py (805 ) : _do_diffusion_step : DEBUG running stencil 15 (truly_horizontal_diffusion_nabla_of_theta_over_steep_points): start +2023-11-09 15:38:55,772 diffusion.py (828 ) : _do_diffusion_step : DEBUG running fused stencil 15 (truly_horizontal_diffusion_nabla_of_theta_over_steep_points): end +2023-11-09 15:38:55,772 diffusion.py (831 ) : _do_diffusion_step : DEBUG running stencil 16 (update_theta_and_exner): start +2023-11-09 15:38:58,441 diffusion.py (844 ) : _do_diffusion_step : DEBUG running stencil 16 (update_theta_and_exner): end +2023-11-09 15:38:58,442 diffusion.py (846 ) : _do_diffusion_step : DEBUG communication of prognogistic.vn - end +2023-11-09 15:38:58,442 diffusion.py (536 ) : _sync_cell_fields : DEBUG communication of prognostic cell fields: theta, w, exner - start +2023-11-09 15:38:58,442 diffusion.py (543 ) : _sync_cell_fields : DEBUG communication of prognostic cell fields: theta, w, exner - done +2023-11-09 15:38:58,442 dycore_driver.py (168 ) : time_integration : INFO starting real time loop for dtime=10.0 n_timesteps=1 +2023-11-09 15:38:58,442 dycore_driver.py (173 ) : time_integration : INFO simulation date : 2021-06-20 12:00:00 run timestep : 0 linit : True +2023-11-09 15:38:58,442 dycore_driver.py (250 ) : _do_dyn_substepping : INFO simulation date : 2021-06-20 12:00:10 sub timestep : 0, linit : True, nnow: 0, nnew : 1 +2023-11-09 15:44:47,480 dycore_driver.py (250 ) : _do_dyn_substepping : INFO simulation date : 2021-06-20 12:00:10 sub timestep : 1, linit : False, nnow: 1, nnew : 0 +2023-11-09 15:46:32,712 diffusion.py (603 ) : _do_diffusion_step : DEBUG rbf interpolation 1: start +2023-11-09 15:46:34,282 diffusion.py (616 ) : _do_diffusion_step : DEBUG rbf interpolation 1: end +2023-11-09 15:46:34,283 diffusion.py (619 ) : _do_diffusion_step : DEBUG communication rbf extrapolation of vn - start +2023-11-09 15:46:34,283 diffusion.py (621 ) : _do_diffusion_step : DEBUG communication rbf extrapolation of vn - end +2023-11-09 15:46:34,283 diffusion.py (623 ) : _do_diffusion_step : DEBUG running stencil 01(calculate_nabla2_and_smag_coefficients_for_vn): start +2023-11-09 15:46:40,201 diffusion.py (650 ) : _do_diffusion_step : DEBUG running stencil 01 (calculate_nabla2_and_smag_coefficients_for_vn): end +2023-11-09 15:46:40,204 diffusion.py (651 ) : _do_diffusion_step : DEBUG running stencils 02 03 (calculate_diagnostic_quantities_for_turbulence): start +2023-11-09 15:46:42,425 diffusion.py (671 ) : _do_diffusion_step : DEBUG running stencils 02 03 (calculate_diagnostic_quantities_for_turbulence): end +2023-11-09 15:46:42,425 diffusion.py (680 ) : _do_diffusion_step : DEBUG 2nd rbf interpolation: start +2023-11-09 15:46:44,032 diffusion.py (693 ) : _do_diffusion_step : DEBUG 2nd rbf interpolation: end +2023-11-09 15:46:44,033 diffusion.py (696 ) : _do_diffusion_step : DEBUG communication rbf extrapolation of z_nable2_e - start +2023-11-09 15:46:44,033 diffusion.py (698 ) : _do_diffusion_step : DEBUG communication rbf extrapolation of z_nable2_e - end +2023-11-09 15:46:44,033 diffusion.py (700 ) : _do_diffusion_step : DEBUG running stencils 04 05 06 (apply_diffusion_to_vn): start +2023-11-09 15:46:47,572 diffusion.py (728 ) : _do_diffusion_step : DEBUG running stencils 04 05 06 (apply_diffusion_to_vn): end +2023-11-09 15:46:47,573 diffusion.py (729 ) : _do_diffusion_step : DEBUG communication of prognistic.vn : start +2023-11-09 15:46:47,573 diffusion.py (732 ) : _do_diffusion_step : DEBUG running stencils 07 08 09 10 (apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulance): start +2023-11-09 15:46:57,401 diffusion.py (763 ) : _do_diffusion_step : DEBUG running stencils 07 08 09 10 (apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulance): end +2023-11-09 15:46:57,401 diffusion.py (767 ) : _do_diffusion_step : DEBUG running fused stencils 11 12 (calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools): start +2023-11-09 15:46:58,513 diffusion.py (784 ) : _do_diffusion_step : DEBUG running stencils 11 12 (calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools): end +2023-11-09 15:46:58,513 diffusion.py (787 ) : _do_diffusion_step : DEBUG running stencils 13 14 (calculate_nabla2_for_theta): start +2023-11-09 15:46:59,431 diffusion.py (804 ) : _do_diffusion_step : DEBUG running stencils 13_14 (calculate_nabla2_for_theta): end +2023-11-09 15:46:59,432 diffusion.py (805 ) : _do_diffusion_step : DEBUG running stencil 15 (truly_horizontal_diffusion_nabla_of_theta_over_steep_points): start +2023-11-09 15:47:02,140 diffusion.py (828 ) : _do_diffusion_step : DEBUG running fused stencil 15 (truly_horizontal_diffusion_nabla_of_theta_over_steep_points): end +2023-11-09 15:47:02,140 diffusion.py (831 ) : _do_diffusion_step : DEBUG running stencil 16 (update_theta_and_exner): start +2023-11-09 15:47:03,077 diffusion.py (844 ) : _do_diffusion_step : DEBUG running stencil 16 (update_theta_and_exner): end +2023-11-09 15:47:03,079 diffusion.py (846 ) : _do_diffusion_step : DEBUG communication of prognogistic.vn - end +2023-11-09 15:47:03,082 dycore_driver.py (454 ) : main : INFO timeloop: DONE diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/nh_solve/solve_nonhydro.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/nh_solve/solve_nonhydro.py index e185fba58e..af3b088271 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/nh_solve/solve_nonhydro.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/nh_solve/solve_nonhydro.py @@ -420,7 +420,7 @@ def time_step( diagnostic_state_nh: DiagnosticStateNonHydro, prognostic_state_ls: list[PrognosticState], prep_adv: PrepAdvection, - z_fields: ZFields, + z_fields: ZFields, # TODO (Magdalena): move local fields to SolveNonHydro nh_constants: NHConstants, bdy_divdamp: Field[[KDim], float], dtime: float, @@ -1697,6 +1697,7 @@ def run_corrector_step( offset_provider={}, ) + # TODO (magdalena): delete NonHydrostaticConfig. l_open_ubc if not (self.config.l_open_ubc and self.l_vert_nested): mo_solve_nonhydro_stencil_46.with_backend(run_gtfn)( w_nnew=prognostic_state[nnew].w, diff --git a/model/atmosphere/dycore/tests/dycore_tests/test_solve_nonhydro.py b/model/atmosphere/dycore/tests/dycore_tests/test_solve_nonhydro.py index 81a2d64909..ef68661718 100644 --- a/model/atmosphere/dycore/tests/dycore_tests/test_solve_nonhydro.py +++ b/model/atmosphere/dycore/tests/dycore_tests/test_solve_nonhydro.py @@ -228,6 +228,7 @@ def test_nonhydro_predictor_step( assert dallclose( np.asarray(sp_exit.z_exner_ex_pr())[cell_start_lb_plus2:, :], np.asarray(solve_nonhydro.z_exner_ex_pr)[cell_start_lb_plus2:, :], + atol=2.0e-18, ) # stencils 4,5 @@ -255,6 +256,7 @@ def test_nonhydro_predictor_step( assert dallclose( np.asarray(sp_exit.z_th_ddz_exner_c())[cell_start_lb_plus2:, 1:], np.asarray(solve_nonhydro.z_th_ddz_exner_c)[cell_start_lb_plus2:, 1:], + atol=1.0e-18, ) # stencils 7,8,9, 11 @@ -341,13 +343,13 @@ def test_nonhydro_predictor_step( # stencil 30 assert dallclose( - np.asarray(sp_exit.z_vn_avg())[2538:31558, :], - np.asarray(solve_nonhydro.z_vn_avg)[2538:31558, :], + np.asarray(sp_exit.z_vn_avg())[edge_start_lb_plus4:, :], + np.asarray(solve_nonhydro.z_vn_avg)[edge_start_lb_plus4:, :], atol=5e-14, ) # stencil 30 assert dallclose( - np.asarray(sp_exit.z_graddiv_vn()[edge_start_lb_plus4:, :]), + np.asarray(sp_exit.z_graddiv_vn())[edge_start_lb_plus4:, :], np.asarray(z_fields.z_graddiv_vn)[edge_start_lb_plus4:, :], atol=5e-20, ) @@ -399,8 +401,8 @@ def test_nonhydro_predictor_step( # stencil 41 assert dallclose( - np.asarray(sp_exit.z_flxdiv_mass())[3316:20896, :], - np.asarray(solve_nonhydro.z_flxdiv_mass)[3316:20896, :], + np.asarray(sp_exit.z_flxdiv_mass())[cell_start_nudging:, :], + np.asarray(solve_nonhydro.z_flxdiv_mass)[cell_start_nudging:, :], atol=5e-15, ) diff --git a/model/atmosphere/dycore/tests/dycore_tests/test_velocity_advection.py b/model/atmosphere/dycore/tests/dycore_tests/test_velocity_advection.py index d8fc6a2acd..dc47e3df09 100644 --- a/model/atmosphere/dycore/tests/dycore_tests/test_velocity_advection.py +++ b/model/atmosphere/dycore/tests/dycore_tests/test_velocity_advection.py @@ -214,12 +214,12 @@ def test_velocity_predictor_step( np.asarray(icon_result_vn_ie), np.asarray(diagnostic_state.vn_ie), atol=1.0e-14 ) # stencil 07 - # TODO: this is not called when vn_only is true, no comparison should be done - assert dallclose( - np.asarray(icon_result_z_v_grad_w)[3777:31558, :], - np.asarray(velocity_advection.z_v_grad_w)[3777:31558, :], - atol=1.0e-16, - ) + if not vn_only: + assert dallclose( + np.asarray(icon_result_z_v_grad_w)[3777:31558, :], + np.asarray(velocity_advection.z_v_grad_w)[3777:31558, :], + atol=1.0e-16, + ) # stencil 08 assert dallclose( np.asarray(savepoint_velocity_exit.z_ekinh())[3316:20896, :], diff --git a/model/driver/pyproject.toml b/model/driver/pyproject.toml index 54b2410297..869566c499 100644 --- a/model/driver/pyproject.toml +++ b/model/driver/pyproject.toml @@ -23,7 +23,6 @@ classifiers = [ ] dependencies = [ "gt4py>=1.0.1", - "pytz>=2023.2", "icon4py-common>=0.0.5", "icon4py-atmosphere-dycore>=0.0.5", "icon4py-atmosphere-diffusion>=0.0.5" diff --git a/model/driver/src/icon4py/model/driver/dycore_driver.py b/model/driver/src/icon4py/model/driver/dycore_driver.py index 64ef3d1d45..69cdaef1e2 100644 --- a/model/driver/src/icon4py/model/driver/dycore_driver.py +++ b/model/driver/src/icon4py/model/driver/dycore_driver.py @@ -17,11 +17,10 @@ import click from devtools import Timer -from gt4py.next import Field, program +from gt4py.next import Field from icon4py.model.atmosphere.diffusion.diffusion import Diffusion, DiffusionParams from icon4py.model.atmosphere.diffusion.diffusion_states import DiffusionDiagnosticState -from icon4py.model.atmosphere.diffusion.diffusion_utils import _identity_c_k, _identity_e_k from icon4py.model.atmosphere.dycore.nh_solve.solve_nonhydro import ( NonHydrostaticConfig, NonHydrostaticParams, @@ -37,8 +36,7 @@ get_processor_properties, get_runtype, ) -from icon4py.model.common.dimension import CellDim, EdgeDim, KDim -from icon4py.model.common.grid.simple import SimpleGrid +from icon4py.model.common.dimension import KDim from icon4py.model.common.states.prognostic_state import PrognosticState from icon4py.model.common.test_utils.helpers import random_field, zero_field from icon4py.model.driver.icon_configuration import IconRunConfig, read_config @@ -55,36 +53,6 @@ log = logging.getLogger(__name__) -# TODO (magdalena) to be removed once there is a proper time stepping -@program -def _copy_diagnostic_and_prognostics( - hdef_ic_new: Field[[CellDim, KDim], float], - hdef_ic: Field[[CellDim, KDim], float], - div_ic_new: Field[[CellDim, KDim], float], - div_ic: Field[[CellDim, KDim], float], - dwdx_new: Field[[CellDim, KDim], float], - dwdx: Field[[CellDim, KDim], float], - dwdy_new: Field[[CellDim, KDim], float], - dwdy: Field[[CellDim, KDim], float], - vn_new: Field[[EdgeDim, KDim], float], - vn: Field[[EdgeDim, KDim], float], - w_new: Field[[CellDim, KDim], float], - w: Field[[CellDim, KDim], float], - exner_new: Field[[CellDim, KDim], float], - exner: Field[[CellDim, KDim], float], - theta_v_new: Field[[CellDim, KDim], float], - theta_v: Field[[CellDim, KDim], float], -): - _identity_c_k(hdef_ic_new, out=hdef_ic) - _identity_c_k(div_ic_new, out=div_ic) - _identity_c_k(dwdx_new, out=dwdx) - _identity_c_k(dwdy_new, out=dwdy) - _identity_e_k(vn_new, out=vn) - _identity_c_k(w_new, out=w) - _identity_c_k(exner_new, out=exner) - _identity_c_k(theta_v_new, out=theta_v) - - class TimeLoop: @classmethod def name(cls): @@ -95,7 +63,6 @@ def __init__( run_config: IconRunConfig, diffusion: Diffusion, solve_nonhydro: SolveNonhydro, - apply_initial_stabilization: bool = True, ): self.run_config: IconRunConfig = run_config self.diffusion = diffusion @@ -105,7 +72,7 @@ def __init__( (self.run_config.end_date - self.run_config.start_date) / timedelta(seconds=self.run_config.dtime) ) - self._substep_timestep: float = float(self.run_config.dtime / self.run_config.ndyn_substeps) + self._substep_timestep: float = float(self.run_config.dtime / self.run_config.n_substeps) # check validity of configurations self._validate() @@ -113,16 +80,19 @@ def __init__( # current simulation date self._simulation_date: datetime = self.run_config.start_date - self._l_init: bool = apply_initial_stabilization + self._l_init: bool = self.run_config.apply_initial_stabilization + + self._n_substeps_var: int = self.run_config.n_substeps - self._now: int = 0 # TODO: move to PrognosticState - self._next: int = 1 # TODO: move to PrognosticState + self._now: int = 0 # TODO (Chia Rui): move to PrognosticState + self._next: int = 1 # TODO (Chia Rui): move to PrognosticState def re_init(self): self._simulation_date = self.run_config.start_date - self._l_init = True - self._now: int = 0 # TODO: move to PrognosticState - self._next: int = 1 # TODO: move to PrognosticState + self._l_init = self.run_config.apply_initial_stabilization + self._n_substeps_var = self.run_config.n_substeps + self._now: int = 0 # TODO (Chia Rui): move to PrognosticState + self._next: int = 1 # TODO (Chia Rui): move to PrognosticState def _validate(self): if self._n_time_steps < 0: @@ -142,6 +112,10 @@ def _next_simulation_date(self): def linit(self): return self._l_init + @property + def n_substeps_var(self): + return self._n_substeps_var + @property def simulation_date(self): return self._simulation_date @@ -174,7 +148,7 @@ def time_integration( self, diffusion_diagnostic_state: DiffusionDiagnosticState, solve_nonhydro_diagnostic_state: DiagnosticStateNonHydro, - # TODO: expand the PrognosticState to include indices of now and next, now it is always assumed that now = 0, next = 1 at the beginning + # TODO (Chia Rui): expand the PrognosticState to include indices of now and next, now it is always assumed that now = 0, next = 1 at the beginning prognostic_state_list: list[PrognosticState], # below is a long list of arguments for dycore time_step that many can be moved to initialization of SolveNonhydro) prep_adv: PrepAdvection, @@ -188,7 +162,7 @@ def time_integration( f"starting time loop for dtime={self.run_config.dtime} n_timesteps={self._n_time_steps}" ) log.info( - f"apply_to_horizontal_wind={self.diffusion.config.apply_to_horizontal_wind} linit={self._l_init} apply_horizontal_diff_at_large_dt={self.run_config.apply_horizontal_diff_at_large_dt} dtime={self.run_config.dtime} substep_timestep={self._substep_timestep}" + f"apply_to_horizontal_wind={self.diffusion.config.apply_to_horizontal_wind} linit={self._l_init} dtime={self.run_config.dtime} substep_timestep={self._substep_timestep}" ) if self.diffusion.config.apply_to_horizontal_wind and self._l_init: log.info("running initial step to diffuse fields before timeloop starts") @@ -223,7 +197,9 @@ def time_integration( ) timer.capture() - # TODO IO + # TODO (Chia Rui): modify n_substeps_var if cfl condition is not met. (set_dyn_substeps subroutine) + + # TODO (Chia Rui): simple IO enough for JW test timer.summary(True) @@ -250,17 +226,14 @@ def _integrate_one_time_step( lprep_adv, ) - if ( - self.diffusion.config.apply_to_horizontal_wind - and self.run_config.apply_horizontal_diff_at_large_dt - ): + if self.diffusion.config.apply_to_horizontal_wind: self.diffusion.run( diffusion_diagnostic_state, prognostic_state_list[self._next], self.run_config.dtime ) self._swap() - # TODO tracer advection + # TODO (Chia Rui): add tracer advection here def _do_dyn_substepping( self, @@ -274,11 +247,11 @@ def _do_dyn_substepping( lprep_adv: bool, ): - # TODO compute airmass for prognostic_state + # TODO (Chia Rui): compute airmass for prognostic_state here l_recompute = True lclean_mflx = True - for idyn_timestep in range(self.run_config.ndyn_substeps): + for idyn_timestep in range(self._n_substeps_var): log.info( f"simulation date : {self._simulation_date} sub timestep : {idyn_timestep}, linit : {self._l_init}, nnow: {self._now}, nnew : {self._next}" ) @@ -289,7 +262,7 @@ def _do_dyn_substepping( z_fields=z_fields, nh_constants=nh_constants, bdy_divdamp=bdy_divdamp, - dtime=self._substep_timestep, + dtime=self._n_substeps_var, idyn_timestep=idyn_timestep, l_recompute=l_recompute, l_init=self._l_init, @@ -298,25 +271,16 @@ def _do_dyn_substepping( lclean_mflx=lclean_mflx, lprep_adv=lprep_adv, ) - if ( - self.diffusion.config.apply_to_horizontal_wind - and not self.run_config.apply_horizontal_diff_at_large_dt - ): - self.diffusion.run( - diffusion_diagnostic_state, - prognostic_state_list[self._next], - self._substep_timestep, - ) l_recompute = False lclean_mflx = False - if idyn_timestep != self.run_config.ndyn_substeps - 1: + if idyn_timestep != self._n_substeps_var - 1: self._swap() self._not_first_step() - # TODO compute airmass for prognostic_state + # TODO (Chia Rui): compute airmass for prognostic_state here def initialize(file_path: Path, props: ProcessProperties): @@ -332,9 +296,10 @@ def initialize(file_path: Path, props: ProcessProperties): Returns: tl: configured timeloop, - prognostic_state: initial state fro prognostic and diagnostic variables - diagnostic_state: - other temporary fields: + diffusion_diagnostic_state: initial state for diffusion diagnostic variables + nonhydro_diagnostic_state: initial state for solve_nonhydro diagnostic variables + prognostic_state: initial state for prognostic variables + other temporary fields: to be removed in the future """ log.info("initialize parallel runtime") experiment_name = "mch_ch_r04b09_dsl" @@ -386,9 +351,8 @@ def initialize(file_path: Path, props: ProcessProperties): nonhydro_config = NonHydrostaticConfig() nonhydro_params = NonHydrostaticParams(nonhydro_config) - grid = SimpleGrid() - enh_smag_fac = zero_field(grid, KDim) - a_vec = random_field(grid, KDim, low=1.0, high=10.0, extend={KDim: 1}) + enh_smag_fac = zero_field(icon_grid, KDim) + a_vec = random_field(icon_grid, KDim, low=1.0, high=10.0, extend={KDim: 1}) fac = (0.67, 0.5, 1.3, 0.8) z = (0.1, 0.2, 0.3, 0.4) @@ -413,7 +377,6 @@ def initialize(file_path: Path, props: ProcessProperties): run_config=config.run_config, diffusion=diffusion, solve_nonhydro=solve_nonhydro, - apply_initial_stabilization=True, ) return ( timeloop, diff --git a/model/driver/src/icon4py/model/driver/icon_configuration.py b/model/driver/src/icon4py/model/driver/icon_configuration.py index d9b965218a..417ebd29b9 100644 --- a/model/driver/src/icon4py/model/driver/icon_configuration.py +++ b/model/driver/src/icon4py/model/driver/icon_configuration.py @@ -10,7 +10,7 @@ # distribution for a copy of the license or check . # # SPDX-License-Identifier: GPL-3.0-or-later - +import logging from dataclasses import dataclass from datetime import datetime from typing import Optional @@ -19,21 +19,24 @@ from icon4py.model.atmosphere.dycore.nh_solve.solve_nonhydro import NonHydrostaticConfig +log = logging.getLogger(__name__) + n_substeps_reduced = 2 -@dataclass +@dataclass(frozen=True) class IconRunConfig: - dtime: float = 60.0 + dtime: float = 600.0 # length of a time step [s] start_date: datetime = datetime(1, 1, 1, 0, 0, 0) end_date: datetime = datetime(1, 1, 1, 1, 0, 0) - ndyn_substeps: int = ( - 5 # ndyn_substeps is not a constant in ICON, it may be modified in restart runs - ) - apply_horizontal_diff_at_large_dt: bool = True # lhdiff_rcf - apply_extra_diffusion_for_largeCFL: bool = True # lextra_diffu + """ndyn_substeps in ICON""" + # TODO (Chia Rui): check ICON code if we need to define extra ndyn_substeps in timeloop that changes in runtime + n_substeps: int = 5 + + """linit_dyn in ICON""" + apply_initial_stabilization: bool = True # False if in restart mode @dataclass @@ -76,9 +79,8 @@ def _mch_ch_r04b09_config(): dtime=10.0, start_date=datetime(2021, 6, 20, 12, 0, 0), end_date=datetime(2021, 6, 20, 12, 0, 10), - ndyn_substeps=2, - apply_horizontal_diff_at_large_dt=True, - apply_extra_diffusion_for_largeCFL=True, + n_substeps=2, + apply_initial_stabilization=True, ), mch_ch_r04b09_diffusion_config(), NonHydrostaticConfig(), @@ -87,7 +89,8 @@ def _mch_ch_r04b09_config(): if experiment == "mch_ch_r04b09_dsl": (model_run_config, diffusion_config, nonhydro_config) = _mch_ch_r04b09_config() else: - raise NotImplementedError("Please specify experiment name for icon run config") + log.info("Warning: Experiment name is not specified, default configuration is used.") + (model_run_config, diffusion_config, nonhydro_config) = _default_config() return IconConfig( run_config=model_run_config, diffusion_config=diffusion_config, diff --git a/model/driver/src/icon4py/model/driver/io_utils.py b/model/driver/src/icon4py/model/driver/io_utils.py index 6f71bd98a6..960a887049 100644 --- a/model/driver/src/icon4py/model/driver/io_utils.py +++ b/model/driver/src/icon4py/model/driver/io_utils.py @@ -73,7 +73,7 @@ def read_icon_grid( raise NotImplementedError(SB_ONLY_MSG) -# TODO initialization of prognostic variables and topography of Jablonowski Williamson test +# TODO (Chia Rui): initialization of prognostic variables and topography of Jablonowski Williamson test def model_initialization(): # create two prognostic states, nnow and nnew? @@ -112,7 +112,8 @@ def read_initial_state( Read prognostic and diagnostic state from serialized data. Args: - path: path the serialized input data + path: path to the serialized input data + rank: mpi rank of the current compute node Returns: a tuple containing the data_provider, the initial diagnostic and prognostic state. The data_provider is returned such that further timesteps of diagnostics and prognostics @@ -161,7 +162,6 @@ def read_initial_state( exner_incr=None, # solve_nonhydro_init_savepoint.exner_incr(), ) - # TODO: move local fields to SolveNonHydro z_fields = ZFields( z_gradh_exner=_allocate(EdgeDim, KDim, grid=icon_grid), z_alpha=_allocate(CellDim, KDim, is_halfdim=True, grid=icon_grid), diff --git a/model/driver/tests/conftest.py b/model/driver/tests/conftest.py index 63088d8697..9117354b7a 100644 --- a/model/driver/tests/conftest.py +++ b/model/driver/tests/conftest.py @@ -24,17 +24,28 @@ grid_savepoint, icon_grid, interpolation_savepoint, + istep_exit, + istep_init, + jstep_exit, + jstep_init, metrics_savepoint, ndyn_substeps, processor_props, ranked_data_path, + savepoint_nonhydro_exit, + savepoint_nonhydro_init, + savepoint_nonhydro_step_exit, + savepoint_velocity_init, + step_date_exit, + step_date_init, + vn_only, ) from icon4py.model.driver.icon_configuration import IconRunConfig @pytest.fixture def r04b09_diffusion_config( - ndyn_substeps, # noqa: F811 # imported `ndyn_substeps` fxiture + ndyn_substeps, # noqa: F811 # imported `ndyn_substeps` fixture ) -> DiffusionConfig: """ Create DiffusionConfig matching MCH_CH_r04b09_dsl. @@ -60,9 +71,9 @@ def r04b09_diffusion_config( @pytest.fixture def r04b09_iconrun_config( - ndyn_substeps, # noqa: F811 # imported `ndyn_substeps` fxiture + ndyn_substeps, # noqa: F811 # imported `ndyn_substeps` fixture timeloop_date_init, - timeloop_date, + timeloop_date_exit, ) -> IconRunConfig: """ Create IconRunConfig matching MCH_CH_r04b09_dsl. @@ -81,23 +92,22 @@ def r04b09_iconrun_config( int(timeloop_date_init[17:19]), ), end_date=datetime( - int(timeloop_date[0:4]), - int(timeloop_date[5:7]), - int(timeloop_date[8:10]), - int(timeloop_date[11:13]), - int(timeloop_date[14:16]), - int(timeloop_date[17:19]), + int(timeloop_date_exit[0:4]), + int(timeloop_date_exit[5:7]), + int(timeloop_date_exit[8:10]), + int(timeloop_date_exit[11:13]), + int(timeloop_date_exit[14:16]), + int(timeloop_date_exit[17:19]), ), - ndyn_substeps=ndyn_substeps, - apply_horizontal_diff_at_large_dt=True, - apply_extra_diffusion_for_largeCFL=True, + n_substeps=ndyn_substeps, + apply_initial_stabilization=True, ) @pytest.fixture def timeloop_diffusion_savepoint_init( data_provider, # noqa: F811 # imported fixtures data_provider - timeloop_date, # imported fixtures data_provider + step_date_init, # noqa: F811 # imported fixtures data_provider timeloop_diffusion_linit_init, ): """ @@ -109,14 +119,14 @@ def timeloop_diffusion_savepoint_init( linit flag is set to true """ return data_provider.from_savepoint_diffusion_init( - linit=timeloop_diffusion_linit_init, date=timeloop_date + linit=timeloop_diffusion_linit_init, date=step_date_init ) @pytest.fixture def timeloop_diffusion_savepoint_exit( data_provider, # noqa: F811 # imported fixtures data_provider` - timeloop_date, # imported fixtures step_date_exit` + step_date_exit, # noqa: F811 # imported fixtures step_date_exit` timeloop_diffusion_linit_exit, ): """ @@ -126,111 +136,16 @@ def timeloop_diffusion_savepoint_exit( fixture, passing 'step_data=' """ sp = data_provider.from_savepoint_diffusion_exit( - linit=timeloop_diffusion_linit_exit, date=timeloop_date + linit=timeloop_diffusion_linit_exit, date=step_date_exit ) return sp -@pytest.fixture -def timeloop_velocity_savepoint_init( - data_provider, # noqa: F811 - timeloop_date, - timeloop_istep_init, - vn_only_init, - timeloop_jstep_init, -): - """ - Load data from ICON savepoint at start of velocity_advection module. - - date of the timestamp to be selected can be set seperately by overriding the 'step_data' - fixture, passing 'step_data=' - """ - return data_provider.from_savepoint_velocity_init( - istep=timeloop_istep_init, - vn_only=vn_only_init, - date=timeloop_date, - jstep=timeloop_jstep_init, - ) - - -@pytest.fixture -def timeloop_nonhydro_savepoint_init( - data_provider, # noqa: F811 - timeloop_date, - timeloop_istep_init, - timeloop_jstep_init, -): - """ - Load data from ICON savepoint at exist of solve_nonhydro module. - - date of the timestamp to be selected can be set seperately by overriding the 'step_data' - fixture, passing 'step_data=' - """ - return data_provider.from_savepoint_nonhydro_init( - istep=timeloop_istep_init, date=timeloop_date, jstep=timeloop_jstep_init - ) - - -@pytest.fixture -def timeloop_nonhydro_savepoint_exit( - data_provider, # noqa: F811 - timeloop_date, - timeloop_istep_exit, - timeloop_jstep_exit, -): # F811 - """ - Load data from ICON savepoint at exist of solve_nonhydro module. - - date of the timestamp to be selected can be set seperately by overriding the 'step_data' - fixture, passing 'step_data=' - """ - return data_provider.from_savepoint_nonhydro_exit( - istep=timeloop_istep_exit, date=timeloop_date, jstep=timeloop_jstep_exit - ) - - -@pytest.fixture -def timeloop_nonhydro_step_savepoint_exit( - data_provider, # noqa: F811 - timeloop_date, - timeloop_jstep_exit, -): # F811 - """ - Load data from ICON savepoint at final exit (after predictor and corrector, and 3 final stencils) of solve_nonhydro module. - - date of the timestamp to be selected can be set seperately by overriding the 'step_data' - fixture, passing 'step_data=' - """ - return data_provider.from_savepoint_nonhydro_step_exit( - date=timeloop_date, jstep=timeloop_jstep_exit - ) - - -@pytest.fixture -def timeloop_istep_init(): - return 1 - - -@pytest.fixture -def timeloop_jstep_init(): - return 0 - - -@pytest.fixture -def timeloop_istep_exit(): - return 2 - - -@pytest.fixture -def timeloop_jstep_exit(): - return 1 - - @pytest.fixture def timeloop_date_init(): return "2021-06-20T12:00:00.000" @pytest.fixture -def timeloop_date(): +def timeloop_date_exit(): return "2021-06-20T12:00:10.000" diff --git a/model/driver/tests/test_io_utils.py b/model/driver/tests/test_io_utils.py deleted file mode 100644 index a7f6582d3a..0000000000 --- a/model/driver/tests/test_io_utils.py +++ /dev/null @@ -1,173 +0,0 @@ -# ICON4Py - ICON inspired code in Python and GT4Py -# -# Copyright (c) 2022, ETH Zurich and MeteoSwiss -# All rights reserved. -# -# This file is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or any later -# version. See the LICENSE.txt file at the top-level directory of this -# distribution for a copy of the license or check . -# -# SPDX-License-Identifier: GPL-3.0-or-later - - -import pytest - -from icon4py.model.common.grid.horizontal import CellParams, EdgeParams -from icon4py.model.common.grid.vertical import VerticalModelParams -from icon4py.model.driver.io_utils import ( - SerializationType, - read_geometry_fields, - read_icon_grid, - read_static_fields, -) - - -@pytest.mark.datatest -@pytest.mark.parametrize("read_fun", (read_geometry_fields, read_static_fields, read_icon_grid)) -def test_read_geometry_fields_not_implemented_type(read_fun, datapath): - with pytest.raises(NotImplementedError, match=r"Only ser_type='sb'"): - read_fun(path=datapath, ser_type=SerializationType.NC) - - -def assert_grid_size_and_connectivities(grid): - assert grid.num_edges == 31558 - assert grid.num_cells == 20896 - assert grid.num_vertices == 10663 - assert grid.get_offset_provider("E2V") - assert grid.get_offset_provider("V2E") - assert grid.get_offset_provider("C2E") - assert grid.get_offset_provider("E2C") - assert grid.get_offset_provider("E2C2V") - assert grid.get_offset_provider("C2E2C") - assert grid.get_offset_provider("E2ECV") - - -@pytest.mark.datatest -def test_read_icon_grid_for_type_sb(datapath): - grid = read_icon_grid(datapath, ser_type=SerializationType.SB) - assert_grid_size_and_connectivities(grid) - - -@pytest.mark.datatest -def test_read_static_fields_for_type_sb(datapath): - ( - diffusion_metric_state, - diffusion_interpolation_state, - solve_nonhydro_metric_state, - solve_nonhydro_interpolation_state, - ) = read_static_fields(datapath, ser_type=SerializationType.SB) - assert_diffusion_metric_state_fields(diffusion_metric_state) - assert_diffusion_interpolation_state_fields(diffusion_interpolation_state) - assert_nonhydro_metric_state_fields(solve_nonhydro_metric_state) - assert_nonhydro_interpolation_state_fields(solve_nonhydro_interpolation_state) - - -@pytest.mark.datatest -def test_read_geometry_fields_for_type_sb(datapath): - edge_geometry, cell_geometry, vertical_geometry, c_owner_mask = read_geometry_fields( - datapath, ser_type=SerializationType.SB - ) - assert_edge_geometry_fields(edge_geometry) - assert_cell_geometry_fields(cell_geometry) - assert_vertical_params(vertical_geometry) - - -def assert_vertical_params(vertical_geometry: VerticalModelParams): - assert vertical_geometry.physical_heights - assert vertical_geometry.index_of_damping_layer > 0 - assert vertical_geometry.rayleigh_damping_height > 0 - - -def assert_cell_geometry_fields(cell_geometry: CellParams): - assert cell_geometry.area - - -def assert_edge_geometry_fields(edge_geometry: EdgeParams): - assert edge_geometry.edge_areas - assert edge_geometry.primal_normal_vert - assert edge_geometry.inverse_primal_edge_lengths - assert edge_geometry.tangent_orientation - assert edge_geometry.inverse_dual_edge_lengths - assert edge_geometry.dual_normal_vert - - -def assert_diffusion_metric_state_fields(metric_state): - assert metric_state.wgtfac_c - assert metric_state.zd_intcoef - assert metric_state.zd_diffcoef - assert metric_state.theta_ref_mc - assert metric_state.mask_hdiff - assert metric_state.zd_vertoffset - - -def assert_nonhydro_metric_state_fields(metric_state): - assert metric_state.bdy_halo_c - assert metric_state.mask_prog_halo_c - assert metric_state.rayleigh_w - assert metric_state.wgtfac_c - assert metric_state.wgtfacq_c_dsl - assert metric_state.wgtfac_e - assert metric_state.wgtfacq_e_dsl - assert metric_state.exner_exfac - assert metric_state.exner_ref_mc - assert metric_state.rho_ref_mc - assert metric_state.theta_ref_mc - assert metric_state.rho_ref_me - assert metric_state.theta_ref_me - assert metric_state.theta_ref_ic - assert metric_state.d_exner_dz_ref_ic - assert metric_state.ddqz_z_half - assert metric_state.d2dexdz2_fac1_mc - assert metric_state.d2dexdz2_fac2_mc - assert metric_state.ddxn_z_full - assert metric_state.ddqz_z_full_e - assert metric_state.ddxt_z_full - assert metric_state.inv_ddqz_z_full - assert metric_state.vertoffset_gradp - assert metric_state.zdiff_gradp - assert metric_state.ipeidx_dsl - assert metric_state.pg_exdist - assert metric_state.vwind_expl_wgt - assert metric_state.vwind_impl_wgt - assert metric_state.hmask_dd3d - assert metric_state.scalfac_dd3d - assert metric_state.coeff1_dwdz - assert metric_state.coeff2_dwdz - assert metric_state.coeff_gradekin - - -def assert_diffusion_interpolation_state_fields(interpolation_state): - assert interpolation_state.geofac_n2s - assert interpolation_state.e_bln_c_s - assert interpolation_state.nudgecoeff_e - assert interpolation_state.geofac_n2s_nbh - assert interpolation_state.geofac_div - assert interpolation_state.geofac_grg_y - assert interpolation_state.geofac_grg_x - assert interpolation_state.rbf_coeff_2 - assert interpolation_state.rbf_coeff_1 - assert interpolation_state.geofac_n2s_c - - -def assert_nonhydro_interpolation_state_fields(interpolation_state): - assert interpolation_state.e_bln_c_s - assert interpolation_state.rbf_coeff_1 - assert interpolation_state.rbf_coeff_2 - assert interpolation_state.geofac_div - assert interpolation_state.geofac_n2s - assert interpolation_state.geofac_grg_x - assert interpolation_state.geofac_grg_y - assert interpolation_state.nudgecoeff_e - assert interpolation_state.c_lin_e - assert interpolation_state.geofac_grdiv - assert interpolation_state.rbf_vec_coeff_e - assert interpolation_state.c_intp - assert interpolation_state.geofac_rot - assert interpolation_state.pos_on_tplane_e_1 - assert interpolation_state.pos_on_tplane_e_2 - assert interpolation_state.e_flx_avg - - assert interpolation_state.geofac_n2s_c - assert interpolation_state.geofac_n2s_nbh diff --git a/model/driver/tests/test_timeloop.py b/model/driver/tests/test_timeloop.py index e9e737b7ea..7f1b4badf4 100644 --- a/model/driver/tests/test_timeloop.py +++ b/model/driver/tests/test_timeloop.py @@ -29,7 +29,6 @@ from icon4py.model.atmosphere.dycore.state_utils.z_fields import ZFields from icon4py.model.common.dimension import CellDim, EdgeDim, KDim from icon4py.model.common.grid.horizontal import CellParams, EdgeParams -from icon4py.model.common.grid.simple import SimpleGrid from icon4py.model.common.grid.vertical import VerticalModelParams from icon4py.model.common.states.prognostic_state import PrognosticState from icon4py.model.common.test_utils.helpers import random_field, zero_field @@ -39,7 +38,7 @@ # testing on MCH_CH_r04b09_dsl data @pytest.mark.datatest @pytest.mark.parametrize( - "debug_mode,timeloop_istep_init,timeloop_istep_exit,timeloop_jstep_init,timeloop_jstep_exit,timeloop_date_init, timeloop_date, timeloop_diffusion_linit_init, timeloop_diffusion_linit_exit, vn_only_init", + "debug_mode,istep_init, istep_exit, jstep_init, jstep_exit,timeloop_date_init, timeloop_date_exit, step_date_init, step_date_exit, timeloop_diffusion_linit_init, timeloop_diffusion_linit_exit, vn_only", [ ( False, @@ -49,6 +48,8 @@ 1, "2021-06-20T12:00:00.000", "2021-06-20T12:00:10.000", + "2021-06-20T12:00:10.000", + "2021-06-20T12:00:10.000", True, False, False, @@ -61,6 +62,8 @@ 1, "2021-06-20T12:00:10.000", "2021-06-20T12:00:20.000", + "2021-06-20T12:00:20.000", + "2021-06-20T12:00:20.000", False, False, True, @@ -70,7 +73,7 @@ def test_run_timeloop_single_step( debug_mode, timeloop_date_init, - timeloop_date, + timeloop_date_exit, grid_savepoint, icon_grid, metrics_savepoint, @@ -81,10 +84,9 @@ def test_run_timeloop_single_step( timeloop_diffusion_linit_init, timeloop_diffusion_savepoint_init, timeloop_diffusion_savepoint_exit, - timeloop_nonhydro_savepoint_init, - timeloop_velocity_savepoint_init, - timeloop_nonhydro_savepoint_exit, - timeloop_nonhydro_step_savepoint_exit, + savepoint_velocity_init, + savepoint_nonhydro_init, + savepoint_nonhydro_exit, ): diffusion_config = r04b09_diffusion_config diffusion_dtime = timeloop_diffusion_savepoint_init.get_metadata("dtime").get("dtime") @@ -119,19 +121,18 @@ def test_run_timeloop_single_step( # Default construction is for the MCH_CH_r04b09_dsl run config for nonhydro nonhydro_config = NonHydrostaticConfig() - sp = timeloop_nonhydro_savepoint_init + sp = savepoint_nonhydro_init nonhydro_params = NonHydrostaticParams(nonhydro_config) - sp_v = timeloop_velocity_savepoint_init - grid = SimpleGrid() - nonhydro_dtime = timeloop_velocity_savepoint_init.get_metadata("dtime").get("dtime") + sp_v = savepoint_velocity_init + nonhydro_dtime = savepoint_velocity_init.get_metadata("dtime").get("dtime") # lprep_adv actually depends on other factors: idiv_method == 1 .AND. (ltransport .OR. p_patch%n_childdom > 0 .AND. grf_intmethod_e >= 5) lprep_adv = sp_v.get_metadata("prep_adv").get("prep_adv") prep_adv = PrepAdvection( vn_traj=sp.vn_traj(), mass_flx_me=sp.mass_flx_me(), mass_flx_ic=sp.mass_flx_ic() ) - enh_smag_fac = zero_field(grid, KDim) - a_vec = random_field(grid, KDim, low=1.0, high=10.0, extend={KDim: 1}) + enh_smag_fac = zero_field(icon_grid, KDim) + a_vec = random_field(icon_grid, KDim, low=1.0, high=10.0, extend={KDim: 1}) fac = (0.67, 0.5, 1.3, 0.8) z = (0.1, 0.2, 0.3, 0.4) @@ -212,13 +213,11 @@ def test_run_timeloop_single_step( exner_incr=None, # sp.exner_incr(), ) - timeloop = TimeLoop( - r04b09_iconrun_config, diffusion, solve_nonhydro, timeloop_diffusion_linit_init - ) + timeloop = TimeLoop(r04b09_iconrun_config, diffusion, solve_nonhydro) assert timeloop.substep_timestep == nonhydro_dtime - if timeloop_date == "2021-06-20T12:00:10.000": + if timeloop_date_exit == "2021-06-20T12:00:10.000": prognostic_state = timeloop_diffusion_savepoint_init.construct_prognostics() else: prognostic_state = PrognosticState( @@ -249,7 +248,7 @@ def test_run_timeloop_single_step( lprep_adv, ) - rho_sp = timeloop_nonhydro_savepoint_exit.rho_new() + rho_sp = savepoint_nonhydro_exit.rho_new() exner_sp = timeloop_diffusion_savepoint_exit.exner() theta_sp = timeloop_diffusion_savepoint_exit.theta_v() vn_sp = timeloop_diffusion_savepoint_exit.vn()