85 if (!NetCDFOutputData.empty()) {
86 NetCDFOutputIter = NetCDFOutputData.begin();
108 if (!NetCDFOutputData.empty()) {
109 ASSERT(NetCDFOutputIter >= NetCDFOutputData.begin());
110 ASSERT(NetCDFOutputIter < NetCDFOutputData.end());
112 if (NetCDFOutputIter->Var_X) NetCDFOutputIter->X = X;
113 if (NetCDFOutputIter->Var_Phi) NetCDFOutputIter->R =
R;
114 if (NetCDFOutputIter->Var_V) NetCDFOutputIter->V = V;
115 if (NetCDFOutputIter->Var_W) NetCDFOutputIter->W = W;
116 if (NetCDFOutputIter->Var_F) NetCDFOutputIter->F = F;
117 if (NetCDFOutputIter->Var_M) NetCDFOutputIter->M = M;
161 template <
unsigned iNN>
173 :
Elem(uLabel, fOut),
180 bPassiveInducedVelocity(bPassive),
188 bJacobian(bUseJacobian)
192 ASSERT(iNN >= 1 && iNN <= 3);
196 template <
unsigned iNN>
209 template <
unsigned iNN>
219 template <
unsigned iNN>
223 *piNumRows = *piNumCols = iNN*6 + iGetNumDof();
227 template <
unsigned iNN>
231 return aerodata->iGetNumDof()*iNN*GDI.iGetNum();
234 template <
unsigned iNN>
237 const char *prefix,
bool bInitial)
const
239 ASSERT(bInitial ==
false);
241 integer iFirstIndex = iGetFirstIndex();
242 integer iNumDof = aerodata->iGetNumDof();
244 for (
unsigned b = 0; b < iNN; b++) {
245 for (
integer i = 0; i < GDI.iGetNum(); i++) {
247 << prefix << iFirstIndex + 1 <<
"->" << iFirstIndex + iNumDof <<
": "
248 "internal states at point #" << i <<
" of " << GDI.iGetNum() <<
", "
249 "block #" << b <<
" of " << iNN << std::endl;
251 iFirstIndex += iNumDof;
265 template <
unsigned iNN>
268 bool bInitial,
int i)
const
275 ASSERT(bInitial ==
false);
277 std::ostringstream os;
278 os <<
elemnames[iNN - 1] <<
"(" << GetLabel() <<
")";
280 integer iNumDof = aerodata->iGetNumDof();
282 integer iTotDof = iNumDof*GDI.iGetNum();
283 desc.resize(iTotDof);
285 std::string name(os.str());
287 for (
integer s = 0; s < iTotDof; s++) {
289 os.seekp(0, std::ios_base::end);
290 os <<
": internal state #" << s % iNumDof <<
" of " << iNumDof
291 <<
" at point #" << s/iNumDof <<
" of " << GDI.iGetNum() <<
", "
292 "block #" << s/(iNumDof*GDI.iGetNum()) <<
" of " << iNN;
300 os <<
": internal state #" << i % iNumDof <<
" of " << iNumDof
301 <<
" at point #" << i/iNumDof <<
" of " << GDI.iGetNum() <<
", "
302 "block #" << i/(iNumDof*GDI.iGetNum()) <<
" of " << iNN;
306 template <
unsigned iNN>
309 const char *prefix,
bool bInitial)
const
311 ASSERT(bInitial ==
false);
313 integer iFirstIndex = iGetFirstIndex();
314 integer iNumDof = aerodata->iGetNumDof();
316 for (
unsigned b = 0; b < iNN; b++) {
317 for (
integer i = 0; i < GDI.iGetNum(); i++) {
319 << prefix << iFirstIndex + 1 <<
"->" << iFirstIndex + iNumDof
320 <<
": dynamics equations at point #" << i <<
" of " << GDI.iGetNum() <<
", "
321 "block #" << b <<
" of " << iNN << std::endl;
323 iFirstIndex += iNumDof;
330 template <
unsigned iNN>
333 bool bInitial,
int i)
const
340 ASSERT(bInitial ==
false);
342 std::ostringstream os;
343 os <<
elemnames[iNN - 1] <<
"(" << GetLabel() <<
")";
345 integer iNumDof = aerodata->iGetNumDof();
347 integer iTotDof = iNumDof*GDI.iGetNum();
348 desc.resize(iTotDof);
350 std::string name(os.str());
352 for (
integer s = 0; s < iTotDof; s++) {
354 os.seekp(0, std::ios_base::end);
355 os <<
": internal equation #" << s % iNumDof <<
" of " << iNumDof
356 <<
" at point #" << s/iNumDof <<
" of " << GDI.iGetNum() <<
", "
357 "block " << s/(iNumDof*GDI.iGetNum()) <<
" of " << iNN;
365 os <<
": internal equation #" << i % iNumDof <<
" of " << iNumDof
366 <<
" at point #" << i/iNumDof <<
" of " << GDI.iGetNum() <<
", "
367 "block " << i/(iNumDof*GDI.iGetNum()) <<
" of " << iNN;
371 template <
unsigned iNN>
375 ASSERT(aerodata->iGetNumDof() > 0);
377 return aerodata->GetDofType(i % aerodata->iGetNumDof());
380 template <
unsigned iNN>
386 integer iNumDof = aerodata->iGetNumDof();
400 template <
unsigned iNN>
407 switch (aerodata->Unsteady()) {
415 for (
unsigned i = 0; i < iNN*GDI.iGetNum(); i++) {
424 for (
unsigned i = 0; i < iNN*GDI.iGetNum(); i++) {
425 aerodata->AfterConvergence(i, X, XP);
430 template <
unsigned iNN>
439 template <
unsigned iNN>
449 template <
unsigned iNN>
458 std::ostringstream os;
459 os <<
"elem.aerodynamic." << GetLabel();
460 (void)OH.CreateVar(os.str(),
elemnames[iNN - 1]);
463 std::string name = os.str();
465 int totgp = iNN*GDI.iGetNum();
466 NetCDFOutputData.resize(totgp);
469 for (std::vector<AeroNetCDFOutput>::iterator i = NetCDFOutputData.begin();
470 i != NetCDFOutputData.end(); ++i, ++j)
473 os <<
"Gauss point #" << j <<
"/" << totgp;
474 std::string gp(os.str());
476 unsigned uOutputFlags = (fToBeOutput() & OUTPUT_GP_ALL);
485 os.seekp(0, std::ios_base::end);
487 i->Var_X = OH.CreateVar<
Vec3>(os.str(),
"m",
488 gp +
" global position vector (X, Y, Z)");
495 i->Var_Phi = OH.CreateRotationVar(name, os.str(), od,
502 os.seekp(0, std::ios_base::end);
504 i->Var_V = OH.CreateVar<
Vec3>(os.str(),
"m/s",
505 gp +
" global frame (V_X, V_Y, V_Z)");
511 os.seekp(0, std::ios_base::end);
513 i->Var_W = OH.CreateVar<
Vec3>(os.str(),
"radian/s",
514 gp +
" global frame (Omega_X, Omega_Y, Omega_Z)");
520 os.seekp(0, std::ios_base::end);
522 i->Var_F = OH.CreateVar<
Vec3>(os.str(),
"N",
523 gp +
" force in local frame (F_X, F_Y, F_Z)");
529 os.seekp(0, std::ios_base::end);
531 i->Var_M = OH.CreateVar<
Vec3>(os.str(),
"Nm",
532 gp +
" force in local frame (M_X, M_Y, M_Z)");
542 template <
unsigned iNN>
548 for (std::vector<AeroNetCDFOutput>::const_iterator i = NetCDFOutputData.begin();
549 i != NetCDFOutputData.end(); ++i)
624 template <
unsigned iNN>
629 if (pIndVel != 0 && !bPassiveInducedVelocity
630 && !pIndVel->bSectionalForces())
632 pIndVel->AddForce(
this, pN, F, M, X);
640 template <
unsigned iNN>
647 if (pIndVel != 0 && !bPassiveInducedVelocity
648 && pIndVel->bSectionalForces())
650 pIndVel->AddSectionalForce(GetElemType(),
this, uPnt,
651 F, M, dW, X, R, V, W);
673 :
Elem(uLabel, fOut),
674 Aerodynamic2DElem<1>(uLabel, pDO, pR, bPassive, pC, pF, pV, pT, pTL, iN,
675 a, pDC, bUseJacobian, ood, fOut),
680 Ra3(RaTmp.GetVec(3)),
702 out <<
" aerodynamic body: " <<
GetLabel() <<
", "
707 out <<
", reference, node, ",
f.
Write(out,
", ")
719 return out <<
";" << std::endl;
728 DEBUGCOUT(
"Entering AerodynamicBody::AssJac()" << std::endl);
748 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
796 integer iOffset = iFirstEq - 6;
798 for (
int iCnt = 6 + 1; iCnt <= iNumRows; iCnt++) {
811 Vec3 Vr(Vn + Wn.Cross(Xr));
847 Mat3x3 RTw( dCosT, dSinT, 0.,
860 VTmp = RRloc.
MulTV(Vr);
883 iFirstEq, iFirstSubEq,
887 integer iOffset = 6 + iPnt*iNumDof;
888 for (
integer iCol = 1; iCol <= iNumDof; iCol++) {
890 Vec3 cqTmp(Xr.Cross(fqTmp) + (RRloc*
cq.
GetVec(iCol))*cc);
892 WM.
Sub(1, iOffset + iCol, fqTmp);
893 WM.
Sub(4, iOffset + iCol, cqTmp);
898 iFirstSubEq += iNumDof;
907 Vec3 fTmp(RRloc*(
Vec3(&Fa0[0])*dCoef));
908 Vec3 cTmp(RRloc*(
Vec3(&Fa0[3])*dCoef) + Xr.Cross(fTmp));
921 Mat22 += Mat21*MatV - Mat3x3(
MatCross, cTmp);
951 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
955 AssVec(WorkVec, dCoef, XCurr, XPrimeCurr);
978 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
982 AssVec(WorkVec, 1., XCurr, XCurr);
1044 integer iOffset = iFirstEq - 6;
1046 for (
int iCnt = 6 + 1; iCnt <= iNumRows; iCnt++) {
1058 Vec3 Vr(Vn + Wn.Cross(Xr));
1094 Mat3x3 RTw( dCosT, dSinT, 0.,
1107 VTmp = RRloc.
MulTV(Vr);
1116 iFirstEq, iFirstSubEq, iPnt, dW, dTng,
OUTA[iPnt]);
1119 iFirstEq += iNumDof;
1120 iFirstSubEq += iNumDof;
1144 SetData(VTmp, dTng, Xr, RRloc, Vr, Wn, FTmp, MTmp);
1182 for (std::vector<Aero_output>::const_iterator i =
OutputData.begin();
1185 out <<
" " << i->alpha
1193 <<
" " <<
OUTA[i].alpha
1194 <<
" " <<
OUTA[i].gamma
1195 <<
" " <<
OUTA[i].mach
1196 <<
" " <<
OUTA[i].cl
1197 <<
" " <<
OUTA[i].cd
1198 <<
" " <<
OUTA[i].cm
1199 <<
" " <<
OUTA[i].alf1
1200 <<
" " <<
OUTA[i].alf2;
1217 unsigned uLabel,
const char *sElemType,
1220 bool bReadIV(
false);
1221 bool bReadUDIV(
false);
1223 silent_cerr(sElemType <<
"(" << uLabel <<
"): "
1224 "\"rotor\" keyword is deprecated; "
1225 "use \"induced velocity\" instead "
1231 }
else if (HP.
IsKeyWord(
"induced" "velocity")) {
1234 }
else if (HP.
IsKeyWord(
"user" "defined" "induced" "velocity")) {
1240 unsigned int uIV = (
unsigned int)HP.
GetInt();
1242 "Linked to InducedVelocity(" << uIV <<
")" << std::endl);
1259 silent_cerr(sElemType <<
"(" << uLabel <<
"): "
1260 "user-defined InducedVelocity(" << uIV <<
") not defined "
1271 if (p == 0 || !dynamic_cast<InducedVelocity *>(p)) {
1272 silent_cerr(sElemType <<
"(" << uLabel <<
"): "
1273 "InducedVelocity(" << uIV <<
") not defined "
1280 silent_cerr(sElemType <<
"(" << uLabel <<
"): "
1281 "InducedVelocity(" << uIV <<
") not defined; using user-defined InducedVelocity(" << uIV <<
") "
1291 return (pIndVel != 0);
1300 while (HP.
IsArg()) {
1306 }
else if (HP.
IsKeyWord(
"orientation")) {
1312 }
else if (HP.
IsKeyWord(
"angular" "velocity")) {
1315 }
else if (HP.
IsKeyWord(
"configuration")) {
1334 if (uFlags & uFlag) {
1335 silent_cerr(
"AerodynamicElement(" << uLabel <<
"): "
1336 "duplicate custom output "
1364 unsigned int uLabel)
1372 bool bPassive(
false);
1388 Shape* pVelocity = 0;
1390 Shape* pTipLoss = 0;
1397 &pChord, &pForce, &pVelocity, &pTwist, &pTipLoss,
1398 &iNumber, &pDC, &aerodata);
1400 bool bUseJacobian(
false);
1405 if (aerodata->
iGetNumDof() > 0 && !bUseJacobian) {
1406 silent_cerr(
"AerodynamicBody(" << uLabel <<
"): "
1407 "aerodynamic model needs \"jacobian, yes\" at line " << HP.
GetLineData()
1425 silent_cerr(
"AerodynamicBody(" << uLabel <<
"): "
1426 "unknown output mode at line " << HP.
GetLineData()
1441 pChord, pForce, pVelocity, pTwist, pTipLoss,
1442 iNumber, aerodata, pDC, bUseJacobian, od, fOut));
1446 silent_cerr(
"semicolon expected at line "
1451 Vec3 Ra3 = Ra.GetVec(3);
1463 out <<
"aero0: " << uLabel
1465 <<
" ", (f - Ra3*(dSpan/2.) + Ram1*(dPm1 - dCm1*3./4.)).
Write(out,
" ")
1466 <<
" ", (f - Ra3*(dSpan/2.) + Ram1*(dPm1 + dCm1/4.)).
Write(out,
" ")
1467 <<
" ", (f + Ra3*(dSpan/2.) + Rap1*(dPp1 - dCp1*3./4.)).
Write(out,
" ")
1468 <<
" ", (f + Ra3*(dSpan/2.) + Rap1*(dPp1 + dCp1/4.)).
Write(out,
" ")
1494 :
Elem(uLabel, fOut),
1496 pC, pF, pV, pT, pTL, iN, a, pDC, bUseJacobian, ood, fOut),
1504 Ra1_3(Ra1Tmp.GetVec(3)),
1505 Ra2_3(Ra2Tmp.GetVec(3)),
1506 Ra3_3(Ra3Tmp.GetVec(3))
1513 for (
int iNode = 0; iNode < 3; iNode++) {
1531 out <<
" aerodynamic beam: " <<
GetLabel()
1536 out <<
", reference, node, ",
f1.
Write(out,
", ")
1539 <<
", reference, node, ",
f2.
Write(out,
", ")
1542 <<
", reference, node, ",
f3.
Write(out,
", ")
1553 return out <<
";" << std::endl;
1567 DEBUGCOUT(
"Entering AerodynamicBeam::AssJac()" << std::endl);
1589 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
1592 WM.
PutRowIndex(6 + iCnt, iNode2FirstIndex + iCnt);
1593 WM.
PutColIndex(6 + iCnt, iNode2FirstPosIndex + iCnt);
1594 WM.
PutRowIndex(12 + iCnt, iNode3FirstIndex + iCnt);
1595 WM.
PutColIndex(12 + iCnt, iNode3FirstPosIndex + iCnt);
1684 integer iOffset = iFirstEq - 18;
1686 for (
int iCnt = 18 + 1; iCnt <= iNumRows; iCnt++) {
1692 for (
int iNode = 0; iNode <
LASTNODE; iNode++) {
1728 Vec3 Xr(X1Tmp*dN1 + X2Tmp*dN2 + X3Tmp*dN3);
1729 Vec3 Vr(V1Tmp*dN1 + V2Tmp*dN2 + V3Tmp*dN3);
1730 Vec3 Wr(Wn1*dN1 + Wn2*dN2 + Wn3*dN3);
1731 Vec3 gr(g1*dN1 + g3*dN3);
1771 Mat3x3 RTw(dCosT, dSinT, 0.,
1785 VTmp = RRloc.
MulTV(Vr);
1796 Vec3 d(Xr - Xn[iNode]);
1798 Mat3x3 Theta1(RR2*Gamma*GammaInv1.
MulMT(RR2*dN1));
1799 Mat3x3 Theta3(RR2*Gamma*GammaInv3.
MulMT(RR2*dN3));
1831 iFirstEq, iFirstSubEq,
1835 integer iOffset = 18 + iPnt*iNumDof;
1836 for (
integer iCol = 1; iCol <= iNumDof; iCol++) {
1840 WM.
Sub(6*iNode + 1, iOffset + iCol, fqTmp);
1841 WM.
Sub(6*iNode + 4, iOffset + iCol, cqTmp);
1845 iFirstEq += iNumDof;
1846 iFirstSubEq += iNumDof;
1856 Vec3 fTmp(RRloc*(
Vec3(&Fa0[0])*dCoef));
1871 delta = (iNode ==
NODE1) ? 1. : 0.;
1874 delta = (iNode ==
NODE2) ? 1. : 0.;
1877 delta = (iNode ==
NODE3) ? 1. : 0.;
1896 WM_M[
DELTAg1] -= cTmp.Cross(Theta1);
1901 WM_M[
DELTAg2] -= cTmp.Cross(Theta2);
1906 WM_M[
DELTAg3] -= cTmp.Cross(Theta3);
1909 for (
int iCnt = 0; iCnt < 2*
LASTNODE; iCnt++) {
1910 WM_F[iCnt] += WM_F2[iCnt];
1911 WM_M[iCnt] += d.
Cross(WM_F2[iCnt]);
1918 for (
int iCnt = 0; iCnt < 2*
LASTNODE; iCnt++) {
1919 WM.
Sub(6*iNode + 1, 3*iCnt + 1, WM_F[iCnt]);
1920 WM.
Sub(6*iNode + 4, 3*iCnt + 1, WM_M[iCnt]);
1944 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
1945 WorkVec.
PutRowIndex(iCnt, iNode1FirstIndex + iCnt);
1946 WorkVec.
PutRowIndex(6 + iCnt, iNode2FirstIndex + iCnt);
1947 WorkVec.
PutRowIndex(12 + iCnt, iNode3FirstIndex + iCnt);
1950 AssVec(WorkVec, dCoef, XCurr, XPrimeCurr);
1966 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
1967 WorkVec.
PutRowIndex(iCnt, iNode1FirstIndex + iCnt);
1968 WorkVec.
PutRowIndex(6 + iCnt, iNode2FirstIndex + iCnt);
1969 WorkVec.
PutRowIndex(12 + iCnt, iNode3FirstIndex + iCnt);
1972 AssVec(WorkVec, 1., XCurr, XCurr);
2063 integer iOffset = iFirstEq - 18;
2065 for (
int iCnt = 18 + 1; iCnt <= iNumRows; iCnt++) {
2070 for (
int iNode = 0; iNode <
LASTNODE; iNode++) {
2094 Vec3 Xr(X1Tmp*dN1 + X2Tmp*dN2 + X3Tmp*dN3);
2095 Vec3 Vr(V1Tmp*dN1 + V2Tmp*dN2 + V3Tmp*dN3);
2096 Vec3 Wr(Wn1*dN1 + Wn2*dN2 + Wn3*dN3);
2135 Mat3x3 RTw(dCosT, dSinT, 0.,
2152 VTmp = RRloc.
MulTV(Vr);
2161 iFirstEq, iFirstSubEq, iPnt, dW, dTng,
OUTA[iPnt]);
2164 iFirstEq += iNumDof;
2165 iFirstSubEq += iNumDof;
2184 M[iNode] += (Xr - Xn[iNode]).
Cross(FTmp);
2188 SetData(VTmp, dTng, Xr, RRloc, Vr, Wr, FTmp, MTmp);
2199 WorkVec.
Add(6*iNode + 1,
F[iNode]);
2200 WorkVec.
Add(6*iNode + 4,
M[iNode]);
2230 for (std::vector<Aero_output>::const_iterator i =
OutputData.begin();
2233 out <<
" " << i->alpha
2241 <<
" " <<
OUTA[i].alpha
2242 <<
" " <<
OUTA[i].gamma
2243 <<
" " <<
OUTA[i].mach
2244 <<
" " <<
OUTA[i].cl
2245 <<
" " <<
OUTA[i].cd
2246 <<
" " <<
OUTA[i].cm
2247 <<
" " <<
OUTA[i].alf1
2248 <<
" " <<
OUTA[i].alf2;
2271 unsigned int uLabel)
2276 unsigned int uBeam = (
unsigned int)HP.
GetInt();
2283 silent_cerr(
"Beam3(" << uBeam <<
") not defined "
2288 Beam *pBeam =
dynamic_cast<Beam *
>(p);
2290 silent_cerr(
"Beam(" << uBeam <<
") is not a Beam3 "
2299 bool bPassive(
false);
2314 "Node 1 rotation matrix: " << std::endl << Ra1 << std::endl);
2327 "Node 2 rotation matrix: " << std::endl << Ra2 << std::endl);
2340 "Node 3 rotation matrix: " << std::endl << Ra3 << std::endl);
2344 Shape* pVelocity = 0;
2346 Shape* pTipLoss = 0;
2353 &pChord, &pForce, &pVelocity, &pTwist, &pTipLoss,
2354 &iNumber, &pDC, &aerodata);
2356 bool bUseJacobian(
false);
2361 if (aerodata->
iGetNumDof() > 0 && !bUseJacobian) {
2362 silent_cerr(
"AerodynamicBeam3(" << uLabel <<
"): "
2363 "aerodynamic model needs \"jacobian, yes\" at line " << HP.
GetLineData()
2381 silent_cerr(
"AerodynamicBeam3(" << uLabel <<
"): "
2382 "unknown output mode at line " << HP.
GetLineData()
2397 f1, f2, f3, Ra1, Ra2, Ra3,
2398 pChord, pForce, pVelocity, pTwist, pTipLoss,
2399 iNumber, aerodata, pDC, bUseJacobian, od, fOut));
2403 silent_cerr(
"semicolon expected at line "
2409 out <<
"aero3: " << uLabel;
2411 Vec3 ra1 = Ra1.GetVec(1);
2412 Vec3 ra3 = Ra1.GetVec(3);
2417 <<
" ", (f1 + ra1*(dP - dC*3./4.)).
Write(out,
" ")
2418 <<
" ", (f1 + ra1*(dP + dC/4.)).
Write(out,
" ");
2420 ra1 = Ra2.GetVec(1);
2421 ra3 = Ra2.GetVec(3);
2422 dC = pChord->
dGet(0.);
2423 dP = pForce->
dGet(0.);
2426 <<
" ", (f2 + ra1*(dP - dC*3./4.)).
Write(out,
" ")
2427 <<
" ", (f2 + ra1*(dP + dC/4.)).
Write(out,
" ");
2429 ra1 = Ra3.GetVec(1);
2430 ra3 = Ra3.GetVec(3);
2431 dC = pChord->
dGet(1.);
2432 dP = pForce->
dGet(1.);
2435 <<
" ", (f3 + ra1*(dP - dC*3./4.)).
Write(out,
" ")
2436 <<
" ", (f3 + ra1*(dP + dC/4.)).
Write(out,
" ")
2446 unsigned int uLabel,
2466 :
Elem(uLabel, fOut),
2468 pC, pF, pV, pT, pTL, iN, a, pDC, bUseJacobian, ood, fOut),
2474 Ra1_3(Ra1Tmp.GetVec(3)),
2475 Ra2_3(Ra2Tmp.GetVec(3))
2501 out <<
" aerodynamic beam2: " <<
GetLabel()
2506 out <<
", reference, node, ",
f1.
Write(out,
", ")
2509 <<
", reference, node, ",
f2.
Write(out,
", ")
2520 return out <<
";" << std::endl;
2533 DEBUGCOUT(
"Entering AerodynamicBeam2::AssJac()" << std::endl);
2553 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
2556 WM.
PutRowIndex(6 + iCnt, iNode2FirstIndex + iCnt);
2557 WM.
PutColIndex(6 + iCnt, iNode2FirstPosIndex + iCnt);
2631 integer iOffset = iFirstEq - 12;
2633 for (
int iCnt = 12 + 1; iCnt <= iNumRows; iCnt++) {
2639 for (
int iNode = 0; iNode <
LASTNODE; iNode++) {
2673 Vec3 Xr(X1Tmp*dN1 + X2Tmp*dN2);
2674 Vec3 Vr(V1Tmp*dN1 + V2Tmp*dN2);
2675 Vec3 Wr(Wn1*dN1 + Wn2*dN2);
2676 Vec3 thetar(overline_theta*dN2);
2715 Mat3x3 RTw(dCosT, dSinT, 0.,
2729 VTmp = RRloc.
MulTV(Vr);
2740 Vec3 d(Xr - Xn[iNode]);
2763 iFirstEq, iFirstSubEq,
2767 integer iOffset = 12 + iPnt*iNumDof;
2768 for (
integer iCol = 1; iCol <= iNumDof; iCol++) {
2772 WM.
Sub(6*iNode + 1, iOffset + iCol, fqTmp);
2773 WM.
Sub(6*iNode + 4, iOffset + iCol, cqTmp);
2777 iFirstEq += iNumDof;
2778 iFirstSubEq += iNumDof;
2788 Vec3 fTmp(RRloc*(
Vec3(&Fa0[0])*dCoef));
2801 delta = (iNode ==
NODE1) ? 1. : 0.;
2804 delta = (iNode ==
NODE2) ? 1. : 0.;
2827 for (
int iCnt = 0; iCnt < 2*
LASTNODE; iCnt++) {
2828 WM_F[iCnt] += WM_F2[iCnt];
2829 WM_M[iCnt] += d.
Cross(WM_F2[iCnt]);
2836 for (
int iCnt = 0; iCnt < 2*
LASTNODE; iCnt++) {
2837 WM.
Sub(6*iNode + 1, 3*iCnt + 1, WM_F[iCnt]);
2838 WM.
Sub(6*iNode + 4, 3*iCnt + 1, WM_M[iCnt]);
2862 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
2863 WorkVec.
PutRowIndex(iCnt, iNode1FirstIndex + iCnt);
2864 WorkVec.
PutRowIndex(6 + iCnt, iNode2FirstIndex + iCnt);
2867 AssVec(WorkVec, dCoef, XCurr, XPrimeCurr);
2882 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
2883 WorkVec.
PutRowIndex(iCnt, iNode1FirstIndex + iCnt);
2884 WorkVec.
PutRowIndex(6 + iCnt, iNode2FirstIndex + iCnt);
2887 AssVec(WorkVec, 1., XCurr, XCurr);
2969 integer iOffset = iFirstEq - 12;
2971 for (
int iCnt = 12 + 1; iCnt <= iNumRows; iCnt++) {
2976 for (
int iNode = 0; iNode <
LASTNODE; iNode++) {
2998 Vec3 Xr(X1Tmp*dN1 + X2Tmp*dN2);
2999 Vec3 Vr(V1Tmp*dN1 + V2Tmp*dN2);
3000 Vec3 Wr(Wn1*dN1 + Wn2*dN2);
3001 Vec3 thetar(overline_theta*((1. + dN2 - dN1)/2.));
3038 Mat3x3 RTw( dCosT, dSinT, 0.,
3051 VTmp = RRloc.
MulTV(Vr);
3060 iFirstEq, iFirstSubEq, iPnt, dW, dTng,
OUTA[iPnt]);
3063 iFirstEq += iNumDof;
3064 iFirstSubEq += iNumDof;
3083 M[iNode] += (Xr - Xn[iNode]).
Cross(FTmp);
3087 SetData(VTmp, dTng, Xr, RRloc, Vr, Wr, FTmp, MTmp);
3098 WorkVec.
Add(6*iNode + 1,
F[iNode]);
3099 WorkVec.
Add(6*iNode + 4,
M[iNode]);
3129 for (std::vector<Aero_output>::const_iterator i =
OutputData.begin();
3132 out <<
" " << i->alpha
3140 <<
" " <<
OUTA[i].alpha
3141 <<
" " <<
OUTA[i].gamma
3142 <<
" " <<
OUTA[i].mach
3143 <<
" " <<
OUTA[i].cl
3144 <<
" " <<
OUTA[i].cd
3145 <<
" " <<
OUTA[i].cm
3146 <<
" " <<
OUTA[i].alf1
3147 <<
" " <<
OUTA[i].alf2;
3170 unsigned int uLabel)
3175 unsigned int uBeam = (
unsigned int)HP.
GetInt();
3182 silent_cerr(
"Beam2(" << uBeam <<
") not defined "
3189 silent_cerr(
"Beam(" << uBeam <<
") is not a Beam2 "
3197 bool bPassive(
false);
3212 "Node 1 rotation matrix: " << std::endl << Ra1 << std::endl);
3225 "Node 2 rotation matrix: " << std::endl << Ra2 << std::endl);
3229 Shape* pVelocity = 0;
3231 Shape* pTipLoss = 0;
3238 &pChord, &pForce, &pVelocity, &pTwist, &pTipLoss,
3239 &iNumber, &pDC, &aerodata);
3241 bool bUseJacobian(
false);
3246 if (aerodata->
iGetNumDof() > 0 && !bUseJacobian) {
3247 silent_cerr(
"AerodynamicBeam2(" << uLabel <<
"): "
3248 "aerodynamic model needs \"jacobian, yes\" at line " << HP.
GetLineData()
3266 silent_cerr(
"AerodynamicBeam2(" << uLabel <<
"): "
3267 "unknown output mode at line " << HP.
GetLineData()
3283 pChord, pForce, pVelocity, pTwist, pTipLoss,
3284 iNumber, aerodata, pDC, bUseJacobian, od, fOut));
3288 silent_cerr(
"semicolon expected at line "
3294 out <<
"aero2: " << uLabel;
3296 Vec3 ra1 = Ra1.GetVec(1);
3297 Vec3 ra3 = Ra1.GetVec(3);
3302 <<
" ", (f1 + ra1*(dP - dC*3./4.)).
Write(out,
" ")
3303 <<
" ", (f1 + ra1*(dP + dC/4.)).
Write(out,
" ");
3305 ra1 = Ra2.GetVec(1);
3306 ra3 = Ra2.GetVec(3);
3307 dC = pChord->
dGet(1.);
3308 dP = pForce->
dGet(1.);
3311 <<
" ", (f2 + ra1*(dP - dC*3./4.)).
Write(out,
" ")
3312 <<
" ", (f2 + ra1*(dP + dC/4.)).
Write(out,
" ")
flag fReadOutput(MBDynParser &HP, const T &t) const
Mat3x3 GetRotRel(const ReferenceFrame &rf)
virtual Elem::Type GetElemType(void) const
virtual std::ostream & Restart(std::ostream &out) const
Mat3x3 MultRMRt(const Mat3x3 &m, const Mat3x3 &R)
Elem * ReadAerodynamicBeam(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
void PutColIndex(integer iSubCol, integer iCol)
static const doublereal pdsi2[]
virtual void SetSectionData(const doublereal &abscissa, const doublereal &chord, const doublereal &forcepoint, const doublereal &velocitypoint, const doublereal &twist, const doublereal &omega=0.)
const Vec3 Zero3(0., 0., 0.)
Vec3 Cross(const Vec3 &v) const
virtual bool GetAirProps(const Vec3 &X, doublereal &rho, doublereal &c, doublereal &p, doublereal &T) const
std::ostream & Write(std::ostream &out, const char *sFill=" ") const
virtual ~AerodynamicBody(void)
virtual bool bToBeOutput(void) const
virtual int GetForcesJac(int i, const doublereal *W, doublereal *TNG, Mat6x6 &J, outa_t &OUTA)
#define MBDYN_EXCEPT_ARGS
GradientExpression< UnaryExpr< FuncSin, Expr > > sin(const GradientExpression< Expr > &u)
virtual void SetOutputFlag(flag f=flag(1))
#define DEBUGCOUTFNAME(fname)
virtual void ResizeReset(integer)
AerodynamicOutput::eOutput GetOutput(void) const
void SetOutputFlag(flag f, int iNP)
virtual integer GetInt(integer iDefval=0)
virtual std::ostream & Restart(std::ostream &out) const =0
const MatCross_Manip MatCross
bool UseNetCDF(int out) const
FullSubMatrixHandler & SetFull(void)
virtual const Mat3x3 & GetRCurr(void) const
virtual Node::Type GetNodeType(void) const
doublereal DxDcsi2N(doublereal d, const Vec3 &X1, const Vec3 &X2)
const StructNode * pNode[2]
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
std::ostream & Write(std::ostream &out, const FullMatrixHandler &m, const char *s, const char *s2)
flag fGetNext(doublereal &d, integer i=0) const
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &)
virtual unsigned int iGetNumDof(void) const
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
PntWght GetFirst(void) const
virtual void Output(OutputHandler &OH) const
doublereal dGet(void) const
void AssVec(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
std::vector< outa_t > OUTA
virtual int GetForces(int i, const doublereal *W, doublereal *TNG, outa_t &OUTA)
virtual std::ostream & DescribeDof(std::ostream &out, const char *prefix="", bool bInitial=false) const
InducedVelocity * pIndVel
void PutMat3x3(integer iCol, const Mat3x3 &m)
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
void GetOutput(Elem::Type t, unsigned &, OrientationDescription &) const
doublereal ShapeFunc3N(doublereal d, integer iNode, enum Order Ord)
static const bool bDefaultUseJacobian
OrientationDescription ReadOptionalOrientationDescription(DataManager *pDM, MBDynParser &HP)
virtual unsigned int iGetNumDof(void) const
virtual Elem::Type GetElemType(void) const =0
static const char * elemnames[]
std::vector< Hint * > Hints
virtual const Shape * pGetShape(void) const
virtual std::ostream & DescribeEq(std::ostream &out, const char *prefix="", bool bInitial=false) const
virtual DofOrder::Order GetDofType(unsigned int) const
virtual integer iGetSize(void) const =0
virtual void Output(OutputHandler &OH) const
Vec3 GetVec(unsigned short int i) const
virtual const StructNode * pGetNode(unsigned int i) const
void ReadOptionalAerodynamicCustomOutput(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, unsigned &uFlags, OrientationDescription &od)
AerodynamicBeam2(unsigned int uLabel, const DofOwner *pDO, const Beam2 *pB, InducedVelocity *pR, bool bPassive, const Vec3 &fTmp1, const Vec3 &fTmp2, const Mat3x3 &Ra1Tmp, const Mat3x3 &Ra2Tmp, const Shape *pC, const Shape *pF, const Shape *pV, const Shape *pT, const Shape *pTL, integer iN, AeroData *a, const DriveCaller *pDC, bool bUseJacobian, OrientationDescription ood, flag fOut)
virtual std::ostream & Restart(std::ostream &out) const =0
virtual void SetAirData(const doublereal &rho, const doublereal &c)
Vec3 VecRot(const Mat3x3 &Phi)
virtual bool GetYesNoOrBool(bool bDefval=false)
Vec3 MulTV(const Vec3 &v) const
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
Elem * pFindElem(Elem::Type Typ, unsigned int uElem, unsigned int iDeriv) const
Vec3 GetVec(integer iCol) const
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
doublereal ShapeFunc2N(doublereal d, integer iNode, enum Order Ord)
void ReadAerodynamicCustomOutput(DataManager *pDM, MBDynParser &HP, unsigned int uLabel, unsigned &uFlags, OrientationDescription &od)
virtual std::ostream & Restart(std::ostream &out) const =0
doublereal dGetWght(void) const
void AssVec(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
static bool ReadInducedVelocity(DataManager *pDM, MBDynParser &HP, unsigned uLabel, const char *sElemType, InducedVelocity *&pIndVel, bool &bPassive)
Vec3 MatR2EulerAngles313(const Mat3x3 &R)
Vec3 GetPosRel(const ReferenceFrame &rf)
virtual Elem::Type GetElemType(void) const
const StructNode * pNode[3]
const ShapeOwner ForcePoint
const doublereal dN3[2][3]
virtual bool IsKeyWord(const char *sKeyWord)
AerodynamicOutput(flag f, int iNP, OrientationDescription ood)
static const doublereal pdsf3[]
void PutTo(doublereal *pd) const
virtual Vec3 GetInducedVelocity(Elem::Type type, unsigned uLabel, unsigned uPnt, const Vec3 &X) const =0
long GetCurrentStep(void) const
static const doublereal pdsf2[]
virtual ~Aerodynamic2DElem(void)
Vec3 MatR2EulerAngles123(const Mat3x3 &R)
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &, const VectorHandler &)
Elem * ReadAerodynamicBody(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
virtual integer iGetFirstMomentumIndex(void) const =0
virtual doublereal dGet(doublereal d) const
virtual integer iGetFirstPositionIndex(void) const
bool IsOutput(void) const
virtual const Vec3 & GetWCurr(void) const
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *h=0)
virtual const StructNode * pGetNode(unsigned int i) const
virtual std::ostream & Restart(std::ostream &out) const
bool IsOpen(int out) const
void ReadAeroData(DataManager *pDM, MBDynParser &HP, int iDim, Shape **ppChord, Shape **ppForce, Shape **ppVelocity, Shape **ppTwist, Shape **ppTipLoss, integer *piNumber, DriveCaller **ppDC, AeroData **aerodata)
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal, const VectorHandler &, const VectorHandler &)
#define ASSERT(expression)
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Mat3x3 MulTM(const Mat3x3 &m) const
virtual doublereal dGetOmega(void) const
VectorExpression< VectorCrossExpr< VectorLhsExpr, VectorRhsExpr >, 3 > Cross(const VectorExpression< VectorLhsExpr, 3 > &u, const VectorExpression< VectorRhsExpr, 3 > &v)
void AddSectionalForce_int(unsigned uPnt, const Vec3 &F, const Vec3 &M, doublereal dW, const Vec3 &X, const Mat3x3 &R, const Vec3 &V, const Vec3 &W) const
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
DriveCaller * pGetDriveCaller(void) const
Elem * ReadAerodynamicBeam2(DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
virtual const Vec3 & GetXCurr(void) const
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
virtual void Add(integer iRow, const Vec3 &v)
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
void Output_int(OutputHandler &OH) const
virtual void ResizeReset(integer, integer)
virtual void Output(OutputHandler &OH) const
const ShapeOwner VelocityPoint
bool IsPGAUSS(void) const
std::vector< Aero_output > OutputData
static std::stack< cleanup * > c
Mat3x3 Transpose(void) const
const MatCrossCross_Manip MatCrossCross
void SetData(const Vec3 &v, const doublereal *pd, const Vec3 &X, const Mat3x3 &R, const Vec3 &V, const Vec3 &W, const Vec3 &F, const Vec3 &M)
doublereal DxDcsi3N(doublereal d, const Vec3 &X1, const Vec3 &X2, const Vec3 &X3)
AerodynamicBody(unsigned int uLabel, const DofOwner *pDO, const StructNode *pN, InducedVelocity *pR, bool bPassive, const Vec3 &fTmp, doublereal dS, const Mat3x3 &RaTmp, const Shape *pC, const Shape *pF, const Shape *pV, const Shape *pT, const Shape *pTL, integer iN, AeroData *a, const DriveCaller *pDC, bool bUseJacobian, OrientationDescription ood, flag fOut)
AerodynamicBeam(unsigned int uLabel, const DofOwner *pDO, const Beam *pB, InducedVelocity *pR, bool bPassive, const Vec3 &fTmp1, const Vec3 &fTmp2, const Vec3 &fTmp3, const Mat3x3 &Ra1Tmp, const Mat3x3 &Ra2Tmp, const Mat3x3 &Ra3Tmp, const Shape *pC, const Shape *pF, const Shape *pV, const Shape *pT, const Shape *pTL, integer iN, AeroData *a, const DriveCaller *pDC, bool bUseJacobian, OrientationDescription ood, flag fOut)
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
void AssVec(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
doublereal dGetPnt(void) const
virtual ~AerodynamicBeam(void)
void PutRowIndex(integer iSubRow, integer iRow)
virtual std::ostream & Restart(std::ostream &out) const
const doublereal * pGetVec(void) const
virtual doublereal dGet(doublereal d1, doublereal d2=0.) const =0
std::ostream & GetLogFile(void) const
Vec3 MatR2EulerAngles321(const Mat3x3 &R)
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const =0
virtual integer iGetNum(void) const
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
static const doublereal d13
virtual const Vec3 & GetVCurr(void) const
void Sub(integer iRow, integer iCol, const Vec3 &v)
virtual flag fGetAirVelocity(Vec3 &Velocity, const Vec3 &X) const
GradientExpression< UnaryExpr< FuncCos, Expr > > cos(const GradientExpression< Expr > &u)
static const doublereal pdsi3[]
Aerodynamic2DElem(unsigned int uLabel, const DofOwner *pDO, InducedVelocity *pR, bool bPassive, const Shape *pC, const Shape *pF, const Shape *pV, const Shape *pT, const Shape *pTL, integer iN, AeroData *a, const DriveCaller *pDC, bool bUseJacobian, OrientationDescription ood, flag fOut)
static const doublereal a
Mat3x3 MulMT(const Mat3x3 &m) const
virtual void SetOutputFlag(flag f=flag(1))
virtual integer iGetFirstIndex(void) const
virtual void AssJac(FullSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, integer iFirstIndex, integer iFirstSubIndex, const Mat3xN &vx, const Mat3xN &wx, Mat3xN &fq, Mat3xN &cq, int i, const doublereal *W, doublereal *TNG, Mat6x6 &J, outa_t &OUTA)
GradientExpression< BinaryExpr< FuncAtan2, LhsExpr, RhsExpr > > atan2(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
void AddForce_int(const StructNode *pN, const Vec3 &F, const Vec3 &M, const Vec3 &X) const
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &, const VectorHandler &)
virtual HighParser::ErrOut GetLineData(void) const
unsigned int GetLabel(void) const
Node * ReadNode(MBDynParser &HP, Node::Type type) const
#define DEBUGLCOUT(level, msg)
virtual ~AerodynamicBeam2(void)
std::vector< Aero_output >::iterator OutputIter
bool UseText(int out) const
virtual void OutputPrepare(OutputHandler &OH)
virtual void AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, integer iFirstIndex, integer iFirstSubIndex, int i, const doublereal *W, doublereal *TNG, outa_t &OUTA)
virtual doublereal GetReal(const doublereal &dDefval=0.0)
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
std::ostream & Aerodynamic(void) const