---
# System prepended metadata

title: '[Greenline]: time stepping'
tags: [cycle 17]

---

# Greenline: timestepping



- Shaped by: Magdalena
- Appetite (FTEs, weeks): 1-2 devs, 1/2 cycle
- Developers: <!-- Filled in at the betting table unless someone is specifically required here -->

## Problem
`diffusion` and `solve_nonhydro` have been ported to from ICON (Fortran) to python. As a next step towards a dycore test case of the python port, we want add time stepping functionality.

## Appetite
Essential step towards a full dycore test case on the other hand it does not look too difficult if we keep it simple. So maybe 1/2 cycle to 1 cycle.


## Solution
<!-- The core elements we came up with, presented in a form that’s easy for people to immediately understand -->
ICONs runs on a main timestep `dt` (pink) on which `diffusion` and `tracer advection` and fast physics are run. The dynamical core is integrated in `n_substeps`   substeps (grey).
![](https://hackmd.io/_uploads/rJhLM1IA3.png)

The project should focus running the time loop over `dt` and `ndyn_substeps`.

The corresponding functionality in ICON (Fortran) can be found in `mo_nh_stepping.f90`: `integrate_nh`. The "outer routines" in `mo_nh_stepping.f90` play no role since we are only running a dynamical without any boundary conditions, physics... However, contrary to the porting that we have done so far we don't want to "clone" the ICON functionality 1 to 1, but rather focus on an independent implementation along the same lines. 

(see comments in graph)
![](https://hackmd.io/_uploads/SJF8Jk8R3.png)

The `driver` package in ICON4py that already runs diffusion in a timeloop without integration of the dynamical core can be used as a blueprint.  A rough draft of the set up of the driver is given below.

```
- init: 
    - read IconGrid (from serialized data)
    - read DecompositionInfo (from serialized data)
    - read Configuration needed to setup the components used in the timeloop (commandline input or hardcoded)
    - retrieve static fields (metric fields, interpolation fields) (currently from serialized data)
- configure the model components: 
    - setup and configure SolveNonHydro, Diffusion, Timeloop
- set up initial state for diagnostics, prognostics (currently from serialized data or dummy values)
- run time loop
- output results
```




## Rabbit holes
<!-- Details about the solution worth calling out to avoid problems -->
`mo_nh_stepping.f90` 
*Don't* try to port `mo_nh_stepping.f90`  to python in a 1-to-1 fashion. contains quite some complexity that we don't want to bring to python.  Keep it as simple as possible. 

depends on SolveNonHydro (and the rest of the greenline) being merged in main.
## 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 -->
- Full python standalone intialization, this will be targeted by other projects as we go along. For this project initialization with serialized data is good enough.
- Initialization of Jablonowski Williamson steady state initial conditions. 

