MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
aerodata.cc File Reference
#include "mbconfig.h"
#include "mynewmem.h"
#include "aerodata_impl.h"
#include "gauss.h"
#include "submat.h"
#include "aerod2.h"
#include "dataman.h"
#include "drive_.h"
Include dependency graph for aerodata.cc:

Go to the source code of this file.

Macros

#define USE_POLCOE
 

Functions

static AeroData::UnsteadyModel ReadUnsteadyFlag (MBDynParser &HP)
 
static void ReadC81MultipleAeroData (DataManager *pDM, MBDynParser &HP, AeroData **aerodata, int iGP, int iDim, bool bInterp=false)
 
void ReadAeroData (DataManager *pDM, MBDynParser &HP, int iDim, Shape **ppChord, Shape **ppForce, Shape **ppVelocity, Shape **ppTwist, Shape **ppTipLoss, integer *piNumber, DriveCaller **ppDC, AeroData **aerodata)
 

Macro Definition Documentation

#define USE_POLCOE

Definition at line 63 of file aerodata.cc.

Function Documentation

void ReadAeroData ( DataManager pDM,
MBDynParser HP,
int  iDim,
Shape **  ppChord,
Shape **  ppForce,
Shape **  ppVelocity,
Shape **  ppTwist,
Shape **  ppTipLoss,
integer piNumber,
DriveCaller **  ppDC,
AeroData **  aerodata 
)

Definition at line 593 of file aerodata.cc.

References DEBUGCOUTFNAME, DEBUGLCOUT, MBDynParser::GetC81Data(), MBDynParser::GetDriveCaller(), HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::GetString(), HighParser::IsArg(), HighParser::IsKeyWord(), LASTKEYWORD, MBDYN_EXCEPT_ARGS, MYDEBUG_INPUT, DataManager::pGetDrvHdl(), ReadC81MultipleAeroData(), ReadShape(), ReadUnsteadyFlag(), SAFENEW, SAFENEWWITHCONSTRUCTOR, and AeroData::STEADY.

Referenced by ReadAerodynamicBeam(), ReadAerodynamicBeam2(), and ReadAerodynamicBody().

