Skip to content

Commit

Permalink
Added a few more functions
Browse files Browse the repository at this point in the history
  • Loading branch information
zjwegert committed Sep 15, 2024
1 parent e2d8dd7 commit e2c29ec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/Embedded/MWEs/zach_embedded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,20 @@ diff_Ωout = DifferentiableTriangulation(Ωout)
fh = interpolate(x->x[1]+x[2],V_φ)

dΩin = Measure(diff_Ωin,2*order)
j_in(φ) = (fh)dΩin
# j_in(φ) = ∫(cos ∘ fh)dΩin # <- this breaks
j_in(φ) = (cos fh)dΩin
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(φ) = (fh)dΩout
j_out(φ) = (cos fh)dΩout
dj_out = gradient(j_out,φh)
dj_vec_out = -assemble_vector(dj_out,V_φ)
norm(dj_vec_out)

Γ = EmbeddedBoundary(cutgeo)
= Measure(Γ,2*order)
dj_expected(q) = (-fh*q/(norm ((φh))))dΓ
dj_expected(q) = (-(cos fh)*q/(norm ((φh))))dΓ
dj_exp_vec = assemble_vector(dj_expected,V_φ)
norm(dj_exp_vec)

Expand Down
12 changes: 12 additions & 0 deletions scripts/Embedded/differentiable_trians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,15 @@ function Geometry.get_glue(ttrian::DifferentiableTriangulation{Dc},val::Val{d})
tface_to_mface_map = ref_cell_map
FaceToFaceGlue(tface_to_mface,tface_to_mface_map,nothing)
end

function CellData.change_domain(a::CellField,strian::DifferentiableTriangulation,sds::ReferenceDomain,ttrian::Triangulation,tds::ReferenceDomain)
change_domain(a,strian.trian,sds,ttrian,tds)
end

function CellData.change_domain(a::CellField,strian::DifferentiableTriangulation,sds::ReferenceDomain,ttrian::DifferentiableTriangulation,tds::ReferenceDomain)
change_domain(a,strian.trian,sds,ttrian.trian,tds)
end

function CellData.change_domain(a::CellField,strian::Triangulation,sds::ReferenceDomain,ttrian::DifferentiableTriangulation,tds::ReferenceDomain)
change_domain(a,strian,sds,ttrian.trian,tds)
end

0 comments on commit e2c29ec

Please sign in to comment.