NeoPZ
pzmultplaca.cpp
Go to the documentation of this file.
1 
6 #include "TPZMaterial.h"
7 #include "pzfmatrix.h"
8 #include "pzbndcond.h"
9 #include <math.h>
10 #include <fstream>
11 using namespace std;
12 
13 #include "pzvec.h"
14 #include "pzerror.h"
15 
16 #include "pzmultplaca.h"
17 
18 TPZMultPlaca::TPZMultPlaca(int num, STATE h, TPZVec<STATE> &esp, STATE f, STATE E1 ,
19  STATE E2 , STATE ni1 , STATE ni2 , STATE G12 , STATE G13 ,
20  STATE G23 , TPZFMatrix<STATE> &naxes, TPZVec<STATE> &xf,
21  int camadaref, int camadaatual) :
23 TPZMatPlaca2(num, h, f, E1 , E2 , ni1 , ni2 , G12 , G13 ,
24  G23 , naxes, xf), fT(6,6,0.) {
25 
26 
27  //variaveis de entrada
28  /* fIdfMax = numero de graus de liberdade por ponto
29  icA = camada atual
30  icR = camada de referencia
31  icC = camada corrente
32  esp = vetor espessuras das camadas
33  f = distancia do eixo de referencia ate o meio da camada atual
34  f>0 quando icA > icR e f<0 quando icA <icR
35  */
36  fIdfMax = (3*(esp.NElements()+1));
37  int icR(camadaref), icA(camadaatual), icC;
38 
39  // Preparacao da matriz T de ordem 6x(3(NCamadas+1))
40  // que transforma as matrizes fKxx em KxxMC
41 
42  fT.Resize(6, fIdfMax);
43 
44  int imin,imax,idif,sign,i,j;
45 
46  if (icA != icR) {
47  if (icA > icR) {
48  idif=icA - icR -1;
49  icC=icR;
50  sign=1;
51  }
52  else {
53  idif=icR-icA-1;
54  icC=icA;
55  sign=-1;
56  };
57 
58  for (i=1; i<=idif; i++) {
59  icC=icC+1;
60  j=3*(icC+1);
61  fT(0,j+1) = sign*esp[icC];
62  fT(1,j)=-sign*esp[icC];
63  };
64 
65  j=3*(icA+1);
66  fT(0,j+1)=-f+sign*esp[icA]/2.0;
67  fT(1,j )= f-sign*esp[icA]/2.0;
68  };
69 
70  if (icA>icR){
71  imin=3*(icR+1);
72  imax=3*(icA+1);
73  }
74  else{
75  imin=3*(icA+1);
76  imax=3*(icR+1);
77  };
78  for (i=0;i<3;i++){
79  fT(i,i)=1.0;
80  fT(3+i,imin+i)=1.0;
81  fT(3+i,imax+i)=1.0;
82  };
83 
84  TPZFMatrix<STATE> TTransp;
85  fT.Transpose(&TTransp);
86 
87  // Obtencao das matrizes do elemento no plano xy, com efeito multicamada
88 
89  TPZFMatrix<STATE> KxxMC,KyyMC,KxyMC,KyxMC,Bx0MC,B0xMC,By0MC,B0yMC,B00MC;
90 
91  KxxMC=TTransp*(fKxx*fT);
92  KyyMC=TTransp*(fKyy*fT);
93  KxyMC=TTransp*(fKxy*fT);
94  Bx0MC=TTransp*(fBx0*fT);
95  By0MC=TTransp*(fBy0*fT);
96  B00MC=TTransp*(fB00*fT);
97 
98  KxyMC.Transpose(&KyxMC);
99  Bx0MC.Transpose(&B0xMC);
100  By0MC.Transpose(&B0yMC);
101 
102  // Geracao da Matriz de Rotacao para passar do plano para o espaco
103 
106 
107  imax= fIdfMax / 3;
108  for (i=0; i<imax; i++){
109  j=3*i;
110  fRmat(j,j) = fnaxes(0,0); fRmat(j,j+1) = fnaxes(0,1); fRmat(j,j+2) = fnaxes(0,2);
111  fRmat(j+1,j) = fnaxes(1,0); fRmat(j+1,j+1) = fnaxes(1,1); fRmat(j+1,j+2) = fnaxes(1,2);
112  fRmat(j+2,j) = fnaxes(2,0); fRmat(j+2,j+1) = fnaxes(2,1); fRmat(j+2,j+2) = fnaxes(2,2);
113  }
114 
116 
117  // Obtencao da matriz auxiliar que ira entrar no calculo das matrizes Knn (do espaco)
118 
124 
125  fKxxR = fRmatT * (KxxMC * fRmat);
126  fKyxR = fRmatT * (KyxMC * fRmat);
127  fKxyR = fRmatT * (KxyMC * fRmat);
128  fKyyR = fRmatT * (KyyMC * fRmat);
129  fB0xR = fRmatT * (B0xMC * fRmat);
130  fB0yR = fRmatT * (B0yMC * fRmat);
131  fBx0R = fRmatT * (Bx0MC * fRmat);
132  fBy0R = fRmatT * (By0MC * fRmat);
133  fB00R = fRmatT * (B00MC * fRmat);
134 
135  // testes
136 
137  ofstream out("saida.dat");
138 
140 
141  fKxxR.Transpose(&Transp);
142  Temp= fKxxR - Transp;
143  Temp.Print("fKxxR - fKxxR^t",out);
144 
145  fKyyR.Transpose(&Transp);
146  Temp= fKyyR - Transp;
147  Temp.Print("fKyyR - fKyyR^t",out);
148 
149  fKyxR.Transpose(&Transp);
150  Temp= fKxyR - Transp;
151  Temp.Print("fKxyR - fKyxR^t",out);
152 
153  fKxyR.Transpose(&Transp);
154  Temp= fKyxR - Transp;
155  Temp.Print("fKyxR - fKxyR^t",out);
156 
157  fB0xR.Transpose(&Transp);
158  Temp= fBx0R - Transp;
159  Temp.Print("fBx0R - fB0xR^t",out);
160 
161  fBx0R.Transpose(&Transp);
162  Temp= fB0xR - Transp;
163  Temp.Print("fB0xR - fBx0R^t",out);
164 
165  fB0yR.Transpose(&Transp);
166  Temp= fBy0R - Transp;
167  Temp.Print("fBy0R - fB0yR^t",out);
168 
169  fBy0R.Transpose(&Transp);
170  Temp= fB0yR - Transp;
171  Temp.Print("fB0yR - fKy0R^t",out);
172 
173  fB00R.Transpose(&Transp);
174  Temp= fB00R - Transp;
175  Temp.Print("fB00R - fB00R^t",out);
176 };
177 
180  TPZFMatrix<REAL> &axes,int var,TPZVec<STATE> &Solout){
181 
182  if(var == 2 || var ==3 || var == 4) {
183  TPZMatPlaca2::Solution(Sol,DSol,axes,var,Solout);
184  return;
185  }
186 
187  if(var > 4) {
188  TPZVec<REAL> Soln(fIdfMax);
189 
190  TPZFMatrix<REAL> DSolnax(2,fIdfMax),DSolnn(2,fIdfMax);
191 
192 
193  int idf,jdf;
194  for(idf=0; idf<fIdfMax; idf++) {
195  Soln[idf] = 0;
196  DSolnax(0,idf) = 0;
197  DSolnax(1,idf) = 0.;
198  for(jdf=0; jdf<fIdfMax; jdf++) {
199  Soln[idf] += fRmat(idf,jdf)*Sol[jdf];
200  DSolnax(0,idf) += fRmat(idf,jdf)*DSol(0,jdf);
201  DSolnax(1,idf) += fRmat(idf,jdf)*DSol(1,jdf);
202  }
203  }
204 
205  TPZFMatrix<REAL> Rmatan(2,2);
206  Rmatan(0,0)= axes(0,0)* fnaxes(0,0) + axes(0,1)* fnaxes(0,1) + axes(0,2)* fnaxes(0,2);
207  Rmatan(0,1)= axes(0,0)* fnaxes(1,0) + axes(0,1)* fnaxes(1,1) + axes(0,2)* fnaxes(1,2);
208  Rmatan(1,0)= axes(1,0)* fnaxes(0,0) + axes(1,1)* fnaxes(0,1) + axes(1,2)* fnaxes(0,2);
209  Rmatan(1,1)= axes(1,0)* fnaxes(1,0) + axes(1,1)* fnaxes(1,1) + axes(1,2)* fnaxes(1,2);
210 
211  for(idf=0;idf<fIdfMax;idf++) {
212  DSolnn(0,idf) = Rmatan(0,0)*DSolnax(0,idf)+Rmatan(0,1)*DSolnax(1,idf);
213  DSolnn(1,idf) = Rmatan(1,0)*DSolnax(0,idf)+Rmatan(1,1)*DSolnax(1,idf);
214  }
215 
216  TPZVec<REAL> SolStarnn(6);
217  TPZFMatrix<REAL> DSolStarnn(2,6);
218 
219  for (idf=0; idf<6; idf++){
220  SolStarnn[idf]=0.;
221  DSolStarnn(0,idf)=0.;
222  DSolStarnn(1,idf)=0.;
223  for (jdf=0; jdf<fIdfMax; jdf++){
224  SolStarnn[idf] += fT(idf,jdf)*Soln[jdf];
225  DSolStarnn(0,idf) += fT(idf,jdf)*DSolnn(0,jdf);
226  DSolStarnn(1,idf) += fT(idf,jdf)*DSolnn(1,jdf);
227  }
228  }
229  TPZVec<STATE> Sol6(6,0.);
230  TPZFMatrix<STATE> DSol6(2,6,0.),DSoln6a(2,6,0.);
231  for(idf=0;idf<6;idf++) {
232  DSoln6a(0,idf) = Rmatan(0,0)*DSolStarnn(0,idf)+Rmatan(1,0)*DSolStarnn(1,idf);
233  DSoln6a(1,idf) = Rmatan(0,1)*DSolStarnn(0,idf)+Rmatan(1,1)*DSolStarnn(1,idf);
234  }
235  for(idf=0; idf<6; idf++) {
236  Sol6[idf] = 0;
237  DSol6(0,idf) = 0;
238  DSol6(1,idf) = 0.;
239  for(jdf=0; jdf<6; jdf++) {
240  Sol6[idf] += fRmat(jdf,idf)*SolStarnn[jdf];
241  DSol6(0,idf) += fRmat(jdf,idf)*DSoln6a(0,jdf);
242  DSol6(1,idf) += fRmat(jdf,idf)*DSoln6a(1,jdf);
243  }
244  }
245 
246  TPZMatPlaca2::Solution(Sol6,DSol6,axes,var,Solout);
247  }
248  return;
249 
250 }
251 
253  return Hash("TPZMultPlaca") ^ TPZMatPlaca2::ClassId() << 1;
254 }
virtual void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override
Returns the solution associated with the var index based on the finite element approximation.
Contains the TPZMultPlaca class.
virtual void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override
Returns the solution associated with the var index based on the finite element approximation.
TPZFMatrix< STATE > fB00R
Definition: pzmatplaca2.h:27
TPZFMatrix< STATE > fRmat
Definition: pzmatplaca2.h:26
int ClassId() const override
Define the class id associated with the class.
DESCRIBE PLEASE.
Definition: pzmultplaca.h:15
Templated vector implementation.
TPZFMatrix< STATE > fKyyR
Definition: pzmatplaca2.h:27
TPZFMatrix< STATE > fRmatT
Definition: pzmatplaca2.h:26
DESCRIBE PLEASE.
Definition: pzmatplaca2.h:20
TPZFMatrix< STATE > fnaxes
Definition: pzmatplaca2.h:25
Defines PZError.
clarg::argBool h("-h", "help message", false)
TPZFMatrix< STATE > fBy0R
Definition: pzmatplaca2.h:27
TPZFMatrix< STATE > fKxxR
Definition: pzmatplaca2.h:27
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
TPZFMatrix< STATE > fBx0
Definition: pzmatplaca2.h:28
f
Definition: test.py:287
virtual int ClassId() const override
Define the class id associated with the class.
Contains TPZMatrixclass which implements full matrix (using column major representation).
TPZFMatrix< STATE > fKxx
Definition: pzmatplaca2.h:28
TPZFMatrix< STATE > fB0yR
Definition: pzmatplaca2.h:27
TPZFMatrix< STATE > fB00
Definition: pzmatplaca2.h:28
TPZFMatrix< STATE > fBy0
Definition: pzmatplaca2.h:28
TPZFMatrix< STATE > fKxyR
Definition: pzmatplaca2.h:27
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
TPZFMatrix< STATE > fB0xR
Definition: pzmatplaca2.h:27
static int idf[6]
TPZMultPlaca(int num, STATE h, TPZVec< STATE > &esp, STATE f, STATE E1, STATE E2, STATE ni1, STATE ni2, STATE G12, STATE G13, STATE G23, TPZFMatrix< STATE > &naxes, TPZVec< STATE > &xf, int camadaref, int camadaatual)
Definition: pzmultplaca.cpp:18
TPZFMatrix< STATE > fKxy
Definition: pzmatplaca2.h:28
TPZFMatrix< STATE > fT
Definition: pzmultplaca.h:38
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Definition: pzfmatrix.cpp:1016
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
TPZFMatrix< STATE > fBx0R
Definition: pzmatplaca2.h:27
TPZFMatrix< STATE > fKyxR
Definition: pzmatplaca2.h:27
void Transpose(TPZMatrix< TVar > *const T) const override
It makes *T the transpose of current matrix.
Definition: pzfmatrix.cpp:1073
TPZFMatrix< STATE > fKyy
Definition: pzmatplaca2.h:28