diff --git a/scripts/Embedded/2d_thermal.jl b/scripts/Embedded/2d_thermal.jl index c0a21ce..d3678a5 100644 --- a/scripts/Embedded/2d_thermal.jl +++ b/scripts/Embedded/2d_thermal.jl @@ -49,7 +49,7 @@ function main() ## Optimisation functionals J(u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(∇(u)⋅∇(u))dΩ1 dJ(q,u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(∇(u)⋅∇(u)*q)dΓ; - Vol(u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(1/vol_D)dΩ1 - ∫(vf)dΩ; + Vol(u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(1/vol_D)dΩ1 - ∫(vf/vol_D)dΩ; dVol(q,u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(-1/vol_D*q)dΓ ## IntegrandWithEmbeddedMeasure @@ -78,17 +78,17 @@ function main() optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh; γ,γ_reinit,verbose=true,constraint_names=[:Vol]) for (it,uh,φh) in optimiser - dΩ1,_,dΓ = get_meas(φh) + _Ω1,_,_Γ = get_embedded_triangulations(embedded_meas) if iszero(it % iter_mod) - writevtk(dΩ1.quad.trian,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) - writevtk(dΓ.quad.trian,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(dΓ.quad.trian)]) + writevtk(_Ω1,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) + writevtk(_Γ,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(_Γ)]) end write_history(path*"/history.txt",optimiser.history) end it = get_history(optimiser).niter; uh = get_state(pcfs) - dΩ1,_,dΓ = get_meas(φh) - writevtk(dΩ1.quad.trian,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) - writevtk(dΓ.quad.trian,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(dΓ.quad.trian)]) + _Ω1,_,_Γ = get_embedded_triangulations(embedded_meas) + writevtk(_Ω1,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) + writevtk(_Γ,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(_Γ)]) end main() \ No newline at end of file diff --git a/scripts/Embedded/2d_thermal_optimised.jl b/scripts/Embedded/2d_thermal_optimised.jl index 24dc88c..684f88a 100644 --- a/scripts/Embedded/2d_thermal_optimised.jl +++ b/scripts/Embedded/2d_thermal_optimised.jl @@ -50,7 +50,7 @@ function main() ## Optimisation functionals J(u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(∇(u)⋅∇(u))dΩ1 dJ(q,u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(∇(u)⋅∇(u)*q)dΓ; - Vol(u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(1/vol_D)dΩ1 - ∫(vf)dΩ; + Vol(u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(1/vol_D)dΩ1 - ∫(vf/vol_D)dΩ; dVol(q,u,φ,dΩ,dΓ_N,dΩ1,dΩ2,dΓ) = ∫(-1/vol_D*q)dΓ ## IntegrandWithEmbeddedMeasure @@ -79,17 +79,17 @@ function main() optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;reinit_mod=5, γ,γ_reinit,verbose=true,constraint_names=[:Vol]) for (it,uh,φh) in optimiser - dΩ1,_,dΓ = get_meas(φh) + _Ω1,_,_Γ = get_embedded_triangulations(embedded_meas) if iszero(it % iter_mod) - writevtk(dΩ1.quad.trian,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) - writevtk(dΓ.quad.trian,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(dΓ.quad.trian)]) + writevtk(_Ω1,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) + writevtk(_Γ,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(_Γ)]) end write_history(path*"/history.txt",optimiser.history) end it = get_history(optimiser).niter; uh = get_state(pcfs) - dΩ1,_,dΓ = get_meas(φh) - writevtk(dΩ1.quad.trian,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) - writevtk(dΓ.quad.trian,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(dΓ.quad.trian)]) + _Ω1,_,_Γ = get_embedded_triangulations(embedded_meas) + writevtk(_Ω1,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) + writevtk(_Γ,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(_Γ)]) end main() \ No newline at end of file diff --git a/scripts/Embedded/2d_thermal_optimised_MPI.jl b/scripts/Embedded/2d_thermal_optimised_MPI.jl index 47b7783..6d49ff9 100644 --- a/scripts/Embedded/2d_thermal_optimised_MPI.jl +++ b/scripts/Embedded/2d_thermal_optimised_MPI.jl @@ -81,7 +81,7 @@ function main(parts,distribute) optimiser = AugmentedLagrangian(pcfs,ls_evo,vel_ext,φh;reinit_mod=5, γ,γ_reinit,verbose=i_am_main(ranks),constraint_names=[:Vol]) for (it,uh,φh) in optimiser - _Ω1,_,_Γ = get_embedded_triangulations(φh,embedded_meas) + _Ω1,_,_Γ = get_embedded_triangulations(embedded_meas) if iszero(it % iter_mod) writevtk(_Ω1,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) writevtk(_Γ,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(_Γ)]) @@ -89,7 +89,7 @@ function main(parts,distribute) write_history(path*"/history.txt",optimiser.history;ranks) end it = get_history(optimiser).niter; uh = get_state(pcfs) - _Ω1,_,_Γ = get_embedded_triangulations(φh,embedded_meas) + _Ω1,_,_Γ = get_embedded_triangulations(embedded_meas) writevtk(_Ω1,path*"Omega_out$it",cellfields=["φ"=>φh,"|∇(φ)|"=>(norm ∘ ∇(φh)),"uh"=>uh]) writevtk(_Γ,path*"Gamma_out$it",cellfields=["normal"=>get_normal_vector(_Γ)]) end diff --git a/scripts/Embedded/embedded_measures.jl b/scripts/Embedded/embedded_measures.jl index 1de0c87..96e514b 100644 --- a/scripts/Embedded/embedded_measures.jl +++ b/scripts/Embedded/embedded_measures.jl @@ -119,7 +119,7 @@ function get_embedded_measures(φ,s::EmbeddedMeasureCache) return s.measures end -function get_embedded_triangulations(φ,s::EmbeddedMeasureCache) +function get_embedded_triangulations(s::EmbeddedMeasureCache) return s.trians end