MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
aerodyn.cc File Reference
#include "mbconfig.h"
#include "aerodyn_.h"
#include "dataman.h"
#include "tpldrive.h"
#include "gust.h"
Include dependency graph for aerodyn.cc:

Go to the source code of this file.

Functions

static void ReadAirstreamData (DataManager *pDM, MBDynParser &HP, TplDriveCaller< Vec3 > *&pDC, std::vector< const Gust * > &gust)
 
ElemReadAirProperties (DataManager *pDM, MBDynParser &HP)
 

Function Documentation

Elem* ReadAirProperties ( DataManager pDM,
MBDynParser HP 
)

Definition at line 521 of file aerodyn.cc.

References a, Elem::AIRPROPERTIES, DEBUGLCOUT, DataManager::fReadOutput(), MBDynParser::GetDriveCaller(), IncludeParser::GetLineData(), HighParser::GetReal(), HighParser::IsKeyWord(), MBDYN_EXCEPT_ARGS, MYDEBUG_INPUT, DataManager::pGetRBK(), R, ReadAirstreamData(), and SAFENEWWITHCONSTRUCTOR.

Referenced by DataManager::ReadElems().

522 {
523  Elem *pEl = NULL;
524 
525  if (HP.IsKeyWord("std")) {
526  doublereal PRef(0.);
527  doublereal rhoRef(0.);
528  DriveCaller *RhoRef(NULL);
529  doublereal TRef(0.);
530  doublereal a(0.);
531  doublereal R(0.);
532  doublereal g0(0.);
533  doublereal z0(0.);
534  doublereal z1(0.);
535  doublereal z2(0.);
536 
537  bool Std = false;
538 
539  if (HP.IsKeyWord("SI")) {
540  Std = true;
541 
542  PRef = 101325.; /* Pa */
543  rhoRef = 1.2250; /* kg/m^3 */
544  TRef = 288.16; /* K */
545  a = -6.5e-3; /* K/m */
546  R = 287.; /* J/kgK */
547  g0 = 9.81; /* m/s^2 */
548  z1 = 11000.; /* m */
549  z2 = 25000.; /* m */
550 
551  } else if (HP.IsKeyWord("british")) {
552  Std = true;
553  PRef = 2116.2; /* lb/ft^2 */
554  rhoRef = 0.002377; /* slug/ft3 */
555  TRef = 518.69; /* R */
556  a = -3.566e-3; /* R/ft */
557  R = 1716; /* ft lb/slug R */
558  g0 = 32.17; /* ft/s^2 */
559  z1 = 36089; /* ft */
560  z2 = 82021; /* ft */
561 
562  } else {
563  PRef = HP.GetReal();
564  if (PRef <= 0.) {
565  silent_cerr("illegal reference "
566  "pressure" << PRef
567  << " at line " << HP.GetLineData()
568  << std::endl);
570  }
571 
572  RhoRef = HP.GetDriveCaller();
573  /* FIXME: we need to do runtime checks ... */
574 
575  TRef = HP.GetReal();
576  if (TRef <= 0.) {
577  silent_cerr("illegal reference "
578  "temperature " << TRef
579  << " at line " << HP.GetLineData()
580  << std::endl);
582  }
583 
584  a = HP.GetReal();
585  if (a >= 0.) {
586  /* FIXME: should we leave this free? */
587  silent_cerr("illegal temperature gradient "
588  << a << " at line " << HP.GetLineData()
589  << std::endl);
591  }
592 
593  R = HP.GetReal();
594  if (R <= 0.) {
595  silent_cerr("illegal gas constant " << R
596  << " at line " << HP.GetLineData()
597  << std::endl);
599  }
600 
601  g0 = HP.GetReal();
602  if (g0 <= 0.) {
603  silent_cerr("illegal reference "
604  "gravity acceleration " << g0
605  << " at line " << HP.GetLineData()
606  << std::endl);
608  }
609 
610  z1 = HP.GetReal();
611  if (z1 <= 0.) {
612  silent_cerr("illegal troposphere altitude "
613  << z1
614  << " at line " << HP.GetLineData()
615  << std::endl);
617  }
618 
619  z2 = HP.GetReal();
620  if (z2 <= z1) {
621  silent_cerr("illegal stratosphere altitude "
622  << z2
623  << " at line " << HP.GetLineData()
624  << std::endl);
626  }
627  }
628 
629  if (Std) {
630  if (HP.IsKeyWord("temperature" "deviation")) {
631  doublereal T = HP.GetReal();
632 
633  if (TRef + T <= 0.) {
634  silent_cerr("illegal "
635  "temperature deviation " << T
636  << " at line "
637  << HP.GetLineData()
638  << std::endl);
640  }
641 
642  /*
643  * trasformazione isobara applicata
644  * all'equazione
645  * di stato: rho * R * T = cost
646  *
647  * rho = rho_0 T_0 / T
648  */
649  rhoRef *= TRef / (TRef + T);
650  TRef += T;
651  }
652 
654  ConstDriveCaller(rhoRef));
655  }
656 
657  if (HP.IsKeyWord("reference" "altitude")) {
658  z0 = HP.GetReal();
659  }
660 
661  /* Driver multiplo */
662  TplDriveCaller<Vec3>* pDC = NULL;
663  std::vector<const Gust *> gust;
664  ReadAirstreamData(pDM, HP, pDC, gust);
665  flag fOut = pDM->fReadOutput(HP, Elem::AIRPROPERTIES);
666 
669  StdAirProperties(pDC,
670  PRef, RhoRef, TRef, a, R, g0, z0, z1, z2,
671  gust, pDM->pGetRBK(), fOut));
672  } else {
673  /* Legacy: density and sound celerity at one altitude;
674  * no altitude dependency */
675 
676  DriveCaller *pRho = HP.GetDriveCaller();
677 
678  doublereal dSS = HP.GetReal();
679  DEBUGLCOUT(MYDEBUG_INPUT, "Sound speed: " << dSS << std::endl);
680  if (dSS <= 0.) {
681  silent_cerr("illegal null or negative sound speed "
682  "at line " << HP.GetLineData() << std::endl);
683 
685  }
686 
687  /* Driver multiplo */
688  TplDriveCaller<Vec3>* pDC = NULL;
689  std::vector<const Gust *> gust;
690  ReadAirstreamData(pDM, HP, pDC, gust);
691  flag fOut = pDM->fReadOutput(HP, Elem::AIRPROPERTIES);
692 
695  BasicAirProperties(pDC, pRho, dSS,
696  gust, pDM->pGetRBK(), fOut));
697  }
698 
699  return pEl;
700 }
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
long int flag
Definition: mbdyn.h:43
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
static void ReadAirstreamData(DataManager *pDM, MBDynParser &HP, TplDriveCaller< Vec3 > *&pDC, std::vector< const Gust * > &gust)
Definition: aerodyn.cc:507
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
const RigidBodyKinematics * pGetRBK(void) const
Definition: dataman.h:485
Definition: elem.h:75
DriveCaller * GetDriveCaller(bool bDeferred=false)
Definition: mbpar.cc:2033
static const doublereal a
Definition: hfluid_.h:289
double doublereal
Definition: colamd.c:52
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
#define DEBUGLCOUT(level, msg)
Definition: myassert.h:244
Mat3x3 R
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

static void ReadAirstreamData ( DataManager pDM,
MBDynParser HP,
TplDriveCaller< Vec3 > *&  pDC,
std::vector< const Gust * > &  gust 
)
static

Definition at line 507 of file aerodyn.cc.

References ASSERT, HighParser::IsKeyWord(), ReadDC3D(), and ReadGustData().

Referenced by ReadAirProperties().

509 {
510  ASSERT(pDC == 0);
511 
512  /* Driver multiplo */
513  pDC = ReadDC3D(pDM, HP);
514  while (HP.IsKeyWord("gust")) {
515  /* gust */
516  gust.insert(gust.end(), ReadGustData(pDM, HP));
517  }
518 }
Gust * ReadGustData(const DataManager *pDM, MBDynParser &HP)
Definition: gust.cc:190
TplDriveCaller< Vec3 > * ReadDC3D(const DataManager *pDM, MBDynParser &HP)
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define ASSERT(expression)
Definition: colamd.c:977

Here is the call graph for this function: