Repository navigation
Guide: finite-difference data, samples, reconstruction and difference operators (#321) - #514
Open
berkgeveci wants to merge 1 commit into
Open
berkgeveci wants to merge 1 commit into
berkgeveci wants to merge 1 commit into
Conversation
jlee-kitware
reviewed
Dec 5, 2026
| dtype=tack.f64) | ||
| shifted.fields["t"] = td.Field(td.H1(shifted), tack.array(samples)) | ||
|
|
||
| where = np.array([[0.5, 0.5, 0.0], [0.05, 0.5, 0.0]]) |
Collaborator
There was a problem hiding this comment.
(0.5, 0.5) is a vertex shared by four solver cells, so the constant reading's 1.125 is whichever cell probe picks. A point inside one cell would make the comparison read cleanly.
jlee-kitware
reviewed
Dec 5, 2026
| data.fields["velocity"] = td.Field(td.Constant(data), velocity) | ||
|
|
||
| print(data.fields["velocity"].values.numpy()[:2]) | ||
| assert np.allclose(velocity.numpy()[:, 0], np.tile(np.arange(nx) + 0.5, ny)) |
Collaborator
There was a problem hiding this comment.
Check v too, since the y-faces' indexing is the easier one to get wrong.
Collaborator
|
Clear, and the x² counterexample makes the point in a few lines. Two nits inline. |
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.
Step 1 of the finite-difference plan (#513, issue #321): a guide,
docs/visualization/finite-difference.md, beside the finite-volume guide. It documents what Tack does today, so it stands on its own whatever the plan's review decides.u = x²counterexample.finite_differences(derivative=2)gives exactly 2; the linear reconstruction between the same samples is the chord,h²/4above the parabola midway.H1,ConstantandValuesread them as. Point and cellValuesare read trilinearly and as constant by any filter that needs a basis, which the page says plainly.Constant, or trilinearly as the points of a grid shifted by half a cell, which covers only the centres' hull.finite_differencesagainstgradients: the operator against the reconstruction, with orders 2, 4 and 6 converging onsin(x), and its rules at edges, hidden points, ghost layers and cell data.Linked from the visualization index, the nav and the finite-volume guide's "Where to go next".
Every marked example runs, and prints what the page shows.
mkdocs build --strictis clean.This will be merged after the 0.8 release.
🤖 Generated with Claude Code