# [Green line] Cleanups
<!-- Add the tag for the current cycle number in the top bar -->
- Shaped by: Magdalena
- Appetite (FTEs, weeks):
- Developers: <!-- Filled in at the betting table unless someone is specifically required here -->
## Problem
<!-- The raw idea, a use case, or something we’ve seen that motivates us to work on this -->
There are a couple of left overs from earlier [cleanup projects](https://hackmd.io/5325WLjjS-GZetlJwviDtA)
## namelist switches in solve_nonhydro - PR opened
There are a couple of switches in SolveNonhydro that can be removed. (list composed by Christoph and Anurag):
The following dycore switches can be kept/ignored:
1. `itime_scheme` we keep flexible: requires porting of 1 additional stencil for itime_scheme 6
2. `divdamp_type`: we support 32 and 3
- `divdamp_type = 32` needs the additional parameters (bounds for transitioning between 2D, 3D divdamp order) for computation of `metrics%scalfac_dd3d`
- `REAL(wp):: divdamp_trans_start `
- `REAL(wp):: divdamp_trans_end`
4. `divdamp_order`: we support 2, 4, and 24
5. `igradp_method` we use 3, throw everything else out: remove the if switches on `igradp_method`
6. ~~l_open_ubc: has been removed from ICON-NWP and from ICON 2.6.7-rc~~
7. ~~`idiv_method` delete control flow (was removed in ICON)~~
8. `lhdiff_rcf == False`: It is an option for/from diffusion and was eliminated there, it should als be remove from SolveNonHydro.
9. `l_vert_nested` vertical nesting is only relevant if there is horizontal nesting.
10. `ltestcase` is not used anywhere in `class SolveNonHydro` . It should be set elsewhere than `NonHydroStaticConfig` - check with Chia Rui.
### type annotations for fields in icon4py - Nikki - PR merged
Currently we annotate the fields with `Field[[CellDim, KDim], wpfloat]` this can now be changed to `Field[Dims[CellDim, KDim], wpfloat]` which is a correct mypy annotation.
### enum values for namelist options - Nikki - PR merged
- use `IntEnum` for namelist options and use them throught the code.
- `NonHydroStaticConfg`: `rayleigh_type` (replace the constants in `constants.py` by an enum), `divdamp_type`, `divdamp_order`,`itime_scheme` `idiv_method`
- `DiffusionConfgig`: `type_vn_diffu`, `type_t_diffu`, already there but potentially not used consistently `shear_type`, `diffusion_type`
## Appetite
<!-- Explain how much time we want to spend and how that constrains the solution -->
Can be done as a side project.
## Solution
<!-- The core elements we came up with, presented in a form that’s easy for people to immediately understand -->
## consolidate switches in solve_nonhydro
- introduce enums for the switches that have integer values, (also in diffusion.py) for example:
```python
class DivergenceDampingType(IntEnum):
D3 = 3,
D2_STRATOSPHERE = 32,
```
- set the correct default values same as ICON default.
- fix validation for allowed values.
- port additional stencils if necessary
-
More information on the value switches (for enum naming etc can be found in the [Namelist_overview.pdf](https://github.com/C2SM/icon-exclaim/blob/icon-dsl/doc/ICON_Namelist_Overview.pdf))
# type annotations - PR merged
The type annotations are becoming long and cumbersome to write, we propose to use a type alias
for the correct (long) annotation
```python
DTYPE: TypeAlias = Union[wpfloat, vpfloat]
CKField:TypeAlias = Field[Dims[CellDim, KDim], DTYPE]
@field_operator
def _calculate_diagnostics_for_turbulence(
div: CKField,
kh_c: CKField,
wgtfac_c: CKField,
) -> tuple[CKField, CKField]:
pass
```
## Rabbit holes
<!-- Details about the solution worth calling out to avoid problems -->
## 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] Task 1 ([PR#xxxx](https://github.com/GridTools/gt4py/pulls))
- [x] Subtask A
- [x] Subtask X
- [ ] Task 2
- [x] Subtask H
- [ ] Subtask J
- [ ] Discovered Task 3
- [ ] Subtask L
- [ ] Subtask S
- [ ] Task 4