Skip to content

Conversation

@erikvansebille
Copy link
Member

As reported in #1685, the Field.add_periodic_halo() method was quite buggy for Fields on Curvilinear Grids. In order to avoid users using broken code, perhaps better to deprecate the method?

@VeckoTheGecko
Copy link
Contributor

I get that for a lot of simulations with curvilinear grids (especially arbitrary curvilinear ones) the approach is buggy/there is no way to sensibly implement periodicity in this case. However, what about people running global simulations?

@erikvansebille
Copy link
Member Author

I get that for a lot of simulations with curvilinear grids (especially arbitrary curvilinear ones) the approach is buggy/there is no way to sensibly implement periodicity in this case. However, what about people running global simulations?

Well, this is described at the start of the Periodic Boundaries tutorial:

In case you have a global model on a C-grid, then there is typically not much that needs to be done. The only thing you have to be aware of, is that there is no ‘gap’ between the longitude values on the right side of the grid and on the left side of the grid (modulo 360). In other words, that

fieldset.U.lon[:, 0] >= fieldset.U.lon[:, -1]

This is the case for most curvilinear NEMO model outputs on a C-grid, so that periodic boundary conditions work out of the box, without any special code required.

For Hycom models, we have found that it can help to add an extra column of longitudes at the end of the longitude array:

lon_c = np.expand_dims(fieldset.U.grid.lon[:, 0], axis=1)
fieldset.U.grid.lon = np.hstack((fieldset.U.grid.lon, lon_c))

Copy link
Contributor

@VeckoTheGecko VeckoTheGecko left a comment

Choose a reason for hiding this comment

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

I see. Thanks for the clarification

@erikvansebille erikvansebille merged commit fdc45ba into master Jan 7, 2025
16 checks passed
@erikvansebille erikvansebille deleted the deprecating_curvilnear_halo_support branch January 7, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants