MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
aeromodal.cc File Reference
#include "mbconfig.h"
#include <cerrno>
#include "aeromodal.h"
#include "dataman.h"
#include "Rot.hh"
Include dependency graph for aeromodal.cc:

Go to the source code of this file.

Functions

ElemReadAerodynamicModal (DataManager *pDM, MBDynParser &HP, const DofOwner *pDO, unsigned int uLabel)
 

Function Documentation

Elem* ReadAerodynamicModal ( DataManager pDM,
MBDynParser HP,
const DofOwner pDO,
unsigned int  uLabel 
)

Definition at line 612 of file aeromodal.cc.

References AbsRefFrame, Elem::AEROMODAL, DEBUGCOUT, DEBUGCOUTFNAME, DataManager::fReadOutput(), IncludeParser::GetFileName(), HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::GetReal(), MBDynParser::GetRotRel(), HighParser::IsArg(), HighParser::IsKeyWord(), Elem::JOINT, MBDYN_EXCEPT_ARGS, AerodynamicModal::NO_RIGID, Modal::pGetModalNode(), FullMatrixHandler::PutCoef(), SpMapMatrixHandler::PutCoef(), DataManager::ReadElem(), SpMapMatrixHandler::Reset(), MBDynParser::RF, AerodynamicModal::RIGID, SAFENEWWITHCONSTRUCTOR, STRLENOF, and Modal::uGetNModes().

Referenced by DataManager::ReadOneElem().

