1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/aero/aerodata.h,v 1.44 2017/01/12 14:45:58 masarati Exp $ */ 2 /* 3 * MBDyn (C) is a multibody analysis code. 4 * http://www.mbdyn.org 5 * 6 * Copyright (C) 1996-2017 7 * 8 * Pierangelo Masarati <masarati@aero.polimi.it> 9 * Paolo Mantegazza <mantegazza@aero.polimi.it> 10 * 11 * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano 12 * via La Masa, 34 - 20156 Milano, Italy 13 * http://www.aero.polimi.it 14 * 15 * Changing this copyright notice is forbidden. 16 * 17 * This program is free software; you can redistribute it and/or modify 18 * it under the terms of the GNU General Public License as published by 19 * the Free Software Foundation (version 2 of the License). 20 * 21 * 22 * This program is distributed in the hope that it will be useful, 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 * GNU General Public License for more details. 26 * 27 * You should have received a copy of the GNU General Public License 28 * along with this program; if not, write to the Free Software 29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 */ 31 32 #ifndef AERODATA_H 33 #define AERODATA_H 34 35 #include "ac/f2c.h" 36 37 #include "myassert.h" 38 #include "withlab.h" 39 #include "drive.h" 40 #include "dofown.h" 41 #include "matvec6.h" 42 #include "matvec3n.h" 43 #include "shape.h" 44 45 #include "aerodc81.h" 46 47 /* C81Data - begin */ 48 49 class C81Data : public WithLabel, public c81_data { 50 public: 51 C81Data(unsigned int uLabel); 52 }; 53 54 /* C81Data - end */ 55 56 57 /* AeroMemory - begin */ 58 59 class AeroMemory { 60 private: 61 doublereal *a; 62 doublereal *t; 63 integer iPoints; 64 int numUpdates; 65 66 protected: 67 DriveCaller *pTime; 68 69 virtual int StorageSize(void) const = 0; 70 71 public: 72 AeroMemory(DriveCaller *pt); 73 virtual ~AeroMemory(void); 74 75 void Predict(int i, doublereal alpha, 76 doublereal &alf1, doublereal &alf2); 77 void Update(int i); 78 void SetNumPoints(int i); 79 int GetNumPoints(void) const; 80 }; 81 82 /* Memory - end */ 83 84 85 /* AeroData - begin */ 86 87 class AeroData : public AeroMemory { 88 public: 89 enum UnsteadyModel { 90 STEADY = 0, 91 HARRIS = 1, 92 BIELAWA = 2, 93 94 LAST 95 }; 96 97 enum { 98 VX = 0, 99 VY = 1, 100 VZ = 2, 101 102 WX = 3, 103 WY = 4, 104 WZ = 5, 105 106 FX = 0, 107 FY = 1, 108 FZ = 2, 109 110 MX = 3, 111 MY = 4, 112 MZ = 5 113 }; 114 115 protected: 116 UnsteadyModel unsteadyflag; 117 vam_t VAM; 118 doublereal Omega; 119 120 int StorageSize(void) const; 121 122 int GetForcesJacForwardDiff_int(int i, const doublereal* W, doublereal* TNG, Mat6x6& J, outa_t& OUTA); 123 int GetForcesJacCenteredDiff_int(int i, const doublereal* W, doublereal* TNG, Mat6x6& J, outa_t& OUTA); 124 125 public: 126 AeroData(int i_p, int i_dim, 127 UnsteadyModel u = STEADY, DriveCaller *pt = 0); 128 virtual ~AeroData(void); 129 130 virtual std::ostream& Restart(std::ostream& out) const = 0; 131 std::ostream& RestartUnsteady(std::ostream& out) const; 132 virtual void SetAirData(const doublereal& rho, const doublereal& c); 133 134 virtual void SetSectionData(const doublereal& abscissa, 135 const doublereal& chord, 136 const doublereal& forcepoint, 137 const doublereal& velocitypoint, 138 const doublereal& twist, 139 const doublereal& omega = 0.); 140 141 virtual int 142 GetForces(int i, const doublereal* W, doublereal* TNG, outa_t& OUTA); 143 virtual int 144 GetForcesJac(int i, const doublereal* W, doublereal* TNG, Mat6x6& J, outa_t& OUTA); 145 146 // aerodynamic models with internal states 147 virtual unsigned int iGetNumDof(void) const; 148 virtual DofOrder::Order GetDofType(unsigned int i) const; 149 virtual void 150 AssRes(SubVectorHandler& WorkVec, 151 doublereal dCoef, 152 const VectorHandler& XCurr, 153 const VectorHandler& XPrimeCurr, 154 integer iFirstIndex, integer iFirstSubIndex, 155 int i, const doublereal* W, doublereal* TNG, outa_t& OUTA); 156 virtual void 157 AssJac(FullSubMatrixHandler& WorkMat, 158 doublereal dCoef, 159 const VectorHandler& XCurr, 160 const VectorHandler& XPrimeCurr, 161 integer iFirstIndex, integer iFirstSubIndex, 162 const Mat3xN& vx, const Mat3xN& wx, Mat3xN& fq, Mat3xN& cq, 163 int i, const doublereal* W, doublereal* TNG, Mat6x6& J, outa_t& OUTA); 164 virtual void 165 AfterConvergence(int i, 166 const VectorHandler& X, const VectorHandler& XP); 167 168 AeroData::UnsteadyModel Unsteady(void) const; 169 }; 170 171 /* AeroData - end */ 172 173 extern void 174 ReadAeroData(DataManager* pDM, MBDynParser& HP, int dim, 175 Shape** ppChord, Shape** ppForce, 176 Shape** ppVelocity, Shape** ppTwist, 177 Shape** ppTipLoss, 178 integer* piNumber, DriveCaller** ppDC, 179 AeroData** aerodata); 180 181 #endif /* AERODATA_H */ 182 183