MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
rodj.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/rodj.h,v 1.47 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 /* Rods */
33 
34 #ifndef RODJ_H
35 #define RODJ_H
36 
37 #include "joint.h"
38 #include "constltp.h"
39 
40 extern const char* psRodNames[];
41 
42 
43 /* Rod - begin */
44 
45 class Rod :
46 virtual public Elem, public Joint, public ConstitutiveLaw1DOwner {
47 protected:
51 
54 
57  virtual doublereal dCalcEpsilon(void);
58 
59 #ifdef USE_NETCDF
60  NcVar *Var_v;
61  NcVar *Var_dElle;
62  NcVar *Var_dEllePrime;
63 #endif // USE_NETCDF
64 
65  /* Le funzioni di assemblaggio sono le stesse, cambiano gli indici
66  * delle equazioni. Allora, dopo aver settato indici e matrici,
67  * le routines normali chiamano queste due che eseguono i calcoli
68  *
69  * Purtroppo questa semplificazione vale solo per i Rod senza offset
70  * e puramente elastici. Allora non dichiaro le funzioni come virtuali
71  * in quanto non devono essere usate direttamente da classi derivate
72  */
73  void AssMat(FullSubMatrixHandler& WorkMat, doublereal dCoef = 1.);
74  void AssVec(SubVectorHandler& WorkVec);
75 
76 public:
77  /* Costruttore non banale */
78  Rod(unsigned int uL, const DofOwner* pDO,
79  const ConstitutiveLaw1D* pCL,
80  const StructDispNode* pN1, const StructDispNode* pN2,
81  doublereal dLength, flag fOut,
82  bool bHasOffsets = 0);
83 
84  /* Distruttore */
85  virtual ~Rod(void);
86 
87  /* Tipo di Joint */
88  virtual Joint::Type GetJointType(void) const {
89  return Joint::ROD;
90  };
91 
92  /* Contributo al file di restart */
93  virtual std::ostream& Restart(std::ostream& out) const;
94 
95  virtual void
96  AfterConvergence(const VectorHandler& X, const VectorHandler& XP);
97 
98  virtual unsigned int iGetNumDof(void) const {
99  return 0;
100  };
101 
102  virtual void
103  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
104  *piNumRows = 6;
105  *piNumCols = 6;
106  };
107 
108 #ifdef MBDYN_X_WORKAROUND_GCC_3_2
109  virtual void SetValue(DataManager *pDM,
111  SimulationEntity::Hints *ph = 0) {};
112 #endif /* MBDYN_X_WORKAROUND_GCC_3_2 */
113 
114  virtual VariableSubMatrixHandler&
116  const VectorHandler& XCurr,
117  const VectorHandler& XPrimeCurr);
118 
119  virtual void
121  VariableSubMatrixHandler& WorkMatB,
122  const VectorHandler& XCurr,
123  const VectorHandler& XPrimeCurr);
124 
125  virtual SubVectorHandler&
126  AssRes(SubVectorHandler& WorkVec, doublereal dCoef,
127  const VectorHandler& XCurr,
128  const VectorHandler& XPrimeCurr);
129 
130  virtual void OutputPrepare(OutputHandler& OH);
131  virtual void Output(OutputHandler& OH) const;
132 
133 #if 0
134  /* Output di un modello NASTRAN equivalente
135  * nella configurazione corrente */
136  virtual void Output_pch(std::ostream& out) const;
137 #endif
138 
139  /* funzioni usate nell'assemblaggio iniziale */
140  virtual unsigned int iGetInitialNumDof(void) const {
141  return 0;
142  };
143  virtual void
144  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
145  *piNumRows = 6;
146  *piNumCols = 6;
147  };
148 
149  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
150  virtual VariableSubMatrixHandler&
152  const VectorHandler& XCurr);
153 
154  /* Contributo al residuo durante l'assemblaggio iniziale */
155  virtual SubVectorHandler&
156  InitialAssRes(SubVectorHandler& WorkVec, const VectorHandler& XCurr);
157 
158  /* Inverse Dynamics stuff */
159 
160  /* is this an Inverse Dynamics capable element? */
161  virtual bool bInverseDynamics(void) const;
162 
163  /* Inverse Dynamics Jacobian matrix assembly */
166  const VectorHandler& XCurr);
167 
168  /* Inverse Dynamics residual assembly */
170  AssRes(SubVectorHandler& WorkVec,
171  const VectorHandler& XCurr,
172  const VectorHandler& XPrimeCurr,
173  const VectorHandler& XPrimePrimeCurr,
175 
176  /* Inverse Dynamics update */
178 
179  virtual void AfterConvergence(const VectorHandler& X,
180  const VectorHandler& XP,
181  const VectorHandler& XPP);
182 
183  /* end of Inverse Dynamics stuff */
184 
185  /* *******PER IL SOLUTORE PARALLELO******** */
186  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
187  * utile per l'assemblaggio della matrice di connessione fra i dofs */
188  virtual void
189  GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
190  connectedNodes.resize(2);
191  connectedNodes[0] = pNode1;
192  connectedNodes[1] = pNode2;
193  };
194  /* ************************************************ */
195 
196 
197  virtual unsigned int iGetNumPrivData(void) const;
198  virtual unsigned int iGetPrivDataIdx(const char *s) const;
199  virtual doublereal dGetPrivData(unsigned int i) const;
200 };
201 
202 /* Rod - end */
203 
204 
205 /* ViscoElasticRod - begin */
206 
207 class ViscoElasticRod : virtual public Elem, public Rod {
208 public:
209  /* Costruttore non banale */
210  ViscoElasticRod(unsigned int uL, const DofOwner* pDO,
211  const ConstitutiveLaw1D* pCL,
212  const StructDispNode* pN1, const StructDispNode* pN2,
213  doublereal dLength, flag fOut);
214 
215  /* Distruttore */
216  virtual ~ViscoElasticRod(void);
217 
218  virtual void
219  AfterConvergence(const VectorHandler& X, const VectorHandler& XP);
220 
221  virtual VariableSubMatrixHandler&
223  const VectorHandler& XCurr,
224  const VectorHandler& XPrimeCurr);
225 
226  virtual SubVectorHandler&
227  AssRes(SubVectorHandler& WorkVec, doublereal dCoef,
228  const VectorHandler& XCurr,
229  const VectorHandler& XPrimeCurr);
230 
231  virtual void
232  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
233  *piNumRows = 6;
234  *piNumCols = 12;
235  };
236 
237  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
238  virtual VariableSubMatrixHandler&
240  const VectorHandler& XCurr);
241 
242  /* Contributo al residuo durante l'assemblaggio iniziale */
243  virtual SubVectorHandler&
245  const VectorHandler& XCurr);
246 
247 #ifdef MBDYN_X_WORKAROUND_GCC_3_2
248  virtual void SetValue(DataManager *pDM,
250  SimulationEntity::Hints *ph = 0) {};
251  virtual unsigned int iGetNumPrivData(void) const {
252  return Rod::iGetNumPrivData();
253  };
254  virtual unsigned int iGetPrivDataIdx(const char *s) const {
255  return Rod::iGetPrivDataIdx(s);
256  };
257  virtual doublereal dGetPrivData(unsigned int i) const {
258  return Rod::dGetPrivData(i);
259  };
260 #endif /* MBDYN_X_WORKAROUND_GCC_3_2 */
261 };
262 
263 /* ViscoElasticRod - end */
264 
265 
266 /* RodWithOffset - begin */
267 
268 class RodWithOffset : virtual public Elem, public Rod {
269 protected:
270  // NOTE: should be "const"
271  // made modifiable to let derived classes modify them
274 
275 public:
276  /* Costruttore non banale */
277  RodWithOffset(unsigned int uL, const DofOwner* pDO,
278  const ConstitutiveLaw1D* pCL,
279  const StructNode* pN1, const StructNode* pN2,
280  const Vec3& f1Tmp, const Vec3& f2Tmp,
281  doublereal dLength, flag fOut);
282 
283  /* Distruttore */
284  virtual ~RodWithOffset(void);
285 
286  /* Contributo al file di restart */
287  virtual std::ostream& Restart(std::ostream& out) const;
288 
289  virtual void
290  AfterConvergence(const VectorHandler& X, const VectorHandler& XP);
291 
292  virtual void
293  WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
294  *piNumRows = 12;
295  *piNumCols = 12;
296  };
297 
298  virtual VariableSubMatrixHandler&
300  const VectorHandler& XCurr,
301  const VectorHandler& XPrimeCurr);
302 
303  virtual SubVectorHandler&
304  AssRes(SubVectorHandler& WorkVec, doublereal dCoef,
305  const VectorHandler& XCurr,
306  const VectorHandler& XPrimeCurr);
307  void AssVec(SubVectorHandler& WorkVec);
308 
309 #if 0
310  /* Output di un modello NASTRAN equivalente
311  * nella configurazione corrente */
312  virtual void Output_pch(std::ostream& out) const;
313 #endif
314 
315  /* funzioni usate nell'assemblaggio iniziale */
316 
317  virtual void
318  InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
319  *piNumRows = 12;
320  *piNumCols = 24;
321  };
322 
323  /* Contributo allo jacobiano durante l'assemblaggio iniziale */
324  virtual VariableSubMatrixHandler&
326  const VectorHandler& XCurr);
327 
328  /* Contributo al residuo durante l'assemblaggio iniziale */
329  virtual SubVectorHandler&
330  InitialAssRes(SubVectorHandler& WorkVec, const VectorHandler& XCurr);
331 
332 #ifdef MBDYN_X_WORKAROUND_GCC_3_2
333  virtual void SetValue(DataManager *pDM,
335  SimulationEntity::Hints *ph = 0) {};
336  virtual unsigned int iGetNumPrivData(void) const {
337  return Rod::iGetNumPrivData();
338  };
339  virtual unsigned int iGetPrivDataIdx(const char *s) const {
340  return Rod::iGetPrivDataIdx(s);
341  };
342  virtual doublereal dGetPrivData(unsigned int i) const {
343  return Rod::dGetPrivData(i);
344  };
345 #endif /* MBDYN_X_WORKAROUND_GCC_3_2 */
346 };
347 
348 /* RodWithOffset - end */
349 
350 #endif /* RODJ_H */
virtual doublereal dCalcEpsilon(void)
Definition: rodj.cc:97
Type
Definition: joint.h:66
virtual void AssMats(VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: rodj.cc:235
doublereal dEpsilonPrime
Definition: rodj.h:56
virtual unsigned int iGetInitialNumDof(void) const
Definition: rodj.h:140
void Update(const VectorHandler &XCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
Definition: rodj.cc:452
long int flag
Definition: mbdyn.h:43
Definition: matvec3.h:98
ViscoElasticRod(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw1D *pCL, const StructDispNode *pN1, const StructDispNode *pN2, doublereal dLength, flag fOut)
Definition: rodj.cc:526
Vec3 f1
Definition: rodj.h:272
void AssMat(FullSubMatrixHandler &WorkMat, doublereal dCoef=1.)
Definition: rodj.cc:121
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: rodj.h:318
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: rodj.cc:357
virtual ~RodWithOffset(void)
Definition: rodj.cc:865
virtual ~Rod(void)
Definition: rodj.cc:90
void AssVec(SubVectorHandler &WorkVec)
Definition: rodj.cc:1038
void AssVec(SubVectorHandler &WorkVec)
Definition: rodj.cc:155
virtual Joint::Type GetJointType(void) const
Definition: rodj.h:88
doublereal dElle
Definition: rodj.h:53
doublereal dL0
Definition: rodj.h:50
virtual std::ostream & Restart(std::ostream &out) const
Definition: rodj.cc:111
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: rodj.h:103
std::vector< Hint * > Hints
Definition: simentity.h:89
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: rodj.cc:620
const StructDispNode * pNode2
Definition: rodj.h:49
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: rodj.cc:1263
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: rodj.cc:884
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: rodj.cc:765
virtual std::ostream & Restart(std::ostream &out) const
Definition: rodj.cc:872
doublereal dEpsilon
Definition: rodj.h:55
const char * psRodNames[]
Definition: enums.cc:215
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: rodj.cc:545
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: rodj.cc:270
virtual bool bInverseDynamics(void) const
Definition: rodj.cc:418
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: rodj.cc:1009
Vec3 v
Definition: rodj.h:52
virtual unsigned int iGetNumPrivData(void) const
Definition: rodj.cc:467
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: rodj.cc:1103
RodWithOffset(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw1D *pCL, const StructNode *pN1, const StructNode *pN2, const Vec3 &f1Tmp, const Vec3 &f2Tmp, doublereal dLength, flag fOut)
Definition: rodj.cc:827
virtual void SetValue(DataManager *pDM, VectorHandler &, VectorHandler &, SimulationEntity::Hints *ph=0)
Definition: joint.h:213
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: rodj.h:293
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: rodj.h:232
virtual SubVectorHandler & InitialAssRes(SubVectorHandler &WorkVec, const VectorHandler &XCurr)
Definition: rodj.cc:389
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: rodj.cc:891
Rod(unsigned int uL, const DofOwner *pDO, const ConstitutiveLaw1D *pCL, const StructDispNode *pN1, const StructDispNode *pN2, doublereal dLength, flag fOut, bool bHasOffsets=0)
Definition: rodj.cc:46
virtual ~ViscoElasticRod(void)
Definition: rodj.cc:539
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: rodj.cc:199
virtual void InitialWorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: rodj.h:144
virtual unsigned int iGetNumDof(void) const
Definition: rodj.h:98
Definition: elem.h:75
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
Definition: rodj.cc:104
virtual void OutputPrepare(OutputHandler &OH)
Definition: rodj.cc:300
Definition: joint.h:50
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: rodj.h:189
virtual VariableSubMatrixHandler & InitialAssJac(VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
Definition: rodj.cc:689
Vec3 f2
Definition: rodj.h:273
virtual void SetValue(DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *h=0)
Definition: simentity.cc:63
const StructDispNode * pNode1
Definition: rodj.h:48
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
Definition: rodj.h:45
virtual doublereal dGetPrivData(unsigned int i) const
Definition: rodj.cc:499
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
Definition: rodj.cc:552
virtual void Output(OutputHandler &OH) const
Definition: rodj.cc:320
virtual unsigned int iGetPrivDataIdx(const char *s) const
Definition: rodj.cc:473