MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
beam2.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/beam2.h,v 1.41 2017/05/12 17:29:26 morandini 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 /* Trave a volumi finiti, con predisposizione per forze di inerzia consistenti
33  * e legame cositutivo piezoelettico */
34 
35 
36 #ifndef BEAM2_H
37 #define BEAM2_H
38 
39 #include "myassert.h"
40 #include "except.h"
41 
42 #include "strnode.h"
43 #include "elem.h"
44 #include "gravity.h"
45 
46 #include "constltp.h"
47 
48 /* Beam - begin */
49 
50 class Beam2
51 : virtual public Elem, public ElemGravityOwner, public InitialAssemblyElem {
52  friend class AerodynamicBeam;
53 
54  public:
55  class ErrGeneric : public MBDynErrBase {
56  public:
58  };
59 
60  private:
62 
63  protected:
64  enum NodeName { NODE1 = 0, NODE2 = 1, NUMNODES = 2 };
65  enum Deformations { STRAIN = 0, CURVAT = 1, NUMDEFORM = 2 };
66 
67  // output flags
68  unsigned uOutputFlags;
70 
71 #ifdef USE_NETCDF
72  NcVar *Var_X,
73  *Var_Phi,
74  *Var_F,
75  *Var_M,
76  *Var_Nu,
77  *Var_K,
78  *Var_NuP,
79  *Var_KP;
80 #endif /* USE_NETCDF */
81 
82  /* Puntatori ai nodi */
84 
85  /* Offset dei nodi */
89 
90  /* Matrice di rotazione delle sezioni - non sono const perche' vengono
91  * aggiornate ad ogni iterazione */
95 
96  /* Constitutive laws*/
98 
99  /* Reference constitutive laws */
101 
102  /* Velocita' angolare delle sezioni */
105 
106  /* Dati temporanei che vengono passati da AssRes ad AssJac */
113 
114  // NOTE: Moved to Beam2 from ViscoElasticBeam2 for output purposes
116 
121 
123 
125 
126  /* Is first res? */
127  bool bFirstRes;
129 
130  /* Funzioni di servizio */
131  virtual Vec3
132  InterpState(const Vec3& v1,
133  const Vec3& v2);
134  virtual Vec3
135  InterpDeriv(const Vec3& v1,
136  const Vec3& v2);
137 
138  /* Funzioni di calcolo delle matrici */
139  virtual void
142  doublereal dCoef,
143  const VectorHandler& XCurr,
144  const VectorHandler& XPrimeCurr);
145 
146  virtual void
148  doublereal dCoef,
149  const VectorHandler& XCurr,
150  const VectorHandler& XPrimeCurr);
151 
152  /* Per le beam che aggiungono qualcosa alle az. interne */
153  virtual void
154  AddInternalForces(Vec6& /* AzLoc */) {
155  NO_OP;
156  };
157 
158  virtual void
160  FullSubMatrixHandler& /* WMB */ ,
161  doublereal /* dCoef */ ,
162  const VectorHandler& /* XCurr */ ,
163  const VectorHandler& /* XPrimeCurr */ ) {
164  NO_OP;
165  };
166 
167  virtual void
169  doublereal /* dCoef */ ,
170  const VectorHandler& /* XCurr */ ,
171  const VectorHandler& /* XPrimeCurr */ ) {
172  NO_OP;
173  };
174 
175  /* Inizializza le derivate delle funzioni di forma
176  * e calcola le deformazioni geometriche iniziali */
177  virtual void DsDxi(void);
178 
179  /* Calcola la velocita' angolare delle sezioni a partire da quelle
180  * dei nodi; per ora lo fa in modo brutale, ma si puo' fare anche
181  * in modo consistente */
182  virtual void Omega0(void);
183 
184  /* cambia il tipo (?) */
186  BeamT = T;
187  };
188 
189  /* Funzione interna di restart */
190  virtual std::ostream& Restart_(std::ostream& out) const;
191 
192  public:
193  /* Costruttore normale */
194  Beam2(unsigned int uL,
195  const StructNode* pN1, const StructNode* pN2,
196  const Vec3& F1, const Vec3& F2,
197  const Mat3x3& R1, const Mat3x3& R2,
198  const Mat3x3& r,
199  const ConstitutiveLaw6D* pd,
201  flag fOut);
202 
203  /* Distruttore banale */
204  virtual ~Beam2(void);
205 
206  /* Tipo di trave */
207  virtual Beam::Type GetBeamType(void) const {
208  return Beam::ELASTIC;
209  };
210 
211  /* Tipo di elemento */
212  virtual Elem::Type GetElemType(void) const {
213  return Elem::BEAM;
214  };
215 
216  /* Contributo al file di restart */
217  virtual std::ostream& Restart(std::ostream& out) const;
218 
219  virtual void
220  AfterConvergence(const VectorHandler& X, const VectorHandler& XP);
221 
222  /* funzioni proprie */
223 
224  /* Dimensioni del workspace; sono 36 righe perche' se genera anche le
225  * forze d'inerzia consistenti deve avere accesso alle righe di definizione
226  * della quantita' di moto */
227  virtual void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
228  *piNumRows = 12;
229  *piNumCols = 12;
230  };
231 
232  /* Settings iniziali, prima della prima soluzione */
233  void SetValue(DataManager *pDM,
234  VectorHandler& /* X */ , VectorHandler& /* XP */ ,
235  SimulationEntity::Hints *ph = 0);
236 
237  /* Prepara i parametri di riferimento dopo la predizione */
238  virtual void
239  AfterPredict(VectorHandler& /* X */ , VectorHandler& /* XP */ );
240 
241  /* assemblaggio residuo */
242  virtual SubVectorHandler&
243  AssRes(SubVectorHandler& WorkVec,
244  doublereal dCoef,
245  const VectorHandler& XCurr,
246  const VectorHandler& XPrimeCurr);
247 
248  /* assemblaggio jacobiano */
249  virtual VariableSubMatrixHandler&
251  doublereal dCoef,
252  const VectorHandler& XCurr,
253  const VectorHandler& XPrimeCurr);
254 
255  virtual void OutputPrepare(OutputHandler &OH);
256 
257  /* output; si assume che ogni tipo di elemento sappia, attraverso
258  * l'OutputHandler, dove scrivere il proprio output */
259  virtual void Output(OutputHandler& OH) const;
260 
261  /* Inverse Dynamics stuff */
262 
263  /* is this an Inverse Dynamics capable element? */
264  virtual bool bInverseDynamics(void) const;
265 
266  /* Inverse Dynamics Jacobian matrix assembly */
269  const VectorHandler& XCurr);
270 
271  /* Inverse Dynamics residual assembly */
273  AssRes(SubVectorHandler& WorkVec,
274  const VectorHandler& XCurr,
275  const VectorHandler& XPrimeCurr,
276  const VectorHandler& XPrimePrimeCurr,
278 
279  /* Inverse Dynamics update */
281 
282  virtual void AfterConvergence(const VectorHandler& X,
283  const VectorHandler& XP,
284  const VectorHandler& XPP);
285 
286  /* end of Inverse Dynamics stuff */
287 
288 #if 0
289  /* Output di un modello NASTRAN equivalente nella configurazione corrente */
290  virtual void Output_pch(std::ostream& out) const;
291 #endif
292 
293  /* Funzioni proprie tipiche dei vincoli, usate durante l'assemblaggio
294  * iniziale. Le travi non sono vincoli (o meglio, non vengono considerate
295  * tali), ma richiedono comunque assemblaggio iniziale. Innanzitutto
296  * le coordinate dei nodi che sono fornite vengono usate per calcolare
297  * la lunghezza della trave e per la metrica della trave stessa.
298  * Inoltre durante l'assemblaggio la trave esplica la propria
299  * deformabilita' quando i vincoli tentano di muovere i nodi. */
300 
301  /* Numero di gradi di liberta' definiti durante l'assemblaggio iniziale
302  * e' dato dai gradi di liberta' soliti piu' le loro derivate necessarie;
303  * tipicamente per un vincolo di posizione il numero di dof raddoppia, in
304  * quanto vengono derivate tutte le equazioni, mentre per un vincolo di
305  * velocita' rimane inalterato. Sono possibili casi intermedi per vincoli
306  * misti di posizione e velocita' */
307  virtual unsigned int iGetInitialNumDof(void) const {
308  return 0;
309  };
310 
311  /* Dimensione del workspace durante l'assemblaggio iniziale. Occorre tener
312  * conto del numero di dof che l'elemento definisce in questa fase e dei
313  * dof dei nodi che vengono utilizzati. Sono considerati dof indipendenti
314  * la posizione e la velocita' dei nodi */
315  virtual void
317  integer* piNumCols) const {
318  *piNumRows = 12;
319  *piNumCols = 12;
320  };
321 
322  /* Setta il valore iniziale delle proprie variabili */
323  virtual void SetInitialValue(VectorHandler& /* X */ ) {
324  NO_OP;
325  };
326 
327  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
328  virtual VariableSubMatrixHandler&
330  const VectorHandler& XCurr);
331 
332  /* Contributo al residuo durante l'assemblaggio iniziale */
333  virtual SubVectorHandler&
334  InitialAssRes(SubVectorHandler& WorkVec, const VectorHandler& XCurr);
335 
336  /* Accesso ai dati privati */
337  virtual unsigned int iGetNumPrivData(void) const;
338  virtual unsigned int iGetPrivDataIdx(const char *s) const;
339  virtual doublereal dGetPrivData(unsigned int i) const;
340 
341  /* Accesso ai nodi */
342  virtual const StructNode* pGetNode(unsigned int i) const;
343 
344  /******** PER IL SOLUTORE PARALLELO *********/
345  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
346  * utile per l'assemblaggio della matrice di connessione fra i dofs */
347  virtual void
348  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
349  connectedNodes.resize(NUMNODES);
350  for (int i = 0; i < NUMNODES; i++) {
351  connectedNodes[i] = pNode[i];
352  }
353  };
354  /**************************************************/
355 
356 };
357 
358 /* Beam - end */
359 
360 
361 /* ViscoElasticBeam - begin */
362 
363 class ViscoElasticBeam2 : virtual public Elem, public Beam2 {
364  protected:
365 
366  /* Derivate di deformazioni e curvature */
369 
371 
372  // NOTE: Moved to Beam2 from ViscoElasticBeam2 for output purposes
373  // Vec6 DefPrimeLoc;
375 
377 
378  /* Funzioni di calcolo delle matrici */
379  virtual void
382  doublereal dCoef,
383  const VectorHandler& XCurr,
384  const VectorHandler& XPrimeCurr);
385 
386  virtual void
388  doublereal dCoef,
389  const VectorHandler& XCurr,
390  const VectorHandler& XPrimeCurr);
391 
392  public:
393  /* Costruttore normale */
394  ViscoElasticBeam2(unsigned int uL,
395  const StructNode* pN1,
396  const StructNode* pN2,
397  const Vec3& F1,
398  const Vec3& F2,
399  const Mat3x3& R1,
400  const Mat3x3& R2,
401  const Mat3x3& r,
402  const ConstitutiveLaw6D* pd,
404  flag fOut);
405 
406  /* Distruttore banale */
407  virtual ~ViscoElasticBeam2(void) {
408  NO_OP;
409  };
410 
411  /* Tipo di trave */
412  virtual Beam::Type GetBeamType(void) const {
413  return Beam::VISCOELASTIC;
414  };
415 
416  /* Settings iniziali, prima della prima soluzione */
417  void SetValue(DataManager *pDM,
418  VectorHandler& /* X */ , VectorHandler& /* XP */ ,
419  SimulationEntity::Hints *ph = 0);
420 
421  /* Prepara i parametri di riferimento dopo la predizione */
422  virtual void
423  AfterPredict(VectorHandler& /* X */ , VectorHandler& /* XP */ );
424 
425  virtual void
426  AfterConvergence(const VectorHandler& X, const VectorHandler& XP);
427 
428  virtual doublereal dGetPrivData(unsigned int i) const;
429 };
430 
431 /* ViscoElasticBeam - end */
432 
433 class DataManager;
434 class MBDynParser;
435 
436 extern Elem*
437 ReadBeam2(DataManager* pDM, MBDynParser& HP, unsigned int uLabel);
438 
439 #endif /* BEAM2_H */
ViscoElasticBeam2(unsigned int uL, const StructNode *pN1, const StructNode *pN2, const Vec3 &F1, const Vec3 &F2, const Mat3x3 &R1, const Mat3x3 &R2, const Mat3x3 &r, const ConstitutiveLaw6D *pd, OrientationDescription ood, flag fOut)
Definition: beam2.cc:945
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: beam2.cc:153
Vec3 LPrimeRef
Definition: beam2.h:370
void Update(const VectorHandler &XCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
Definition: beam2.cc:924
Mat3x3 RRef
Definition: beam2.h:93
Vec3 Omega
Definition: beam2.h:103
Vec6 Az
Definition: beam2.h:107
Vec3 OmegaRef
Definition: beam2.h:104
long int flag
Definition: mbdyn.h:43
virtual void DsDxi(void)
Definition: beam2.cc:230
Definition: matvec3.h:98
virtual doublereal dGetPrivData(unsigned int i) const
Definition: beam2.cc:1306
Mat3x3 RPrev
Definition: beam2.h:94
virtual void AssInertiaVec(SubVectorHandler &, doublereal, const VectorHandler &, const VectorHandler &)
Definition: beam2.h:168
#define MBDYN_EXCEPT_ARGS_PASSTHRU
Definition: except.h:55
Vec3 L
Definition: beam2.h:120
void SetValue(DataManager *pDM, VectorHandler &, VectorHandler &, SimulationEntity::Hints *ph=0)
Definition: beam2.cc:543
Vec3 L0
Definition: beam2.h:119
Definition: beam2.h:50
const StructNode * pNode[NUMNODES]
Definition: beam2.h:83
ErrGeneric(MBDYN_EXCEPT_ARGS_DECL)
Definition: beam2.h:57
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: beam2.cc:804
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: beam2.h:227
OrientationDescription
Definition: matvec3.h:1597
Vec3 fRef[NUMNODES]
Definition: beam2.h:87
#define MBDYN_EXCEPT_ARGS_DECL
Definition: except.h:43
virtual Beam::Type GetBeamType(void) const
Definition: beam2.h:412
Mat3x3 RNode[NUMNODES]
Definition: beam2.h:88
NodeName
Definition: beam2.h:64
#define NO_OP
Definition: myassert.h:74
std::vector< Hint * > Hints
Definition: simentity.h:89
Vec6 DefLoc
Definition: beam2.h:110
OrientationDescription od
Definition: beam2.h:69
Elem * ReadBeam2(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: beam2.cc:1329
Vec3 LRef
Definition: beam2.h:122
virtual Beam::Type GetBeamType(void) const
Definition: beam2.h:207
virtual Vec3 InterpState(const Vec3 &v1, const Vec3 &v2)
Definition: beam2.cc:208
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: beam2.cc:517
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: beam2.cc:830
Vec6 AzRef
Definition: beam2.h:108
Mat6x6 ERef
Definition: beam2.h:376
virtual ~ViscoElasticBeam2(void)
Definition: beam2.h:407
bool bFirstRes
Definition: beam2.h:127
virtual bool bInverseDynamics(void) const
Definition: beam2.cc:867
Mat3x3 R
Definition: beam2.h:92
Definition: matvec6.h:37
ConstitutiveLaw6DOwner * pD
Definition: beam2.h:97
virtual void SetInitialValue(VectorHandler &)
Definition: beam2.h:323
Vec6 DefPrimeLoc
Definition: beam2.h:115
virtual Elem::Type GetElemType(void) const
Definition: beam2.h:212
DataManager * pDM
Definition: mbpar.h:252
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: beam2.h:316
Vec3 p
Definition: beam2.h:117
Vec6 DefPrimeLocRef
Definition: beam2.h:374
Mat6x6 DRef
Definition: beam2.h:100
virtual void AssStiffnessMat(FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: beam2.cc:330
virtual doublereal dGetPrivData(unsigned int i) const
Definition: beam2.cc:164
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: beam2.cc:972
unsigned uOutputFlags
Definition: beam2.h:68
void SetBeamType(Beam::Type T)
Definition: beam2.h:185
virtual void AfterPredict(VectorHandler &, VectorHandler &)
Definition: beam2.cc:565
virtual void Omega0(void)
Definition: beam2.cc:264
Deformations
Definition: beam2.h:65
doublereal dsdxi
Definition: beam2.h:124
virtual const StructNode * pGetNode(unsigned int i) const
Definition: beam2.cc:852
Type
Definition: beam.h:64
virtual unsigned int iGetNumPrivData(void) const
Definition: beam2.cc:147
void SetValue(DataManager *pDM, VectorHandler &, VectorHandler &, SimulationEntity::Hints *ph=0)
Definition: beam2.cc:1198
virtual void AssStiffnessMat(FullSubMatrixHandler &WMA, FullSubMatrixHandler &WMB, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: beam2.cc:983
virtual unsigned int iGetInitialNumDof(void) const
Definition: beam2.h:307
virtual void AssStiffnessVec(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: beam2.cc:1092
Definition: elem.h:75
Type
Definition: elem.h:91
Vec6 DefLocPrev
Definition: beam2.h:112
virtual std::ostream & Restart(std::ostream &out) const
Definition: beam2.cc:299
Vec6 AzLoc
Definition: beam2.h:109
virtual void AssStiffnessVec(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: beam2.cc:408
virtual Vec3 InterpDeriv(const Vec3 &v1, const Vec3 &v2)
Definition: beam2.cc:219
virtual void AddInternalForces(Vec6 &)
Definition: beam2.h:154
virtual void Output(OutputHandler &OH) const
Definition: beam2.cc:712
Beam::Type BeamT
Definition: beam2.h:61
virtual void AfterPredict(VectorHandler &, VectorHandler &)
Definition: beam2.cc:1221
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: beam2.h:348
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)
Definition: beam2.cc:485
bool bFirstIDRes
Definition: beam2.h:128
Vec6 DefLocRef
Definition: beam2.h:111
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: beam2.cc:321
Beam2(unsigned int uL, const StructNode *pN1, const StructNode *pN2, const Vec3 &F1, const Vec3 &F2, const Mat3x3 &R1, const Mat3x3 &R2, const Mat3x3 &r, const ConstitutiveLaw6D *pd, OrientationDescription ood, flag fOut)
Definition: beam2.cc:65
virtual std::ostream & Restart_(std::ostream &out) const
Definition: beam2.cc:305
virtual ~Beam2(void)
Definition: beam2.cc:137
Vec3 f[NUMNODES]
Definition: beam2.h:86
Vec3 g
Definition: beam2.h:118
virtual void OutputPrepare(OutputHandler &OH)
Definition: beam2.cc:625
virtual void AssInertiaMat(FullSubMatrixHandler &, FullSubMatrixHandler &, doublereal, const VectorHandler &, const VectorHandler &)
Definition: beam2.h:159