Skip to content

Fields given their gradient; world derivatives from the field's view - #299

Open
jlee-kitware wants to merge 4 commits into
Kitware:mainfrom
jlee-kitware:vis/given-gradients
Open

jlee-kitware wants to merge 4 commits into
Kitware:mainfrom
jlee-kitware:vis/given-gradients

Conversation

@jlee-kitware

Copy link
Copy Markdown
Collaborator

Fields given their gradient; world derivatives from the field's view

Problem
A solver often knows its gradients better than the basis does: a lattice Boltzmann solver's central differences, a finite-volume reconstruction. world_gradient, world_jet and gradients could only differentiate the field's basis.

Approach

  • Field(space, values, unit, gradient=g): g is a field on the same topology, with 3 values per entry for a scalar, and 3k row by row for a vector of k.
  • world_gradient and world_jet ask the field's view. By default they differentiate the basis as before, from a mixin on every field view whose basis gives derivatives (_derivative_mixins in _space_parts). A view that already defines world_gradient keeps its own, so a space that computes its values can supply its derivatives.
  • A field given its gradient reads g. Its world_jet pairs it with a NaN Hessian, which a gradient does not determine.
  • gradients reads a given gradient, row by row for a vector, so flow_quantities and every kernel built on these use the solver's derivatives.
  • A given gradient on polyhedral meshes is refused for now.

Verified
tack-vis on CPU and CUDA, including tests for world_gradient, world_jet, gradients and flow_quantities reading a given gradient, for the validation of g, and for point data keeping its gradient.

A solver's derivatives are its own: a finite-volume reconstruction, or a
lattice Boltzmann solver's from its populations. Field(..., gradient=) takes
that gradient as a field on the same topology (gradients' layout), and
world_gradient and world_jet ask the field's view, which reads it, or a space's
own derivatives, or else differentiates the basis as before. gradients splits
a vector's given gradient into its rows, so flow_quantities and every kernel on
world_gradient use the solver's derivatives.
@berkgeveci berkgeveci added this to the 0.7 milestone Nov 4, 2026
jlee-kitware added a commit to jlee-kitware/tack that referenced this pull request Nov 4, 2026
…face

# Conflicts:
#	packages/tack-vis/tests/test_field_resolver.py
#	packages/tack-vis/tests/test_given_gradients.py

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants