|
1 | 1 | # Initialisation |
2 | | -using Plots, Printf, Statistics, LinearAlgebra, JLD2 |
| 2 | +using Printf, Statistics, LinearAlgebra, JLD2 |
| 3 | +import Plots as pt |
3 | 4 | # Macros |
4 | 5 | @views av(A) = 0.25*(A[1:end-1,1:end-1].+A[2:end,1:end-1].+A[1:end-1,2:end].+A[2:end,2:end]) |
5 | 6 | @views av_xa(A) = 0.5*(A[1:end-1,:].+A[2:end,:]) |
@@ -255,26 +256,22 @@ end |
255 | 256 | end |
256 | 257 | Pt .+= γ_eff.*Rp |
257 | 258 | end |
| 259 | + |
258 | 260 | # Plotting |
259 | | - p1 = heatmap(xc, yc, ∇V' , aspect_ratio=1, c=:inferno, title="∇V", xlims=(-Lx/2,Lx/2), xlabel="x", ylabel="y") |
260 | | - p2 = heatmap(xc, yc, Pt' , aspect_ratio=1, c=:inferno, title="Pt", xlims=(-Lx/2,Lx/2), xlabel="x", ylabel="y") |
261 | | - p3 = plot(title="Convergence", xlabel="DR iterations / nx",ylabel="errors") |
262 | | - p3 = plot!(err_evo_it/ncx, log10.(err_evo_V), label="V") |
263 | | - p3 = plot!(err_evo_it/ncx, log10.(err_evo_P), label="P") |
264 | | - # p3 = plot!(err_evo_it/ncx, log10.(ϵ.*ones(size(err_evo_it))), label="tol") |
265 | | - p4 = heatmap(xc, yc, log10.(ηc)' , aspect_ratio=1, c=:inferno, title="ηc", xlims=(-Lx/2,Lx/2), xlabel="x", ylabel="y") |
266 | | - display(plot(p1, p2, p3, p4)) |
| 261 | + p1 = pt.heatmap(xc, yc, ∇V' , aspect_ratio=1, c=:inferno, title="∇V", xlims=(-Lx/2,Lx/2), xlabel="x", ylabel="y") |
| 262 | + p2 = pt.heatmap(xc, yc, Pt' , aspect_ratio=1, c=:inferno, title="Pt", xlims=(-Lx/2,Lx/2), xlabel="x", ylabel="y") |
| 263 | + p3 = pt.plot(title="Convergence", xlabel="DR iterations / nx",ylabel="errors") |
| 264 | + p3 = pt.plot!(err_evo_it/ncx, log10.(err_evo_V), label="V") |
| 265 | + p3 = pt.plot!(err_evo_it/ncx, log10.(err_evo_P), label="P") |
| 266 | + p4 = pt.heatmap(xc, yc, log10.(ηc)' , aspect_ratio=1, c=:inferno, title="ηc", xlims=(-Lx/2,Lx/2), xlabel="x", ylabel="y") |
| 267 | + display(pt.plot(p1, p2, p3, p4)) |
| 268 | + |
267 | 269 | @show iter/ncx |
268 | 270 | n = length(ηc) |
269 | 271 | @show η_h = 1.0 / sum(1.0/n ./ηc) |
270 | 272 | @show η_g = exp( sum( 1.0/n*log.(ηc))) |
271 | 273 | @show η_a = mean(ηc) |
272 | 274 |
|
273 | | - # save("./results/compressible_K2e0_PH.jld2", "err_evo_it", err_evo_it, "ncx", ncx, "err_evo_V", err_evo_V, "err_evo_P", err_evo_P, "xc", xc, "yc", yc, "∇V", ∇V ) |
274 | | - # save("./results/compressible_K2e3_PH.jld2", "err_evo_it", err_evo_it, "ncx", ncx, "err_evo_V", err_evo_V, "err_evo_P", err_evo_P, "xc", xc, "yc", yc, "∇V", ∇V ) |
275 | | - # save("./results/compressible_K2e0_1step.jld2", "err_evo_it", err_evo_it, "ncx", ncx, "err_evo_V", err_evo_V, "err_evo_P", err_evo_P, "xc", xc, "yc", yc, "∇V", ∇V ) |
276 | | - # save("./results/compressible_K2e3_1step.jld2", "err_evo_it", err_evo_it, "ncx", ncx, "err_evo_V", err_evo_V, "err_evo_P", err_evo_P, "xc", xc, "yc", yc, "∇V", ∇V ) |
277 | | - |
278 | 275 | return |
279 | 276 | end |
280 | 277 |
|
|
0 commit comments