Skip to content

Commit 0ee08ef

Browse files
committed
update sensitivity example with finer mesh;
1 parent ec1a596 commit 0ee08ef

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
99
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
1010
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
1111
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
12+
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
1213
JSOSolvers = "10dff2fc-5484-5881-a0e0-c90441020f8a"
1314
MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
1415
MadNLP = "2621e9c9-9eb4-46b1-8089-e8c72242dfb6"
@@ -24,6 +25,7 @@ Triangulate = "f7e6ffb2-c36d-4f8f-a77e-16e897189344"
2425
ColorSchemes = "3.25"
2526
Enzyme = "0.13"
2627
Flux = "0.16"
28+
JLD2 = "0.6.2"
2729
JSOSolvers = "0.14.1"
2830
MAT = "0.10"
2931
MadNLP = "0.8"

data/PIG_Control_drag_dJUICE.mat

-225 KB
Binary file not shown.

examples/sensitivity_PIG.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
using DJUICE
22
using MAT
3+
using GLMakie
34

45
#Load model from MATLAB file
5-
file = matopen(joinpath(@__DIR__, "..", "Data","PIG_Control_drag_dJUICE.mat"))
6+
file = matopen(joinpath(@__DIR__, ".","PIG_Control_drag_dJUICE.mat"))
67

78
mat = read(file, "md")
89
close(file)
910
md = model(mat)
1011

1112
#make model run faster
12-
md.stressbalance.maxiter = 20
13+
md.stressbalance.maxiter = 100
1314

1415
#Now call AD!
1516
md.inversion.iscontrol = 1
17+
md.friction.coefficient = 30*ones(size(md.friction.coefficient))
1618
md.inversion.independent = md.friction.coefficient
1719
md.inversion.independent_string = "FrictionCoefficient"
1820
md.inversion.dependent_string = ["SurfaceAbsVelMisfit"]
@@ -21,3 +23,9 @@ md = solve(md, :sb)
2123

2224
# the gradient
2325
g = md.results["StressbalanceSolution"]["Gradient"]
26+
27+
plotmodel(md, abs.(g), caxis=(0.0,5e-3))
28+
29+
# save results to MAT for postproc
30+
filename = "sensitivity_PIG.mat"
31+
matwrite(filename, Dict("Gradient1" => g))

0 commit comments

Comments
 (0)