598 {
599  DEBUGCOUTFNAME("ReadAeroData");
600 
601  /* Keywords */
602  const char* sKeyWords[] = {
603  "naca0012",
604  "rae9671",
605  "c81",
606 
607  "theodorsen",
608 
609  0
610  };
611 
612  /* enum delle parole chiave */
613  enum KeyWords {
614  UNKNOWN = -1,
615  NACA0012 = 0,
616  RAE9671,
617  C81,
618 
619  THEODORSEN,
620 
622  };
623 
624  /* tabella delle parole chiave */
625  KeyTable K(HP, sKeyWords);
626 
627  *ppChord = ReadShape(HP);
628  *ppForce = ReadShape(HP);
629  *ppVelocity = ReadShape(HP);
630  *ppTwist = ReadShape(HP);
631 
632  *ppTipLoss = 0;
633  if (HP.IsKeyWord("tip" "loss")) {
634  *ppTipLoss = ReadShape(HP);
635 
636  } else {
638  ConstShape1D(1.));
639  }
640 
641  *piNumber = HP.GetInt();
642  if (*piNumber <= 0) {
643  silent_cerr("need at least 1 Gauss integration point at line "
644  << HP.GetLineData() << std::endl);
646  }
647  DEBUGLCOUT(MYDEBUG_INPUT, "Gauss points number: "
648  << *piNumber << std::endl);
649 
650  if (HP.IsKeyWord("control")) {
651  /* Driver di un'eventuale controllo */
652  *ppDC = HP.GetDriveCaller();
653 
654  } else {
655  SAFENEW(*ppDC, NullDriveCaller);
656  }
657 
658  if (HP.IsArg()) {
659  switch (HP.IsKeyWord()) {
660  default:
661  silent_cerr("unknown airfoil type \"" << HP.GetString()
662  << "\" at line " << HP.GetLineData()
663  << "; using default (NACA0012)"
664  << std::endl);
665 
666  case NACA0012: {
668  "airfoil is NACA0012" << std::endl);
669 
671  DriveCaller *ptime = 0;
672  if (eInst != AeroData::STEADY) {
674  TimeDriveCaller(pDM->pGetDrvHdl()));
675  }
676  SAFENEWWITHCONSTRUCTOR(*aerodata,
678  STAHRAeroData(*piNumber, iDim, eInst, 1, ptime));
679  break;
680  }
681 
682  case RAE9671: {
684  "airfoil is RAE9671" << std::endl);
685 
687  DriveCaller *ptime = 0;
688  if (eInst != AeroData::STEADY) {
690  TimeDriveCaller(pDM->pGetDrvHdl()));
691  }
692  SAFENEWWITHCONSTRUCTOR(*aerodata,
694  STAHRAeroData(*piNumber, iDim, eInst, 2, ptime));
695  break;
696  }
697 
698  /*
699  * uso tabelle standard, che vengono cercate in base all'indice
700  * (sistemare)
701  */
702  case C81:
703  if (HP.IsKeyWord("multiple")) {
704  ReadC81MultipleAeroData(pDM, HP, aerodata, *piNumber, iDim);
705 
706  } else if (HP.IsKeyWord("interpolated")) {
707  ReadC81MultipleAeroData(pDM, HP, aerodata, *piNumber, iDim, true);
708 
709  } else {
710  unsigned iProfile = (unsigned)HP.GetInt();
711  const c81_data* data = HP.GetC81Data(iProfile);
712 
714  "airfoil data is from file c81 "
715  << iProfile << std::endl);
717  eInst = ReadUnsteadyFlag(HP);
718  DriveCaller *ptime = 0;
719  if (eInst != AeroData::STEADY) {
722  TimeDriveCaller(pDM->pGetDrvHdl()));
723  }
724  SAFENEWWITHCONSTRUCTOR(*aerodata,
725  C81AeroData,
726  C81AeroData(*piNumber, iDim,
727  eInst, iProfile,
728  data, ptime));
729  }
730  break;
731 
732  case THEODORSEN: {
733  if (!HP.IsKeyWord("c81")) {
734  silent_cerr("Theodorsen aerodata: warning, assuming \"c81\" at line "
735  << HP.GetLineData() << std::endl);
736  }
737 
738  AeroData *pa = 0;
739  if (HP.IsKeyWord("multiple")) {
740  ReadC81MultipleAeroData(pDM, HP, &pa, *piNumber, iDim);
741 
742  } else if (HP.IsKeyWord("interpolated")) {
743  ReadC81MultipleAeroData(pDM, HP, &pa, *piNumber, iDim, true);
744 
745  } else {
746  unsigned iProfile = (unsigned)HP.GetInt();
747  const c81_data* data = HP.GetC81Data(iProfile);
748 
750  "airfoil data is from file c81 "
751  << iProfile << std::endl);
753  eInst = ReadUnsteadyFlag(HP);
754  DriveCaller *ptime = 0;
755  if (eInst != AeroData::STEADY) {
758  TimeDriveCaller(pDM->pGetDrvHdl()));
759  }
761  C81AeroData,
762  C81AeroData(*piNumber, iDim,
763  eInst, iProfile,
764  data, ptime));
765  }
766 
767  DriveCaller *ptime = 0;
770  TimeDriveCaller(pDM->pGetDrvHdl()));
771 
772  SAFENEWWITHCONSTRUCTOR(*aerodata,
774  TheodorsenAeroData(*piNumber, iDim,
775  pa, ptime));
776  } break;
777  }
778 
779  } else {
780  /* FIXME: better abort! */
781  silent_cerr("missing airfoil type at line "
782  << HP.GetLineData()
783  << "; using default (NACA0012)"
784  << std::endl);
785 
787  SAFENEWWITHCONSTRUCTOR(*aerodata,
788  STAHRAeroData, STAHRAeroData(*piNumber, iDim, eInst, 1));
789  }
790 }
static void ReadC81MultipleAeroData(DataManager *pDM, MBDynParser &HP, AeroData **aerodata, int iGP, int iDim, bool bInterp=false)
Definition: aerodata.cc:496
#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
static AeroData::UnsteadyModel ReadUnsteadyFlag(MBDynParser &HP)
Definition: aerodata.cc:427
const DriveHandler * pGetDrvHdl(void) const
Definition: dataman.h:340
Shape * ReadShape(MBDynParser &HP)
Definition: shape.cc:298
const c81_data * GetC81Data(unsigned profile) const
Definition: mbpar.cc:1921
#define SAFENEW(pnt, item)
Definition: mynewmem.h:695
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
UnsteadyModel
Definition: aerodata.h:89
KeyWords
Definition: dataman4.cc:94
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual std::string GetString(const std::string &sDefVal)
Definition: parser.cc:1074
virtual bool IsArg(void)
Definition: parser.cc:807
DriveCaller * GetDriveCaller(bool bDeferred=false)
Definition: mbpar.cc:2033
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244

