Skip to content

Commit

Permalink
add cooldown to 3d heater example
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeGehring committed Oct 19, 2023
1 parent 210eb83 commit 4caacef
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions docs/julia/heater_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ T0 = calculate_temperature(
Ω_w = Triangulation(model, tags = "core")
dΩ_w = Measure(Ω_w, 1)

println("Average Temperature: ", ((temperature(T0))dΩ_w) / ((1)dΩ_w), " K")
println(
"Average Temperature of silicon waveguide: ",
((temperature(T0))dΩ_w) / ((1)dΩ_w),
" K",
)

writevtk(
Ω,
Expand Down Expand Up @@ -145,12 +149,40 @@ uₕₜ = calculate_temperature_transient(
# )
# end
#end
sums = [(t, ((u)dΩ_w) / ((1)dΩ_w)) for (u, t) in uₕₜ]
sums_heatup = [(t, ((u)dΩ_w) / ((1)dΩ_w)) for (u, t) in uₕₜ]

uₕₜ = calculate_temperature_transient(
ϵ_conductivities τ,
ϵ_diffisitivities τ,
power_density(p0) * 0,
temperatures,
temperature(T0),
2e-7,
2e-4,
#solver = PETScLinearSolver(),
)

#createpvd("poisson_transient_solution") do pvd
# for (uₕ, t) in uₕₜ
# pvd[t] = createvtk(
# Ω,
# "poisson_transient_solution_$t" * ".vtu",
# cellfields = ["u" => uₕ],
# )
# end
#end
sums_cooldown = [(t, ((u)dΩ_w) / ((1)dΩ_w)) for (u, t) in uₕₜ]

figure = Figure()
ax = Axis(figure[1, 1], ylabel = "Temperature / K", xlabel = "time / ms")
ax = Axis(
figure[1, 1],
ylabel = "Average silicon waveguide temperature / K",
xlabel = "time / ms",
)

t, s = getindex.(sums, 1), getindex.(sums, 2)
t, s = getindex.(sums_heatup, 1), getindex.(sums_heatup, 2)
lines!(ax, t * 1e3, s)
t, s = getindex.(sums_cooldown, 1), getindex.(sums_cooldown, 2)
lines!(ax, t * 1e3, s)
display(figure)
# end

0 comments on commit 4caacef

Please sign in to comment.