diff --git a/hspm/src/hspm.h b/hspm/src/hspm.h index d17501395c01238da11c54f96e9aeffccec5ae6c..d65917c71e4d47bf8924ca1bda60bbe21a089198 100644 --- a/hspm/src/hspm.h +++ b/hspm/src/hspm.h @@ -61,6 +61,7 @@ public: Eigen::VectorXd Vt; double cd; double cl; + double cm; private: diff --git a/hspm/src/solver.cpp b/hspm/src/solver.cpp index afb83ad551966e0cbbb8d47a2da63066ed2c356e..9afdfe5ff374dde57649054566e6a7371223fe05 100644 --- a/hspm/src/solver.cpp +++ b/hspm/src/solver.cpp @@ -89,7 +89,7 @@ double HSPM::solveOffBodyKutta() { double _const_terms = pow(_b,2) + pow(_d,2) - pow(_f,2) - pow(_h,2); // Solve the quadratic equation - double tau_ = (-_tau_terms - sqrt(pow(_tau_terms,2) - 4*_tau2_terms*_const_terms)) / (2*_tau2_terms); + double tau_ = (-_tau_terms + sqrt(pow(_tau_terms,2) - 4*_tau2_terms*_const_terms)) / (2*_tau2_terms); return tau_; } @@ -118,7 +118,7 @@ void HSPM::computePressureDistribution() { */ Eigen::VectorXd V_t(N); - Cp = Eigen::MatrixXd(N, 2); + Cp = Eigen::MatrixXd(N, 4); // Compute the tangential speeds for (size_t i=0; i<N; i++) { @@ -130,14 +130,18 @@ void HSPM::computePressureDistribution() { // Compute the pressure coefficients Cp(i, 0) = x_m(i); - Cp(i, 1) = 1 - pow(V_t(i) / V_inf, 2); + Cp(i, 1) = y_m(i); + Cp(i, 2) = 0; + Cp(i, 3) = 1 - pow(V_t(i) / V_inf, 2); } cl = 0; cd = 0; + cm = 0; // Compute cd, cl for (size_t i=0; i<N; i++) { - cl -= Cp(i, 1) * cos(theta(i) - AoA) * lengths(i); - cd += Cp(i, 1) * sin(theta(i) - AoA) * lengths(i); + cl -= Cp(i, 3) * cos(theta(i) - AoA) * lengths(i); + cd += Cp(i, 3) * sin(theta(i) - AoA) * lengths(i); + cm -= Cp(i, 3) * (x_m(i) - 0.25) * cos(theta(i) - AoA) * lengths(i); } } \ No newline at end of file