diff --git a/sdpm/src/sdpmMotion.cpp b/sdpm/src/sdpmMotion.cpp index 674680d948b1277f5dbdc1508c1ca2742c8c6b00..72ced1553209a7c2c5161c5dcf7f63931fac19b9 100644 --- a/sdpm/src/sdpmMotion.cpp +++ b/sdpm/src/sdpmMotion.cpp @@ -23,7 +23,7 @@ using namespace sdpm; Motion::Motion(size_t n) : sdpmObject(), _aAmp(0.), _hAmp(0.), _xRef(0.), _zRef(0.), - _mAmp(0.), _dzMod(n, 0.), _rxMod(n, 0.), _ryMod(n, 0.) + _dzMod(n, 0.), _rxMod(n, 0.), _ryMod(n, 0.) { } @@ -43,12 +43,11 @@ void Motion::setRigid(double aAmp, double hAmp, double xRef, double zRef) */ void Motion::setFlexible(double mAmp, std::vector<std::vector<double>> const &xMod, std::vector<Node *> const &nodes) { - _mAmp = mAmp; for (size_t i = 0; i < nodes.size(); ++i) { - _dzMod[nodes[i]->getId() - 1] = xMod[i][0]; - _rxMod[nodes[i]->getId() - 1] = xMod[i][1]; - _ryMod[nodes[i]->getId() - 1] = xMod[i][2]; + _dzMod[nodes[i]->getId() - 1] = mAmp * xMod[i][0]; + _rxMod[nodes[i]->getId() - 1] = mAmp * xMod[i][1]; + _ryMod[nodes[i]->getId() - 1] = mAmp * xMod[i][2]; } } @@ -67,7 +66,7 @@ sdpmVector3d Motion::computeSteady(Element const &e, sdpmVector3d const &ui) { sdpmDouble rx = _rxMod[n->getId() - 1]; sdpmDouble ry = _ryMod[n->getId() - 1]; - flex += _mAmp * sdpmVector3d(ui(2) * ry, ui(2) * rx, -ui(0) * ry - ui(1) * rx) / e.getNodes().size(); + flex += sdpmVector3d(ui(2) * ry, ui(2) * rx, -ui(0) * ry - ui(1) * rx) / e.getNodes().size(); } return rigd + flex; } @@ -78,11 +77,11 @@ sdpmVector3d Motion::computeSteady(Element const &e, sdpmVector3d const &ui) sdpmVector3d Motion::computeHarmonic(Element const &e) { // Rigid contribution - sdpmVector3d cg = e.getCompressibleCg(); + sdpmVector3d cg = e.getCg(); sdpmVector3d rigd(-_aAmp * (cg(2) - _zRef), 0., _aAmp * (cg(0) - _xRef) + _hAmp); // Flexible contribution sdpmVector3d flex = sdpmVector3d::Zero(); for (auto n : e.getNodes()) - flex += _mAmp * sdpmVector3d(0., 0., _dzMod[n->getId() - 1]) / e.getNodes().size(); + flex += sdpmVector3d(0., 0., _dzMod[n->getId() - 1]) / e.getNodes().size(); return rigd + flex; } diff --git a/sdpm/src/sdpmMotion.h b/sdpm/src/sdpmMotion.h index a43cdb06dbeca562c6cb4f7717b956a90ff7797d..4920054eef97fffe5a60a756c873accd1f320347 100644 --- a/sdpm/src/sdpmMotion.h +++ b/sdpm/src/sdpmMotion.h @@ -34,14 +34,13 @@ class SDPM_API Motion : public sdpmObject sdpmDouble _hAmp; ///< plunge amplitude sdpmDouble _xRef; ///< x-coordinate of center of pitch sdpmDouble _zRef; ///< z-coordinate of center of pitch - sdpmDouble _mAmp; ///< modal amplitude std::vector<sdpmDouble> _dzMod; ///< modal displacements along z std::vector<sdpmDouble> _rxMod; ///< modal rotations about x std::vector<sdpmDouble> _ryMod; ///< modal rotations about y public: Motion(size_t n); - ~Motion(){}; + ~Motion() {}; sdpmDouble getPitchAmplitude() const { return _aAmp; } std::vector<sdpmDouble> const &getModeZ() const { return _dzMod; } diff --git a/sdpm/src/sdpmSolver.cpp b/sdpm/src/sdpmSolver.cpp index 4953c5b48b8e65e4c2c19a88208e74d5f0f3eda2..ab12fb6f07759320b07253d7a28c410ac9294e2a 100644 --- a/sdpm/src/sdpmSolver.cpp +++ b/sdpm/src/sdpmSolver.cpp @@ -558,7 +558,7 @@ void Solver::post(size_t imd, size_t ifq, sdpmVectorXcd const &etau, sdpmVectorX sdpmComplex phit = -sdpmComplex(0., 1.) * omega * emu(_rows[elems[i]]); sdpmComplex phix = u1[i](0) - (uc0[i](0) + uc1[i](0) * sdpmComplex(0., 1.) * omega); sdpmComplex phix0(_u[elems[i]->getId() - 1](0) - ui(0), 0.); - sdpmComplex cp1 = -sdpmComplex(2., 0.) * phit + sdpmComplex(mi * mi, 0.) * (sdpmComplex(2., 0.) * phix0 * phix + phix0 * phit); + sdpmComplex cp1 = -sdpmComplex(2., 0.) * phit + sdpmComplex(2 * mi * mi, 0.) * (phix0 * phix + phix0 * phit); for (size_t j = 0; j < 3; ++j) cp1 -= sdpmComplex(2 * _u[elems[i]->getId() - 1](j), 0.) * u1[i](j); // cp diff --git a/sdpm/tests/agard.py b/sdpm/tests/agard.py index b70f59bbe328cdafc354db07f4c5bd0902fce324..a5c39fd25c2e9fe15232a10fba43142a5f390461 100644 --- a/sdpm/tests/agard.py +++ b/sdpm/tests/agard.py @@ -76,11 +76,11 @@ def main(): tests.add(CTest('Abs(CL1), mode 1', abs(cl1[0]), 0.076, 5e-2)) tests.add(CTest('Ang(CL1), mode 1', cmath.phase(cl1[0]) * 180 / math.pi, 7.6, 5e-2)) tests.add(CTest('Abs(CL1), mode 2', abs(cl1[1]), 0.114, 5e-2)) - tests.add(CTest('Ang(CL1), mode 2', cmath.phase(cl1[1]) * 180 / math.pi, -4.7, 5e-2)) + tests.add(CTest('Ang(CL1), mode 2', cmath.phase(cl1[1]) * 180 / math.pi, -4.8, 5e-2)) tests.add(CTest('Abs(CL1), mode 3', abs(cl1[2]), 0.099, 5e-2)) tests.add(CTest('Ang(CL1), mode 3', cmath.phase(cl1[2]) * 180 / math.pi, 177.0, 5e-2)) tests.add(CTest('Abs(CL1), mode 4', abs(cl1[3]), 0.015, 5e-2)) - tests.add(CTest('Ang(CL1), mode 4', cmath.phase(cl1[3]) * 180 / math.pi, 176.4, 5e-2)) + tests.add(CTest('Ang(CL1), mode 4', cmath.phase(cl1[3]) * 180 / math.pi, 176.1, 5e-2)) tests.run() # eof diff --git a/sdpm/tests/lann.py b/sdpm/tests/lann.py index ea71b57de6e956abcc8be02e45f6ab8f9e47ccd7..5144209757e35ca4f51eefe629ca4864d9eb3972 100644 --- a/sdpm/tests/lann.py +++ b/sdpm/tests/lann.py @@ -52,7 +52,7 @@ def main(): pbl.setUnsteady(1, [kred]) wing = sdpm.Body(msh, 'wing', 'te', crd, wnc, 1, 1) wing.addMotion() - wing.setRigidMotion(0, amp, 0., xf/math.sqrt(1-minf*minf), 0.) + wing.setRigidMotion(0, amp, 0., xf, 0.) pbl.addBody(wing) tms['pbl'].stop() # solver @@ -76,14 +76,14 @@ def main(): tests.add(CTest('CD0', sol.getDragCoeff(), 0.0020, 5e-2)) # MATLAB: 0.0031 tests.add(CTest('CS0', sol.getSideforceCoeff(), 0.006, 5e-2)) tests.add(CTest('CM0', sol.getMomentCoeff(), -0.079, 5e-2)) - tests.add(CTest('Abs(CL1)', abs(cl1) / amp / math.pi, 1.61, 5e-2)) # MATLAB: 1.69 - tests.add(CTest('Ang(CL1)', cmath.phase(cl1) * 180 / math.pi, 0.45, 5e-2)) # MATLAB: 0.64 - tests.add(CTest('Abs(CD1)', abs(cd1) / amp / math.pi, 0.036, 5e-2)) # MATLAB: 0.037 - tests.add(CTest('Ang(CD1)', cmath.phase(cd1) * 180 / math.pi, 16.4, 5e-2)) # MATLAB: 19.9 + tests.add(CTest('Abs(CL1)', abs(cl1) / amp / math.pi, 1.60, 5e-2)) + tests.add(CTest('Ang(CL1)', cmath.phase(cl1) * 180 / math.pi, -1.8, 5e-2)) + tests.add(CTest('Abs(CD1)', abs(cd1) / amp / math.pi, 0.036, 5e-2)) + tests.add(CTest('Ang(CD1)', cmath.phase(cd1) * 180 / math.pi, 16.5, 5e-2)) tests.add(CTest('Abs(CS1)', abs(cs1) / amp / math.pi, 0.040, 5e-2)) - tests.add(CTest('Ang(CS1)', cmath.phase(cs1) * 180 / math.pi, -9.7, 5e-2)) - tests.add(CTest('Abs(CM1)', abs(cm1) / amp / math.pi, 0.34, 5e-2)) - tests.add(CTest('Ang(CM1)', cmath.phase(cm1) * 180 / math.pi, -170.4, 5e-2)) + tests.add(CTest('Ang(CS1)', cmath.phase(cs1) * 180 / math.pi, -10.3, 5e-2)) + tests.add(CTest('Abs(CM1)', abs(cm1) / amp / math.pi, 0.33, 5e-2)) + tests.add(CTest('Ang(CM1)', cmath.phase(cm1) * 180 / math.pi, -174.7, 5e-2)) tests.run() # eof diff --git a/sdpm/tests/lann_ad.py b/sdpm/tests/lann_ad.py index 6fd4884bbd420af1cadba43deda838021ae303e0..88227e409e7123b7fbe2bbfe1271ef0f504642e7 100644 --- a/sdpm/tests/lann_ad.py +++ b/sdpm/tests/lann_ad.py @@ -52,7 +52,7 @@ def main(): pbl.setUnsteady(1, [kred]) wing = sdpm.Body(msh, 'wing', 'te', crd, wnc, 1, 1) wing.addMotion() - wing.setRigidMotion(0, amp, 0., xf/math.sqrt(1-minf*minf), 0.) + wing.setRigidMotion(0, amp, 0., xf, 0.) pbl.addBody(wing) tms['pbl'].stop() # solver @@ -75,14 +75,14 @@ def main(): # test tests = CTests() - tests.add(CTest('dRe(CL1)/dAlpha', d_cl1_re['aoa'][0], 1.4e-3, 2e-4, forceabs=True)) - tests.add(CTest('dRe(CL1)/dOmega', d_cl1_re['omega'][0], -1.3e-3, 2e-4, forceabs=True)) + tests.add(CTest('dRe(CL1)/dAlpha', d_cl1_re['aoa'][0], 1.3e-3, 2e-4, forceabs=True)) + tests.add(CTest('dRe(CL1)/dOmega', d_cl1_re['omega'][0], -1.4e-3, 2e-4, forceabs=True)) tests.add(CTest('dIm(CL1)/dAlpha', d_cl1_im['aoa'][0], -1.4e-4, 2e-5, forceabs=True)) - tests.add(CTest('dIm(CL1)/dOmega', d_cl1_im['omega'][0], 1.1e-3, 2e-4, forceabs=True)) - tests.add(CTest('dRe(CD1)/dAlpha', d_cd1_re['aoa'][0], 7.9e-3, 2e-4, forceabs=True)) - tests.add(CTest('dRe(CD1)/dOmega', d_cd1_re['omega'][0], 3.3e-5, 2e-6, forceabs=True)) - tests.add(CTest('dIm(CD1)/dAlpha', d_cd1_im['aoa'][0], 1.7e-3, 2e-4, forceabs=True)) - tests.add(CTest('dIm(CD1)/dOmega', d_cd1_im['omega'][0], 6.2e-5, 2e-6, forceabs=True)) + tests.add(CTest('dIm(CL1)/dOmega', d_cl1_im['omega'][0], 6.4e-4, 2e-4, forceabs=True)) + tests.add(CTest('dRe(CD1)/dAlpha', d_cd1_re['aoa'][0], 8.0e-3, 2e-4, forceabs=True)) + tests.add(CTest('dRe(CD1)/dOmega', d_cd1_re['omega'][0], 3.7e-5, 2e-6, forceabs=True)) + tests.add(CTest('dIm(CD1)/dAlpha', d_cd1_im['aoa'][0], 1.6e-3, 2e-4, forceabs=True)) + tests.add(CTest('dIm(CD1)/dOmega', d_cd1_im['omega'][0], 6.4e-5, 2e-6, forceabs=True)) tests.run() # eof diff --git a/sdpm/tests/lann_xsonic.py b/sdpm/tests/lann_xsonic.py index 3480595cde561997a8fa75cf452d370d797d4b58..26b9b3482024ae96326bb1c66a86f39b9450c2d6 100644 --- a/sdpm/tests/lann_xsonic.py +++ b/sdpm/tests/lann_xsonic.py @@ -52,7 +52,7 @@ def main(): pbl.setUnsteady(1, [kred]) wing = sdpm.Body(msh, 'wing', 'te', crd, wnc, 1, 1) wing.addMotion() - wing.setRigidMotion(0, amp, 0., xf/math.sqrt(1-minf*minf), 0.) + wing.setRigidMotion(0, amp, 0., xf, 0.) dcp = interpolate_pressure(build_fpath('models/lann_dcp_rans.csv', __file__, 1), wing.getNodes()) wing.setTransonicPressureGrad(dcp[:,0]) pbl.addBody(wing) @@ -78,14 +78,14 @@ def main(): tests.add(CTest('CD0', sol.getDragCoeff(), 0.0127, 5e-2)) tests.add(CTest('CS0', sol.getSideforceCoeff(), 0.015, 5e-2)) tests.add(CTest('CM0', sol.getMomentCoeff(), -0.148, 5e-2)) - tests.add(CTest('Abs(CL1)', abs(cl1) / amp / math.pi, 2.45, 5e-2)) - tests.add(CTest('Ang(CL1)', cmath.phase(cl1) * 180 / math.pi, -3.08, 5e-2)) - tests.add(CTest('Abs(CD1)', abs(cd1) / amp / math.pi, 0.193, 5e-2)) - tests.add(CTest('Ang(CD1)', cmath.phase(cd1) * 180 / math.pi, 4.2, 5e-2)) + tests.add(CTest('Abs(CL1)', abs(cl1) / amp / math.pi, 2.42, 5e-2)) + tests.add(CTest('Ang(CL1)', cmath.phase(cl1) * 180 / math.pi, -6.5, 5e-2)) + tests.add(CTest('Abs(CD1)', abs(cd1) / amp / math.pi, 0.192, 5e-2)) + tests.add(CTest('Ang(CD1)', cmath.phase(cd1) * 180 / math.pi, 2.8, 5e-2)) tests.add(CTest('Abs(CS1)', abs(cs1) / amp / math.pi, 0.072, 5e-2)) - tests.add(CTest('Ang(CS1)', cmath.phase(cs1) * 180 / math.pi, -12.3, 5e-2)) - tests.add(CTest('Abs(CM1)', abs(cm1) / amp / math.pi, 0.51, 5e-2)) - tests.add(CTest('Ang(CM1)', cmath.phase(cm1) * 180 / math.pi, -172.3, 5e-2)) + tests.add(CTest('Ang(CS1)', cmath.phase(cs1) * 180 / math.pi, -13.5, 5e-2)) + tests.add(CTest('Abs(CM1)', abs(cm1) / amp / math.pi, 0.50, 5e-2)) + tests.add(CTest('Ang(CM1)', cmath.phase(cm1) * 180 / math.pi, -179.1, 5e-2)) tests.run() # eof