[WIP] Clean up global grid parameters and grid shape#1183
[WIP] Clean up global grid parameters and grid shape#1183
Conversation
|
Hi there, this is jenkins continuous integration... |
1 similar comment
|
Hi there, this is jenkins continuous integration... |
Agent-Logs-Url: https://github.com/C2SM/icon4py/sessions/148d4123-da81-4914-a9e3-16465bc49c48 Co-authored-by: jcanton <5622559+jcanton@users.noreply.github.com>
| grid_shape: Final[GridShape | None] = None | ||
| radius: float = constants.EARTH_RADIUS | ||
| radius: float | None = constants.EARTH_RADIUS | ||
| domain_length: float | None = None | ||
| domain_height: float | None = None | ||
| global_num_cells: int | None = None | ||
| num_cells: int | None = None | ||
| num_edges: int | None = None | ||
| num_vertices: int | None = None | ||
| characteristic_length: float | None = None | ||
| limited_area: bool = False |
There was a problem hiding this comment.
What I had more in mind for this is something like:
- torus_or_icosahedron_params: IcosahedronParams | TorusParams (with a better variable name)
- num_cells: int
- num_edges: int
- num_vertices: int
- limited_area: bool
More concretely:
- no
Noneparameters, we should almost always be able to figure out what the parameters are - following from the previous, torus/icosahedron parameters should be variant-like, not sometimes set, sometimes not set
- either all of num cells/edges/vertices are stored here, or none are
- limited area: not sure if this belongs here or not
- charecteristic length: probably belongs next to the mean edge lengths etc., it's directly derived from them
@jcanton @nfarabullini @OngChia do you have opinions on what this should look like?
There was a problem hiding this comment.
Here are my 2 cents:
- why did you add
Noneto radius if it anyway has a default value? The Nonetype is only specified because the default value is None - how about
meshParamsas an alternative totorus_or_icosahedron_params? - where would you place
limited_areainstead? - I'm ok if you move
charecteristic_length
There was a problem hiding this comment.
- Because it doesn't make sense for torus to have a radius. It was a poor solution.
- Mesh params sounds like a more promising name, I'm also considering keeping something related to "grid" and "shape"... I think we've tried to avoid mixing "grid" and "mesh" since they are mostly the same as far as I know, and so far we prefer "grid"
- It's also in
GridConfig. I don't know yet if we can keep only one of these. - 👍 for characteristic length
There was a problem hiding this comment.
One more: num_cells, num_edges, num_vertices also have a helper class: HorizontalGridSize. We should probably reuse that here, or remove it from here if HorizontalGridSize anyway lives on its own.
There was a problem hiding this comment.
Ok then how about CustomGridParams because simply GridParams might be too generic. Thank you for answer the other questions. As far as I'm concerned, you can go ahead with the changes
There was a problem hiding this comment.
Yeah, agree on GridParams being quite generic. Not sure Custom makes it less generic, but I'll have a think about it. Thanks for the suggestions!
GlobalGridParamsdataclass (model/common/src/icon4py/model/common/grid/icon.py):grid_shaperequired (non-Optional)global_num_cellsfield (theoretical full-sphere count, not used in production)num_edgesandnum_verticesfields (only used in test definitions, grid size info belongs in GridConfig)characteristic_lengthfield (dead field, never populated - computed in geometry.py)limited_areafield (redundant with GridConfig.limited_area)compute_mean_cell_area_for_spherefunction (dead code, never called)__post_init__to reflect removed fieldsgeometry_typeandsubdivisionproperties (no Optional return)GridDescription(model/testing/src/icon4py/model/testing/definitions.py):num_edges,num_vertices,limited_areafields toGridDescriptionglobal_num_cellsfrom params constructionGlobalGridParams()constructionglobal_num_cells,mean_cell_areafrom test parametersglobal_num_cells, updateparams.num_edges/params.num_verticesreferencesparams.limited_areareferencesparams.limited_areareferences