MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
genfm.h File Reference
#include "aerodyn.h"
Include dependency graph for genfm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GenericAerodynamicData
 
struct  GenericAerodynamicData::GenericAerodynamicCoef
 
class  GenericAerodynamicForce
 

Functions

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

Function Documentation

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

Definition at line 802 of file genfm.cc.

References Elem::AERODYNAMIC, GenericAerodynamicData::bAlphaFirst, Eye3, DataManager::fReadOutput(), IncludeParser::GetFileName(), IncludeParser::GetLineData(), MBDynParser::GetPosRel(), HighParser::GetReal(), MBDynParser::GetRotRel(), HighParser::GetYesNo(), HighParser::IsKeyWord(), M_PI, MBDYN_EXCEPT_ARGS, ReadGenericAerodynamicData(), DataManager::ReadNode(), SAFENEWWITHCONSTRUCTOR, Node::STRUCTURAL, and Zero3.

804 {
805  /* Nodo */
806  const StructNode* pNode = pDM->ReadNode<const StructNode, Node::STRUCTURAL>(HP);
807 
808  /* The offset is in the reference frame of the node */
809  ReferenceFrame RF(pNode);
810  Vec3 f(Zero3);
811  if (HP.IsKeyWord("position")) {
812  f = HP.GetPosRel(RF);
813  }
814 
815  /* the orientation is in flight mechanics (FIXME?) reference frame:
816  * X forward, Y to the right, Z down */
817  Mat3x3 Ra(Eye3);
818  if (HP.IsKeyWord("orientation")) {
819  Ra = HP.GetRotRel(RF);
820  }
821 
822  /* 1. by default, which means that coefficients are only normalized
823  * by the dynamic pressure */
824  doublereal dRefSurface = 1.;
825  doublereal dRefLength = 1.;
826  bool bAlphaFirst(false);
827 
828  if (HP.IsKeyWord("reference" "surface")) {
829  dRefSurface = HP.GetReal();
830  }
831 
832  if (HP.IsKeyWord("reference" "length")) {
833  dRefLength = HP.GetReal();
834  }
835 
836  if (HP.IsKeyWord("alpha" "first")) {
837  if (!HP.GetYesNo(bAlphaFirst)) {
838  silent_cerr("GenericAerodynamicForce(" << uLabel << "): "
839  "invalid \"alpha first\" value at line " << HP.GetLineData() << std::endl);
841  }
842  }
843 
844  /* TODO: allow to reference previously loaded data */
845  GenericAerodynamicData *pData = 0;
846  if (HP.IsKeyWord("file")) {
847  doublereal dScaleAngle = 1.;
848  if (HP.IsKeyWord("angle" "units")) {
849  if (HP.IsKeyWord("radians")) {
850  dScaleAngle = 1.;
851 
852  } else if (HP.IsKeyWord("degrees")) {
853  dScaleAngle = M_PI/180.;
854 
855  } else {
856  silent_cerr("GenericAerodynamicForce(" << uLabel << "): "
857  "unknown angle unit at line " << HP.GetLineData() << std::endl);
859  }
860 
861  } else if (HP.IsKeyWord("scale" "angles")) {
862  doublereal d = HP.GetReal(dScaleAngle);
863  if (d <= 0.) {
864  silent_cerr("GenericAerodynamicForce(" << uLabel << "): "
865  "invalid angle scale factor " << d
866  << " at line " << HP.GetLineData() << std::endl);
868  }
869  dScaleAngle = d;
870  }
871 
872  doublereal dScaleLength = 1.;
873  if (HP.IsKeyWord("scale" "lengths")) {
874  doublereal d = HP.GetReal(dScaleLength);
875  if (d <= 0.) {
876  silent_cerr("GenericAerodynamicForce(" << uLabel << "): "
877  "invalid length scale factor " << d
878  << " at line " << HP.GetLineData() << std::endl);
880  }
881  dScaleLength = d;
882  }
883 
884  std::string fname(HP.GetFileName());
885  pData = ReadGenericAerodynamicData(fname, dScaleAngle, dScaleLength, bAlphaFirst);
886 
887  } else if (HP.IsKeyWord("reference")) {
888  silent_cerr("GenericAerodynamicForce(" << uLabel << "): "
889  "references to generic aerodynamic data not implemented yet "
890  "at line " << HP.GetLineData() << std::endl);
892 
893  } else {
894  silent_cerr("GenericAerodynamicForce(" << uLabel << "): "
895  "keyword \"file\" or \"reference\" expected "
896  "at line " << HP.GetLineData() << std::endl);
898  }
899 
900  flag fOut = pDM->fReadOutput(HP, Elem::AERODYNAMIC);
901 
902  Elem *pEl = 0;
904  GenericAerodynamicForce(uLabel, pDO,
905  pNode, f, Ra,
906  dRefSurface, dRefLength, bAlphaFirst,
907  pData, fOut));
908 
909  return pEl;
910 }
flag fReadOutput(MBDynParser &HP, const T &t) const
Definition: dataman.h:1064
Mat3x3 GetRotRel(const ReferenceFrame &rf)
Definition: mbpar.cc:1795
#define M_PI
Definition: gradienttest.cc:67
const Vec3 Zero3(0., 0., 0.)
long int flag
Definition: mbdyn.h:43
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: matvec3.h:98
const Mat3x3 Eye3(1., 0., 0., 0., 1., 0., 0., 0., 1.)
virtual const char * GetFileName(enum Delims Del=DEFAULTDELIM)
Definition: parsinc.cc:673
static GenericAerodynamicData * ReadGenericAerodynamicData(const std::string &fname, doublereal dScaleAngle, doublereal dScaleLength, bool bAlphaFirst)
Definition: genfm.cc:582
Vec3 GetPosRel(const ReferenceFrame &rf)
Definition: mbpar.cc:1331
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual bool GetYesNo(bool &bRet)
Definition: parser.cc:1022
Definition: elem.h:75
double doublereal
Definition: colamd.c:52
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
Node * ReadNode(MBDynParser &HP, Node::Type type) const
Definition: dataman3.cc:2309
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function: