MOLE.jl: New Grids module - #411
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
9dcc97f to
f8a2ae9
Compare
|
@Tony-Drummond and @joehellmers , can you still review this PR? Thank you |
6261599 to
6da444b
Compare
6da444b to
22319dc
Compare
|
@joehellmers , @Tony-Drummond , are you still able to review this PR? |
|
This pull request has had no activity for 14 days. It will be marked |
There was a problem hiding this comment.
Pull request overview
Adds a Julia Grids module for constructing and validating computational grids.
Changes:
- Adds grid types, coordinate generation, validation, and constructors.
- Supports uniform grids, boundary metadata, and 2D curvilinear grids.
- Adds documentation and automated tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
docs/src/index.md |
Documents the Grids API. |
src/MOLE.jl |
Loads the new module. |
src/Grids/Grids.jl |
Defines module exports and includes. |
src/Grids/coordinates.jl |
Generates grid coordinates. |
src/Grids/make_grid.jl |
Adds grid constructors. |
src/Grids/topologies.jl |
Defines grid data structures. |
src/Grids/validate_grid.jl |
Implements validation and normalization. |
test/runtests.jl |
Registers grid tests. |
test/Grids/make_grid.jl |
Tests grid construction. |
test/Grids/validate_grid.jl |
Tests validation and edge cases. |
Suppressed comments (3)
julia/MOLE.jl/src/Grids/validate_grid.jl:257
- The 2D partial fallback drops all valid supplied values (
m,n, and any available spacing or boundary data), leaving onlydimandtopology. Preserve and validate the fields that are present so the returned object can actually be completed incrementally.
return Grid{Float64}(dim = 2, topology = topology)
julia/MOLE.jl/src/Grids/validate_grid.jl:314
- The 3D partial fallback discards
m,n,o, and any supplied spacing or boundary values. A partial grid should retain and validate its present fields rather than returning an empty shell, otherwise subsequentmakeGrid(grid)calls cannot recover the user's definition.
return Grid{Float64}(dim = 3, topology = topology)
julia/MOLE.jl/src/Grids/validate_grid.jl:209
- If either
mornis absent, this partial-grid branch calls the parametricGrid{T}constructor without a type-bearing value from whichTcan be inferred. ThusvalidateGrid(Dict(:dim=>2, :topology=>:curvilinear); allowPartial=true)throws instead of returning a partial grid. Specify an element type here (consistent with the other partial branches), while separately retaining any supplied fields.
return Grid(dim = 2, topology = :curvilinear)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| end | ||
|
|
||
| dim = get(raw, :dim, _infer_dim(raw)) | ||
| topology = Symbol(get(raw, :topology, _infer_topology(raw))) |
There was a problem hiding this comment.
Thank you. Explicit topology values are now validated and carried through the complete normalization paths. An explicit :periodic topology is preserved and, when no boundary coefficients are supplied, marks all coordinate directions periodic. Explicit topology values that conflict with supplied boundary metadata now raise an ArgumentError, and unsupported symbols are rejected even for partial grids. Regression tests cover these cases.
| elseif any(haskey(raw, k) for k in (:x, :y, :z)) | ||
| return :nonuniform |
| ) | ||
| end | ||
|
|
||
| return Grid{Float64}(dim = 1, topology = topology) |
| if topology == :curvilinear | ||
| if haskey(raw, :m) && haskey(raw, :n) | ||
| return _normalize_curvilinear_2d(raw, bc_raw) |
| end | ||
|
|
||
| faces, centers = _coordinates_curvilinear_2d(nodes) | ||
| bc = _normalize_bc(bc_raw, 4) |
| function _validate_positive_spacing(value, name) | ||
| value = float(value) | ||
|
|
||
| if value <= 0 |
What type of PR is this? (check all applicable)
Description
This PR adds a Grids module for the MOLE.jl Julia implementation. This contains new functions, tests, and documentation. A follow-up PR will be created to make the Operators compatible (and retro-compatible) with the new Grid module.
Related Issues & Documents
Added/updated tests?
_We encourage you to test all code included with MOLE, including examples.
have not been included
Read Contributing Guide and Code of Conduct