diff --git a/blast/validation/agardValidation.py b/blast/validation/agardValidation.py index 0b887faac6bba390274d51e1e67d58160cc7d2b6..a97d4d484f4f25922c0175f5ec2f3d518152aa88 100644 --- a/blast/validation/agardValidation.py +++ b/blast/validation/agardValidation.py @@ -18,19 +18,7 @@ # @author Paul Dechamps # @date 2022 -# Test the blast implementation. The test case is a compressible attached transitional flow. -# Tested functionalities; -# - Time integration. -# - Two time-marching techniques (agressive and safe). -# - Transition routines. -# - Forced transition. -# - Compressible flow routines. -# - Laminar and turbulent flow. -# -# Untested functionalities. -# - Separation routines. -# - Multiple failure case at one iteration. -# - Response to unconverged inviscid solver. +# Test the blast implementation on the 3D AGARD wing # Imports. @@ -68,7 +56,7 @@ def cfgInviscid(nthrds, verb): 'dbc' : True, 'Upstream' : 'upstream', # Freestream - 'M_inf' : 0.954, # freestream Mach number + 'M_inf' : 0.96, # freestream Mach number 'AoA' : 1, # freestream angle of attack # Geometry 'S_ref' : 0.35, # reference surface length @@ -89,7 +77,7 @@ def cfgInviscid(nthrds, verb): def cfgBlast(verb): return { 'Re' : 6.7e6, # Freestream Reynolds number - 'Minf' : 0.954, # Freestream Mach number (used for the computation of the time step only) + 'Minf' : 0.96, # Freestream Mach number (used for the computation of the time step only) 'CFL0' : 1, # Inital CFL number of the calculation 'sections' : np.linspace(0.026, 0.7, 15), @@ -121,49 +109,69 @@ def main(): icfg = cfgInviscid(args.k, args.verb) vcfg = cfgBlast(args.verb) - parsViscous = {'nLe': 15, 'nMid': 30, 'nTe': 7, 'nSpan': 60, 'nWake': 30, - 'progLe': 1.07, 'progMid': 1.0, 'progTe': 1.0, 'progSpan': 1.0, 'progWake': 1.15} - vMsh = viscUtils.mesh(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/models/dart/agard445_visc.geo', parsViscous) - vcfg['vMsh'] = vMsh - - tms['pre'].start() - coupler, iSolverAPI, vSolver = viscUtils.initBlast(icfg, vcfg) - tms['pre'].stop() - - print(ccolors.ANSI_BLUE + 'PySolving...' + ccolors.ANSI_RESET) - tms['solver'].start() - aeroCoeffs = coupler.run() - tms['solver'].stop() - - # Display results. - print(ccolors.ANSI_BLUE + 'PyRes...' + ccolors.ANSI_RESET) - print(' Re M alpha Cl Cd Cdp Cdf Cm') - print('{0:6.1f}e6 {1:8.2f} {2:8.1f} {3:8.4f} {4:8.4f} {5:8.4f} {6:8.4f} {7:8.4f}'.format(vcfg['Re']/1e6, iSolverAPI.getMinf(), iSolverAPI.getAoA()*180/math.pi, iSolverAPI.getCl(), vSolver.Cdt, vSolver.Cdp, vSolver.Cdf, iSolverAPI.getCm())) - - # Write results to file. - vSolution = viscUtils.getSolution(vSolver) - - # Write results to file. - for iSec in range(len(iSolverAPI.cfg['EffSections'])): - vSolution = viscUtils.getSolution(vSolver, iSec) - viscUtils.write(vSolution, vSolver.getRe(), sfx='slice'+str(iSec)) - vSolution['Cdt_int'] = vSolver.Cdf + iSolverAPI.getCd() - - # Save pressure coefficient - iSolverAPI.save(sfx='_viscous') - tms['total'].stop() - - print(ccolors.ANSI_BLUE + 'PyTiming...' + ccolors.ANSI_RESET) - print('CPU statistics') - print(tms) - print('SOLVERS statistics') - print(coupler.tms) - + AoAVec = [-1, 0., 1] + sfxVec = ['_AoAminus1deg', '_AoA0deg', '_AoA1deg'] + for i in range(3): + vcfg['sfx'] = sfxVec[i] + icfg['AoA'] = AoAVec[i] + + parsViscous = {'nLe': 15, 'nMid': 30, 'nTe': 7, 'nSpan': 60, 'nWake': 30, + 'progLe': 1.07, 'progMid': 1.0, 'progTe': 1.0, 'progSpan': 1.0, 'progWake': 1.15} + vMsh = viscUtils.mesh(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/models/dart/agard445_visc.geo', parsViscous) + vcfg['vMsh'] = vMsh + + tms['pre'].start() + coupler, iSolverAPI, vSolver = viscUtils.initBlast(icfg, vcfg) + tms['pre'].stop() + + print(ccolors.ANSI_BLUE + 'PySolving...' + ccolors.ANSI_RESET) + tms['solver'].start() + aeroCoeffs = coupler.run() + tms['solver'].stop() + + # Display results. + print(ccolors.ANSI_BLUE + 'PyRes...' + ccolors.ANSI_RESET) + print(' Re M alpha Cl Cd Cdp Cdf Cm') + print('{0:6.1f}e6 {1:8.2f} {2:8.1f} {3:8.4f} {4:8.4f} {5:8.4f} {6:8.4f} {7:8.4f}'.format(vcfg['Re']/1e6, iSolverAPI.getMinf(), iSolverAPI.getAoA()*180/math.pi, iSolverAPI.getCl(), vSolver.Cdt, vSolver.Cdp, vSolver.Cdf, iSolverAPI.getCm())) + + # Write results to file. + vSolution = viscUtils.getSolution(vSolver) + + # Write results to file. + for iSec in range(len(iSolverAPI.cfg['EffSections'])): + vSolution = viscUtils.getSolution(vSolver, iSec) + viscUtils.write(vSolution, vSolver.getRe(), sfx=sfxVec[i]+'slice'+str(iSec)) + vSolution['Cdt_int'] = vSolver.Cdf + iSolverAPI.getCd() + tms['total'].stop() + + print(ccolors.ANSI_BLUE + 'PyTiming...' + ccolors.ANSI_RESET) + print('CPU statistics') + print(tms) + print('SOLVERS statistics') + print(coupler.tms) + + cps = [] + for s in sfxVec: + cps_s = [] + for i in range(len(vcfg['writeSections'])): + cps_s.append(np.loadtxt('/Users/pauldechamps/lab/softwares/blaster/workspace/blast_validation_agardValidation/agard445_viscous'+s+'_slice_'+str(i)+'.dat', delimiter=',', skiprows=1)) + cps.append(cps_s) + # Plotting + from matplotlib import pyplot as plt + for i in range(len(vcfg['writeSections'])): + plt.figure(i) + for j in range(len(sfxVec)): + plt.plot(cps[j][i][:,3], cps[j][i][:,4], label=sfxVec[j].replace('_', ' ')) + plt.legend() + plt.title('Section ' + str(i)) + plt.xlabel('x') + plt.ylabel('cp') + plt.show() # Test solution print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET) tests = CTests() tests.add(CTest('Cl', iSolverAPI.getCl(), 0.069, 5e-2)) - tests.add(CTest('Cd wake', vSolution['Cdt_int'], 0.00498, 1e-3, forceabs=True)) + tests.add(CTest('Cd', vSolution['Cdt_int'], 0.00498, 1e-3, forceabs=True)) tests.add(CTest('Iterations', len(aeroCoeffs), 8, 0, forceabs=True)) tests.run() diff --git a/blast/validation/lannValidation.py b/blast/validation/lannValidation.py index 870d67fb74d662404e41d12036708eb9e868712d..f5e865925ca0f310cfdada7ec3eb750ce2877f0e 100644 --- a/blast/validation/lannValidation.py +++ b/blast/validation/lannValidation.py @@ -18,19 +18,7 @@ # @author Paul Dechamps # @date 2022 -# Test the blast implementation. The test case is a compressible attached transitional flow. -# Tested functionalities; -# - Time integration. -# - Two time-marching techniques (agressive and safe). -# - Transition routines. -# - Forced transition. -# - Compressible flow routines. -# - Laminar and turbulent flow. -# -# Untested functionalities. -# - Separation routines. -# - Multiple failure case at one iteration. -# - Response to unconverged inviscid solver. +# Test the blast implementation on the 3D LANN wing. # Imports. diff --git a/blast/validation/oneraValidation.py b/blast/validation/oneraValidation.py index 3c0d239551906db5425f858a1753f52adf60b6e9..cb9af04aba1ac3f44ca2572ff00b376f3e510fdd 100644 --- a/blast/validation/oneraValidation.py +++ b/blast/validation/oneraValidation.py @@ -18,19 +18,7 @@ # @author Paul Dechamps # @date 2022 -# Test the blast implementation. The test case is a compressible attached transitional flow. -# Tested functionalities; -# - Time integration. -# - Two time-marching techniques (agressive and safe). -# - Transition routines. -# - Forced transition. -# - Compressible flow routines. -# - Laminar and turbulent flow. -# -# Untested functionalities. -# - Separation routines. -# - Multiple failure case at one iteration. -# - Response to unconverged inviscid solver. +# Test the blast implementation on the 3D ONERA M6 wing. # Imports.