52 AerodynamicExternal::AerodynamicExternal(
unsigned int uLabel,
 
   82         for (
int i=1; i<=3; i++) pOffsetVectors->Put(i,i,1.);
 
   83         ConstructAndInitialize();
 
   86 AerodynamicExternal::AerodynamicExternal(
unsigned int uLabel,
 
  116         ConstructAndInitialize();
 
  119 AerodynamicExternal::~AerodynamicExternal(
void)
 
  122         if (pdBufferVel != NULL) 
SAFEDELETE(pdBufferVel);
 
  131 AerodynamicExternal::ConstructAndInitialize(
void)
 
  148         for (
int i=0; i < NodeN; i++) {
 
  149                 pLabList[i] = ppNode[i]->GetLabel();
 
  150                 pLabList[i+NodeN] = 1+OffN;
 
  151                 X = ppNode[i]->GetXCurr();
 
  152                 pdBuffer->
Put(i*(OffN+1)*3+1, X);
 
  153                 for (
int j=1; j <= OffN; j++) {
 
  154                         MatTmp.LeftMult(ppNode[i]->GetRCurr(), *pOffsetVectors);
 
  155                         MatTmp *= pRefLength[i];
 
  156                         pdBuffer->Put(i*(OffN+1)*3+j*3+1, X + MatTmp.GetVec(j));
 
  161         pInterfComm->Send(pLabList, 2*NodeN, MPI::UNSIGNED, 0,(this->GetLabel())*10+1);
 
  162         pInterfComm->Send(pdBuffer->pdGetVec(), 3*NodeN*(OffN+1), MPI::DOUBLE, 0,(this->GetLabel())*10+2);
 
  191                 Vec3 Xc(0.), V, W, Xt;
 
  194                 GetAirProps(Xc, rho, c, p, T);
 
  195                 fGetAirVelocity(Vinf,Xc);
 
  198                 pdBuffer->Put(2, Vinf);
 
  199                 pdBuffer->PutCoef(5, rho);
 
  200                 pdBuffer->PutCoef(6,c);
 
  201                 pdBuffer->PutCoef(7,p);
 
  202                 pdBuffer->PutCoef(8,T);
 
  205                 for (
int i=0; i < NodeN; i++) {
 
  206                         Xc = ppNode[i]->GetXCurr();
 
  207                         pdBuffer->Put(8+i*(OffN+1)*3+1, Xc);
 
  210                                 V = ppNode[i]->GetVCurr();
 
  211                                 W = ppNode[i]->GetWCurr();
 
  212                                 pdBufferVel->
Put(i*(OffN+1)*3+1, V);
 
  214                         R = ppNode[i]->GetRCurr();
 
  216                         for (
int j=1; j <= OffN; j++) {
 
  217                                 MatTmp.LeftMult(R, *pOffsetVectors);
 
  218                                 MatTmp *= pRefLength[i];
 
  219                                 Xt = MatTmp.GetVec(j);
 
  220                                 pdBuffer->
Put(8+i*(OffN+1)*3+j*3+1, Xc + Xt);
 
  221                                 if (VelFlag) pdBufferVel->Put(i*(OffN+1)*3+j*3+1, V + W.
Cross(Xt));
 
  225                 pInterfComm->Send(pdBuffer->pdGetVec(), 8+3*NodeN*(OffN+1), MPI::DOUBLE, 0,(this->GetLabel())*10+2);
 
  226                 if (VelFlag) pInterfComm->Send(pdBufferVel->pdGetVec(), 3*NodeN*(OffN+1), MPI::DOUBLE, 0,(this->GetLabel())*10+3);
 
  241         Send(XCurr, XPrimeCurr);
 
  245         for (
int i=0; i < NodeN; i++) {
 
  246                 integer iFirstIndex = ppNode[i]->iGetFirstMomentumIndex();
 
  247                 for (
int iCnt = 1; iCnt <= 6; iCnt++) {
 
  248                         WorkVec.
PutRowIndex(i*6 + iCnt, iFirstIndex + iCnt);
 
  252         pInterfComm->Recv(pdBuffer->pdGetVec(), 3*NodeN*(OffN+1), MPI::DOUBLE, 0,(this->GetLabel())*10+4);
 
  253         if(MomFlag) pInterfComm->Recv(pdBufferVel->pdGetVec(), 3*NodeN*(OffN+1), MPI::DOUBLE, 0,(this->GetLabel())*10+5);
 
  260         for (
int i=0; i < NodeN; i++) {
 
  264                 F[0] +=  pdBuffer->operator()(i*(OffN+1)*3+1);
 
  265                 F[1] +=  pdBuffer->operator()(i*(OffN+1)*3+2);
 
  266                 F[2] +=  pdBuffer->operator()(i*(OffN+1)*3+3);
 
  268                         M[0] +=  pdBufferVel->operator()(i*(OffN+1)*3+1);
 
  269                         M[1] +=  pdBufferVel->operator()(i*(OffN+1)*3+2);
 
  270                         M[2] +=  pdBufferVel->operator()(i*(OffN+1)*3+3);
 
  272                 for (
int j=1; j <= OffN; j++) {
 
  273                         Fo[0] =  pdBuffer->operator()(i*(OffN+1)*3+j*3+1);
 
  274                         Fo[1] =  pdBuffer->operator()(i*(OffN+1)*3+j*3+2);
 
  275                         Fo[2] =  pdBuffer->operator()(i*(OffN+1)*3+j*3+3);
 
  278                                 M[0] +=  pdBufferVel->operator()(i*(OffN+1)*3+j*3+1);
 
  279                                 M[1] +=  pdBufferVel->operator()(i*(OffN+1)*3+j*3+2);
 
  280                                 M[2] +=  pdBufferVel->operator()(i*(OffN+1)*3+j*3+3);
 
  282                         M -= Fo.Cross( ppNode[i]->GetRCurr() * pOffsetVectors->GetVec(j) * pRefLength[i]);
 
  287                         pForce->PutVec(i+2,F);
 
  288                         pMoms->PutVec(i+2,M);
 
  290                 WorkVec.
Add(i*6+1, F);
 
  291                 WorkVec.
Add(i*6+4, M);
 
  306                         << std::setw(8) << lab
 
  307                         << 
" " << pForce->GetVec(1)
 
  308                         << 
" " << pMoms->GetVec(1) << std::endl;
 
  310                         for (
int i=1; i <= NodeN; i++) {
 
  311                                 out << std::setw(8) << pLabList[i-1]
 
  312                                         << 
" " << pForce->GetVec(i+1)
 
  313                                         << 
" " << pMoms->GetVec(i+1) << std::endl;
 
  321         const DofOwner *pDO, 
unsigned int uLabel)
 
  324         AerodynamicExternal* pEl = NULL;
 
  326         unsigned int NodeN = HP.
GetInt();
 
  328         std::cout << 
"Aerodynamic External Block made of  " << NodeN << 
" Nodes." << std::endl;
 
  333         for (
unsigned int iN = 0; iN < NodeN; iN++) {
 
  334                 unsigned int NodeL = HP.
GetInt();
 
  337                         std::cerr << 
"Aerodynamic External(" << uLabel
 
  338                                 << 
"): structural node " << NodeL
 
  340                                 << 
" not defined" << std::endl;
 
  343                         ppNodeList[iN] = pTmpNode;
 
  349                 for (
unsigned int iN=0; iN < NodeN; iN++) {
 
  354                 for (
unsigned int iN=1; iN < NodeN; iN++) {
 
  355                         pRefLenght[iN] = pRefLenght[iN-1];
 
  364                 for (
int iOf = 1; iOf <= OffN; iOf++) {
 
  365                         for (
int iCnt = 1; iCnt <= 3; iCnt++) {
 
  376         std::list<MPI::Intercomm>::iterator iComm =  InterfaceComms.begin();
 
  377         std::list<MPI::Intercomm>::iterator iComm_end =  InterfaceComms.end();
 
  378         if (iComm == iComm_end) {
 
  379                    std::cerr << 
"Aerodynamic External(" << uLabel
 
  380                                 << 
"): there are no external communicators " 
  381                                 << 
"Aborting." << std::endl;
 
  385         for (
int i = 0; i++ < comm; ++iComm) {
 
  386                 if (iComm == iComm_end) {
 
  387                    std::cerr << 
"Aerodynamic External(" << uLabel
 
  388                                 << 
"): external communicator " << comm
 
  389                                 << 
"does not exist. Last communicator is " << i-1
 
  390                                 << 
". Aborting." << std::endl;
 
  394         MPI::Intercomm* pInterC = &(*(iComm));
 
  396         bool VelFlag = 
false;
 
  397         bool MomFlag = 
false;
 
  399         if (HP.
IsKeyWord(
"velocity")) VelFlag = 
true;
 
  400         if (HP.
IsKeyWord(
"moment")) MomFlag = 
true;
 
  409                         AerodynamicExternal(uLabel,
 
  424                         AerodynamicExternal(uLabel,
 
  445 AerodynamicExternalModal::AerodynamicExternalModal(
unsigned int uLabel,
 
  459 ModalNodes(pM->uGetNFemNodes()),
 
  470                 integer NModes = pModal->uGetNModes();
 
  478         unsigned int*  pLabList = NULL;
 
  480         pLabList[0] = pModal->GetLabel();
 
  481         pLabList[1] = ModalNodes;
 
  484         pInterfComm->Send(pLabList, 2, MPI::UNSIGNED, 0,(this->
GetLabel())*10+1);
 
  486         Mat3xN* pNodePos = pModal->GetCurrFemNodesPosition();
 
  487         for (
int i=0; i < ModalNodes; i++) {
 
  488                 pdBuffer->
Put(i*3, pNodePos->
GetVec(i+1));
 
  490         pInterfComm->Send(pdBuffer->pdGetVec(), 3*ModalNodes, MPI::DOUBLE, 0,(this->
GetLabel())*10+2);
 
  493 AerodynamicExternalModal::~AerodynamicExternalModal(
void)
 
  496         if (pdBufferVel != NULL) 
SAFEDELETE(pdBufferVel);
 
  509 void AerodynamicExternalModal::Update(
const VectorHandler& X  ,
 
  522         GetAirProps(Vinf, rho, c, p, T);
 
  525         pdBuffer->Put(2, Vinf);
 
  526         pdBuffer->PutCoef(5, rho);
 
  527         pdBuffer->PutCoef(6,c);
 
  528         pdBuffer->PutCoef(7,p);
 
  529         pdBuffer->PutCoef(8,T);
 
  531         Mat3xN* pNodePos = pModal->GetCurrFemNodesPosition();
 
  533         if (VelFlag) pNodeVel = pModal->GetCurrFemNodesVelocity();
 
  534         for (
int i=0; i < ModalNodes; i++) {
 
  535                 pdBuffer->
Put(8+i*3, pNodePos->
GetVec(i+1));
 
  536                 if (VelFlag) pdBufferVel->Put(i*3, pNodeVel->
GetVec(i+1));
 
  538         pInterfComm->Send(pdBuffer->pdGetVec(), 8+3*ModalNodes, MPI::DOUBLE, 0,(this->GetLabel())*10+2);
 
  539         if (VelFlag) pInterfComm->Send(pdBufferVel->pdGetVec(), 3*ModalNodes, MPI::DOUBLE, 0,(this->GetLabel())*10+3);
 
  553                 Send(XCurr, XPrimeCurr);
 
  555         integer NModes = pModal->uGetNModes();
 
  559         integer iFirstIndex = pModal->iGetFirstIndex() + NModes;
 
  560         for (
int iCnt = 0; iCnt < NModes; iCnt++) {
 
  564         pInterfComm->Recv(pdBuffer->pdGetVec(), 3*ModalNodes, MPI::DOUBLE, 0, GetLabel()*10 + 4);
 
  566                 pInterfComm->Recv(pdBufferVel->pdGetVec(), 3*ModalNodes, MPI::DOUBLE, 0, GetLabel()*10 + 5);
 
  577         Mat3x3 RT(pModal->pGetModalNode()->GetRCurr().Transpose());
 
  579 #warning "FIXME: review" 
  580         for (
int iNode = 0; iNode < ModalNodes; iNode++) {
 
  581                 F[0] +=  pdBuffer->operator()(iNode*ModalNodes*3 + 1);
 
  582                 F[1] +=  pdBuffer->operator()(iNode*ModalNodes*3 + 2);
 
  583                 F[2] +=  pdBuffer->operator()(iNode*ModalNodes*3 + 3);
 
  585                         M[0] +=  pdBufferVel->operator()(iNode*ModalNodes*3 + 1);
 
  586                         M[1] +=  pdBufferVel->operator()(iNode*ModalNodes*3 + 2);
 
  587                         M[2] +=  pdBufferVel->operator()(iNode*ModalNodes*3 + 3);
 
  589                 for (
int iMode = 0; iMode < NModes; iMode++) {
 
  590                         WorkVec.
Add(iMode + 1, RT*F*(pModal->pGetPHIt().GetVec(iMode*ModalNodes + iNode + 1)));
 
  592                                 WorkVec.
Add(iMode + 1, RT*M*(pModal->pGetPHIr().GetVec(iMode*ModalNodes + iNode + 1)));
 
  611                         << std::setw(8) << -1*GetLabel();
 
  612                 int size = pForce->iGetSize();
 
  613                 for (
int i = 0; i < size; i++) {
 
  615                                 << 
" " << pForce->operator()(i+1) << std::endl;
 
  622         const DofOwner *pDO, 
unsigned int uLabel)
 
  625         AerodynamicExternalModal* pEl = NULL;
 
  634         std::list<MPI::Intercomm>::iterator iComm =  InterfaceComms.begin();
 
  635         for (
int i = 0; i++ < comm; ++iComm) {}
 
  636         MPI::Intercomm* pInterC = &(*(iComm));
 
  638         bool VelFlag = 
false;
 
  639         bool MomFlag = 
false;
 
  641         if (HP.
IsKeyWord(
"velocity")) VelFlag = 
true;
 
  642         if (HP.
IsKeyWord(
"moment")) MomFlag = 
true;
 
  649                 AerodynamicExternalModal,
 
  650                 AerodynamicExternalModal(uLabel,
 
flag fReadOutput(MBDynParser &HP, const T &t) const 
Vec3 Cross(const Vec3 &v) const 
virtual bool bToBeOutput(void) const 
void Put(int i, integer j, const doublereal &d)
#define MBDYN_EXCEPT_ARGS
#define DEBUGCOUTFNAME(fname)
virtual void ResizeReset(integer)
virtual integer GetInt(integer iDefval=0)
Elem * ReadElem(MBDynParser &HP, Elem::Type type) const 
#define SAFEDELETEARR(pnt)
doublereal dGet(void) const 
const DriveHandler * pGetDrvHdl(void) const 
virtual void PutRowIndex(integer iSubRow, integer iRow)=0
Vec3 GetVec(integer iCol) const 
virtual bool IsKeyWord(const char *sKeyWord)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
virtual void Add(integer iRow, const Vec3 &v)
std::ostream & Externals(void) const 
static std::stack< cleanup * > c
#define SAFENEWARR(pnt, item, sz)
virtual HighParser::ErrOut GetLineData(void) const 
unsigned int GetLabel(void) const 
Node * pFindNode(Node::Type Typ, unsigned int uNode) const 
void Put(unsigned short int iRow, const doublereal &dCoef)
virtual doublereal GetReal(const doublereal &dDefval=0.0)