616 {
617  DEBUGCOUTFNAME("ReadAerodynamicModal(" << uLabel << ")" << std::endl);
618 
619  /* formato dell'input:
620  *
621  * label,
622  * modal node,
623  * reference modal joint,
624  * rotation of the aerodynamic reference in respect of nodal reference,
625  * reference cord,
626  * number of aerodynamic states,
627  * {rigid, gust, gust filter cut-off frequency}
628  * file name containing state space model matrices;
629  */
630 
631  /* giunto modale collegato */
632  const Modal *pModalJoint = pDM->ReadElem<const Modal, const Joint, Elem::JOINT>(HP);
633  ReferenceFrame RF;
634  const StructNode *pModalNode = pModalJoint->pGetModalNode();
635  if (pModalNode) {
636  RF = ReferenceFrame(pModalNode);
637 
638  } else {
639  RF = ::AbsRefFrame;
640  }
641 
642  Mat3x3 Ra(HP.GetRotRel(RF));
643 
644  doublereal Chord = HP.GetReal();
645 
646  unsigned int AeroN = HP.GetInt();
647  /* numero modi e FEM */
648  unsigned int NModes = pModalJoint->uGetNModes();
649 
651  if (HP.IsKeyWord("rigid")) {
652  rigidF = AerodynamicModal::RIGID;
653  NModes += rigidF;
654  }
655 
656  /* Eventuale raffica */
657  unsigned int GustN = 0;
658  doublereal Vff = 0.;
659  if (HP.IsKeyWord("gust")) {
660  GustN = 2;
661  Vff = HP.GetReal();
662  }
663 
664  /* apre il file contenente le matrici A B C D0 D1 D2 */
665  const char *sFileData = HP.GetFileName();
666  std::ifstream fdat(sFileData);
667  DEBUGCOUT("Reading Aerodynamic State Space Matrices from file '"
668  << sFileData << '\'' << std::endl);
669  if (!fdat) {
670  int save_errno = errno;
671  silent_cerr(std::endl << "Unable to open file \"" << sFileData << "\" "
672  "(" << save_errno << ": " << strerror(save_errno) << ")" << std::endl);
674  }
675 
676  SpMapMatrixHandler* pAMat = 0;
677  FullMatrixHandler* pBMat = 0;
678  FullMatrixHandler* pCMat = 0;
679  FullMatrixHandler* pD0Mat = 0;
680  FullMatrixHandler* pD1Mat = 0;
681  FullMatrixHandler* pD2Mat = 0;
683  pAMat->Reset();
684  SAFENEWWITHCONSTRUCTOR(pBMat, FullMatrixHandler, FullMatrixHandler(AeroN, NModes + GustN));
686  SAFENEWWITHCONSTRUCTOR(pD0Mat, FullMatrixHandler, FullMatrixHandler(NModes, NModes + GustN));
687  SAFENEWWITHCONSTRUCTOR(pD1Mat, FullMatrixHandler, FullMatrixHandler(NModes, NModes + GustN));
688  SAFENEWWITHCONSTRUCTOR(pD2Mat, FullMatrixHandler, FullMatrixHandler(NModes, NModes + GustN));
689 
690  doublereal d;
691  char str[BUFSIZ];
692 
693  /* parsing del file */
694  while (!fdat.eof()) {
695  fdat.getline(str, sizeof(str));
696 
697  /* legge il primo blocco (HEADER) */
698  if (!strncmp("*** MATRIX A", str, STRLENOF("*** MATRIX A"))) {
699  for (unsigned int iCnt = 1; iCnt <= AeroN; iCnt++) {
700  for (unsigned int jCnt = 1; jCnt <= AeroN; jCnt++) {
701  fdat >> d;
702  pAMat->PutCoef(iCnt, jCnt, d);
703  }
704  }
705 
706  /* legge il primo blocco (HEADER) */
707  } else if (!strncmp("*** MATRIX B", str, STRLENOF("*** MATRIX B"))) {
708  for (unsigned int iCnt = 1; iCnt <= AeroN; iCnt++) {
709  for (unsigned int jCnt = 1; jCnt <= NModes + GustN; jCnt++) {
710  fdat >> d;
711  pBMat->PutCoef(iCnt, jCnt, d);
712  }
713  }
714 
715  /* legge il primo blocco (HEADER) */
716  } else if (!strncmp("*** MATRIX C", str, STRLENOF("*** MATRIX C"))) {
717  for (unsigned int iCnt = 1; iCnt <= NModes; iCnt++) {
718  for (unsigned int jCnt = 1; jCnt <= AeroN; jCnt++) {
719  fdat >> d;
720  pCMat->PutCoef(iCnt, jCnt, d);
721  }
722  }
723 
724  /* legge il primo blocco (HEADER) */
725  } else if (!strncmp("*** MATRIX D0", str, STRLENOF("*** MATRIX D0"))) {
726  for (unsigned int iCnt = 1; iCnt <= NModes; iCnt++) {
727  for (unsigned int jCnt = 1; jCnt <= NModes + GustN; jCnt++) {
728  fdat >> d;
729  pD0Mat->PutCoef(iCnt, jCnt, d);
730  }
731  }
732 
733  /* legge il primo blocco (HEADER) */
734  } else if (!strncmp("*** MATRIX D1", str, STRLENOF("*** MATRIX D1"))) {
735  for (unsigned int iCnt = 1; iCnt <= NModes; iCnt++) {
736  for (unsigned int jCnt = 1; jCnt <= NModes + GustN; jCnt++) {
737  fdat >> d;
738  pD1Mat->PutCoef(iCnt, jCnt, d);
739  }
740  }
741 
742  /* legge il primo blocco (HEADER) */
743  } else if (!strncmp("*** MATRIX D2", str, STRLENOF("*** MATRIX D2"))) {
744  for (unsigned int iCnt = 1; iCnt <= NModes; iCnt++) {
745  for (unsigned int jCnt = 1; jCnt <= NModes + GustN; jCnt++) {
746  fdat >> d;
747  pD2Mat->PutCoef(iCnt, jCnt, d);
748  }
749  }
750  }
751  }
752  fdat.close();
753 
754  flag fOut = pDM->fReadOutput(HP, Elem::AEROMODAL);
755 
756  Elem* pEl = 0;
759  AerodynamicModal(uLabel, pModalNode, pModalJoint,
760  Ra, pDO, Chord, NModes - rigidF,
761  AeroN, rigidF, GustN, Vff,
762  pAMat, pBMat, pCMat, pD0Mat, pD1Mat, pD2Mat, fOut));
763 
764  /* Se non c'e' il punto e virgola finale */
765  if (HP.IsArg()) {
766  silent_cerr("semicolon expected at line "
767  << HP.GetLineData() << std::endl);
769  }
770 
771  return pEl;
772 } /* End of DataManager::ReadAerodynamicModal() */
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
const ModalNode * pGetModalNode(void) const
Definition: modal.h:395
Mat3x3 GetRotRel(const ReferenceFrame &rf)
Definition: mbpar.cc:1795
long int flag
Definition: mbdyn.h:43
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
Elem * ReadElem(MBDynParser &HP, Elem::Type type) const
Definition: dataman3.cc:2334
integer uGetNModes(void) const
Definition: modal.h:363
virtual const char * GetFileName(enum Delims Del=DEFAULTDELIM)
Definition: parsinc.cc:673
Definition: modal.h:74
void Reset(void)
Definition: spmapmh.cc:161
const ReferenceFrame AbsRefFrame(0, Vec3(0., 0., 0), Mat3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), Vec3(0., 0., 0), Vec3(0., 0., 0), EULER_123)
virtual void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: fullmh.h:178
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define DEBUGCOUT(msg)
Definition: myassert.h:232
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
void PutCoef(integer ix, integer iy, const doublereal &val)
Definition: spmapmh.h:187
#define STRLENOF(s)
Definition: mbdyn.h:166
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
Definition: joint.h:50
double doublereal
Definition: colamd.c:52
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function: