Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change float power to integer power #311

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -26,7 +26,7 @@ def _calculate_diagnostics_for_turbulence(
) -> tuple[Field[[CellDim, KDim], float], Field[[CellDim, KDim], float]]:
div_ic = wgtfac_c * div + (1.0 - wgtfac_c) * div(Koff[-1])
# TODO(magdalena): change exponent back to int (workaround for gt4py)
hdef_ic = (wgtfac_c * kh_c + (1.0 - wgtfac_c) * kh_c(Koff[-1])) ** 2.0
hdef_ic = (wgtfac_c * kh_c + (1.0 - wgtfac_c) * kh_c(Koff[-1])) ** 2
return div_ic, hdef_ic


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _calculate_nabla2_and_smag_coefficients_for_vn(
)
)
- 2.0 * vn
) * (inv_primal_edge_length**2.0)
) * (inv_primal_edge_length**2)
# TODO(magdalena): change exponent back to int (workaround for gt4py)
z_nabla2_e = z_nabla2_e + (
(
Expand All @@ -118,7 +118,7 @@ def _calculate_nabla2_and_smag_coefficients_for_vn(
)
)
- 2.0 * vn
) * (inv_vert_vert_length**2.0)
) * (inv_vert_vert_length**2)

z_nabla2_e = 4.0 * z_nabla2_e

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def _calculate_nabla4(
)
# TODO(magdalena): change exponent back to int (workaround for gt4py)
z_nabla4_e2 = 4.0 * (
(nabv_norm - 2.0 * z_nabla2_e) * inv_vert_vert_length**2.0
+ (nabv_tang - 2.0 * z_nabla2_e) * inv_primal_edge_length**2.0
(nabv_norm - 2.0 * z_nabla2_e) * inv_vert_vert_length**2
+ (nabv_tang - 2.0 * z_nabla2_e) * inv_primal_edge_length**2
)
return z_nabla4_e2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _mo_solve_nonhydro_stencil_21(
* inv_dual_edge_length
* (z_theta_1 - z_theta_0)
* float(4.0)
/ (z_theta_0 + z_theta_1) ** 2.0
/ (z_theta_0 + z_theta_1) ** 2
)

return z_hydro_corr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _mo_solve_nonhydro_stencil_36(
vn_ie = wgtfac_e * vn + (1.0 - wgtfac_e) * vn(Koff[-1])
z_vt_ie = wgtfac_e * vt + (1.0 - wgtfac_e) * vt(Koff[-1])
# TODO(magdalena): change exponent back to int (workaround for gt4py)
z_kin_hor_e = 0.5 * (vn**2.0 + vt**2.0)
z_kin_hor_e = 0.5 * (vn**2 + vt**2)
return vn_ie, z_vt_ie, z_kin_hor_e


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def compute_z_raylfac(
def _scal_divdamp_calcs(
enh_divdamp_fac: Field[[KDim], float], mean_cell_area: float
) -> Field[[KDim], float]:
return -enh_divdamp_fac * mean_cell_area**2.0
return -enh_divdamp_fac * mean_cell_area**2


@program
Expand Down