🚀[FEA]: Add non-periodic boundary mode to grid-gradient operators
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Domain
- backend, machine-learning
Research direction
Start with physicsnemo.nn.functional.derivatives.rectilinear_grid_gradient and uniform_grid_gradient, then trace their torch and Warp forward and backward paths. Add the opt-in boundary mode while preserving periodic defaults, and verify analytic interior and boundary derivatives, uniform-grid equivalence, backend parity, autograd coverage, documentation, and the CHANGELOG entry.
Written by the indexing model from the issue text.
Description
Is this a new feature, an improvement, or a change to existing functionality?
Improvement
How would you describe the priority of this feature request?
Medium
Please provide a clear description of the problem you would like to solve.
physicsnemo.nn.functional.derivatives.rectilinear_grid_gradient and uniform_grid_gradient currently use periodic wrapping (for example, via torch.roll) at domain boundaries. On bounded, non-periodic domains this mixes values from opposite edges and produces incorrect boundary-row gradients.
Add an opt-in non-periodic boundary mode that:
- preserves the existing 3-point non-uniform central stencil in the interior;
- uses appropriate one-sided stencils only at the lower and upper boundaries;
- is implemented consistently in the torch and Warp backends, including forward and backward paths; and
- keeps periodic behavior as the default, so existing callers see no behavior change.
A suggested API is:
boundary: Literal["periodic", "one_sided"] = "periodic"
An explicit boundary mode is preferable to periodic: bool because it is self-documenting and leaves room for other boundary treatments later.
Suggested validation and acceptance criteria:
- analytic checks for both interior and boundary derivatives;
- equivalence between rectilinear and uniform-grid implementations on uniform coordinates;
- parity between torch and Warp backends;
- autograd coverage;
- documentation for the new argument; and
- a CHANGELOG entry.
This would make the gradient helpers reusable for bounded-domain problems without requiring each caller to mask or replace corrupted boundary values.
Describe any alternatives you have considered
Callers can currently ignore or mask the boundary rows, or implement separate one-sided differences outside PhysicsNeMo. That duplicates numerical logic across applications and still requires special handling around the existing operator. Changing the current behavior globally is not viable because it would break callers that depend on periodic wrapping.
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 824
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 70
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NVIDIA/physicsnemo
-
Wasserstein CDF distance uses the first width for every binPossibly taken @sylvesterkaczmarek claimed this 22 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
NVIDIA/physicsnemo#2042 ·
Maintainers usually reply within 2 days
-
🐛[BUG]: Darcy2D Jacobi kernel divides grad(k)·grad(u) by 2dx instead of 4dx², so the data doesn't solve the Darcy equationPossibly taken @coreyjadams claimed this 20 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/physicsnemo#2036 · 2 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
🐛[BUG]: MHD_PDE equation "B_grad_u" uses v * Bx.diff(y) instead of By * u.diff(y)Possibly taken @aaguadob claimed this 27 days ago. Open? - Needs Triage bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
NVIDIA/physicsnemo#2021 ·
Maintainers usually reply within 2 days
-
🐛[BUG]: Diffusion(time=True) in darcy_physics_informed/utils.py silently drops the time-derivative termPossibly taken @aaguadob claimed this 27 days ago. Open? - Needs Triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NVIDIA/physicsnemo#2020 ·
Maintainers usually reply within 2 days
-
🐛[BUG]: DistributedManager's SLURM setup connects to the srun launch node, not to rank 0's nodePossibly taken @peterdsharpe claimed this 1 day ago. Open? - Needs Triage bug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
NVIDIA/physicsnemo#2168 ·
Maintainers usually reply within 2 days
All issues in NVIDIA/physicsnemo
Similar issues
-
The changelog workflow excludes otelbot but not dependabot, so every Dependabot pull request fails the changelog checkPossibly taken @ocelotl claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 82/100
open-telemetry/opentelemetry-python#5825 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cuga-project/cuga-agent#1020 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
microsoft/playwright#43640 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
stac-utils/stac-fastapi-elasticsearch-opensearch#965 ·
Maintainers usually reply within 2 days
-
from-review-extraction library privacy python severity:suggested
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
LearningCircuit/local-deep-research#7951 ·
Maintainers usually reply within 2 days