Repository navigation
Conversation
At the right bound of the local subdomain, `TensorFemSpace.eval_field` and `eval_field_gradient` moved back by one knot from the span given by `find_span`, which selects an empty knot span (and yields NaN) if the bound is a knot of multiplicity larger than one. Add the option `side='left'` to `psydac.core.bsplines.find_span`, which selects the non-empty knot span on the left of an interior knot of any multiplicity. Use it in the new private method `TensorFemSpace._find_local_span`, which replaces the code duplicated in `eval_field` and `eval_field_gradient`. Add unit tests for `find_span` with `side='left'`, and an MPI test which evaluates a linear field and its gradient on the closed local subdomains with simple, repeated and mixed knot multiplicities. Fixes #612.
Unlike `TensorFemSpace.eval_field`, `eval_field_gradient` did not update the ghost regions of the field coefficients when they were not in sync, and did not check the space of the weights. Add both, and check the weights with `is not None` in both methods. Add helper functions to the tests in `psydac.fem.tests.test_tensor`, and add an MPI test which evaluates the field or its gradient (separately) on the closed local subdomains, starting from coefficients whose ghost regions are not in sync.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 16 |
| Duplication | 4 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
yguclu
marked this pull request as ready for review
October 9, 2026 16:05
yguclu
marked this pull request as draft
October 9, 2026 22:20
yguclu
marked this pull request as ready for review
October 9, 2026 22:21
jowezarek
self-requested a review
October 15, 2026 12:37
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix NaN values in the parallel point evaluation of fields at subdomain boundaries with repeated knots, as reported in #612, and make
TensorFemSpace.eval_field_gradientbehave likeeval_field.Fixes #612
Changes
psydac.core.bsplines.find_span: add the optionside, with values'right'(default, unchanged behavior) or'left'. Withside='left', ifxis an interior knot of any multiplicity, the function selects the non-empty knot span on the left ofx, i.e. such thatknots[span] < x <= knots[span+1]. It does so by skipping back over all copies ofxin the knot sequence.TensorFemSpace._find_local_span: new private method, which replaces the code duplicated ineval_fieldandeval_field_gradient. It moves a point lying outside of the local interval by at most one machine epsilon onto its closest bound, and usesfind_spanwithside='left'on the right bound of the local interval, whose right knot span belongs to the next process. The special case of the domain end is no longer needed.TensorFemSpace.eval_field_gradient: likeeval_field, update the ghost regions of the coefficients if they are not in sync, and check the space of the weights. In both methods, check the weights withis not None.Tests
psydac/core/tests/test_bsplines.py: newtest_find_span_side, for degrees 1 to 3 and simple, repeated, and mixed knot multiplicities.psydac/fem/tests/test_tensor.py:test_TensorFemSpace_eval_field_parallel(MPI): evaluates the linear fieldf(x, y) = x + 2yand its gradient on the closed local subdomains, with simple, repeated, and mixed knot multiplicities. Without the fix, the repeated and mixed cases fail (NaN) on all processes except the last one along each direction.test_TensorFemSpace_eval_field_ghost_regions(MPI): evaluates the field or its gradient (separately), starting from coefficients whose ghost regions are not in sync. Without the change toeval_field_gradient, the gradient case fails.The MPI tests pass on 1, 2, and 4 processes.
Notes
On
devel,psydac/fem/tests/test_plot_field_2d.py::test_plot_field[True-*]fails because a two-patch domain is built without interface orientation; this is fixed in #527 and unrelated to this PR.Related bugs: #474, #613.