41 const int mysleeptime = 300;
62 pRotor(0), pGround(0),
63 dOmegaRef(0.), dRadius(0), dVTipRef(0.), dArea(0.),
64 dUMean(0.), dUMeanRef(0.), dUMeanPrev(0.),
69 bUMeanRefConverged(
false),
70 Weight(), dWeight(0.),
71 dHoverCorrection(1.), dForwardFlightCorrection(1.),
74 dPsi0(0.), dSinAlphad(1.), dCosAlphad(0.),
75 dMu(0.), dLambda(1.), dChi(0.),
76 dVelocity(0.), dOmega(0.),
91 pRotor(0), pGround(0),
92 dOmegaRef(0.), dRadius(0), dVTipRef(0.), dArea(0.),
93 dUMean(0.), dUMeanRef(0.), dUMeanPrev(0.),
98 bUMeanRefConverged(
false),
99 Weight(), dWeight(0.),
100 dHoverCorrection(1.), dForwardFlightCorrection(1.),
103 dPsi0(0.), dSinAlphad(1.), dCosAlphad(0.),
104 dMu(0.), dLambda(1.), dChi(0.),
105 dVelocity(0.), dOmega(0.),
108 Init(pC, rrot, pR, pG, ppres, dR, iMaxIt, dTol, dE, fOut);
134 if (R3C.Dot(R3R) < 1. - std::numeric_limits<doublereal>::epsilon()) {
135 silent_cerr(
"Rotor(" <<
GetLabel() <<
"): "
136 "warning, possible misalignment "
138 "axis Rr(3) = {" << R3R <<
"} "
140 "axis Rc*Rh(3) = {" << R3C <<
"} "
141 <<
"for Rotor(" <<
GetLabel() <<
")"
168 silent_cout(
"Rotor(" <<
GetLabel() <<
"): "
169 "delay < 0.0; using 0.0" << std::endl);
173 silent_cout(
"Rotor(" <<
GetLabel() <<
"): "
174 "delay > 1.0; using 1.0" << std::endl);
187 if (is_parallel && IndVelComm.Get_size() > 1) {
188 if (IndVelComm.Get_rank() == 0) {
190 Vec3 TmpM(pTmpVecR+3);
208 Vec3 TmpF(pTmpVecR+6+6*i);
209 Vec3 TmpM(pTmpVecR+9+6*i);
213 <<
":" << ppRes[i]->GetLabel()
238 <<
":" << ppRes[i]->GetLabel()
239 <<
" " << ppRes[i]->pRes->Force()
240 <<
" " << ppRes[i]->pRes->Moment()
265 <<
":" << ppRes[i]->GetLabel()
266 <<
" " << ppRes[i]->pRes->Force()
267 <<
" " << ppRes[i]->pRes->Moment()
313 ASSERT(
dRadius > std::numeric_limits<doublereal>::epsilon());
368 if (!bComputeMeanInducedVelocity) {
374 if (dRho <= std::numeric_limits<doublereal>::epsilon()) {
392 if (std::abs(
dUMeanRef) < std::numeric_limits<doublereal>::epsilon()
393 && std::abs(dT) > std::numeric_limits<doublereal>::epsilon())
407 silent_cerr(
"warning, illegal negative "
408 "normalized altitude "
409 "z=" << z << std::endl);
434 bool bRetrying =
false;
438 dLambda = dLambda0 + dLambdaInd;
444 if (dRef1 > std::numeric_limits<doublereal>::epsilon()) {
445 dF = dLambdaInd - dCt/dRef1;
446 doublereal dFPrime = 1. + (dCt/dRef2)*dLambda;
448 dLambdaInd -=
dEta*dDelta;
454 <<
" lambda=" << dLambda
455 <<
" dRef1=" << dRef1
469 if (dLambdaInd*dCt < 0.) {
474 dLambdaInd = -dLambdaInd;
478 silent_cerr(
"Rotor(" <<
GetLabel() <<
"): "
479 "induced velocity and thrust signs differ "
480 "(lambda_u=" << dLambdaInd <<
", Ct=" << dCt <<
")"
484 dLambda = dLambda0 + dLambdaInd;
493 silent_cerr(
"unable to compute mean induced velocity "
494 "for Rotor(" <<
GetLabel() <<
")" << std::endl);
501 if (std::abs(
dMu) < std::numeric_limits<doublereal>::epsilon() ) {
520 if (dRef > std::abs(dCt)) {
537 return out <<
" rotor: " <<
GetLabel() <<
", "
539 <<
", induced velocity: ";
566 Init(pCraft, rrot, pRotor, ppres, dR, fOut);
577 Rotor::Init(pCraft, rrot, pRotor, 0, ppres, dR, 0, 0., 0., fOut);
583 for (
int i = 0; i < 3; i++) {
586 for (
int i = 0; i < 3; i++) {
590 MPI::Datatype(MPI::DOUBLE.Create_hindexed(3, pBlockLenght, pDispl)));
591 pIndVelDataType->Commit();
612 DEBUGCOUT(
"Entering NoRotor::AssRes()" << std::endl);
621 if (!is_parallel || IndVelComm.Get_rank() == 0)
637 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
639 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
658 if (ReqV != MPI::REQUEST_NULL) {
659 while (!ReqV.Test()) {
665 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
666 pthread_mutex_lock(&forces_mutex);
668 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
675 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
676 pthread_mutex_unlock(&forces_mutex);
677 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
684 unsigned uLabel,
unsigned uPnt,
const Vec3& X)
const
720 Init(pCraft, rrot, pRotor, pGround, ppres, dOR, dR,
721 pdW, iMaxIt, dTol, dE, dCH, dCFF, fOut);
744 Rotor::Init(pCraft, rrot, pRotor, pGround, ppres, dR, iMaxIt, dTol, dE, fOut);
757 for (
int i = 0; i < 7; i++) {
760 for (
int i = 0; i < 3; i++) {
764 for (
int i = 4; i <= 6; i++) {
768 MPI::Datatype(MPI::DOUBLE.Create_hindexed(7, pBlockLenght, pDispl)));
769 pIndVelDataType->Commit();
790 DEBUGCOUT(
"Entering UniformRotor::AssRes()" << std::endl);
794 if (!is_parallel || IndVelComm.Get_rank() == 0)
808 <<
"V rotore: " <<
VCraft << std::endl
809 <<
"X punto: " << XTmp << std::endl
810 <<
"Omega: " <<
dOmega << std::endl
811 <<
"Velocita': " <<
dVelocity << std::endl
812 <<
"Psi0: " <<
dPsi0 << std::endl
813 <<
"Psi punto: " << dPsiTmp << std::endl
814 <<
"Raggio: " <<
dRadius << std::endl
815 <<
"r punto: " << dXTmp << std::endl
816 <<
"mu: " <<
dMu << std::endl
817 <<
"lambda: " <<
dLambda << std::endl
820 <<
"UMean: " <<
dUMean << std::endl;
834 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
836 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
856 if (ReqV != MPI::REQUEST_NULL) {
857 while (!ReqV.Test()) {
863 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
864 pthread_mutex_lock(&forces_mutex);
866 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
876 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
877 pthread_mutex_unlock(&forces_mutex);
885 unsigned uLabel,
unsigned uPnt,
const Vec3& X)
const
887 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
917 :
Elem(uLabel, fOut),
918 UniformRotor(uLabel, pDO, pCraft, rrot, pRotor, pGround, ppres, dOR, dR, pdW, iMaxIt, dTol, dE, dCH, dCFF, fOut)
937 const Elem *pEl,
unsigned uPnt,
943 if (ReqV != MPI::REQUEST_NULL) {
944 while (!ReqV.Test()) {
950 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
951 pthread_mutex_lock(&forces_mutex);
953 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
966 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
967 pthread_mutex_unlock(&forces_mutex);
1005 Init(pCraft, rrot, pRotor, pGround, ppres, dOR, dR,
1006 pdW, iMaxIt, dTol, dE, dCH, dCFF, fOut);
1018 unsigned int iMaxIt,
1029 Rotor::Init(pCraft, rrot, pRotor, pGround, ppres, dR, iMaxIt, dTol, dE, fOut);
1042 for (
int i = 0; i < 20; i++) {
1043 pBlockLenght[i] = 1;
1045 for (
int i = 0; i < 3; i++) {
1049 pDispl[4] = MPI::Get_address(&
dLambda);
1050 pDispl[5] = MPI::Get_address(&
dMu);
1051 pDispl[6] = MPI::Get_address(&
dChi);
1052 pDispl[7] = MPI::Get_address(&
dPsi0);
1053 for (
int i = 8; i <= 10; i++) {
1056 for (
int i = 11; i < 20; i++) {
1060 MPI::Datatype(MPI::DOUBLE.Create_hindexed(20, pBlockLenght, pDispl)));
1061 pIndVelDataType->Commit();
1084 DEBUGCOUT(
"Entering GlauertRotor::AssRes()" << std::endl);
1088 if (!is_parallel || IndVelComm.Get_rank() == 0)
1104 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
1106 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
1127 if (ReqV != MPI::REQUEST_NULL) {
1128 while (!ReqV.Test()) {
1134 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
1135 pthread_mutex_lock(&forces_mutex);
1147 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
1148 pthread_mutex_unlock(&forces_mutex);
1159 unsigned uLabel,
unsigned uPnt,
const Vec3& X)
const
1165 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
1169 if (std::abs(
dLambda) < 1.e-9) {
1242 k1 = 4./3.*((1. - 1.8*
dMu*
dMu)*
sqrt(1. + dLdM*dLdM) - dLdM);
1278 unsigned int iMaxIt,
1287 Init(pCraft, rrot, pRotor, pGround, ppres, dOR, dR, pdW, iMaxIt, dTol, dE, dCH, dCFF, fOut);
1299 unsigned int iMaxIt,
1310 Rotor::Init(pCraft, rrot, pRotor, pGround, ppres, dR, iMaxIt, dTol, dE, fOut);
1323 for (
int i = 0; i < 18; i++) {
1324 pBlockLenght[i] = 1;
1326 for (
int i = 0; i < 3; i++) {
1331 pDispl[5] = MPI::Get_address(&
dPsi0);
1332 for (
int i = 6; i <= 8; i++) {
1335 for (
int i = 9; i < 18; i++) {
1339 MPI::Datatype(MPI::DOUBLE.Create_hindexed(18, pBlockLenght, pDispl)));
1340 pIndVelDataType->Commit();
1363 DEBUGCOUT(
"Entering ManglerRotor::AssRes()" << std::endl);
1367 if (!is_parallel || IndVelComm.Get_rank() == 0)
1376 Vec3 XTmp(2.,2.,0.);
1382 <<
"V rotore: " <<
VCraft << std::endl
1383 <<
"X punto: " << XTmp << std::endl
1384 <<
"Omega: " <<
dOmega << std::endl
1385 <<
"Velocita': " <<
dVelocity << std::endl
1386 <<
"Psi0: " <<
dPsi0 << std::endl
1387 <<
"Psi punto: " << dPsiTmp << std::endl
1388 <<
"Raggio: " <<
dRadius << std::endl
1389 <<
"r punto: " << dXTmp << std::endl
1390 <<
"mu: " <<
dMu << std::endl
1391 <<
"lambda: " <<
dLambda << std::endl
1394 <<
"UMean: " <<
dUMean << std::endl
1395 <<
"iv punto: " << IndV << std::endl;
1409 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
1411 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
1431 if (ReqV != MPI::REQUEST_NULL) {
1432 while (!ReqV.Test()) {
1438 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
1439 pthread_mutex_lock(&forces_mutex);
1451 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
1452 pthread_mutex_unlock(&forces_mutex);
1461 unsigned uLabel,
unsigned uPnt,
const Vec3& X)
const
1467 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
1493 dd -= 4.*dc*
cos(dp);
1496 dc = 45./256.*
M_PI*
pow(da*dr, 3);
1497 dd -= 4.*dc*
cos(3.*dp);
1502 for (
int i = 2; i <= 10; i += 2) {
1503 dc =
pow(-1., i/2 - 1)*15./8.
1504 *((dm + i)/(i*i - 1.)*(3. - 9.*dr2 + i*i) + 3.*dm)/(i*i - 9.)
1505 *
pow(((1. - dm)/(1. + dm))*da, i/2.);
1506 dd -= 4.*dc*
cos(i*dp);
1540 dVConst(0), dVSine(0), dVCosine(0),
1541 dL11(0.), dL13(0.), dL22(0.), dL31(0.), dL33(0.)
1555 unsigned int iMaxIt,
1566 dVConst(0), dVSine(0), dVCosine(0),
1567 dL11(0.), dL13(0.), dL22(0.), dL31(0.), dL33(0.)
1569 Init(pCraft, rrot, pRotor, pGround, ppres, dOR, dR,
1570 iMaxIt, dTol, dE, dCH, dCFF,
1571 dVConstTmp, dVSineTmp, dVCosineTmp, fOut);
1582 unsigned int iMaxIt,
1595 Rotor::Init(pCraft, rrot, pRotor, pGround, ppres, dR, iMaxIt, dTol, dE, fOut);
1615 for (
int i = 0; i < 20; i++) {
1616 pBlockLenght[i] = 1;
1618 for (
int i = 0; i < 3; i++) {
1621 pDispl[3] = MPI::Get_address(&
dVConst);
1622 pDispl[4] = MPI::Get_address(&
dVSine);
1623 pDispl[5] = MPI::Get_address(&
dVCosine);
1624 pDispl[6] = MPI::Get_address(&
dOmega);
1625 pDispl[7] = MPI::Get_address(&
dPsi0);
1626 for (
int i = 8; i <= 10; i++) {
1629 for (
int i = 11; i < 20; i++) {
1633 MPI::Datatype(MPI::DOUBLE.Create_hindexed(20, pBlockLenght, pDispl)));
1634 pIndVelDataType->Commit();
1659 if (is_parallel && IndVelComm.Get_size() > 1) {
1660 if (IndVelComm.Get_rank() == 0) {
1661 Vec3 TmpF(pTmpVecR), TmpM(pTmpVecR+3);
1682 Vec3 TmpF(pTmpVecR+6+6*i);
1683 Vec3 TmpM(pTmpVecR+9+6*i);
1687 <<
":" << ppRes[i]->GetLabel()
1715 <<
":" << ppRes[i]->GetLabel()
1716 <<
" " << ppRes[i]->pRes->Force()
1717 <<
" " << ppRes[i]->pRes->Moment()
1744 <<
":" << ppRes[i]->GetLabel()
1745 <<
" " << ppRes[i]->pRes->Force()
1746 <<
" " << ppRes[i]->pRes->Moment()
1760 DEBUGCOUT(
"Entering DynamicInflowRotor::AssJac()" << std::endl);
1765 if (is_parallel && IndVelComm.Get_rank() == 0)
1774 WM.
PutItem(2, iFirstIndex + 3, iFirstIndex + 1, dCoef*
dL31);
1776 WM.
PutItem(4, iFirstIndex + 1, iFirstIndex + 3, dCoef*
dL13);
1790 DEBUGCOUT(
"Entering DynamicInflowRotor::AssRes()" << std::endl);
1793 ExchangeLoads(
flag(1));
1795 if (!is_parallel || IndVelComm.Get_rank() == 0)
1809 dVConst = XCurr(iFirstIndex + 1);
1810 dVSine = XCurr(iFirstIndex + 2);
1813 doublereal dVConstPrime = XPrimeCurr(iFirstIndex + 1);
1814 doublereal dVSinePrime = XPrimeCurr(iFirstIndex + 2);
1815 doublereal dVCosinePrime = XPrimeCurr(iFirstIndex + 3);
1834 if (dDim > std::numeric_limits<doublereal>::epsilon()) {
1847 =
sqrt(dLambdaTmp*dLambdaTmp + dMuTmp*dMuTmp);
1850 dVm = (dMuTmp*dMuTmp + dLambdaTmp*(dLambdaTmp +
dVConst))/dVT;
1864 Mat3x3 RTmp( dCosP, -dSinP, 0.,
1876 if (dVT > std::numeric_limits<doublereal>::epsilon()
1877 && dVm > std::numeric_limits<doublereal>::epsilon())
1891 d = 2.*dCosChi2*dCosChi2;
1897 d = dl11*dl33 - dl31*dl13;
1910 int iv[] = { 0, 1, 0, -1, 0 };
1916 GetPos(XTmp, dXTmp, dPsiTmp);
1920 <<
"V rotore: " <<
VCraft << std::endl
1921 <<
"X punto: " << XTmp << std::endl
1922 <<
"Omega: " <<
dOmega << std::endl
1923 <<
"Velocita': " <<
dVelocity << std::endl
1924 <<
"Psi0: " <<
dPsi0 <<
" ("
1925 <<
dPsi0*180./
M_PI <<
" deg)" << std::endl
1926 <<
"Psi punto: " << dPsiTmp <<
" ("
1927 << dPsiTmp*180./
M_PI <<
" deg)" << std::endl
1928 <<
"Raggio: " <<
dRadius << std::endl
1929 <<
"r punto: " << dXTmp << std::endl
1930 <<
"mu: " <<
dMu << std::endl
1931 <<
"lambda: " <<
dLambda << std::endl
1934 <<
"UMean: " <<
dUMean << std::endl
1935 <<
"iv punto: " << IndV << std::endl;
1958 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
1960 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
1981 for (
int iCnt = 1; iCnt <= 3; iCnt++) {
1982 XP.
PutCoef(iFirstIndex + iCnt, 0.);
2011 if (ReqV != MPI::REQUEST_NULL) {
2012 while (!ReqV.Test()) {
2018 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
2019 pthread_mutex_lock(&forces_mutex);
2028 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
2029 pthread_mutex_unlock(&forces_mutex);
2038 unsigned uLabel,
unsigned uPnt,
const Vec3& X)
const
2040 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
2058 dVConst(0), dVSine(0), dVCosine(0),
2059 dL11(0.), dL13(0.), dL22(0.), dL31(0.), dL33(0.)
2073 unsigned int iMaxIt,
2084 dVConst(0), dVSine(0), dVCosine(0),
2085 dL11(0.), dL13(0.), dL22(0.), dL31(0.), dL33(0.)
2087 Init(pCraft, rrot, pRotor, pGround, ppres, dOR, dR,
2088 iMaxIt, dTol, dE, dCH, dCFF,
2089 dVConstTmp, dVSineTmp, dVCosineTmp, fOut);
2100 unsigned int iMaxIt,
2113 Rotor::Init(pCraft, rrot, pRotor, pGround, ppres, dR, iMaxIt, dTol, dE, fOut);
2133 for (
int i = 0; i < 20; i++) {
2134 pBlockLenght[i] = 1;
2136 for (
int i = 0; i < 3; i++) {
2139 pDispl[3] = MPI::Get_address(&
dVConst);
2140 pDispl[4] = MPI::Get_address(&
dVSine);
2141 pDispl[5] = MPI::Get_address(&
dVCosine);
2142 pDispl[6] = MPI::Get_address(&
dOmega);
2143 pDispl[7] = MPI::Get_address(&
dPsi0);
2144 for (
int i = 8; i <= 10; i++) {
2147 for (
int i = 11; i < 20; i++) {
2151 MPI::Datatype(MPI::DOUBLE.Create_hindexed(20, pBlockLenght, pDispl)));
2152 pIndVelDataType->Commit();
2177 if (is_parallel && IndVelComm.Get_size() > 1) {
2178 if (IndVelComm.Get_rank() == 0) {
2179 Vec3 TmpF(pTmpVecR), TmpM(pTmpVecR+3);
2200 Vec3 TmpF(pTmpVecR+6+6*i);
2201 Vec3 TmpM(pTmpVecR+9+6*i);
2205 <<
":" << ppRes[i]->GetLabel()
2233 <<
":" << ppRes[i]->GetLabel()
2234 <<
" " << ppRes[i]->pRes->Force()
2235 <<
" " << ppRes[i]->pRes->Moment()
2262 <<
":" << ppRes[i]->GetLabel()
2263 <<
" " << ppRes[i]->pRes->Force()
2264 <<
" " << ppRes[i]->pRes->Moment()
2278 DEBUGCOUT(
"Entering PetersHeRotor::AssJac()" << std::endl);
2283 if (is_parallel && IndVelComm.Get_rank() == 0)
2292 WM.
PutItem(2, iFirstIndex + 3, iFirstIndex + 1, dCoef*
dL31);
2294 WM.
PutItem(4, iFirstIndex + 1, iFirstIndex + 3, dCoef*
dL13);
2308 DEBUGCOUT(
"Entering PetersHeRotor::AssRes()" << std::endl);
2311 ExchangeLoads(
flag(1));
2313 if (!is_parallel || IndVelComm.Get_rank() == 0)
2327 dVConst = XCurr(iFirstIndex + 1);
2328 dVSine = XCurr(iFirstIndex + 2);
2331 doublereal dVConstPrime = XPrimeCurr(iFirstIndex + 1);
2332 doublereal dVSinePrime = XPrimeCurr(iFirstIndex + 2);
2333 doublereal dVCosinePrime = XPrimeCurr(iFirstIndex + 3);
2352 if (dDim > std::numeric_limits<doublereal>::epsilon()) {
2365 =
sqrt(dLambdaTmp*dLambdaTmp + dMuTmp*dMuTmp);
2368 dVm = (dMuTmp*dMuTmp + dLambdaTmp*(dLambdaTmp +
dVConst))/dVT;
2382 Mat3x3 RTmp( dCosP, -dSinP, 0.,
2394 if (dVT > std::numeric_limits<doublereal>::epsilon()
2395 && dVm > std::numeric_limits<doublereal>::epsilon())
2409 d = 2.*dCosChi2*dCosChi2;
2415 d = dl11*dl33 - dl31*dl13;
2428 int iv[] = { 0, 1, 0, -1, 0 };
2434 GetPos(XTmp, dXTmp, dPsiTmp);
2438 <<
"V rotore: " <<
VCraft << std::endl
2439 <<
"X punto: " << XTmp << std::endl
2440 <<
"Omega: " <<
dOmega << std::endl
2441 <<
"Velocita': " <<
dVelocity << std::endl
2442 <<
"Psi0: " <<
dPsi0 <<
" ("
2443 <<
dPsi0*180./
M_PI <<
" deg)" << std::endl
2444 <<
"Psi punto: " << dPsiTmp <<
" ("
2445 << dPsiTmp*180./
M_PI <<
" deg)" << std::endl
2446 <<
"Raggio: " <<
dRadius << std::endl
2447 <<
"r punto: " << dXTmp << std::endl
2448 <<
"mu: " <<
dMu << std::endl
2449 <<
"lambda: " <<
dLambda << std::endl
2452 <<
"UMean: " <<
dUMean << std::endl
2453 <<
"iv punto: " << IndV << std::endl;
2476 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
2478 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
2499 for (
int iCnt = 1; iCnt <= 3; iCnt++) {
2500 XP.
PutCoef(iFirstIndex + iCnt, 0.);
2529 if (ReqV != MPI::REQUEST_NULL) {
2530 while (!ReqV.Test()) {
2536 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
2537 pthread_mutex_lock(&forces_mutex);
2546 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
2547 pthread_mutex_unlock(&forces_mutex);
2556 unsigned uLabel,
unsigned uPnt,
const Vec3& X)
const
2558 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
2576 unsigned int uLabel)
2578 DEBUGCOUT(
"Entering ReadRotor()" << std::endl);
2581 pedantic_cout(
"WARNING: the syntax changed; use a comma ',' "
2582 "instead of a colon ':' after the keyword "
2583 "\"induced velocity\"" << std::endl);
2585 const char* sKeyWords[] = {
2586 "induced" "velocity",
2589 "uniform" "sectional",
2625 silent_cerr(
"InducedVelocity(" << uLabel <<
"): deprecated keyword \"hinge\"; use \"orientation\" instead at line " << HP.
GetLineData() << std::endl);
2642 switch (InducedType) {
2644 DEBUGCOUT(
"No induced velocity is considered" << std::endl);
2650 silent_cerr(
"Rotor(" << uLabel <<
"): "
2651 "invalid radius " << dR
2664 NoRotor(uLabel, pDO, pCraft, rrot, pRotor,
2669 case UNIFORM_SECTIONAL:
2672 case DYNAMICINFLOW: {
2674 if (InducedType == GLAUERT && HP.
IsKeyWord(
"type")) {
2687 }
else if (HP.
IsKeyWord(
"white" "and" "blake")) {
2690 }
else if (HP.
IsKeyWord(
"pitt" "and" "peters")) {
2697 silent_cerr(
"warning, \"drees 2\" deprecated at line " << HP.
GetLineData() <<
"; use \"drees\" instead" << std::endl);
2701 silent_cerr(
"Rotor(" << uLabel <<
"): "
2702 "unknown variant of Glauert's induced velocity at line "
2709 DEBUGCOUT(
"Reference rotation speed: " << dOR << std::endl);
2711 silent_cerr(
"Rotor(" << uLabel <<
"): "
2712 "invalid reference speed " << dOR
2719 DEBUGCOUT(
"Radius: " << dR << std::endl);
2721 silent_cerr(
"Rotor(" << uLabel <<
"): "
2722 "invalid radius " << dR
2729 bool bGotInitialValues(
false);
2735 unsigned iMaxIter = unsigned(-1);
2736 doublereal dTolerance = std::numeric_limits<double>::max();
2741 while (HP.
IsArg()) {
2747 silent_cerr(
"Rotor(" << uLabel <<
"): "
2748 "providing another \"ground\" node "
2757 }
else if (HP.
IsKeyWord(
"initial" "value")) {
2758 if (InducedType != DYNAMICINFLOW) {
2759 silent_cerr(
"Rotor(" << uLabel <<
"): "
2760 "invalid parameter \"initial value\" "
2766 if (bGotInitialValues) {
2767 silent_cerr(
"Rotor(" << uLabel <<
"): "
2768 "providing \"initial value\" another time "
2778 bGotInitialValues =
true;
2781 if (InducedType == DYNAMICINFLOW) {
2782 silent_cerr(
"Rotor(" << uLabel <<
"): "
2783 "invalid parameter \"delay\" "
2790 silent_cerr(
"Rotor(" << uLabel <<
"): "
2791 "providing another \"delay\" driver "
2816 }
else if (HP.
IsKeyWord(
"max" "iterations")) {
2817 if (iMaxIter !=
unsigned(-1)) {
2818 silent_cerr(
"Rotor(" << uLabel <<
"): "
2819 "providing another \"max iterations\" value "
2831 silent_cerr(
"illegal max iterations "
2832 << i <<
" for Rotor(" << uLabel <<
")");
2838 if (dTolerance != std::numeric_limits<double>::max()) {
2839 silent_cerr(
"Rotor(" << uLabel <<
"): "
2840 "providing another \"tolerance\" value "
2852 if (dTolerance <= 0.) {
2853 silent_cerr(
"illegal tolerance "
2854 << dTolerance <<
" for Rotor(" << uLabel <<
")");
2860 silent_cerr(
"Rotor(" << uLabel <<
"): "
2861 "providing another \"eta\" relaxation factor "
2873 silent_cerr(
"illegal eta "
2874 << dEta <<
" for Rotor(" << uLabel <<
")");
2878 }
else if (HP.
IsKeyWord(
"correction")) {
2880 silent_cerr(
"Rotor(" << uLabel <<
"): "
2881 "providing another \"correction\" factor "
2889 DEBUGCOUT(
"Hover correction: " << dCH << std::endl);
2891 silent_cerr(
"Rotor(" << uLabel <<
"): "
2892 "illegal null or negative hover inflow correction "
2899 DEBUGCOUT(
"Forward-flight correction: " << dCFF << std::endl);
2901 silent_cerr(
"Rotor(" << uLabel <<
"): "
2902 "illegal null or negative forward-flight inflow correction "
2918 if (InducedType != DYNAMICINFLOW && pdW == 0) {
2922 if (iMaxIter ==
unsigned(-1)) {
2926 if (dTolerance == std::numeric_limits<double>::max()) {
2927 silent_cerr(
"Rotor(" << uLabel <<
"): "
2928 "warning, \"max iterations\" is meaningless with default tolerance"
2943 switch (InducedType) {
2945 DEBUGCOUT(
"Uniform induced velocity" << std::endl);
2950 ppres, dOR, dR, pdW,
2951 iMaxIter, dTolerance, dEta,
2956 case UNIFORM_SECTIONAL:
2957 DEBUGCOUT(
"Uniform induced velocity" << std::endl);
2962 ppres, dOR, dR, pdW,
2963 iMaxIter, dTolerance, dEta,
2969 DEBUGCOUT(
"Glauert induced velocity" << std::endl);
2974 ppres, dOR, dR, pdW,
2975 iMaxIter, dTolerance, dEta,
2981 DEBUGCOUT(
"Mangler induced velocity" << std::endl);
2987 ppres, dOR, dR, pdW,
2988 iMaxIter, dTolerance, dEta,
2994 DEBUGCOUT(
"Dynamic inflow" << std::endl);
2999 pCraft, rrot, pRotor,
3002 iMaxIter, dTolerance, dEta,
3004 dVConst, dVSine, dVCosine,
3009 ASSERTMSG(0,
"You shouldn't have reached this point");
3017 DEBUGCOUT(
"Reference rotation speed: " << dOR << std::endl);
3019 silent_cerr(
"Rotor(" << uLabel <<
"): "
3020 "invalid reference speed " << dOR
3027 DEBUGCOUT(
"Radius: " << dR << std::endl);
3029 silent_cerr(
"Rotor(" << uLabel <<
"): "
3030 "invalid radius " << dR
3037 bool bGotInitialValues(
false);
3042 unsigned iMaxIter = unsigned(-1);
3043 doublereal dTolerance = std::numeric_limits<double>::max();
3048 while (HP.
IsArg()) {
3054 silent_cerr(
"Rotor(" << uLabel <<
"): "
3055 "providing another \"ground\" node "
3064 }
else if (HP.
IsKeyWord(
"initial" "value")) {
3065 if (bGotInitialValues) {
3066 silent_cerr(
"Rotor(" << uLabel <<
"): "
3067 "providing \"initial value\" another time "
3077 bGotInitialValues =
true;
3079 }
else if (HP.
IsKeyWord(
"max" "iterations")) {
3080 if (iMaxIter !=
unsigned(-1)) {
3081 silent_cerr(
"Rotor(" << uLabel <<
"): "
3082 "providing another \"max iterations\" value "
3094 silent_cerr(
"illegal max iterations "
3095 << i <<
" for Rotor(" << uLabel <<
")");
3101 if (dTolerance != std::numeric_limits<double>::max()) {
3102 silent_cerr(
"Rotor(" << uLabel <<
"): "
3103 "providing another \"tolerance\" value "
3115 if (dTolerance <= 0.) {
3116 silent_cerr(
"illegal tolerance "
3117 << dTolerance <<
" for Rotor(" << uLabel <<
")");
3123 silent_cerr(
"Rotor(" << uLabel <<
"): "
3124 "providing another \"eta\" relaxation factor "
3136 silent_cerr(
"illegal eta "
3137 << dEta <<
" for Rotor(" << uLabel <<
")");
3141 }
else if (HP.
IsKeyWord(
"correction")) {
3143 silent_cerr(
"Rotor(" << uLabel <<
"): "
3144 "providing another \"correction\" factor "
3152 DEBUGCOUT(
"Hover correction: " << dCH << std::endl);
3154 silent_cerr(
"Rotor(" << uLabel <<
"): "
3155 "illegal null or negative hover inflow correction "
3162 DEBUGCOUT(
"Forward-flight correction: " << dCFF << std::endl);
3164 silent_cerr(
"Rotor(" << uLabel <<
"): "
3165 "illegal null or negative forward-flight inflow correction "
3180 if (iMaxIter ==
unsigned(-1)) {
3184 if (dTolerance == std::numeric_limits<double>::max()) {
3185 silent_cerr(
"Rotor(" << uLabel <<
"): "
3186 "warning, \"max iterations\" is meaningless with default tolerance"
3201 DEBUGCOUT(
"Dynamic inflow" << std::endl);
3206 pCraft, rrot, pRotor,
3209 iMaxIter, dTolerance, dEta,
3211 dVConst, dVSine, dVCosine,
3217 silent_cerr(
"Rotor(" << uLabel <<
"): "
3218 "unknown induced velocity type at line "
3225 silent_cerr(
"Rotor(" << uLabel <<
"): "
3226 "semicolon expected at line "
flag fReadOutput(MBDynParser &HP, const T &t) const
virtual doublereal dGetAirDensity(const Vec3 &X) const
virtual void SetInitialValue(VectorHandler &X)
Mat3x3 GetRotRel(const ReferenceFrame &rf)
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
virtual Vec3 GetInducedVelocity(Elem::Type type, unsigned uLabel, unsigned uPnt, const Vec3 &X) const
doublereal dHoverCorrection
virtual std::ostream & Restart(std::ostream &out) const
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
const Vec3 Zero3(0., 0., 0.)
doublereal dForwardFlightCorrection
virtual std::ostream & Restart(std::ostream &out) const
virtual bool bToBeOutput(void) const
virtual void ResetForce(void)
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
virtual doublereal dGetPsi(const Vec3 &X) const
#define MBDYN_EXCEPT_ARGS
virtual std::ostream & Restart(std::ostream &out) const
static const doublereal dM22
GradientExpression< UnaryExpr< FuncSin, Expr > > sin(const GradientExpression< Expr > &u)
virtual integer GetInt(integer iDefval=0)
virtual const Mat3x3 & GetRCurr(void) const
NoRotor(unsigned int uLabel, const DofOwner *pDO)
virtual const Vec3 & Force(void) const
virtual std::ostream & Restart(std::ostream &out) const
#define SAFEDELETEARR(pnt)
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
GlauertRotor(unsigned int uLabel, const DofOwner *pDO)
#define ASSERTMSG(expr, msg)
const Vec3 & Pole(void) const
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
virtual void AddForce(const Elem *pEl, const StructNode *pNode, const Vec3 &F, const Vec3 &M, const Vec3 &X)
void ResizeReset(integer iNewRow, integer iNewCol)
virtual std::ostream & Restart(std::ostream &out) const
virtual void Init(const StructNode *pC, const Mat3x3 &rrot, const StructNode *pR, const StructNode *pG, ResForceSet **ppres, const doublereal &dR, unsigned int iMaxIt, const doublereal &dTol, const doublereal &dE, flag fOut)
virtual Elem::Type GetElemType(void) const =0
ManglerRotor(unsigned int uLabel, const DofOwner *pDO)
std::vector< Hint * > Hints
virtual const Vec3 & Moment(void) const
virtual void Init(const StructNode *pCraft, const Mat3x3 &rrot, const StructNode *pRotor, const StructNode *pGround, ResForceSet **ppres, const doublereal &dOR, const doublereal &dR, unsigned int iMaxIt, const doublereal &dTol, const doublereal &dE, const doublereal &dCH, const doublereal &dCFF, const doublereal &dVConstTmp, const doublereal &dVSineTmp, const doublereal &dVCosineTmp, flag fOut)
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Vec3 GetVec(unsigned short int i) const
virtual Vec3 GetInducedVelocity(Elem::Type type, unsigned uLabel, unsigned uPnt, const Vec3 &X) const
virtual std::ostream & Restart(std::ostream &out) const =0
virtual void SetInitialValue(VectorHandler &X)
virtual void Init(const StructNode *pCraft, const Mat3x3 &rrot, const StructNode *pRotor, const StructNode *pGround, ResForceSet **ppres, const doublereal &dOR, const doublereal &dR, DriveCaller *pdW, unsigned int iMaxIt, const doublereal &dTol, const doublereal &dE, const doublereal &dCH, const doublereal &dCFF, flag fOut)
DynamicInflowRotor(unsigned int uLabel, const DofOwner *pDO)
virtual ~GlauertRotor(void)
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
const Mat3x3 Zero3x3(0., 0., 0., 0., 0., 0., 0., 0., 0.)
virtual void AddForce(const Elem *pEl, const StructNode *pNode, const Vec3 &F, const Vec3 &M, const Vec3 &X)
virtual void AddForce(const Elem *pEl, const StructNode *pNode, const Vec3 &F, const Vec3 &M, const Vec3 &X)
static const doublereal dM33
virtual ~PetersHeRotor(void)
void PutItem(integer iSubIt, integer iRow, integer iCol, const doublereal &dCoef)
void AddForces(const Vec3 &f, const Vec3 &c, const Vec3 &x)
PetersHeRotor(unsigned int uLabel, const DofOwner *pDO)
virtual const Vec3 & GetXCurr(void) const
static const doublereal dVTipTreshold
Rotor(unsigned int uL, const DofOwner *pDO)
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
#define SAFENEW(pnt, item)
virtual Vec3 GetInducedVelocity(Elem::Type type, unsigned uLabel, unsigned uPnt, const Vec3 &X) const
virtual void Output(OutputHandler &OH) const
virtual bool IsKeyWord(const char *sKeyWord)
virtual std::ostream & Restart(std::ostream &out) const
virtual Vec3 GetInducedVelocity(Elem::Type type, unsigned uLabel, unsigned uPnt, const Vec3 &X) const
doublereal copysign(doublereal x, doublereal y)
virtual Vec3 GetInducedVelocity(Elem::Type type, unsigned uLabel, unsigned uPnt, const Vec3 &X) const
virtual const Vec3 & GetWCurr(void) const
virtual void GetPos(const Vec3 &X, doublereal &dr, doublereal &dp) const
void PutPole(const Vec3 &x)
#define ASSERT(expression)
virtual void AddForce(const Elem *pEl, const StructNode *pNode, const Vec3 &F, const Vec3 &M, const Vec3 &X)
Elem * ReadRotor(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
virtual void Init(const StructNode *pCraft, const Mat3x3 &rrot, const StructNode *pRotor, const StructNode *pGround, ResForceSet **ppres, const doublereal &dOR, const doublereal &dR, DriveCaller *pdW, unsigned int iMaxIt, const doublereal &dTol, const doublereal &dE, const doublereal &dCH, const doublereal &dCFF, flag fOut)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
DriveCaller * pGetDriveCaller(void) const
virtual const Vec3 & GetXCurr(void) const
ResForceSet ** ReadResSets(DataManager *pDM, MBDynParser &HP)
virtual void Output(OutputHandler &OH) const
virtual doublereal dGetPos(const Vec3 &X) const
VectorExpression< VectorExpr, N_rows >::ScalarType Norm(const VectorExpression< VectorExpr, N_rows > &u)
Mat3x3 Transpose(void) const
const doublereal * pGetMat(void) const
void AddForce(const Vec3 &f)
virtual int GetWord(void)
std::ostream & Rotors(void) const
const doublereal * pGetVec(void) const
virtual ~DynamicInflowRotor(void)
virtual flag fToBeOutput(void) const
void Set(const DriveCaller *pDC)
doublereal dGet(const doublereal &dVar) const
virtual void InitParam(bool bComputeMeanInducedVelocity=true)
virtual void AddForce(const Elem *pEl, const StructNode *pNode, const Vec3 &F, const Vec3 &M, const Vec3 &X)
virtual void Init(const StructNode *pCraft, const Mat3x3 &rrot, const StructNode *pRotor, ResForceSet **ppres, const doublereal &dR, flag fOut)
virtual const Vec3 & GetVCurr(void) const
#define SAFENEWARR(pnt, item, sz)
virtual flag fGetAirVelocity(Vec3 &Velocity, const Vec3 &X) const
GradientExpression< UnaryExpr< FuncCos, Expr > > cos(const GradientExpression< Expr > &u)
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
DriveCaller * GetDriveCaller(bool bDeferred=false)
const StructNode * pRotor
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
SparseSubMatrixHandler & SetSparse(void)
virtual void SetOutputFlag(flag f=flag(1))
virtual integer iGetFirstIndex(void) const
GradientExpression< BinaryExpr< FuncAtan2, LhsExpr, RhsExpr > > atan2(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
virtual void Output(OutputHandler &OH) const
static const doublereal dM11
virtual HighParser::ErrOut GetLineData(void) const
const StructNode * pGround
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
virtual void AddForce(const Elem *pEl, const StructNode *pNode, const Vec3 &F, const Vec3 &M, const Vec3 &X)
GradientExpression< UnaryExpr< FuncTan, Expr > > tan(const GradientExpression< Expr > &u)
unsigned int GetLabel(void) const
Node * ReadNode(MBDynParser &HP, Node::Type type) const
virtual void Init(const StructNode *pCraft, const Mat3x3 &rrot, const StructNode *pRotor, const StructNode *pGround, ResForceSet **ppres, const doublereal &dOR, const doublereal &dR, unsigned int iMaxIt, const doublereal &dTol, const doublereal &dE, const doublereal &dCH, const doublereal &dCFF, const doublereal &dVConstTmp, const doublereal &dVSineTmp, const doublereal &dVCosineTmp, flag fOut)
virtual void Resize(integer iNewSize)=0
const StructNode * pCraft
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
virtual ~ManglerRotor(void)
virtual doublereal GetReal(const doublereal &dDefval=0.0)