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

add doc string on the combined stencils on velocity advection #707

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yiluchen1066
Copy link

@yiluchen1066 yiluchen1066 commented Apr 3, 2025

Adding the doc string on the combined stencil on velocity advection:

  • compute_derived_horizontal_winds_and_ke_and_horizontal_advection_of_w_and_contravariant_correction
  • compute_horizontal_advection_of_w
  • interpolate_horizontal_kinetic_energy_to_cells_and_compute_contravariant_terms
  • interpolate_horizontal_kinetic_energy_to_cells_and_compute_contravariant_corrected_w
  • compute_advection_in_vertical_momentum_equation
  • compute_advection_in_horizontal_momentum_equation

The updated documentation includes:

  • High-level descriptions of the computations
  • Clarified input/output arguments to explain data flow

@nfarabullini
Copy link
Contributor

cscs-ci run default

Copy link

github-actions bot commented Apr 3, 2025

Mandatory Tests

Please make sure you run these tests via comment before you merge!

  • cscs-ci run default
  • launch jenkins spack

Optional Tests

To run benchmarks you can use:

  • cscs-ci run benchmark-bencher

To run tests and benchmarks with the DaCe backend you can use:

  • cscs-ci run dace

In case your change might affect downstream icon-exclaim, please consider running

  • launch jenkins icon

For more detailed information please look at CI in the EXCLAIM universe.

Args:
- normal_wind_advective_tendency: horizontal advection tendency of the normal wind
- vn: normal wind at edges
- horizontal_kinetic_energy_at_edges_on_model_levels: horizontal kinematic energy at edges on model levels
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- horizontal_kinetic_energy_at_edges_on_model_levels: horizontal kinematic energy at edges on model levels
- horizontal_kinetic_energy_at_edges_on_model_levels: horizontal kinetic energy at edges on model levels

- normal_wind_advective_tendency: horizontal advection tendency of the normal wind
- vn: normal wind at edges
- horizontal_kinetic_energy_at_edges_on_model_levels: horizontal kinematic energy at edges on model levels
- horizontal_kinetic_energy_at_cells_on_model_levels: horizontal kinematic energy at cell centers on model levels
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- horizontal_kinetic_energy_at_cells_on_model_levels: horizontal kinematic energy at cell centers on model levels
- horizontal_kinetic_energy_at_cells_on_model_levels: horizontal kinetic energy at cell centers on model levels

- coriolis_frequency: coriolis frequency parameter
- contravariant_corrected_w_at_cells_on_model_levels: contravariant-corrected vertical velocity at model levels
- vn_on_half_levels: normal wind on half levels
- geofac_rot: interpolation field
Copy link
Contributor

@jcanton jcanton Apr 3, 2025

Choose a reason for hiding this comment

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

Suggested change
- geofac_rot: interpolation field
- geofac_rot: metrics field for rotor computations

- vn_on_half_levels: normal wind on half levels
- geofac_rot: interpolation field
- coeff_gradekin: metrics field/coefficient for the gradient of kinematic energy
- c_lin_e: interpolation field/linear interpolation coefficients from cells to edges
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- c_lin_e: interpolation field/linear interpolation coefficients from cells to edges
- c_lin_e: metrics field for linear interpolation from cells to edges

- geofac_rot: interpolation field
- coeff_gradekin: metrics field/coefficient for the gradient of kinematic energy
- c_lin_e: interpolation field/linear interpolation coefficients from cells to edges
- ddqz_z_full_e: metrics field
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- ddqz_z_full_e: metrics field
- ddqz_z_full_e: metrics field equal to vertical spacing

- area_edge: area associated with each edge
- tangent_orientation: orientation of the edge with respect to the grid
- inv_primal_edge_length: inverse primal edge length
- geofac_grdiv: interpolation field =
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- geofac_grdiv: interpolation field =
- geofac_grdiv: metrics field used to compute the gradient of a divergence (of vn)

- scalfac_exdiff: scalar factor for external diffusion
- d_time: time step
- levelmask: mask for valid vertical levels
- nlev: total number of vertical levels
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- nlev: total number of vertical levels
- nlev: number of (full/model) vertical levels

- d_time: time step
- levelmask: mask for valid vertical levels
- nlev: total number of vertical levels
- nrdmax: vertical index where damping ends.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- nrdmax: vertical index where damping ends.
- nrdmax: vertical index where damping ends

