diff --git a/hspm/api/core.py b/hspm/api/core.py index f17fcc3893acbe4141571bebc860f29b0e6f01a7..53a19be82ed60bebdd056bcde83b406c1357411a 100644 --- a/hspm/api/core.py +++ b/hspm/api/core.py @@ -9,8 +9,7 @@ def initHSPM(cfg): hspm = hspmw.HSPM() hspm.chord = cfg['chord'] # Not optimal, but it will do for now - hspm.IT_SOLVER_TOLERANCE = cfg['it_solver_tolerance'] - hspm.V_inf = 1 # Shouldn't have any impact on the solution (To verify) + hspm.V_inf = 1 # Shouldn't have any impact on the solution hspm.AoA = np.deg2rad(cfg['aoa']) if cfg['naca']: diff --git a/hspm/src/hspm.h b/hspm/src/hspm.h index d1e206b2e5ad051e9b76b4ee2ad19667f0306124..640c1ba1aa8cab65c79c45c2ec8a4ce05bb08299 100644 --- a/hspm/src/hspm.h +++ b/hspm/src/hspm.h @@ -52,7 +52,6 @@ public: Eigen::VectorXd b; Eigen::VectorXd c; - double IT_SOLVER_TOLERANCE; double tau; Eigen::VectorXd s1; Eigen::VectorXd s2; diff --git a/hspm/src/influenceCoeffs.cpp b/hspm/src/influenceCoeffs.cpp index 3ee327f3e7a2bc2e896e1fa8b708060b1045528f..16146b4c9e802fcd0c39674da97ca9e1d8df03b3 100644 --- a/hspm/src/influenceCoeffs.cpp +++ b/hspm/src/influenceCoeffs.cpp @@ -92,6 +92,27 @@ Eigen::MatrixXd HSPM::getSpeedAtPoint(double x_p, double y_p) // Influence of the panels: A and B for (size_t j=0; j<N; j++) { + // Check if we are on the panel + if (abs(x_p - x_m(j) < 1e-10) && abs(y_p - y_m(j)) < 1e-10) { + double _A_t = 0; + double _A_n = .5; + + double _A_x = _A_t * cos(theta(j)) - _A_n * sin(theta(j)); + double _A_y = _A_t * sin(theta(j)) + _A_n * cos(theta(j)); + double _B_x = _A_y; + double _B_y = -_A_x; + + // tau contribution + speeds(0,0) += _A_x * s1(j) + _B_x; + speeds(1,0) += _A_y * s1(j) + _B_y; + + // constant contribution + speeds(0,1) += _A_x * s2(j); + speeds(1,1) += _A_y * s2(j); + + continue; + } + double sine = sin(-theta(j)); double cosine = cos(-theta(j)); double r_p_jp1 = sqrt( pow(x_p - x(j+1), 2) + pow(y_p - y(j+1), 2) ); diff --git a/hspm/src/solver.cpp b/hspm/src/solver.cpp index 0eea9925306a168663476cd8d302d9c5fab1dc30..4e986a9b7896a3254ed30f0c72530d921461e86d 100644 --- a/hspm/src/solver.cpp +++ b/hspm/src/solver.cpp @@ -42,10 +42,10 @@ void HSPM::solve() } double HSPM::solveOffBodyKutta() { - double xc_0 = x_m(0) - (dStar(0)+1e-10) * sin(theta(0)); - double yc_0 = y_m(0) + (dStar(0)+1e-10) * cos(theta(0)); - double xc_N1 = x_m(N-1) - (dStar(N-1)+1e-10) * sin(theta(N-1)); - double yc_N1 = y_m(N-1) + (dStar(N-1)+1e-10) * cos(theta(N-1)); + double xc_0 = x_m(0) - dStar(0) * sin(theta(0)); + double yc_0 = y_m(0) + dStar(0) * cos(theta(0)); + double xc_N1 = x_m(N-1) - dStar(N-1) * sin(theta(N-1)); + double yc_N1 = y_m(N-1) + dStar(N-1) * cos(theta(N-1)); /* The magnitude of the velocity at the control points is equal @@ -98,8 +98,8 @@ void HSPM::computeInviscidVelocity() */ for (size_t i=0; i<N; i++) { - double x_visc = x_m(i) - (dStar(i)+1e-10) * sin(theta(i)); - double y_visc = y_m(i) + (dStar(i)+1e-10) * cos(theta(i)); + double x_visc = x_m(i) - dStar(i) * sin(theta(i)); + double y_visc = y_m(i) + dStar(i) * cos(theta(i)); Eigen::MatrixXd UV = this->getSpeedAtPoint(x_visc, y_visc); @@ -144,8 +144,8 @@ void HSPM::computePressureDistribution() { /* // Off body Cp, gives better graphs ! - double x_visc = x_m(i) - (dStar(i)+1e-10) * sin(theta(i)); - double y_visc = y_m(i) + (dStar(i)+1e-10) * cos(theta(i)); + double x_visc = x_m(i) - dStar(i) * sin(theta(i)); + double y_visc = y_m(i) + dStar(i) * cos(theta(i)); Eigen::MatrixXd UV = this->getSpeedAtPoint(x_visc, y_visc); double _U = UV(0,0) * tau + UV(0,1);