Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import logging
import math
import sys
from typing import Final, Literal
from typing import Final

import gt4py.next as gtx
import gt4py.next.typing as gtx_typing
Expand Down Expand Up @@ -125,27 +125,6 @@ class TurbulenceShearForcingType(int, enum.Enum):
VERTICAL_HORIZONTAL_OF_HORIZONTAL_WIND_LTHESH = 3 #: same as `VERTICAL_HORIZONTAL_OF_HORIZONTAL_WIND` but scaling of coarse-grid horizontal shear production term with 1/sqrt(Ri) (if LTKESH = TRUE)


ValidDiffusionType = Literal[
DiffusionType.NO_DIFFUSION,
DiffusionType.LINEAR_2ND_ORDER,
DiffusionType.SMAGORINSKY_NO_BACKGROUND,
DiffusionType.LINEAR_4TH_ORDER,
DiffusionType.SMAGORINSKY_4TH_ORDER,
]
ValidSmagorinskyStencilType = Literal[
SmagorinskyStencilType.DIAMOND_VERTICES, SmagorinskyStencilType.CELLS_AND_VERTICES
]
ValidTemperatureDiscretizationType = Literal[
TemperatureDiscretizationType.HOMOGENEOUS, TemperatureDiscretizationType.HETEROGENEOUS
]
ValidTurbulenceShearForcingType = Literal[
TurbulenceShearForcingType.VERTICAL_OF_HORIZONTAL_WIND,
TurbulenceShearForcingType.VERTICAL_HORIZONTAL_OF_HORIZONTAL_WIND,
TurbulenceShearForcingType.VERTICAL_HORIZONTAL_OF_HORIZONTAL_VERTICAL_WIND,
TurbulenceShearForcingType.VERTICAL_HORIZONTAL_OF_HORIZONTAL_WIND_LTHESH,
]


class DiffusionConfig:
"""
Contains necessary parameter to configure a diffusion run.
Expand All @@ -160,14 +139,14 @@ class DiffusionConfig:

def __init__(
self,
diffusion_type: ValidDiffusionType = DiffusionType.SMAGORINSKY_4TH_ORDER,
diffusion_type: DiffusionType = DiffusionType.SMAGORINSKY_4TH_ORDER,
hdiff_w: bool = True,
hdiff_vn: bool = True,
hdiff_temp: bool = True,
hdiff_smag_w: bool = False,
type_vn_diffu: ValidSmagorinskyStencilType = SmagorinskyStencilType.DIAMOND_VERTICES,
type_vn_diffu: SmagorinskyStencilType = SmagorinskyStencilType.DIAMOND_VERTICES,
smag_3d: bool = False,
type_t_diffu: ValidTemperatureDiscretizationType = TemperatureDiscretizationType.HETEROGENEOUS,
type_t_diffu: TemperatureDiscretizationType = TemperatureDiscretizationType.HETEROGENEOUS,
hdiff_efdt_ratio: float = 36.0,
hdiff_w_efdt_ratio: float = 15.0,
smagorinski_scaling_factor: float = 0.015,
Expand All @@ -180,7 +159,7 @@ def __init__(
_nudge_max_coeff: float | None = None, # default is set in __init__
max_nudging_coefficient: float | None = None, # default is set in __init__
nudging_decay_rate: float = 2.0,
shear_type: ValidTurbulenceShearForcingType = TurbulenceShearForcingType.VERTICAL_OF_HORIZONTAL_WIND,
shear_type: TurbulenceShearForcingType = TurbulenceShearForcingType.VERTICAL_OF_HORIZONTAL_WIND,
ltkeshs: bool = True,
):
"""Set the diffusion configuration parameters with the ICON default values."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def test_diffusion_benchmark(
diffusion_type=diffusion.DiffusionType.SMAGORINSKY_4TH_ORDER,
hdiff_w=True,
hdiff_vn=True,
type_t_diffu=2,
type_vn_diffu=1,
type_t_diffu=diffusion.TemperatureDiscretizationType.HETEROGENEOUS,
type_vn_diffu=diffusion.SmagorinskyStencilType.DIAMOND_VERTICES,
hdiff_efdt_ratio=24.0,
hdiff_w_efdt_ratio=15.0,
smagorinski_scaling_factor=0.025,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def _mch_ch_r04b09_diffusion_config():
diffusion_type=diffusion.DiffusionType.SMAGORINSKY_4TH_ORDER,
hdiff_w=True,
hdiff_vn=True,
type_t_diffu=2,
type_vn_diffu=1,
type_t_diffu=diffusion.TemperatureDiscretizationType.HETEROGENEOUS,
type_vn_diffu=diffusion.SmagorinskyStencilType.DIAMOND_VERTICES,
hdiff_efdt_ratio=24.0,
hdiff_w_efdt_ratio=15.0,
smagorinski_scaling_factor=0.025,
Expand Down Expand Up @@ -110,8 +110,8 @@ def _jabw_diffusion_config(n_substeps: int):
hdiff_vn=True,
hdiff_temp=False,
n_substeps=n_substeps,
type_t_diffu=2,
type_vn_diffu=1,
type_t_diffu=diffusion.TemperatureDiscretizationType.HETEROGENEOUS,
type_vn_diffu=diffusion.SmagorinskyStencilType.DIAMOND_VERTICES,
hdiff_efdt_ratio=10.0,
hdiff_w_efdt_ratio=15.0,
smagorinski_scaling_factor=0.025,
Expand Down
4 changes: 2 additions & 2 deletions model/driver/tests/driver/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def r04b09_diffusion_config(ndyn_substeps) -> diffusion.DiffusionConfig:
diffusion_type=diffusion.DiffusionType.SMAGORINSKY_4TH_ORDER,
hdiff_w=True,
hdiff_vn=True,
type_t_diffu=2,
type_vn_diffu=1,
type_t_diffu=diffusion.TemperatureDiscretizationType.HETEROGENEOUS,
type_vn_diffu=diffusion.SmagorinskyStencilType.DIAMOND_VERTICES,
hdiff_efdt_ratio=24.0,
hdiff_w_efdt_ratio=15.0,
smagorinski_scaling_factor=0.025,
Expand Down
8 changes: 4 additions & 4 deletions tools/tests/tools/py2fgen/wrappers/test_diffusion_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def test_diffusion_wrapper_granule_inputs(
hdiff_temp = True
hdiff_smag_w = False
ltkeshs = True
type_t_diffu = 2
type_vn_diffu = 1
type_t_diffu = diffusion.TemperatureDiscretizationType.HETEROGENEOUS
type_vn_diffu = diffusion.SmagorinskyStencilType.DIAMOND_VERTICES
hdiff_efdt_ratio = 24.0
smagorinski_scaling_factor = 0.025
zdiffu_t = True
Expand Down Expand Up @@ -287,8 +287,8 @@ def test_diffusion_wrapper_single_step(
hdiff_temp = True
hdiff_smag_w = False
ltkeshs = True
type_t_diffu = 2
type_vn_diffu = 1
type_t_diffu = diffusion.TemperatureDiscretizationType.HETEROGENEOUS
type_vn_diffu = diffusion.SmagorinskyStencilType.DIAMOND_VERTICES
hdiff_efdt_ratio = 24.0
smagorinski_scaling_factor = 0.025
zdiffu_t = True
Expand Down
Loading