- nlev: total number of vertical levels
- nrdmax: vertical index where damping ends.
- start_vertex_lateral_boundary_level_2: start index of lateral boundary level 2 on vertex
- end_vertex_halo: ebd index of halo on vertex
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- end_vertex_halo: ebd index of halo on vertex
- end_vertex_halo: end index of halo on vertex

- vertical_end: end index in the vertical domain

Returns:
- normal_wind_advective_tendency
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- normal_wind_advective_tendency
- normal_wind_advective_tendency: horizontal advection tendency of the normal wind


Args:
- contravariant_corrected_w_at_cells_on_model_levels: contravariant-corrected vertical velocity at model levels
- vertical_wind_advective_tendency: vertical advection tendency
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- vertical_wind_advective_tendency: vertical advection tendency
- vertical_wind_advective_tendency: vertical advection tendency of the vertical wind

same as you did for
- normal_wind_advective_tendency: horizontal advection tendency of the normal wind

- w: vertical wind at cell centers
- contravariant_corrected_w_at_cells_on_half_levels: contravariant-corrected vertical velocity at cells on half levels
- horizontal_advection_of_w_at_edges_on_half_levels: horizontal advection for vertical velocity at edges on half levels
- coeff1_dwdz: metrics field (first coefficient for vertical derivative of 'w')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- coeff1_dwdz: metrics field (first coefficient for vertical derivative of 'w')
- coeff1_dwdz: metrics field (first coefficient for vertical derivative of vertical wind)

(I prefer w, but you called it "vertical wind" everywhere else)

- contravariant_corrected_w_at_cells_on_half_levels: contravariant-corrected vertical velocity at cells on half levels
- horizontal_advection_of_w_at_edges_on_half_levels: horizontal advection for vertical velocity at edges on half levels
- coeff1_dwdz: metrics field (first coefficient for vertical derivative of 'w')
- coeff2_dwdz: metrics field (second coefficient for vertical derivative of 'w')
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- coeff2_dwdz: metrics field (second coefficient for vertical derivative of 'w')
- coeff2_dwdz: metrics field (second coefficient for vertical derivative of vertical wind)

Formerly known as fused_velocity_advection_stencil_8_to_13_predictor.

This interpolates horizontal kinetic energy from edges to cells on models levels
and compute the contravariant correction term on half levels
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
and compute the contravariant correction term on half levels
and compute the contravariant correction term on half levels.


This interpolates horizontal kinetic energy from edges to cells on models levels
and compute the contravariant correction term on half levels
It also computes the vertical velocity with the contravariant correction term
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
It also computes the vertical velocity with the contravariant correction term
It also computes the vertical velocity with the contravariant correction term.


This computes the derived horizontal wind components, kinetic energy, horizontal advection of the vertical velocity,
and the contravariant correction.
It also extrapolates vertical velocity at the top level
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
It also extrapolates vertical velocity at the top level
It also extrapolates vertical velocity at the top level.

Agrs:
- tangential_wind: tangential wind at model levels
- tangential_wind_on_half_levels: tangential wind interpolated to half levels
- vn_on_half_levels: normal wind on half levels
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- vn_on_half_levels: normal wind on half levels
- vn_on_half_levels: normal wind interpolated to half levels

- halo_1: end index of halo on edges

Returns:
- tangential_wind
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- tangential_wind
- tangential_wind

Copy link
Contributor

Choose a reason for hiding this comment

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

why is that stuff duplicated?

    @functools.cached_property
    def nrdmax(self) -> gtx.int32:
        """Vertical index where damping ends."""
        return self.end_index_of_damping_layer

    @functools.cached_property
    def end_index_of_damping_layer(self) -> gtx.int32:
        """Vertical index where damping ends."""
        return self.index(Domain(dims.KDim, Zone.DAMPING))

Copy link
Contributor

Choose a reason for hiding this comment

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

There was a time when we decided we kept both, one with the old ICON name and the other one with the new easier-to-understand name.
Now it is a good time we remove nrdmax in my opinion because we have decided to rename variables. And add that this new name corresponds to nrdmax.

@jcanton
Copy link
Contributor

jcanton commented Apr 3, 2025

mostly looks good to me, but I'm looking forward to when we will finally make this properly automated with a dict or something so you don't have to re-write or copy/paste the same description in multiple places with the risk of different descriptions :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants