# [ICON4Py] A round of cleanup on ICON4Py programs <!-- Add the tag for the current cycle number in the top bar --> - Shaped by: Hannes - Appetite (FTEs, weeks): - Developers: <!-- Filled in at the betting table unless someone is specifically required here --> ## Problem After combining all programs to the extent we currently could, we discovered that some patterns can be improved for better readability and at the same time for better performance. Improvements were already applied to some programs. This project is about applying a round of improvements on the remaining programs ## Appetite <!-- Explain how much time we want to spend and how that constrains the solution --> ## Solution The status of the dycore and diffusion is summarized in https://docs.google.com/spreadsheets/d/1cpNl8EWSdAj0OSqlTBwyPNkHZMzLnLFW0e9JmaJgUA8/edit?usp=sharing. All programs that are currently used are listed. In a first step go through the list and prioritize the clean-ups, then ### Apply target representation See [How to write clean ICON4Py programs](/Z1wHLlygR7u_WzMnlRlSIw) for which patterns to apply. While working on these programs, keep [How to write clean ICON4Py programs](/Z1wHLlygR7u_WzMnlRlSIw) up-to-date. ### Use all combined programs - Nikki * In diffusion, us `apply_diffusion_to_theta_and_exner`, the combined program, instead of the smaller programs. ### pre-compile as much as possible In diffusion and solve nonhydro add all booleans and integers we have knowledge of to the pre compilation. If for example an integer is `True` for the first substep of the dycore but `False` for all other substeps, it can be pre-compiled with `[True, False]` ## Rabbit holes This will not be the last round of such refactorings, therefore keep an eye on balancing best vs good-enough in this round of refactoring. ## No-gos <!-- Anything specifically excluded from the concept: functionality or use cases we intentionally aren’t covering to fit the ## appetite or make the problem tractable --> ## Progress <!-- Don't fill during shaping. This area is for collecting TODOs during building. As first task during building add a preliminary list of coarse-grained tasks for the project and refine them with finer-grained items when it makes sense as you work on them. --> - [x] Integrate `apply_diffusion_to_theta_and_exner` - [x] datatests (waiting for update of serialized data) - [ ] working with DaCe - [ ] working in granule integration - [x] cleanup compute_edge_diagnostics_for_dycore_and_update_vn https://github.com/C2SM/icon4py/pull/772 - predictor: `compute_theta_rho_face_values_and_pressure_gradient_and_update_vn` - corrector: `apply_divergence_damping_and_update_vn` - [ ] cleanup `compute_cell_diagnostics_for_dycore.py` aka 1 to 13 https://github.com/C2SM/icon4py/pull/762 - [ ] cleanup `vertically_implicit_dycore_solver` aka 41 to 60 https://github.com/C2SM/icon4py/pull/784 - [x] cleanup CFL related programs in https://hackmd.io/CWiHVuaiQ1i0NKwasD0CRQ - [ ] TODO: make list of next steps