1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/vb.h,v 1.10 2017/01/12 14:46:44 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 /* Deformable hinges */
33 
34 #ifndef VB_H
35 #define VB_H
36 
37 #include "joint.h"
38 #include "constltp.h"
39 
40 
41 /* ViscousBody - begin */
42 
43 class ViscousBody :
44 virtual public Elem, public Joint, public ConstitutiveLaw6DOwner {
45 protected:
46 	const StructNode* pNode;
47 	mutable Vec3 tilde_f;
48 	mutable Mat3x3 tilde_Rh;
49 
50 	OrientationDescription od;
51 
52 	Vec6 tilde_kPrime;
53 
54 	bool bFirstRes;
55 
56 	Vec3 f;
57 	Mat3x3 Rh;
58 
59 	Vec6 F;
60 	Mat6x6 FDEPrime;
61 
62 	void AssMats(FullSubMatrixHandler& WMA,
63 		FullSubMatrixHandler& WMB,
64 		doublereal dCoef);
65 	void AssVec(SubVectorHandler& WorkVec);
66 
67 public:
68 	/* Costruttore non banale */
69 	ViscousBody(unsigned int uL,
70 		const DofOwner* pDO,
71 		const ConstitutiveLaw6D* pCL,
72 		const StructNode* pN,
73 		const Vec3& tilde_f,
74 		const Mat3x3& tilde_Rh,
75 		const OrientationDescription& od,
76 		flag fOut);
77 
78 	/* Distruttore */
79 	virtual ~ViscousBody(void);
80 
81 	/* Tipo di Joint */
GetJointType(void)82 	virtual Joint::Type GetJointType(void) const {
83 		return Joint::VISCOUSBODY;
84 	};
85 
86 	/* Contributo al file di restart */
87 	virtual std::ostream& Restart(std::ostream& out) const;
88 
89 	virtual void Output(OutputHandler& OH) const;
90 
91 	void SetValue(DataManager *pDM,
92 		VectorHandler& X, VectorHandler& XP,
93 		SimulationEntity::Hints *ph = 0);
94 
95 	virtual Hint *
96 	ParseHint(DataManager *pDM, const char *s) const;
97 
iGetNumDof(void)98 	virtual unsigned int iGetNumDof(void) const {
99 		return 0;
100 	};
101 
GetDofType(unsigned int)102 	virtual DofOrder::Order GetDofType(unsigned int /* i */ ) const {
103 		return DofOrder::UNKNOWN;
104 	};
105 
WorkSpaceDim(integer * piNumRows,integer * piNumCols)106 	virtual void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
107 		*piNumRows = 6;
108 		*piNumCols = 6;
109 	};
110 
111 	/* funzioni usate nell'assemblaggio iniziale */
112 
iGetInitialNumDof(void)113 	virtual unsigned int iGetInitialNumDof(void) const {
114 		return 0;
115 	};
116 
117 	virtual unsigned int iGetNumPrivData(void) const;
118 	virtual unsigned int iGetPrivDataIdx(const char *s) const;
119 	virtual doublereal dGetPrivData(unsigned int i) const;
120 
121 	/* *******PER IL SOLUTORE PARALLELO******** */
122 	/* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
123 	   utile per l'assemblaggio della matrice di connessione fra i dofs */
GetConnectedNodes(std::vector<const Node * > & connectedNodes)124 	virtual void GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
125 		connectedNodes.resize(1);
126 		connectedNodes[0] = pNode;
127 	};
128 	/* ************************************************ */
129 
130 	/* assemblaggio jacobiano */
131 	virtual VariableSubMatrixHandler&
132 	AssJac(VariableSubMatrixHandler& WorkMat,
133 		doublereal dCoef,
134 		const VectorHandler& XCurr,
135 		const VectorHandler& XPrimeCurr);
136 
137 	/* assemblaggio jacobiano */
138 	virtual void
139 	AssMats(VariableSubMatrixHandler& WorkMatA,
140 		VariableSubMatrixHandler& WorkMatB,
141 		const VectorHandler& XCurr,
142 		const VectorHandler& XPrimeCurr);
143 
144 	/* assemblaggio residuo */
145 	virtual SubVectorHandler&
146 	AssRes(SubVectorHandler& WorkVec,
147 		doublereal dCoef,
148 		const VectorHandler& XCurr,
149 		const VectorHandler& XPrimeCurr);
150 
151 	/* inverse dynamics capable element */
152 	virtual bool bInverseDynamics(void) const;
153 
154 	/* Inverse Dynamics residual assembly */
155 	SubVectorHandler&
156 	AssRes(SubVectorHandler& WorkVec,
157 		const VectorHandler& XCurr,
158 		const VectorHandler&  XPrimeCurr,
159 		const VectorHandler&  XPrimePrimeCurr,
160 		InverseDynamics::Order iOrder = InverseDynamics::INVERSE_DYNAMICS);
161 
162 	/* Contributo al residuo durante l'assemblaggio iniziale */
163 	virtual SubVectorHandler&
164 	InitialAssRes(SubVectorHandler& WorkVec, const VectorHandler& XCurr);
165 
166 	/* Tipo di DeformableDispHinge */
GetConstLawType(void)167 	virtual ConstLawType::Type GetConstLawType(void) const {
168 		return ConstLawType::VISCOUS;
169 	};
170 
171 	virtual void
172 	AfterConvergence(const VectorHandler& X, const VectorHandler& XP);
173 
174 	/* Aggiorna le deformazioni ecc. */
175 	virtual void AfterPredict(VectorHandler& X, VectorHandler& XP);
176 
177 	/* Aggiorna le deformazioni ecc. */
178 	virtual void
InitialWorkSpaceDim(integer * piNumRows,integer * piNumCols)179 	InitialWorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
180 		*piNumRows = 6;
181 		*piNumCols = 6;
182 	};
183 
184 	/* Contributo allo jacobiano durante l'assemblaggio iniziale */
185 	virtual VariableSubMatrixHandler&
186 	InitialAssJac(VariableSubMatrixHandler& WorkMat,
187 		const VectorHandler& XCurr);
188 
189 };
190 
191 /* ViscousBody - end */
192 
193 #endif // VB_H
194 
195