diff --git a/dart/default.py b/dart/default.py index 2a05db4c7d7df4fea350cfbbccf08e48559e4686..6d118f069ca053b2076fbe60e6f54c7aa5f7ac6b 100644 --- a/dart/default.py +++ b/dart/default.py @@ -224,3 +224,20 @@ def initViewer(problem): if not args.nogui: from tbox.viewer import GUI GUI().open( problem.msh.name ) + +def plot(x, y, cfg): + """Plot data with check + + Parameters + ---------- + x : array of float + x-data + y : array of float + y-data + cfg : dictionary + plot configuration + """ + args = parseargs() + if not args.nogui: + import tbox.utils as utils + utils.plot(x, y, cfg) diff --git a/dart/tests/lift.py b/dart/tests/lift.py index 345eacf55887f3b92bbba5097f267f1cee508a3b..a541a8368e1d8d04883bd9fa0cfa5c86661bc27b 100644 --- a/dart/tests/lift.py +++ b/dart/tests/lift.py @@ -80,7 +80,7 @@ def main(): # visualize solution and plot results floD.initViewer(pbl) - tboxU.plot(Cp[:,0], Cp[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(solver.Cl, solver.Cd, solver.Cm, 4), 'invert': True}) + floD.plot(Cp[:,0], Cp[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(solver.Cl, solver.Cd, solver.Cm, 4), 'invert': True}) # check results print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET) diff --git a/dart/tests/morpher.py b/dart/tests/morpher.py index 1c9e6a386e79434fb16a969b212c0d594eb39806..ff109a79c72bc2e30467e1aa3495e416320fa059 100644 --- a/dart/tests/morpher.py +++ b/dart/tests/morpher.py @@ -128,8 +128,8 @@ def main(): print(tms) # visualize solution and plot results - tboxU.plot(Cp[:,0], Cp[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(solver.Cl, solver.Cd, solver.Cm, 4), 'invert': True}) - tboxU.plot(Cp_ref[:,0], Cp_ref[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(solver_ref.Cl, solver_ref.Cd, solver_ref.Cm, 4), 'invert': True}) + floD.plot(Cp[:,0], Cp[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(solver.Cl, solver.Cd, solver.Cm, 4), 'invert': True}) + floD.plot(Cp_ref[:,0], Cp_ref[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(solver_ref.Cl, solver_ref.Cd, solver_ref.Cm, 4), 'invert': True}) # check results print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET) diff --git a/dart/tests/nonlift.py b/dart/tests/nonlift.py index c9c543be6f9fbcde1f14521f0a3fd7a06f4e68df..17effbc1737c4a60b0d9977f257ef9e94ac31db8 100644 --- a/dart/tests/nonlift.py +++ b/dart/tests/nonlift.py @@ -80,7 +80,7 @@ def main(): # visualize solution and plot results floD.initViewer(pbl) - tboxU.plot(Cp[:,0], Cp[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(solver.Cl, solver.Cd, solver.Cm, 4), 'invert': True}) + floD.plot(Cp[:,0], Cp[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(solver.Cl, solver.Cd, solver.Cm, 4), 'invert': True}) # check results print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET) diff --git a/dart/validation/agard.py b/dart/validation/agard.py index b2debb13fd29bbcb8b39f9b5e4df7fa7f7bd8de0..bda122b06e122184eaff19b4aa55188cf912239f 100644 --- a/dart/validation/agard.py +++ b/dart/validation/agard.py @@ -85,7 +85,7 @@ def main(): if canPost: floU.writeSlices(msh.name,[0.01, 0.37, 0.75],5) data = tbxU.read('agard445_slice_1.dat') - tbxU.plot(data[:,3], data[:,4], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Pressure distribution at MAC', 'invert': True}) + floD.plot(data[:,3], data[:,4], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Pressure distribution at MAC', 'invert': True}) tms['post'].stop() # display timers diff --git a/dart/validation/onera.py b/dart/validation/onera.py index 90d65952246cea415444779b6d0c27fcd6f0235c..e06d623cb17f17c73ac9a21052ef4254c251c955 100644 --- a/dart/validation/onera.py +++ b/dart/validation/onera.py @@ -83,7 +83,7 @@ def main(): if canPost: floU.writeSlices(msh.name,[0.01, 0.239, 0.526, 0.777, 0.957, 1.076, 1.136, 1.184],5) data = tbxU.read('oneraM6_slice_2.dat') - tbxU.plot(data[:,3], data[:,4], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Pressure distribution at MAC', 'invert': True}) + floD.plot(data[:,3], data[:,4], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Pressure distribution at MAC', 'invert': True}) tms['post'].stop() # display timers diff --git a/ext/amfe b/ext/amfe index e3b7f5ec2f629f6516a9d68e55637468c161f9d0..348dbe9ed37b0840e2098382c25b5e8d537bb3aa 160000 --- a/ext/amfe +++ b/ext/amfe @@ -1 +1 @@ -Subproject commit e3b7f5ec2f629f6516a9d68e55637468c161f9d0 +Subproject commit 348dbe9ed37b0840e2098382c25b5e8d537bb3aa diff --git a/vii/tests/bli2D.py b/vii/tests/bli2D.py index 14e5c75f35b66946895e40e17a659cad6bd38793..e4456e222a8674c6d14904c26465161de6ca2f32 100644 --- a/vii/tests/bli2D.py +++ b/vii/tests/bli2D.py @@ -105,8 +105,8 @@ def main(): print(Coupler.tms) # Plot results. - tboxU.plot(Cp[:,0], Cp[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(iSolverAPI.getCl(), vSolver.Cdt, iSolverAPI.getCm(), 4), 'invert': True}) - tboxU.plot(vSolution['x/c'], vSolution['Cf'], {'xlabel': '$x/c$', 'ylabel': '$c_f$', 'title': 'Cdt = {0:.{3}f}, Cdf = {1:.{3}f}, Cdp = {2:.{3}f}'.format(vSolver.Cdt, vSolver.Cdf, vSolver.Cdp, 4), 'xlim': [0, 1]}) + invDefault.plot(Cp[:,0], Cp[:,3], {'xlabel': 'x', 'ylabel': 'Cp', 'title': 'Cl = {0:.{3}f}, Cd = {1:.{3}f}, Cm = {2:.{3}f}'.format(iSolverAPI.getCl(), vSolver.Cdt, iSolverAPI.getCm(), 4), 'invert': True}) + invDefault.plot(vSolution['x/c'], vSolution['Cf'], {'xlabel': '$x/c$', 'ylabel': '$c_f$', 'title': 'Cdt = {0:.{3}f}, Cdf = {1:.{3}f}, Cdp = {2:.{3}f}'.format(vSolver.Cdt, vSolver.Cdf, vSolver.Cdp, 4), 'xlim': [0, 1]}) # Check results. # Test for n0012 (le=0.01, te=0.01), alpha=2, M=.2, Re=1e7.