if __name__ == '__main__': base = split(split(split(os.getcwd())[0])[0])[0] skip = 0 for poly_order in [1]: full_path = os.path.join( base, f"build/src/cutfem/stokes_time/errors-d2o{poly_order}.csv") head = list(map(str.strip, open(full_path).readline().split(","))) data = np.genfromtxt(full_path, delimiter=",", skip_header=True) data = data[skip:, :] conv_plots( data, head, title=r"$\textrm{Time dep. Stokes, (impl. Euler), element order: (" + str(poly_order + 1) + ", " + str(poly_order) + ")}$", domain_length=0.205) plt.savefig(f"figure-o{poly_order}.pdf") # Create a EOC-plot eoc_plot( data, head, title= r"\textrm{Time dep. Stokes (impl. Euler) EOC, element order: (" + str(poly_order + 1) + ", " + str(poly_order) + ")}", domain_lenght=0.205, lines_at=np.array([0, 1]) + poly_order) plt.savefig(f"eoc-o{poly_order}.pdf")
import os from os.path import split import numpy as np import matplotlib.pyplot as plt from utils.plot import conv_plots if __name__ == '__main__': base = split(split(os.getcwd())[0])[0] for poly_order in [1, 2]: full_path = os.path.join( base, f"build/src/poisson/errors-o{poly_order}-dg.csv") head = list(map(str.strip, open(full_path).readline().split(","))) data = np.genfromtxt(full_path, delimiter=",", skip_header=True) conv_plots(data, head, title=r"$\textrm{Poisson: polynomial order: " + str(poly_order) + "}$", latex=True) plt.show()
1: "Galerkin Least Squares" } for poly_order in [1, 2]: full_path = os.path.join( base, f"build/src/streamline_diffusion/errors-o{poly_order}-eps={eps}-rho={rho}.csv" ) head = list(map(str.strip, open(full_path).readline().split(","))) data = np.genfromtxt(full_path, delimiter=",", skip_header=True) data = data[skip:, :] conv_plots(data, head, title=r"$\textrm{" + names[rho] + ": " r"polynomial order: " + str(poly_order) + "}$" r", $\epsilon=" + str(float(eps)) + r"$, $\rho=" + str(rho) + "$", latex=True) hs = data[:, 0] l2 = data[:, 1] h1 = data[:, 2] eoc_l2 = np.log(l2[:-1] / l2[1:]) / np.log(hs[:-1] / hs[1:]) eoc_h1 = np.log(h1[:-1] / h1[1:]) / np.log(hs[:-1] / hs[1:]) print() print("========================================") print("EOC (L2): ", eoc_l2) print("EOC (H1): ", eoc_h1) print("========================================")
skip = 1 eps = "0.001000" # eps = "0.100000" for poly_order in [1, 2]: full_path = os.path.join( base, f"build/src/advection_diffusion/errors-o{poly_order}-eps={eps}-dg.csv" ) head = list(map(str.strip, open(full_path).readline().split(","))) data = np.genfromtxt(full_path, delimiter=",", skip_header=True) data = data[skip:, :] conv_plots( data, head, title=r"$\textrm{Advection Diffusion DG: polynomial order: " + str(poly_order) + ", eps: " + str(float(eps)) + "}$") hs = data[:, 0] l2 = data[:, 1] h1 = data[:, 2] eoc_l2 = np.log(l2[:-1] / l2[1:]) / np.log(hs[:-1] / hs[1:]) eoc_h1 = np.log(h1[:-1] / h1[1:]) / np.log(hs[:-1] / hs[1:]) print() print("========================================") print("EOC (L2): ", eoc_l2) print("EOC (H1): ", eoc_h1) print("========================================") plt.show()
from utils.plot import conv_plots if __name__ == '__main__': base = split(split(os.getcwd())[0])[0] skip = 0 for poly_order in [1, 2]: full_path = os.path.join(base, f"build/src/stokes/errors-o{poly_order}.csv") head = list(map(str.strip, open(full_path).readline().split(","))) data = np.genfromtxt(full_path, delimiter=",", skip_header=True) data = data[skip:, :] conv_plots(data, head, title=r"$\textrm{Stokes: polynomial order: (" + str(poly_order + 1) + ", " + str(poly_order) + ")}$") hs = data[:, 0] l2 = data[:, 1] h1 = data[:, 2] eoc_l2 = np.log(l2[:-1] / l2[1:]) / np.log(hs[:-1] / hs[1:]) eoc_h1 = np.log(h1[:-1] / h1[1:]) / np.log(hs[:-1] / hs[1:]) print() print("========================================") print("EOC (L2): ", eoc_l2) print("EOC (H1): ", eoc_h1) print("========================================") plt.savefig(f"figure-o{poly_order}.pdf") plt.show()
import os from os.path import split import numpy as np import matplotlib.pyplot as plt from utils.plot import conv_plots, eoc_plot if __name__ == '__main__': base = split(split(split(os.getcwd())[0])[0])[0] skip = 0 for poly_order in [1, 2]: full_path = os.path.join(base, f"build/src/nitsche/poisson/errors-d2o{poly_order}.csv") head = list(map(str.strip, open(full_path).readline().split(","))) data = np.genfromtxt(full_path, delimiter=",", skip_header=True) data = data[skip:, :] conv_plots(data, head, title=r"$\textrm{Poisson, element order: " + str(poly_order) + "}$", domain_length=2) # plt.savefig(f"figure-o{poly_order}.pdf") # Create a EOC-plot eoc_plot(data, head, title=r"\textrm{Poisson EOC, element order: " + str(poly_order) + "}", domain_lenght=2, lines_at=np.array([0, 1]) + poly_order) # plt.savefig(f"eoc-o{poly_order}.pdf") plt.show()
if __name__ == '__main__': base = split(split(split(os.getcwd())[0])[0])[0] skip = 0 for poly_order in [1, 2]: full_path = os.path.join( base, f"build/src/cutfem/stokes_gen/errors-d2o{poly_order}.csv") head = list(map(str.strip, open(full_path).readline().split(","))) data = np.genfromtxt(full_path, delimiter=",", skip_header=True) data = data[skip:, :] conv_plots( data, head, title=r"$\textrm{Generalized Stokes (cutFEM), element order: (" + str(poly_order + 1) + ", " + str(poly_order) + ")}$", domain_length=0.41) # plt.savefig(f"figure-o{poly_order}.pdf") # Create a EOC-plot eoc_plot( data, head, title=r"\textrm{Generalized Stokes (cutFEM) EOC, element order: (" + str(poly_order + 1) + ", " + str(poly_order) + ")}", domain_lenght=0.41, lines_at=np.array([0, 1, 2]) + poly_order) # plt.savefig(f"eoc-o{poly_order}.pdf") plt.show()
convergence_plot_report() skip = 0 xlabel = "M" for poly_order in degrees: full_path = os.path.join(base, f"build/src/cutfem/heat_eqn", folder, f"errors-d2o{poly_order}.csv") head = list(map(str.strip, open(full_path).readline().split(",")))[1:-1] data = np.genfromtxt(full_path, delimiter=",", skip_header=True) data = data[skip:, 1:-1] conv_plots(data, head, title=r"$\textrm{Heat Equation (CutFEM), element order: " + str(poly_order) + "}$", domain_length=domain_length, xlabel=xlabel) plt.savefig(f"figure-o{poly_order}.pdf") # Create a EOC-plot eoc_plot(data, head, title=r"\textrm{Heat Equation (CutFEM) EOC, element order: " + str(poly_order) + "}", domain_lenght=domain_length, lines_at=np.array([0, 1]) + poly_order, xlabel=xlabel) plt.savefig(f"eoc-o{poly_order}.pdf") plt.show()
import os from os.path import split import numpy as np import matplotlib.pyplot as plt from utils.plot import conv_plots if __name__ == '__main__': base = split(split(os.getcwd())[0])[0] skip = 0 for poly_order in [2, 3]: full_path = os.path.join( base, f"build/src/artificial_diffusion/errors-o{poly_order}-eps=0.100000.csv" ) head = list(map(str.strip, open(full_path).readline().split(","))) data = np.genfromtxt(full_path, delimiter=",", skip_header=True) data = data[skip:, :] conv_plots(data, head, title=r"$\textrm{Artificial Diffusion: polynomial order: " + str(poly_order) + ", eps=0.1}$", latex=True) plt.show()