Skip to content

Commit

Permalink
Bug fix and found bug/missing method
Browse files Browse the repository at this point in the history
  • Loading branch information
zjwegert committed Sep 14, 2024
1 parent af22b1b commit e2d8dd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions scripts/Embedded/MWEs/zach_embedded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ cutgeo = cut(model,geo)
diff_Ωin = DifferentiableTriangulation(Ωin)
diff_Ωout = DifferentiableTriangulation(Ωout)

f(x)=x[1]+x[2]
fh = interpolate(f,V_φ)
fh = interpolate(x->x[1]+x[2],V_φ)

dΩin = Measure(diff_Ωin,2*order)
j_in(φ) = (f)dΩin # <- Cannot take fh due to missing method?
j_in(φ) = (fh)dΩin
# j_in(φ) = ∫(cos ∘ fh)dΩin # <- this breaks
dj_in = gradient(j_in,φh)
dj_vec_in = assemble_vector(dj_in,V_φ)
norm(dj_vec_in)

dΩout = Measure(diff_Ωout,2*order)
j_out(φ) = (f)dΩout
j_out(φ) = (fh)dΩout
dj_out = gradient(j_out,φh)
dj_vec_out = -assemble_vector(dj_out,V_φ)
norm(dj_vec_out)
Expand Down Expand Up @@ -128,17 +128,16 @@ cutgeo = cut(model,geo)
diff_Ωin = DifferentiableTriangulation(Ωin)
diff_Ωout = DifferentiableTriangulation(Ωout)

f(x)=x[1]+x[2]+x[3]
fh = interpolate(f,V_φ)
fh = interpolate(x->x[1]+x[2]+x[3],V_φ)

dΩin = Measure(diff_Ωin,2*order)
j_in(φ) = (f)dΩin # <- Cannot take fh due to missing method?
j_in(φ) = (fh)dΩin # <- Cannot take fh due to missing method?
dj_in = gradient(j_in,φh)
dj_vec_in = assemble_vector(dj_in,V_φ)
norm(dj_vec_in)

dΩout = Measure(diff_Ωout,2*order)
j_out(φ) = (f)dΩout
j_out(φ) = (fh)dΩout
dj_out = gradient(j_out,φh)
dj_vec_out = -assemble_vector(dj_out,V_φ)
norm(dj_vec_out)
Expand Down
2 changes: 1 addition & 1 deletion scripts/Embedded/differentiable_trians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ end

function Geometry.get_glue(ttrian::DifferentiableTriangulation{Dc},val::Val{d}) where {Dc,d}
if isnothing(ttrian.cell_values)
get_glue(ttrian.trian,val)
return get_glue(ttrian.trian,val)
end
if d != Dc
return nothing
Expand Down

0 comments on commit e2d8dd7

Please sign in to comment.