From 1632222c371ebb7d2a1f382a6c723106280aaebf Mon Sep 17 00:00:00 2001 From: Luke Roberts Date: Wed, 25 Sep 2024 17:42:42 -0600 Subject: [PATCH] update script --- example/poisson_gmg/plot_convergence.py | 51 ++++++++++++++++--------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/example/poisson_gmg/plot_convergence.py b/example/poisson_gmg/plot_convergence.py index 89caa569a906..06816c08f1bd 100644 --- a/example/poisson_gmg/plot_convergence.py +++ b/example/poisson_gmg/plot_convergence.py @@ -19,35 +19,48 @@ plt.style.use("tableau-colorblind10") solver = "BiCGSTAB" +solver_lbl = "BCGS" difco = 1e6 +refine = True + for bound_pro in ["Constant", "Linear"]: - for interior_pro in ["Constant", "OldLinear"]: - - p = subprocess.run( - [ - "./poisson-gmg-example", - "-i", - "parthinput.poisson", - "poisson/solver=" + solver, - "poisson/interior_D=" + str(difco), - "poisson/prolongation=" + bound_pro, - "poisson/solver_params/prolongation=" + interior_pro, - ], - capture_output=True, - text=True, - ) - dat = np.genfromtxt(p.stdout.splitlines()) + for interior_pro in ["Constant", "Linear", "SplitLin", "Kwak"]: + command = ["./poisson-gmg-example", "-i", "parthinput.poisson"] + command.append("poisson/solver=" + solver) + command.append("poisson/interior_D=" + str(difco)) + command.append("poisson/boundary_prolongation=" + bound_pro) + if interior_pro == "SplitLin": + command.append("poisson/solver_params/prolongation=Default") + else: + command.append("poisson/interior_prolongation=" + interior_pro) + command.append("poisson/solver_params/prolongation=User") + + if refine: + command.append("parthenon/static_refinement0/x1min=-1.0") + command.append("parthenon/static_refinement0/x1max=-0.75") + command.append("parthenon/static_refinement0/x2min=-1.0") + command.append("parthenon/static_refinement0/x2max=-0.75") + command.append("parthenon/static_refinement0/level=3") + p = subprocess.run(command, capture_output=True, text=True) + lines = p.stdout.splitlines() + # Ignore any initialization junk that gets spit out earlier from adding parameters + idx = lines.index("# [0] v-cycle") + dat = np.genfromtxt(lines[idx:]) + label = "{}_{}".format(solver_lbl, interior_pro) + if refine: + label = "{}_{}_Bnd{}".format(solver_lbl, interior_pro, bound_pro) plt.semilogy( dat[:, 0], dat[:, 1], - label=solver + "_" + str(difco) + "_" + bound_pro + "_" + interior_pro, + label=label.replace("Constant", "Const").replace("Linear", "Lin"), ) -plt.legend(loc="upper right") -plt.ylim([1.0e-14, 1e2]) +plt.legend() +plt.ylim([1.0e-14, 1e4]) plt.xlim([0, 40]) plt.xlabel("# of V-cycles") plt.ylabel("RMS Residual") +plt.title("$D_{int} = 10^6$ w/ Refinement") plt.savefig("convergence_1e6.pdf")