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

Remove pre levelmask from vel adv because cfl_clipping is the same thing #258

Merged
merged 6 commits into from
Aug 30, 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
Prev Previous commit
Next Next commit
Test vel adv 20 on correct domain, add comments, format
  • Loading branch information
muellch committed Aug 22, 2023
commit 2dac0a0861d84e970e54ecd766833efd98374089
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def _mo_velocity_advection_stencil_14(
False,
)

# TOOO: As soon as reductions of arbitrar dimensions are possible in gt4py, this stencil
# should reduce the vertical cfl to a scalar and the levmask to a per level boolean field (see Fortran dycore).
vcfl = where(cfl_clipping, z_w_con_c * dtime / ddqz_z_half, 0.0)

z_w_con_c = where((cfl_clipping) & (vcfl < -0.85), -0.85 * ddqz_z_half / dtime, z_w_con_c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
CellDim,
E2C2EODim,
E2CDim,
E2VDim,
EdgeDim,
KDim,
Koff,
Expand Down Expand Up @@ -74,7 +73,13 @@ def _mo_velocity_advection_stencil_20(
)
ddt_vn_adv = where(
(levelmask | levelmask(Koff[1])) & (abs(w_con_e) > cfl_w_limit * ddqz_z_full_e),
ddt_vn_adv + difcoef * area_edge * (neighbor_sum(geofac_grdiv * vn(E2C2EO), axis=E2C2EODim) + tangent_orientation * inv_primal_edge_length * (zeta(E2V[1]) - zeta(E2V[0]))),
ddt_vn_adv
+ difcoef
* area_edge
* (
neighbor_sum(geofac_grdiv * vn(E2C2EO), axis=E2C2EODim)
+ tangent_orientation * inv_primal_edge_length * (zeta(E2V[1]) - zeta(E2V[0]))
),
ddt_vn_adv,
)
return ddt_vn_adv
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

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

why not also port it to the new format using the StencilTest? Or is there a reason why this is not possible for this stencil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, but I will do that as a follow up. For now it is important that everyone gets the fixes, so they can run the correct code.
I can put the tests into the new format on my fused velocity advection branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,13 @@ def mo_velocity_advection_stencil_20_numpy(
ddt_vn_adv = np.where(
((levelmask_offset_0 == 1) | (levelmask_offset_1 == 1))
& (np.abs(w_con_e) > cfl_w_limit * ddqz_z_full_e),
ddt_vn_adv + difcoef * area_edge *
(np.sum(geofac_grdiv * vn[e2c2eO], axis=1) + tangent_orientation * inv_primal_edge_length * (zeta[e2v][:, 1] - zeta[e2v][:, 0])),
ddt_vn_adv
+ difcoef
* area_edge
* (
np.sum(geofac_grdiv * vn[e2c2eO], axis=1)
+ tangent_orientation * inv_primal_edge_length * (zeta[e2v][:, 1] - zeta[e2v][:, 0])
),
ddt_vn_adv,
)
return ddt_vn_adv
Expand Down Expand Up @@ -145,4 +150,4 @@ def test_mo_velocity_advection_stencil_20():
},
)

assert np.allclose(ddt_vn_adv[:, :-1], ddt_vn_adv_ref[:, :-1])
assert np.allclose(ddt_vn_adv, ddt_vn_adv_ref)