MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
aeroext.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/aero/aeroext.h,v 1.28 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  /* Aerodynmic External Element by Giuseppe Quaranta(C) - December 2002
33  * <quaranta@aero.polimi.it>
34  */
35 
36 #ifndef AEROEXT_H
37 #define AEROEXT_H
38 
39 #ifdef USE_EXTERNAL
40 #include "aerodyn.h"
41 #include "ac/mpi.h"
42 
43 #include "myassert.h"
44 #include "except.h"
45 
46 #include "modal.h"
47 /* AerodynamicExternal */
48 
49 
50 class AerodynamicExternal :
51  virtual public Elem,
52  public AerodynamicElem,
53  public DriveOwner
54 {
55 private:
56  MyVectorHandler* pdBuffer; /* buffer per lo scambio dei dati riguardanti
57  le posizioni e le forze */
58  MyVectorHandler* pdBufferVel; /* buffer per lo scambio dei dati riguardanti le velocita' */
59  integer NodeN;
60  const StructNode** ppNode; /* vettore di puntatori a i nodi che compongono il blocco */
61  const doublereal* pRefLength; /* lunghezza di riferimento per scalare i punti definiti nella matrice offset
62  associati a ciascun nodo*/
63 
64  int OffN; /* numero di punto rigidamente collegati con coascun nodo */
65  Mat3xN* pOffsetVectors; /* posizioni dei punto collegati con ciascun nodo */
66  MPI::Intercomm* pInterfComm; /* Intercomunicatore con il codice di interfacia */
67  MPI::Request* pRecReq;
68  bool VelFlag;
69  bool MomFlag;
70  bool SentFlag;
71  Mat3xN* pForce; /* output forze */
72  Mat3xN* pMoms; /* output momenti */
73  unsigned int* pLabList; /* lista label nodi */
74 
75 public:
76 
77  AerodynamicExternal(unsigned int uLabel,
78  const DofOwner *pDO,
79  const DriveCaller* pDC,
80  int NN,
81  const StructNode** ppN,
82  const doublereal* RefL,
83  MPI::Intercomm* IC,
84  flag fOut,
85  bool VF,
86  bool MF);
87 
88  AerodynamicExternal(unsigned int uLabel,
89  const DofOwner *pDO,
90  const DriveCaller* pDC,
91  int NN,
92  const StructNode** ppN,
93  const doublereal* RefL,
94  MPI::Intercomm* IC,
95  int ON,
96  Mat3xN* OV,
97  flag fOut,
98  bool VF,
99  bool MF);
100 
101  virtual ~AerodynamicExternal(void);
102 
103  bool NeedsAirProperties(void) const
104  { return true; };
105 
106  /* Tipo dell'elemento (usato per debug ecc.) */
107  Elem::Type GetElemType(void) const
108  { return Elem::AERODYNAMIC;};
109 
110  /* Contributo al file di restart */
111  virtual std::ostream& Restart(std::ostream& out) const
112  { return out << std::endl; };
113 
114  virtual void BeforePredict(VectorHandler& /* X */ ,
115  VectorHandler& /* XP */ ,
116  VectorHandler& /* XPrev */ ,
117  VectorHandler& /* XPPrev */ ) const { NO_OP; };
118 
119 
120  virtual void AfterPredict(VectorHandler& X ,
121  VectorHandler& XP );
122 
123  virtual void
124  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
125  *piNumRows = 0;
126  *piNumCols = 0;
127  };
128 
129  /* assemblaggio jacobiano */
130  virtual VariableSubMatrixHandler&
132  doublereal /* dCoef */ ,
133  const VectorHandler& /* XCurr */ ,
134  const VectorHandler& /* XPrimeCurr */ ) {
135  DEBUGCOUTFNAME("AerodynamicExternal::AssJac");
136  WorkMat.SetNullMatrix();
137  return WorkMat;
138  };
139 
140  /* assemblaggio residuo */
141  virtual SubVectorHandler&
142  AssRes(SubVectorHandler& WorkVec,
143  doublereal dCoef,
144  const VectorHandler& XCurr,
145  const VectorHandler& XPrimeCurr);
146 
147  virtual void Update(const VectorHandler& XCurr ,
148  const VectorHandler& XPrimeCurr );
149 
150  /*
151  * Elaborazione stato interno dopo la convergenza
152  */
153  virtual void AfterConvergence(const VectorHandler& X,
154  const VectorHandler& XP) { NO_OP; };
155 
156  /*
157  * output; si assume che ogni tipo di elemento sappia, attraverso
158  * l'OutputHandler, dove scrivere il proprio output
159  */
160  virtual void Output(OutputHandler& OH) const;
161 
162  /* Tipo di elemento aerodinamico */
163  virtual AerodynamicElem::Type GetAerodynamicElemType(void) const {
165  };
166 
167  /* *******PER IL SOLUTORE PARALLELO******** */
168  /*
169  * Fornisce il tipo e la label dei nodi che sono connessi all'elemento
170  * utile per l'assemblaggio della matrice di connessione fra i dofs
171  */
172  virtual int GetNumConnectedNodes(void) const {
173  return NodeN;
174  };
175 
176 
177  virtual void
178  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
179  connectedNodes.resize(NodeN);
180  for (int i = 0; i < NodeN; i++) {
181  connectedNodes[i] = ppNode[i];
182  }
183  };
184 
185 private:
186  void ConstructAndInitialize(void);
187 
188  void Send(const VectorHandler& X ,
189  const VectorHandler& XP );
190 
191 };
192 
193 
194 
195 
196 /* AerodynamicExternalModal */
197 class AerodynamicExternalModal :
198  virtual public Elem,
199  public AerodynamicElem,
200  public DriveOwner
201 {
202 protected:
203 
204  MyVectorHandler* pdBuffer; /* buffer per lo scambio dei dati riguardanti
205  le posizioni e le forze */
206  MyVectorHandler* pdBufferVel; /* buffer per lo scambio dei dati riguardanti le velocita' */
207 
208  Modal* pModal;
209  int ModalNodes;
210  MPI::Intercomm* pInterfComm; /* Intercomunicatore con il codice di interfaccia */
211  MPI::Prequest* pSenReq;
212  MPI::Prequest* pRecReq;
213  bool VelFlag;
214  bool MomFlag;
215  bool SentFlag;
216  MyVectorHandler* pForce; /* buffer per l'output delle forze */
217 
218 public:
219 
220  AerodynamicExternalModal(unsigned int uLabel,
221  const DofOwner* pDO,
222  const DriveCaller* pDC,
223  Modal* pM,
224  MPI::Intercomm* IC,
225  flag fOut,
226  bool VelFlag,
227  bool MomFlag);
228 
229  virtual ~AerodynamicExternalModal(void);
230 
231  bool NeedsAirProperties(void) const
232  { return false; };
233 
234  /* Tipo dell'elemento (usato per debug ecc.) */
235  Elem::Type GetElemType(void) const
236  { return Elem::AERODYNAMIC;};
237 
238  virtual void
239  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
240  *piNumRows = 0;
241  *piNumCols = 0;
242  };
243 
244  /* Contributo al file di restart */
245  virtual std::ostream& Restart(std::ostream& out) const
246  { return out << std::endl; };
247 
248  virtual void BeforePredict(VectorHandler& /* X */ ,
249  VectorHandler& /* XP */ ,
250  VectorHandler& /* XPrev */ ,
251  VectorHandler& /* XPPrev */ ) const { NO_OP; };
252 
253 
254  virtual void AfterPredict(VectorHandler& X ,
255  VectorHandler& XP );
256 
257 
258  /* assemblaggio jacobiano */
259  virtual VariableSubMatrixHandler&
261  doublereal /* dCoef */ ,
262  const VectorHandler& /* XCurr */ ,
263  const VectorHandler& /* XPrimeCurr */ ) {
264  DEBUGCOUTFNAME("AerodynamicExternalModal::AssJac");
265  WorkMat.SetNullMatrix();
266  return WorkMat;
267  };
268 
269  /* assemblaggio residuo */
270  virtual SubVectorHandler&
271  AssRes(SubVectorHandler& WorkVec,
272  doublereal dCoef,
273  const VectorHandler& XCurr,
274  const VectorHandler& XPrimeCurr);
275 
276  virtual void Update(const VectorHandler& XCurr ,
277  const VectorHandler& XPrimeCurr );
278  /*
279  * Elaborazione stato interno dopo la convergenza
280  */
281  virtual void AfterConvergence(const VectorHandler& X,
282  const VectorHandler& XP)
283  { NO_OP; };
284 
285  /*
286  * output; si assume che ogni tipo di elemento sappia, attraverso
287  * l'OutputHandler, dove scrivere il proprio output
288  */
289  virtual void Output(OutputHandler& OH) const;
290 
291  /* Tipo di elemento aerodinamico */
292  virtual AerodynamicElem::Type GetAerodynamicElemType(void) const {
294  };
295 
296  /* *******PER IL SOLUTORE PARALLELO******** */
297  /*
298  * Fornisce il tipo e la label dei nodi che sono connessi all'elemento
299  * utile per l'assemblaggio della matrice di connessione fra i dofs
300  */
301  virtual int GetNumConnectedNodes(void) const {
302  return 1;
303  };
304 
305 
306  virtual void
307  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
308  connectedNodes.resize(1);
309  connectedNodes[0] = pModal->pGetModalNode();
310  };
311 
312 private:
313  void Send(const VectorHandler& X, const VectorHandler& XP);
314 };
315 
316 class DataManager;
317 class MBDynParser;
318 
319 extern Elem *
320 ReadAerodynamicExternal(DataManager* pDM, MBDynParser& HP,
321  const DofOwner *pDO, unsigned int uLabel);
322 
323 extern Elem *
324 ReadAerodynamicExternalModal(DataManager* pDM, MBDynParser& HP,
325  const DofOwner *pDO, unsigned int uLabel);
326 
327 #endif /* USE_EXTERNAL */
328 #endif /* AEROEXT_H */
long int flag
Definition: mbdyn.h:43
#define DEBUGCOUTFNAME(fname)
Definition: myassert.h:256
virtual AerodynamicElem::Type GetAerodynamicElemType(void) const =0
#define NO_OP
Definition: myassert.h:74
virtual Elem::Type GetElemType(void) const =0
virtual std::ostream & Restart(std::ostream &out) const =0
Definition: modal.h:74
DataManager * pDM
Definition: mbpar.h:252
void SetNullMatrix(void)
Definition: submat.h:1159
virtual bool NeedsAirProperties(void) const
Definition: aerodyn.cc:785
virtual void BeforePredict(VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
Definition: simentity.cc:82
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: elem.h:243
Definition: elem.h:75
Type
Definition: elem.h:91
virtual void Output(OutputHandler &OH) const
Definition: output.cc:870
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: simentity.cc:120
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const =0
virtual int GetNumConnectedNodes(void) const
Definition: elem.h:234
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
virtual void AfterPredict(VectorHandler &X, VectorHandler &XP)
Definition: simentity.cc:91
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)=0
virtual void Update(const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: simentity.cc:98