Skip to content
Open
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 @@ -126,8 +126,6 @@ def __init__(
smagorinski_scaling_factor: float = 0.015,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if we should cherry-pick the changes in config from the configuration PR #936

n_substeps: int = 5,
zdiffu_t: bool = True,
thslp_zdiffu: float = 0.025,
thhgtd_zdiffu: float = 200.0,
velocity_boundary_diffusion_denom: float = 200.0,
temperature_boundary_diffusion_denom: float = 135.0,
_nudge_max_coeff: float | None = None, # default is set in __init__
Expand Down Expand Up @@ -181,11 +179,6 @@ def __init__(
#: Called 'l_zdiffu_t' in mo_nonhydrostatic_nml.f90
self.apply_zdiffusion_t: bool = zdiffu_t

#:slope threshold (temperature diffusion): is used to build up an index list for application of truly horizontal diffusion in mo_vertical_grid.f90
self.thslp_zdiffu = thslp_zdiffu
#: threshold [m] for height difference between adjacent grid points, defaults to 200m (temperature diffusion)
self.thhgtd_zdiffu = thhgtd_zdiffu

# from other namelists:
# from parent namelist mo_nonhydrostatic_nml

Expand Down Expand Up @@ -270,6 +263,11 @@ def _validate(self):
f"implemented"
)

if self.compute_3d_smag_coeff:
raise NotImplementedError(
"3D Smagorinsky diffusion coefficient computation is not implemented yet."
)

@functools.cached_property
def substep_as_float(self):
return float(self.ndyn_substeps)
Expand Down Expand Up @@ -333,9 +331,6 @@ def _determine_smagorinski_factor(self, config: DiffusionConfig):
smagorinski_height = None
case _:
raise NotImplementedError("Only implemented for diffusion type 4 and 5")
smagorinski_factor = None
smagorinski_height = None
pass
return smagorinski_factor, smagorinski_height


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ def test_diffusion_benchmark(
hdiff_w_efdt_ratio=15.0,
smagorinski_scaling_factor=0.025,
zdiffu_t=False,
thslp_zdiffu=0.02,
thhgtd_zdiffu=125.0,
velocity_boundary_diffusion_denom=150.0,
max_nudging_coefficient=0.375,
n_substeps=5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ def _mch_ch_r04b09_diffusion_config():
hdiff_w_efdt_ratio=15.0,
smagorinski_scaling_factor=0.025,
zdiffu_t=True,
thslp_zdiffu=0.02,
thhgtd_zdiffu=125.0,
velocity_boundary_diffusion_denom=150.0,
max_nudging_coefficient=0.375,
n_substeps=n_substeps_reduced,
Expand Down
2 changes: 0 additions & 2 deletions model/testing/src/icon4py/model/testing/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ def construct_diffusion_config(
hdiff_w_efdt_ratio=15.0,
smagorinski_scaling_factor=0.025,
zdiffu_t=True,
thslp_zdiffu=0.02,
thhgtd_zdiffu=125.0,
velocity_boundary_diffusion_denom=150.0,
max_nudging_coefficient=0.375,
n_substeps=ndyn_substeps,
Expand Down
6 changes: 2 additions & 4 deletions tools/src/icon4py/tools/py2fgen/wrappers/diffusion_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ def diffusion_init(
type_t_diffu: gtx.int32,
type_vn_diffu: gtx.int32,
hdiff_efdt_ratio: gtx.float64,
hdiff_w_efdt_ratio: gtx.float64,
smagorinski_scaling_factor: gtx.float64,
hdiff_temp: bool,
thslp_zdiffu: float,
thhgtd_zdiffu: float,
denom_diffu_v: float,
nudge_max_coeff: float, # note: this is the scaled ICON value, i.e. not the namelist value
itype_sher: gtx.int32,
Expand Down Expand Up @@ -107,11 +106,10 @@ def diffusion_init(
type_t_diffu=type_t_diffu,
type_vn_diffu=type_vn_diffu,
hdiff_efdt_ratio=hdiff_efdt_ratio,
hdiff_w_efdt_ratio=hdiff_w_efdt_ratio,
smagorinski_scaling_factor=smagorinski_scaling_factor,
hdiff_temp=hdiff_temp,
n_substeps=ndyn_substeps,
thslp_zdiffu=thslp_zdiffu,
thhgtd_zdiffu=thhgtd_zdiffu,
velocity_boundary_diffusion_denom=denom_diffu_v,
max_nudging_coefficient=nudge_max_coeff,
shear_type=TurbulenceShearForcingType(itype_sher),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ function diffusion_init_wrapper(theta_ref_mc, &
type_t_diffu, &
type_vn_diffu, &
hdiff_efdt_ratio, &
hdiff_w_efdt_ratio, &
smagorinski_scaling_factor, &
hdiff_temp, &
thslp_zdiffu, &
thhgtd_zdiffu, &
denom_diffu_v, &
nudge_max_coeff, &
itype_sher, &
Expand Down Expand Up @@ -269,14 +268,12 @@ function diffusion_init_wrapper(theta_ref_mc, &

real(c_double), value, target :: hdiff_efdt_ratio

real(c_double), value, target :: hdiff_w_efdt_ratio

real(c_double), value, target :: smagorinski_scaling_factor

logical(c_int), value, target :: hdiff_temp

real(c_double), value, target :: thslp_zdiffu

real(c_double), value, target :: thhgtd_zdiffu

real(c_double), value, target :: denom_diffu_v

real(c_double), value, target :: nudge_max_coeff
Expand Down Expand Up @@ -506,10 +503,9 @@ subroutine diffusion_init(theta_ref_mc, &
type_t_diffu, &
type_vn_diffu, &
hdiff_efdt_ratio, &
hdiff_w_efdt_ratio, &
smagorinski_scaling_factor, &
hdiff_temp, &
thslp_zdiffu, &
thhgtd_zdiffu, &
denom_diffu_v, &
nudge_max_coeff, &
itype_sher, &
Expand Down Expand Up @@ -562,14 +558,12 @@ subroutine diffusion_init(theta_ref_mc, &

real(c_double), value, target :: hdiff_efdt_ratio

real(c_double), value, target :: hdiff_w_efdt_ratio

real(c_double), value, target :: smagorinski_scaling_factor

logical(c_int), value, target :: hdiff_temp

real(c_double), value, target :: thslp_zdiffu

real(c_double), value, target :: thhgtd_zdiffu

real(c_double), value, target :: denom_diffu_v

real(c_double), value, target :: nudge_max_coeff
Expand Down Expand Up @@ -786,10 +780,9 @@ subroutine diffusion_init(theta_ref_mc, &
type_t_diffu=type_t_diffu, &
type_vn_diffu=type_vn_diffu, &
hdiff_efdt_ratio=hdiff_efdt_ratio, &
hdiff_w_efdt_ratio=hdiff_w_efdt_ratio, &
smagorinski_scaling_factor=smagorinski_scaling_factor, &
hdiff_temp=hdiff_temp, &
thslp_zdiffu=thslp_zdiffu, &
thhgtd_zdiffu=thhgtd_zdiffu, &
denom_diffu_v=denom_diffu_v, &
nudge_max_coeff=nudge_max_coeff, &
itype_sher=itype_sher, &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ extern int diffusion_init_wrapper(
int zd_intcoef_size_1, int zd_intcoef_size_2, int ndyn_substeps,
int diffusion_type, int hdiff_w, int hdiff_vn, int zdiffu_t,
int type_t_diffu, int type_vn_diffu, double hdiff_efdt_ratio,
double smagorinski_scaling_factor, int hdiff_temp, double thslp_zdiffu,
double thhgtd_zdiffu, double denom_diffu_v, double nudge_max_coeff,
double hdiff_w_efdt_ratio, double smagorinski_scaling_factor,
int hdiff_temp, double denom_diffu_v, double nudge_max_coeff,
int itype_sher, int ltkeshs, int backend, int on_gpu);
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,9 @@ def diffusion_init_wrapper(
type_t_diffu,
type_vn_diffu,
hdiff_efdt_ratio,
hdiff_w_efdt_ratio,
smagorinski_scaling_factor,
hdiff_temp,
thslp_zdiffu,
thhgtd_zdiffu,
denom_diffu_v,
nudge_max_coeff,
itype_sher,
Expand Down Expand Up @@ -588,10 +587,9 @@ def diffusion_init_wrapper(
type_t_diffu=type_t_diffu,
type_vn_diffu=type_vn_diffu,
hdiff_efdt_ratio=hdiff_efdt_ratio,
hdiff_w_efdt_ratio=hdiff_w_efdt_ratio,
smagorinski_scaling_factor=smagorinski_scaling_factor,
hdiff_temp=hdiff_temp,
thslp_zdiffu=thslp_zdiffu,
thhgtd_zdiffu=thhgtd_zdiffu,
denom_diffu_v=denom_diffu_v,
nudge_max_coeff=nudge_max_coeff,
itype_sher=itype_sher,
Expand Down
12 changes: 4 additions & 8 deletions tools/tests/tools/py2fgen/wrappers/test_diffusion_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ def test_diffusion_wrapper_granule_inputs(
type_t_diffu = 2
type_vn_diffu = 1
hdiff_efdt_ratio = 24.0
hdiff_w_efdt_ratio = 15.0
smagorinski_scaling_factor = 0.025
zdiffu_t = True
thslp_zdiffu = 0.02
thhgtd_zdiffu = 125.0
denom_diffu_v = 150.0
max_nudging_coefficient = 0.375
itype_sher = (
Expand Down Expand Up @@ -173,10 +172,9 @@ def test_diffusion_wrapper_granule_inputs(
type_t_diffu=type_t_diffu,
type_vn_diffu=type_vn_diffu,
hdiff_efdt_ratio=hdiff_efdt_ratio,
hdiff_w_efdt_ratio=hdiff_w_efdt_ratio,
smagorinski_scaling_factor=smagorinski_scaling_factor,
hdiff_temp=hdiff_temp,
thslp_zdiffu=thslp_zdiffu,
thhgtd_zdiffu=thhgtd_zdiffu,
denom_diffu_v=denom_diffu_v,
nudge_max_coeff=max_nudging_coefficient,
itype_sher=itype_sher.value,
Expand Down Expand Up @@ -287,10 +285,9 @@ def test_diffusion_wrapper_single_step(
type_t_diffu = 2
type_vn_diffu = 1
hdiff_efdt_ratio = 24.0
hdiff_w_efdt_ratio = 15.0
smagorinski_scaling_factor = 0.025
zdiffu_t = True
thslp_zdiffu = 0.02
thhgtd_zdiffu = 125.0
denom_diffu_v = 150.0
max_nudging_coefficient = 0.375
itype_sher = (
Expand Down Expand Up @@ -370,10 +367,9 @@ def test_diffusion_wrapper_single_step(
type_t_diffu=type_t_diffu,
type_vn_diffu=type_vn_diffu,
hdiff_efdt_ratio=hdiff_efdt_ratio,
hdiff_w_efdt_ratio=hdiff_w_efdt_ratio,
smagorinski_scaling_factor=smagorinski_scaling_factor,
hdiff_temp=hdiff_temp,
thslp_zdiffu=thslp_zdiffu,
thhgtd_zdiffu=thhgtd_zdiffu,
denom_diffu_v=denom_diffu_v,
nudge_max_coeff=max_nudging_coefficient,
itype_sher=itype_sher.value,
Expand Down