Here is the call graph for this function:

static void ReadC81MultipleAeroData ( DataManager pDM,
MBDynParser HP,
AeroData **  aerodata,
int  iGP,
int  iDim,
bool  bInterp = false 
)
static

Definition at line 496 of file aerodata.cc.

References DEBUGLCOUT, MBDynParser::GetC81Data(), HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::GetReal(), HighParser::IsKeyWord(), MBDYN_EXCEPT_ARGS, MYDEBUG_INPUT, DataManager::pGetDrvHdl(), ReadUnsteadyFlag(), SAFENEWWITHCONSTRUCTOR, and AeroData::STEADY.

Referenced by ReadAeroData().

498 {
499  doublereal dcltol = 1.e-6;
500  if (bInterp && HP.IsKeyWord("tolerance")) {
501  dcltol = HP.GetReal();
502  if (dcltol <= 0.) {
503  silent_cerr("ReadC81MultipleAeroData: "
504  "invalid c81 data tolerance at line "
505  << HP.GetLineData() << std::endl);
507  }
508  }
509 
510  integer nProfiles = HP.GetInt();
511  if (nProfiles <= 0) {
512  silent_cerr("Need at least one airfoil at line "
513  << HP.GetLineData() << std::endl);
515  }
516 
517  std::vector<unsigned> profiles(nProfiles);
518  std::vector<doublereal> upper_bounds(nProfiles);
519  std::vector<const c81_data *> data(nProfiles);
520 
521  for (int i = 0; i < nProfiles; i++) {
522  profiles[i] = (unsigned)HP.GetInt();
523  upper_bounds[i] = HP.GetReal();
524  if (upper_bounds[i] <= -1.) {
525  if (!bInterp || upper_bounds[i] < -1.) {
526  silent_cerr("upper bound "
527  << i + 1 << " = " << upper_bounds[i]
528  << " too small at line "
529  << HP.GetLineData()
530  << std::endl);
532  }
533 
534  } else if (upper_bounds[i] > 1.) {
535  silent_cerr("upper bound "
536  << i + 1 << " = "
537  << upper_bounds[i]
538  << " too large at line "
539  << HP.GetLineData()
540  << std::endl);
542 
543  } else if (i > 0 && upper_bounds[i] <= upper_bounds[i-1]) {
544  silent_cerr("upper bound "
545  << i+1 << " = " << upper_bounds[i]
546  << " not in increasing order "
547  "at line " << HP.GetLineData()
548  << std::endl);
550  }
551  data[i] = HP.GetC81Data(profiles[i]);
552  if (data[i] == 0) {
553  silent_cerr("Unable to find airfoil "
554  << profiles[i] << " at line "
555  << HP.GetLineData() << std::endl);
557  }
558  DEBUGLCOUT(MYDEBUG_INPUT, "airfoil data " << i+1
559  << " is from file c81 " << profiles[i]
560  << std::endl);
561  }
562 
563  if (upper_bounds[nProfiles - 1] != 1.) {
564  silent_cerr("warning: the last upper bound should be 1.0 "
565  "at line " << HP.GetLineData() << std::endl);
566  }
567 
569  DriveCaller *ptime = 0;
570  if (eInst != AeroData::STEADY) {
573  TimeDriveCaller(pDM->pGetDrvHdl()));
574  }
575 
576  if (bInterp) {
577  SAFENEWWITHCONSTRUCTOR(*aerodata,
579  C81InterpolatedAeroData(iGP, iDim,
580  eInst, profiles, upper_bounds, data,
581  dcltol, ptime));
582 
583  } else {
584  SAFENEWWITHCONSTRUCTOR(*aerodata,
586  C81MultipleAeroData(iGP, iDim,
587  eInst, profiles, upper_bounds, data,
588  ptime));
589  }
590 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
static AeroData::UnsteadyModel ReadUnsteadyFlag(MBDynParser &HP)
Definition: aerodata.cc:427
const DriveHandler * pGetDrvHdl(void) const
Definition: dataman.h:340
const c81_data * GetC81Data(unsigned profile) const
Definition: mbpar.cc:1921
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
UnsteadyModel
Definition: aerodata.h:89
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

