Skip to content

Conversation

@neutrinoceros
Copy link
Member

PR Summary

I'm opening the PR very early in to ease the process of synchronising during the 2025 workshop's hackathon.

PR Checklist

  • New features are documented, with docstrings and narrative docs
  • Adds a test for any bugs fixed. Adds tests for new features.

@matthewturk
Copy link
Member

As a follow-up to our discussion in person, I'll write here a few of the things I was thinking about with this.

  • I think the icoords is going to be the sticking point. If we skip projections, it might not be so bad. But the issue will be getting icoords to be able to create globally unique (and deterministic across grids) indices for a given cell at a given level.
  • The machinery for fwidth I believe should just work as-is given the cell_widths

@neutrinoceros
Copy link
Member Author

Right now the big missing piece is the reconstruction of cell widths. I intentionally used an undefined variable _cell_widths, which should be a clear indicator that the code is incomplete.

I'm trying to fill in as many details as I can now, but we found a couple limitations already:

  • grid stretching is parametrized in namelist files, not in datfiles
  • crucially, stretch_dim is an array of (up to ?) 3 values, which specifies the kind of stretching used along each direction
  • AMRVAC users seem to typically only stretch in one direction, and write stretch_dim(1) = 'uni'
  • f90nml doesn't handle this case well (and how could it ? there's no clear way for it to infer the size or type of the array). xref f90nml fails to read namelist entries for Fortran90 structure variables marshallward/f90nml#110

So the only way we're going to get away with it (at least for now, but probably for ever), is to force the more explicit syntax on users: (e.g. stretch_dim = '', 'uni', ''). We could in principle implement a custom parser just for this but I'm going to boldly mark this as "nice to have" and move on for now. In any case I think we should resist the temptation to guess what the stretched direction is (even though we expect it to always be radial if coordinates are spherical....)

@neutrinoceros neutrinoceros added enhancement Making something better frontend: amrvac index: grid generalised orthogonal grids supporting non-AMR, orthogonal meshes labels Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Making something better frontend: amrvac generalised orthogonal grids supporting non-AMR, orthogonal meshes index: grid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants