Skip to content

Commit

Permalink
add a sensitivity example of Pine Island Glacier
Browse files Browse the repository at this point in the history
  • Loading branch information
enigne committed May 29, 2024
1 parent 64401e6 commit d140317
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Binary file added data/PIG_Control_B_dJUICE.mat
Binary file not shown.
Binary file added data/PIG_Control_drag_dJUICE.mat
Binary file not shown.
26 changes: 26 additions & 0 deletions examples/sensitivity_PIG.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Enzyme
Enzyme.API.typeWarning!(false)
Enzyme.Compiler.RunAttributor[] = false

using DJUICE
using MAT

#Load model from MATLAB file
file = matopen(joinpath(@__DIR__, "..", "Data","PIG_Control_drag_dJUICE.mat"))

mat = read(file, "md")
close(file)
md = model(mat)

#make model run faster
md.stressbalance.maxiter = 20

#Now call AD!
md.inversion.iscontrol = 1
md.inversion.independent = md.friction.coefficient
md.inversion.independent_string = "FrictionCoefficient"

md = solve(md, :grad)

# the gradient
g = md.results["StressbalanceSolution"]["Gradient"]

0 comments on commit d140317

Please sign in to comment.