1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/aero/aeromodal.h,v 1.33 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 /* Elemento aerodinamico modale */
33 
34 /* Aerodynamic Modal Element by Giuseppe Quaranta (C) - March 2002
35  * <quaranta@aero.polimi.it>
36  *
37  * This element is connected to a modal joint element.
38  * It needs a state-space representation of the instationary
39  * generalized aerodynamic forces of the following type:
40  *
41  *  xa' = A*xa + B*q
42  *  Fa  = (1/2*rho*V^2) * ((c/2*V)^2*D2*q'' + (c/2*V)*D1*q'+ D0*q + C*xa)
43  * where
44  *  xa are the aerodynamic states
45  *  q  are the modal coordinates (structural)
46  *
47  * The matrices A, B, C, D0, D1, D2 can be computed starting from the
48  * knowledge of the generalized aerodynamic forces frequency response
49  * H(jw,M).
50  * The current model can only deal with data relative to a specific Mach number.
51  * Future development will include:
52  *   - aerodinamic forces generated by wind gust (FIXME: DONE?);
53  *   - the capability to handle data at various Mach numbers;
54  *   - the effect unsteady aerodynamic forces related to rigid-body motion (FIXME: DONE?).
55  */
56 
57 #ifndef AerodynamicModal_hh
58 #define AerodynamicModal_hh
59 
60 #include "myassert.h"
61 #include "mynewmem.h"
62 #include "elem.h"
63 #include "aerodyn.h"
64 #include "modal.h"
65 #include "spmapmh.h"
66 
67 /* AerodynamicModal - begin */
68 
69 class AerodynamicModal :
70 	virtual public Elem,
71 	public AerodynamicElem,
72 	public InitialAssemblyElem
73 {
74 protected:
75 	const StructNode* pModalNode; /* Nodo modale per il moto rigido */
76 	const Modal* pModalJoint;     /* puntatore all'elemento modale di riferimento */
77 	Vec3 P0;                      /* Posizione iniziale nodo modale */
78 	Mat3x3 R0;                    /* Rotazione iniziale nel sistema aerodinamico del nodo modale */
79 	const Mat3x3 Ra;              /* Rotaz. del sistema aerodinamico al nodo */
80 
81 	doublereal Chord;             /* Reference Cord */
82 	unsigned int NStModes;        /* Numero di modi strutturali */
83 	unsigned int NAeroStates;     /* Numero stati aerodinamici */
84 	unsigned int NGust;           /* Numero ingressi raffica */
85 
86 	SpMapMatrixHandler* pA;	      /* Vettore degli autovalori del sistema aerodinamco */
87 	FullMatrixHandler* pB;        /* Matrici del modello agli stati dell'aerodinamica */
88 	FullMatrixHandler* pC;
89 	FullMatrixHandler* pD0;
90 	FullMatrixHandler* pD1;
91 	FullMatrixHandler* pD2;
92 
93 	MyVectorHandler* pq;          /* coordinate modali */
94 	MyVectorHandler* pqPrime;     /* velocita' modali */
95 	MyVectorHandler* pqSec;	      /* accelerazioni modali */
96 
97 	MyVectorHandler* pxa;         /* coordinate modali aerodinamiche*/
98 	MyVectorHandler* pxaPrime;    /* velocita' modali aerodinamiche*/
99 
100 	MyVectorHandler* pgs;         /* coordinate modali raffica*/
101 	MyVectorHandler* pgsPrime;    /* derivate prime modali raffica*/
102 
103 	const doublereal gustVff;     /* frequenza di taglio filtro passa basso raffica */
104 	const doublereal gustXi;      /* smorzamento filtro del secondo ordine raffica */
105 
106 public:
107 	enum RigidF_t {
108 		NO_RIGID = 0,
109 		RIGID = 6
110 	};
111 
112 protected:
113 	RigidF_t RigidF;              /* Numero di gdl del corpo rigido */
114 
115 	/* Assemblaggio residuo */
116 	void AssVec(SubVectorHandler& WorkVec);
117 
118 public:
119 	AerodynamicModal(unsigned int uLabel,
120 		const StructNode* pN,
121 		const Modal* pMJ,
122 		const Mat3x3& RaTmp,
123 		const DofOwner* pDO,
124 		doublereal Cd,
125 		const int NModal,
126 		const int NAero,
127 		RigidF_t rgF,
128 		const int Gust,
129 		const doublereal Vff,
130 		SpMapMatrixHandler* pAMat,
131 		FullMatrixHandler* pBMat,
132 		FullMatrixHandler* pCMat,
133 		FullMatrixHandler* pD0Mat,
134 		FullMatrixHandler* pD1Mat,
135 		FullMatrixHandler* pD2Mat,
136 		flag fout);
137 
138 	~AerodynamicModal(void);
139 
140 	/* Scrive il contributo dell'elemento al file di restart */
141 	std::ostream& Restart(std::ostream& out) const;
142 
143 	/* ritorna il numero di Dofs per gli elementi che sono anche DofOwners */
iGetNumDof(void)144 	unsigned int iGetNumDof(void) const {
145 		return NAeroStates + NGust*2;
146 	};
147 
148 	/* esegue operazioni sui dof di proprieta' dell'elemento */
GetDofType(unsigned int i)149 	DofOrder::Order GetDofType(unsigned int i) const {
150 		/* gradi di liberta' differenziali (eq. modali) */
151 		ASSERT(i < iGetNumDof());
152 		return DofOrder::DIFFERENTIAL;
153 	};
154 
155 	/* Tipo dell'elemento (usato per debug ecc.) */
GetElemType(void)156 	Elem::Type GetElemType(void) const {
157 		return Elem::AEROMODAL;
158 	};
159 
160 	/* funzioni proprie */
161 
162 	/* Dimensioni del workspace */
WorkSpaceDim(integer * piNumRows,integer * piNumCols)163 	void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
164 		*piNumRows = NAeroStates + NStModes + NGust*2;
165 		*piNumCols = NAeroStates + 2*NStModes + NGust*2;
166 	};
167 
168 	/* assemblaggio jacobiano */
169 	VariableSubMatrixHandler&
170 	AssJac(VariableSubMatrixHandler& WorkMat,
171 		doublereal dCoef ,
172 		const VectorHandler& /* XCurr */ ,
173 		const VectorHandler& /* XPrimeCurr */);
174 
175 	/* assemblaggio residuo */
176 	SubVectorHandler&
177 	AssRes(SubVectorHandler& WorkVec,
178 		doublereal dCoef,
179 		const VectorHandler& XCurr,
180 		const VectorHandler& XPrimeCurr);
181 
182 	/* output; si assume che ogni tipo di elemento sappia, attraverso
183 	 * l'OutputHandler, dove scrivere il proprio output */
184 	void Output(OutputHandler& OH) const;
185 
186 	/* Numero di GDL iniziali */
iGetInitialNumDof(void)187 	unsigned int iGetInitialNumDof(void) const {
188 		return NAeroStates + NGust*2;
189 	};
190 
191 	/* Dimensioni del workspace */
192 	void
InitialWorkSpaceDim(integer * piNumRows,integer * piNumCols)193 	InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
194 		*piNumRows = NAeroStates + NStModes + NGust*2;
195 		*piNumCols = NAeroStates + 2*NStModes + NGust*2;
196 	};
197 
198 	/* assemblaggio jacobiano */
199 	VariableSubMatrixHandler&
InitialAssJac(VariableSubMatrixHandler & WorkMat,const VectorHandler & XCurr)200 	InitialAssJac(VariableSubMatrixHandler& WorkMat,
201 		const VectorHandler& XCurr)
202 	{
203 		DEBUGCOUTFNAME("AerodynamicModal::InitialAssJac");
204 		AssJac(WorkMat, 0, XCurr, XCurr);
205 		return WorkMat;
206 	};
207 
208 	/* assemblaggio residuo */
209 	SubVectorHandler&
210 	InitialAssRes(SubVectorHandler& WorkVec, const VectorHandler& XCurr);
211 
212 	/* Tipo di elemento aerodinamico */
GetAerodynamicElemType(void)213 	AerodynamicElem::Type GetAerodynamicElemType(void) const {
214 		return AerodynamicElem::AEROMODAL;
215 	};
216 
217 	/* *******PER IL SOLUTORE PARALLELO******** */
218 	/* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
219 	 * utile per l'assemblaggio della matrice di connessione fra i dofs */
220 	virtual void
GetConnectedNodes(std::vector<const Node * > & connectedNodes)221 	GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
222 		connectedNodes.resize(1);
223 		connectedNodes[0] = pModalNode;
224 	};
225 	/* ************************************************ */
226 };
227 
228 /* AerodynamicModal - end */
229 
230 class DataManager;
231 class MBDynParser;
232 
233 extern Elem*
234 ReadAerodynamicModal(DataManager* pDM, MBDynParser& HP,
235 	const DofOwner* pDO, unsigned int uLabel);
236 
237 #endif /* AerodynamicModal_hh */
238