Skip to content
Snippets Groups Projects
Commit ac067532 authored by Thomee Corentin's avatar Thomee Corentin
Browse files

CutTE

parent 68d63db8
Branches main
No related tags found
No related merge requests found
......@@ -63,6 +63,17 @@ def initHSPM(cfg):
hspm.sLe = cfg['sLe']
hspm.sTe = cfg['sTe']
cfg["N"] = 1 # Placeholder value for the generateNaca4DigitCoordinates function
if 'cutTE' in cfg:
hspm.cutTE = cfg['cutTE']
if not "sTe" in cfg:
print("HSPM Warning: Trailing edge mesh size (sTe) not defined. Using default value of 0.01")
cfg['sTe'] = 0.01
hspm.sTe = cfg['sTe']
if 'stopTE' in cfg:
hspm.stopTE = True
hspm.stopTELocation = cfg['stopTE']
if cfg['naca']:
hspm.generateNaca4DigitCoordinates(int(cfg['naca'][0]), int(cfg['naca'][1]), int(cfg['naca'][2:4]), int(cfg['N']))
......
......@@ -67,8 +67,6 @@ void HSPM::generateNaca4DigitCoordinates(double camber, double camberPos, double
}
N = _N;
x = Eigen::VectorXd(N+1);
y = Eigen::VectorXd(N+1);
Eigen::VectorXd angleDistribution = Eigen::VectorXd::LinSpaced(N+1, 0, 2*M_PI);
......@@ -117,6 +115,74 @@ void HSPM::generateNaca4DigitCoordinates(double camber, double camberPos, double
}
}
if (cutTE) {
size_t newN = N;
size_t remPts = 0;
for (size_t i=1; i<=N/2; i++) {
if (chord - x_distr(i) >= sTe) {
std::cout << "Removed " << i-1 << " points from the trailing edge. " << std::endl;
newN = N - (i-1)*2;
remPts = i-1;
break;
}
}
Eigen::VectorXd x_distr_new = Eigen::VectorXd(newN+1);
x_distr_new(0) = x_distr(0);
for (size_t i=1; i<newN; i++) {
x_distr_new(i) = x_distr(i+remPts);
}
x_distr_new(newN) = x_distr(N);
N = newN;
x_distr = x_distr_new;
std::cout << "HSPM: The mesh contains " << N << " elements." << std::endl;
}
if (stopTE) {
// First, find the mesh size at stopTELOcation
double stopSize;
size_t N_behind;
double actualStopTELocation;
double behindSize;
size_t N_rem;
size_t newN;
for (size_t i=1; i<N/2; i++) {
if (x_distr(i) <= stopTELocation) {
// We found the location
actualStopTELocation = x_distr(i);
stopSize = x_distr(i) - x_distr(i+1);
N_behind = (1 - actualStopTELocation) / stopSize;
behindSize = (1 - actualStopTELocation) / N_behind;
N_rem = i;
newN = N+2*(N_behind-N_rem);
break;
}
}
std::cout << newN << std::endl;
Eigen::VectorXd x_distr_new = Eigen::VectorXd(newN+1);
for (size_t i=0; i<N_behind; i++) {
x_distr_new(i) = 1-behindSize*i;
}
for (size_t i=0; i<N-2*N_rem; i++) {
x_distr_new(i+N_behind) = x_distr(i+N_rem);
}
for (size_t i=0; i<N_behind+1; i++) {
x_distr_new(newN-i) = 1 - i*behindSize;
}
N = newN;
x_distr = x_distr_new;
std::cout << "HSPM: The mesh contains " << N << " elements." << std::endl;
}
x = Eigen::VectorXd(N+1);
y = Eigen::VectorXd(N+1);
for (size_t i=0; i<=N; i++) {
double T = 10 * thickness/100 * chord * (.2969*sqrt(x_distr(i)/chord) - .126*x_distr(i)/chord
- .3537*pow(x_distr(i)/chord, 2) + .2843*pow(x_distr(i)/chord, 3) - .1015*pow(x_distr(i)/chord, 4));
......
......@@ -84,6 +84,10 @@ public:
double sLe, sTe;
double prog; // For exponential mesh
bool cutTE;
bool stopTE;
double stopTELocation;
private:
Eigen::PartialPivLU<Eigen::MatrixXd> solver;
};
......
......@@ -133,7 +133,7 @@ void HSPM::computePressureDistribution() {
// Compute the tangential speeds
for (size_t i=0; i<N; i++) {
V_t(i) = V_inf * cos(AoA - theta(i));
/*V_t(i) = V_inf * cos(AoA - theta(i));
for (size_t j=0; j<N; j++) {
V_t(i) += A_t(i, j) * q(j);
V_t(i) += B_t(i, j) * tau;
......@@ -143,9 +143,9 @@ void HSPM::computePressureDistribution() {
Cp(i, 0) = x_m(i);
Cp(i, 1) = y_m(i);
Cp(i, 2) = 0;
Cp(i, 3) = 1 - pow(V_t(i) / V_inf, 2);
Cp(i, 3) = 1 - pow(V_t(i) / V_inf, 2);*/
/*
// Off body Cp, gives better graphs !
double x_visc = x_m(i) - dStar(i) * sin(theta(i));
double y_visc = y_m(i) + dStar(i) * cos(theta(i));
......@@ -160,7 +160,7 @@ void HSPM::computePressureDistribution() {
Cp(i, 1) = y_m(i);
Cp(i, 2) = 0;
Cp(i, 3) = 1 - pow(V_mag / V_inf, 2);
*/
}
cl = 0;
......
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