diff --git a/blast/coupler.py b/blast/coupler.py index 2878d67f8d1bb29607c63671310a522894251a5a..58430e8e2d4bbaabc7fb114a7cf9d0e7551b0f14 100644 --- a/blast/coupler.py +++ b/blast/coupler.py @@ -79,7 +79,7 @@ class Coupler: self.tms['inviscid'].start() if self.resetInviscid: self.isol.reset() - self.isol.run() + iEc = self.isol.run() self.tms['inviscid'].stop() # Write inviscid Cp distribution. @@ -98,7 +98,7 @@ class Coupler: # Run viscous solver. self.tms['viscous'].start() - exitCode = self.vsol.run() + vEc = self.vsol.run() self.tms['viscous'].stop() aeroCoeffs['Cl'].append(self.isol.getCl()) @@ -111,7 +111,9 @@ class Coupler: error = abs((cd - cdPrev) / cd) if cd != 0 else 1 if error <= self.tol: - print(ccolors.ANSI_GREEN, '{:>4.0f}| {:>7.5f} {:>7.5f} {:>7.5f} | {:>6.4f} {:>6.4f} | {:>6.3f}\n'.format(couplIter, self.isol.getCl(), self.isol.getCd()+self.vsol.Cdf, self.vsol.Cdt, self.vsol.getAverageTransition(0), self.vsol.getAverageTransition(1), np.log10(error)), ccolors.ANSI_RESET) + print(ccolors.ANSI_GREEN, '{:>4.0f}| {:>7.5f} {:>7.5f} {:>7.5f} | {:>6.4f} {:>6.4f} | {:>5.0f} {:>5.0f} | {:>6.3f}\n'.format(couplIter, self.isol.getCl(), self.isol.getCd()+self.vsol.Cdf, self.vsol.Cdt, self.vsol.getAverageTransition(0), self.vsol.getAverageTransition(1), iEc, vEc, np.log10(error)), ccolors.ANSI_RESET) + if iEc != 0 or vEc != 0: + print(ccolors.ANSI_RED, 'Warning: Solver(s) did not converge', ccolors.ANSI_RESET) if write: self.isol.writeCp(sfx='_viscous'+self.filesfx) return aeroCoeffs @@ -119,10 +121,10 @@ class Coupler: if couplIter == 0: print('') - print('{:>5s}| {:>7s} {:>7s} {:>7s} | {:>6s} {:>6s} | {:>6s}'.format('It', 'Cl', 'Cd', 'Cdwake', 'xtrT', 'xtrB', 'Error')) + print('{:>5s}| {:>7s} {:>7s} {:>7s} | {:>6s} {:>6s} | {:>5s} {:>5s} | {:>6s}'.format('It', 'Cl', 'Cd', 'Cdwake', 'xtrT', 'xtrB', 'iOut', 'vOut', 'Error')) print(' ----------------------------------------------------------') if couplIter % self.iterPrint == 0: - print(' {:>4.0f}| {:>7.5f} {:>7.5f} {:>7.5f} | {:>6.4f} {:>6.4f} | {:>6.3f}'.format(couplIter, self.isol.getCl(), self.isol.getCd()+self.vsol.Cdf, self.vsol.Cdt, self.vsol.getAverageTransition(0), self.vsol.getAverageTransition(1), np.log10(error))) + print(' {:>4.0f}| {:>7.5f} {:>7.5f} {:>7.5f} | {:>6.4f} {:>6.4f} | {:>5.0f} {:>5.0f} | {:>6.3f}'.format(couplIter, self.isol.getCl(), self.isol.getCd()+self.vsol.Cdf, self.vsol.Cdt, self.vsol.getAverageTransition(0), self.vsol.getAverageTransition(1), iEc, vEc, np.log10(error))) if self.isol.getVerbose() != 0 or self.vsol.verbose != 0: print('') couplIter += 1