Skip to content
Snippets Groups Projects
Verified Commit 3e9aa7b7 authored by Paul Dechamps's avatar Paul Dechamps :speech_balloon:
Browse files

(feat) Average of transition

Driver now computes the average position of the transition
parent bc2c3362
No related branches found
No related tags found
1 merge request!1BLASTER v1.0
Pipeline #19927 passed
......@@ -87,7 +87,7 @@ class Coupler:
print('{:>5s}| {:>7s} {:>7s} {:>7s} | {:>6s} {:>6s} | {:>6s}'.format('It', 'Cl', 'Cd', 'Cdwake', 'xtrT', 'xtrB', 'Error'))
print(' ----------------------------------------------------------')
if couplIter % self.iterPrint == 0:
print(' {:>4.0f}| {:>7.4f} {:>7.4f} {:>7.4f} | {:>6.4f} {:>6.4f} | {:>6.3f}'.format(couplIter, self.iSolverAPI.getCl(), self.iSolverAPI.getCd()+self.vSolver.Cdf, self.vSolver.Cdt, self.vSolver.getxoctr(0, 0), self.vSolver.getxoctr(0, 1), np.log10(error)))
print(' {:>4.0f}| {:>7.4f} {:>7.4f} {:>7.4f} | {:>6.4f} {:>6.4f} | {:>6.3f}'.format(couplIter, self.iSolverAPI.getCl(), self.iSolverAPI.getCd()+self.vSolver.Cdf, self.vSolver.Cdt, self.vSolver.getAvrgxoctr(0), self.vSolver.getAvrgxoctr(1), np.log10(error)))
if self.iSolverAPI.getVerbose() != 0 or self.vSolver.verbose != 0:
print('')
couplIter += 1
......@@ -97,6 +97,6 @@ class Coupler:
print('')
print('{:>5s}| {:>7s} {:>7s} {:>7s} | {:>6s} {:>8s} | {:>6s}'.format('It', 'Cl', 'Cd', 'Cdwake', 'xtrT', 'xtrB', 'Error'))
print(' ----------------------------------------------------------')
print(ccolors.ANSI_RED, '{:>4.0f}| {:>7.5f} {:>7.5f} {:>7.5f} | {:>6.4f} {:>7.4f} | {:>6.3f}\n'.format(couplIter, self.iSolverAPI.getCl(), self.iSolverAPI.getCd()+self.vSolver.Cdf, self.vSolver.Cdt, self.vSolver.getxoctr(0, 0), self.vSolver.getxoctr(0, 1), np.log10(error)), ccolors.ANSI_RESET)
print(ccolors.ANSI_RED, '{:>4.0f}| {:>7.5f} {:>7.5f} {:>7.5f} | {:>6.4f} {:>7.4f} | {:>6.3f}\n'.format(couplIter, self.iSolverAPI.getCl(), self.iSolverAPI.getCd()+self.vSolver.Cdf, self.vSolver.Cdt, self.vSolver.getAvrgxoctr(0), self.vSolver.getAvrgxoctr(1), np.log10(error)), ccolors.ANSI_RESET)
self.iSolverAPI.writeCp(sfx='_viscous'+self.filesfx)
return aeroCoeffs
......@@ -393,6 +393,15 @@ void Driver::computeSectionalDrag(std::vector<BoundaryLayer *> const &bl, size_t
Cdp_sec[i] = Cdt_sec[i] - Cdf_sec[i];
}
double Driver::getAvrgxoctr(size_t const iRegion) const
{
double xtr = 0.0;
for (size_t iSec = 0; iSec < sections.size(); ++iSec)
xtr += sections[iSec][iRegion]->xoctr;
xtr /= sections.size();
return xtr;
}
/**
* @brief Compute total drag coefficient on the airfoil/wing.
* Performs the sectional drag integration for 3D computations.
......
......@@ -45,6 +45,7 @@ public:
// Getters.
double getxtr(size_t iSec, size_t iRegion) const { return sections[iSec][iRegion]->xtr; };
double getxoctr(size_t iSec, size_t iRegion) const { return sections[iSec][iRegion]->xoctr; };
double getAvrgxoctr(size_t const iRegion) const;
double getRe() const { return Re; };
std::vector<std::vector<double>> getSolution(size_t iSec);
......
......@@ -67,6 +67,8 @@ def initBlast(iconfig, vconfig, iSolver='DART'):
if 'nSections' not in vconfig:
vconfig['nSections'] = len(vconfig['sections'])
if 'sfx' not in vconfig:
vconfig['sfx'] = ''
# Viscous solver
vSolver = initBL(vconfig['Re'], vconfig['Minf'], vconfig['CFL0'], vconfig['nSections'], xtrF=vconfig['xtrF'])
......@@ -80,7 +82,7 @@ def initBlast(iconfig, vconfig, iSolver='DART'):
# Coupler
import blast.coupler as blastCoupler
coupler = blastCoupler.Coupler(iSolverAPI, vSolver, _maxCouplIter=vconfig['couplIter'], _couplTol=vconfig['couplTol'], _iterPrint=vconfig['iterPrint'], _resetInv=vconfig['resetInv'])
coupler = blastCoupler.Coupler(iSolverAPI, vSolver, _maxCouplIter=vconfig['couplIter'], _couplTol=vconfig['couplTol'], _iterPrint=vconfig['iterPrint'], _resetInv=vconfig['resetInv'], sfx=vconfig['sfx'])
return coupler, iSolverAPI, vSolver
def mesh(file, pars):
......@@ -131,8 +133,8 @@ def getSolution(vSolver, iSec=0):
'y' : solverOutput[17],
'z' : solverOutput[18],
'ueInv' : solverOutput[19],
'xtrT' : vSolver.getxtr(iSec, 0),
'xtrB' : vSolver.getxtr(iSec, 1),
'xtrT' : vSolver.getAvrgxoctr(0),
'xtrB' : vSolver.getAvrgxoctr(1),
'Cdt_w' : vSolver.Cdt_sec[iSec],
'Cdf' : vSolver.Cdf_sec[iSec],
'Cdp' : vSolver.Cdp_sec[iSec]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment