def test(self): labels = ['L2u', 'L2v', 'L2p'] df1 = run_spatial('plane-poiseuille-flow.i', 7, "velocity_interp_method='average'", 'two_term_boundary_expansion=false', "--error", "--error-unused", y_pp=labels, mpi=16) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=labels, marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('plane-poiseuille-average-first.png') for key, value in fig.label_to_slope.items(): if key == 'L2p': self.assertTrue(fuzzyAbsoluteEqual(value, 1., .1)) else: self.assertTrue(fuzzyAbsoluteEqual(value, 2., .1))
def test(self): labels = ['L2u', 'L2v', 'L2p'] df1 = mms.run_spatial('2d-average.i', 6, y_pp=labels) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=labels, marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('2d-average.png') for key,value in fig.label_to_slope.items(): print("%s, %f" % (key, value)) if key == 'L2p': self.assertTrue(fuzzyAbsoluteEqual(value, 1., .1)) else: self.assertTrue(fuzzyAbsoluteEqual(value, 2., .1))
def test(self): df1 = mms.run_spatial('advection-outflow.i', 7, y_pp=['L2u', 'L2v']) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=['L2u', 'L2v'], marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('outflow.png') for label, value in fig.label_to_slope.items(): if label == 'L2u': self.assertTrue(fuzzyAbsoluteEqual(value, 1., .05)) else: self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
def test(self): df1 = run_spatial('2d-rc.i', 6, y_pp=['L2u', 'L2v', 'L2p'], mpi=16) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=['L2u', 'L2v', 'L2p'], marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('rc-2d.png') for key,value in fig.label_to_slope.items(): print("%s, %f" % (key, value)) self.assertTrue(fuzzyAbsoluteEqual(value, 2., .15))
def test(self): labels = ['L2u', 'L2v', 'L2p', 'L2t'] df1 = mms.run_spatial('2d-average-with-temp.i', 7, "velocity_interp_method='rc'", y_pp=labels, mpi=16) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=labels, marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('2d-rc-with-temp.png') for key,value in fig.label_to_slope.items(): print("%s, %f" % (key, value)) self.assertTrue(fuzzyAbsoluteEqual(value, 2., .1))
def test(self): labels = ['L2u', 'L2v', 'L2p'] df1 = run_spatial('rotated-pp-flow.i', 6, "velocity_interp_method='rc'", "--error", y_pp=labels, mpi=8) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=labels, marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('plane-poiseuille-rc.png') for key,value in fig.label_to_slope.items(): print("%s, %f" % (key, value)) self.assertTrue(fuzzyAbsoluteEqual(value, 2., .1))
def test(self): labels = ['L2rho', 'L2rho_u', 'L2rho_et'] df1 = run_spatial('hllc-mms.i', list(range(6,12)), "--allow-test-objects", "--error", y_pp=labels, mpi=6) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=labels, marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('hllc.png') for key,value in fig.label_to_slope.items(): print("%s, %f" % (key, value)) self.assertTrue(fuzzyAbsoluteEqual(value, 1., .05))
def test(self): velocity_labels = ['L2u', 'L2v'] pressure_labels = ['L2p'] labels = velocity_labels + pressure_labels df1 = run_spatial('skewed-vortex.i', 5, y_pp=labels, mpi=2) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=labels, marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('skewed.png') for key, value in fig.label_to_slope.items(): print("%s, %f" % (key, value)) if key in velocity_labels: self.assertTrue(fuzzyAbsoluteEqual(value, 2., .2)) else: self.assertTrue(fuzzyAbsoluteEqual(value, 1., .2))
def test(self): df1 = run_spatial('1d-rc-no-diffusion.i', 5, "--error", "--error-unused", "--error-deprecated", y_pp=['L2u', 'L2p']) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=['L2u', 'L2p'], marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('1d-rc-no-diffusion.png') for key, value in fig.label_to_slope.items(): print("%s, %f" % (key, value)) if (key == 'L2u'): self.assertTrue(fuzzyAbsoluteEqual(value, 1.5, .1)) else: self.assertTrue(fuzzyAbsoluteEqual(value, 1., .1))
def test(self): df1 = mms.run_spatial('limited-advection.i', 9, "FVKernels/advection_u/limiter='vanLeer'", y_pp=['L2u']) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=['L2u'], marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('vanLeer-limiter.png') for label, value in fig.label_to_slope.items(): self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
def test(self): df1 = mms.run_spatial( 'kt-limited-advection.i', 11, "FVKernels/advection_u/limiter='central_difference'", y_pp=['L2u']) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=['L2u'], marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('kt-cd-limiter.png') for key, value in fig.label_to_slope.items(): self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05)) print("%s slope, %f" % (key, value))
def test(self): labels = ['L2u', 'L2v', 'L2p'] df1 = run_spatial('2d-rc-rz-symmetry.i', list(range(1, 6)), "--error", y_pp=labels, mpi=8) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=labels, marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('2d-rc-rz-symmetry.png') for key, value in fig.label_to_slope.items(): print("%s, %f" % (key, value)) self.assertTrue(fuzzyAbsoluteEqual(value, 2., .1))
def test(self): df1 = run_spatial('pressure-interpolation-corrected.i', 7, "--error", "--error-unused", "--error-deprecated", y_pp=['L2u', 'L2v', 'L2p'], mpi=8) fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error') fig.plot(df1, label=['L2u', 'L2v', 'L2p'], marker='o', markersize=8, num_fitted_points=3, slope_precision=1) fig.save('pressure-interpolation-corrected.png') for key, value in fig.label_to_slope.items(): print("%s, %f" % (key, value)) self.assertTrue(fuzzyAbsoluteEqual(value, 2., .1))