static AeroData::UnsteadyModel ReadUnsteadyFlag ( MBDynParser HP)
static

Definition at line 427 of file aerodata.cc.

References AeroData::BIELAWA, HighParser::GetInt(), IncludeParser::GetLineData(), AeroData::HARRIS, HighParser::IsArg(), HighParser::IsKeyWord(), AeroData::LAST, MBDYN_EXCEPT_ARGS, and AeroData::STEADY.

Referenced by ReadAeroData(), and ReadC81MultipleAeroData().

428 {
429  if (HP.IsArg()) {
431  if (HP.IsKeyWord("unsteady")) {
432  /*
433  * swallow "unsteady" keyword
434  */
435  if (HP.IsKeyWord("steady")) {
436  eInst = AeroData::STEADY;
437  } else if (HP.IsKeyWord("harris")) {
438  eInst = AeroData::HARRIS;
439  } else if (HP.IsKeyWord("bielawa")) {
440  eInst = AeroData::BIELAWA;
441  } else {
442  /* demote to pedantic, because the integer
443  * form allows to change unsteady model
444  * parametrically (while waiting for string
445  * vars) */
446  pedantic_cerr("deprecated unsteady model "
447  "given by integer number;"
448  " use \"steady\", \"Harris\" or \"Bielawa\" "
449  "instead, at line " << HP.GetLineData()
450  << std::endl);
451 
452  int i = HP.GetInt();
453  if (i < AeroData::STEADY || i >= AeroData::LAST) {
454  silent_cerr("illegal unsteady flag "
455  "numeric value " << i
456  << " at line "
457  << HP.GetLineData()
458  << std::endl);
460  }
461  eInst = AeroData::UnsteadyModel(i);
462  }
463  }
464 
465  switch (eInst) {
466  case AeroData::STEADY:
467  case AeroData::BIELAWA:
468  break;
469 
470  case AeroData::HARRIS:
471  silent_cerr("\"Harris\" unsteady aerodynamics "
472  "are not available at line "
473  << HP.GetLineData()
474  << std::endl);
476 
477  default:
478  silent_cerr("illegal unsteady flag at line "
479  << HP.GetLineData() << std::endl);
481  }
482 
483  /*
484  * unsteady flag
485  */
486  return eInst;
487  }
488 
489  /*
490  * default: no unsteady ...
491  */
492  return AeroData::STEADY;
493 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
UnsteadyModel
Definition: aerodata.h:89
virtual bool IsArg(void)
Definition: parser.cc:807
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function: