Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic differentiation in chunks #44

Merged
merged 17 commits into from
May 17, 2021
Merged

Automatic differentiation in chunks #44

merged 17 commits into from
May 17, 2021

Conversation

jdeldre
Copy link
Collaborator

@jdeldre jdeldre commented May 17, 2021

This PR enables carrying out automatic differentiation of functions with respect to positions and strength of elements in chunks that are smaller than the vector of elements. This should make the differentiation (gradient, jacobian) faster for larger systems. Consider, e.g.,

nblob = 15
pos = rand(ComplexF64,nblob)
str = rand(length(pos))
σ = 1e-2
blobs = Vortex.Blob.(pos,str,σ)

and we wish to differentiate velocity evaluated at a single point,

z = rand(ComplexF64)
compute_velocity(v) = induce_velocity(z,v,0.0)

with respect to blob positions. To enable the differentiation in chunks of size 3, for example, set

N = 3
cfg = PotentialFlow.Utils.ComplexGradientConfig(compute_velocity,blobs,PotentialFlow.Utils.Chunk{N}())
dwdz, dwdzstar = PotentialFlow.Elements.gradient_position(compute_velocity,blobs,cfg)

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.

1 participant