NeoPZ
hdiv2dpaper201504.cpp
Go to the documentation of this file.
1 //
2 // Hdiv2dPaper201504.cpp
3 // PZ
4 //
5 // Created by Douglas Castro on 18/03/15.
6 //
7 //
8 
9 #include "hdiv2dpaper201504.h"
10 
11 //#define DEFORMED
12 #define SENOSENO
13 
15 {
16 
17  fDim = 2;
18 
19  fmatId = 1;
20 
21  fdirichlet = 0;
22  fneumann = 1;
23 
24  fbc1 = -2;
25  fbc2 = -3;
26  fbc3 = -4;
27  fbc4 = -5;
28 
29  fmatskeleton = -7;
30 
31  ftriang = false;
32 }
33 
35 {
36 
37 }
38 
39 void Hdiv2dPaper201504::Run(ApproximationSpace problem, Eltype element, TPZVec<int> POrderBeginAndEnd, TPZVec<int> ndivinterval, TPZFMatrix< REAL > &errors)
40 {
41  if (POrderBeginAndEnd.size()!=2)
42  {
43  std::cout << " POrderBeginAndEnd Vector must have size == 2 and contain just two values, the first and last approximation orders. " << std::endl;
44  std::cout << " Some like POrderBeginAndEnd[0] = 1, POrderBeginAndEnd[1] = 3 " << std::endl;
45  return;
46  }
47 
48  if (ndivinterval.size()!=2)
49  {
50  std::cout << " ndivinterval Vector must have size == 2 and contain just two values, the first and last number of uniform refinements. " << std::endl;
51  std::cout << " Some like ndivinterval[0] = 0, ndivinterval[1] = 3 for simulations with 0, 1, 2 and 3 refinements " << std::endl;
52  std::cout << " Some like ndivinterval[0] = 1, ndivinterval[1] = 1 for simulations with 1 refinement " << std::endl;
53  return;
54  }
55 
56  int sizeErrorMatrix = (ndivinterval[1]-ndivinterval[0])*(POrderBeginAndEnd[1] - POrderBeginAndEnd[0]) + 1;
57  int errorposition = 0;
58 
59  errors.Resize(sizeErrorMatrix, 4);
60 
61  for(int p = POrderBeginAndEnd[0]; p <= POrderBeginAndEnd[1]; p++)
62  {
63 
64  for (int ndiv = ndivinterval[0]; ndiv<=ndivinterval[1]; ndiv++)
65  {
66  int ordemP = p;
67 
68  std::cout<< " BEGIN (Quadrilateral Domain) - Polinomial degree: " << ordemP << " rerfinement size (h): " << ndiv << std::endl;
69 
70  TPZGeoMesh *gmesh;
71  switch (element) {
72  case EQuad:
73  {
74  gmesh = this->GMesh(fDim, false, ndiv);
75  }
76  break;
77  case ETriangle:
78  {
79  setTriangTrue();
80  gmesh = this->GMesh(fDim, true, ndiv);
81  }
82  break;
83  default:
84  break;
85  }
86 
87 
88  switch (problem) {
89  case EH1:
90  {
91 
92  gmesh->SetDimension(fDim);
93  TPZCompMesh *cmeshH1 = this->CMeshH1(gmesh, ordemP, fDim);
94  //condensar
95  for (int64_t iel=0; iel<cmeshH1->NElements(); iel++) {
96  TPZCompEl *cel = cmeshH1->Element(iel);
97  if(!cel) continue;
98  new TPZCondensedCompEl(cel);
99  }
100 
101  cmeshH1->ExpandSolution();
102  cmeshH1->CleanUpUnconnectedNodes();
103 
104  TPZAnalysis anh1(cmeshH1, true);
105 
106  SolveSyst(anh1, cmeshH1);
107 
108  ErrorH1(cmeshH1, ordemP, ndiv, errorposition, errors);
109 
110  }
111  break;
112  case EHDiv:
113  {
114  DebugStop(); //Mudanca na topologia
115  }
116  break;
117  case EHDivStar:
118  {
119 
120  TPZCompMesh *cmesh1 = this->CMeshFlux(gmesh, ordemP, fDim);
121 
122  TPZCompMesh *cmesh2 = this->CMeshPressure(gmesh, ordemP, fDim);
123 
124  // P**
126 
127 
128  //malha multifisica
129  TPZVec<TPZCompMesh *> meshvec(2);
130  meshvec[0] = cmesh1;
131  meshvec[1] = cmesh2;
132 
133  TPZCompMesh * mphysics = CMeshMixed(gmesh,meshvec);
134 
135  TPZAnalysis an(mphysics, true);
136 
137  SolveSyst(an, mphysics);
138 
139  //Calculo do erro
141  TPZVec<REAL> erros;
142 
143  std::cout << "Computing Errors\n";
144 
145  ErrorPrimalDual( cmesh2, cmesh1, ordemP, ndiv, errorposition, errors);
146  }
147  break;
148 
149  case EHDivStarStar:
150  {
151 
152  ordemP = ordemP + 1;
153 
154  TPZCompMesh *cmesh1 = this->CMeshFlux(gmesh, ordemP, fDim);
155 
156  TPZCompMesh *cmesh2 = this->CMeshPressure(gmesh, ordemP, fDim);
157  //P**
159 
160  //malha multifisica
161  TPZVec<TPZCompMesh *> meshvec(2);
162  meshvec[0] = cmesh1;
163  meshvec[1] = cmesh2;
164 
165  TPZCompMesh * mphysics = CMeshMixed(gmesh,meshvec);
166 
167  TPZAnalysis an(mphysics, true);
168 
169  SolveSyst(an, mphysics);
170 
171  //Calculo do erro
173  TPZVec<REAL> erros;
174 
175  std::cout << "Computing Errors\n";
176 
177  ErrorPrimalDual( cmesh2, cmesh1, ordemP, ndiv, errorposition, errors);
178  }
179  break;
180 
181  default:
182  break;
183  }
184 
185  std::cout<< " END (QUAD) - polinomial degree: " << ordemP << " refinement size (h): " << ndiv << std::endl;
186 
187  errorposition++;
188 
189  }
190  }
191 
192  std::cout<< " The End " << std::endl;
193 
194 
195 }
196 
197 void Hdiv2dPaper201504::PrintErrors(ApproximationSpace problem, Eltype element, TPZVec<int> POrderBeginAndEnd, TPZVec<int> ndivinterval, TPZVec<REAL> &errors, std::ostream &output)
198 {
199  if (POrderBeginAndEnd.size()!=2)
200  {
201  std::cout << " POrderBeginAndEnd Vector must have size == 2 and contain just two values, the first and last approximation orders. " << std::endl;
202  std::cout << " Some like POrderBeginAndEnd[0] = 1, POrderBeginAndEnd[1] = 3 " << std::endl;
203  return;
204  }
205 
206  if (ndivinterval.size()!=2)
207  {
208  std::cout << " ndivinterval Vector must have size == 2 and contain just two values, the first and last number of uniform refinements. " << std::endl;
209  std::cout << " Some like ndivinterval[0] = 0, ndivinterval[1] = 3 for simulations with 0, 1, 2 and 3 refinements " << std::endl;
210  std::cout << " Some like ndivinterval[0] = 1, ndivinterval[1] = 1 for simulations with 1 refinement " << std::endl;
211  return;
212  }
213 
214  for(int p = POrderBeginAndEnd[0]; p <= POrderBeginAndEnd[1]; p++)
215  {
216  output << "\n WHEN p = " << p << " \n " << endl;
217  output << "ndiv " << setw(6) << "DoFTot" << setw(20) << "DofCond" << setw(28) << "PrimalL2Error" << setw(35) << "L2DualError" << endl;
218 
219  for (int ndiv = ndivinterval[0]; ndiv<=ndivinterval[1]; ndiv++)
220  {
221  int ordemP = p;
222 
223  std::cout<< " BEGIN (Quadrilateral Domain) - Polinomial degree: " << ordemP << " rerfinement size (h): " << ndiv << std::endl;
224 
225  TPZGeoMesh *gmesh;
226  switch (element) {
227  case EQuad:
228  {
229  gmesh = this->GMesh(fDim, false, ndiv);
230  }
231  break;
232  case ETriangle:
233  {
234  setTriangTrue();
235  gmesh = this->GMesh(fDim, true, ndiv);
236  }
237  break;
238  default:
239  break;
240  }
241 
242  gmesh->SetDimension(fDim);
243 
244  switch (problem) {
245  case EH1:
246  {
247 
248  TPZCompMesh *cmeshH1 = this->CMeshH1(gmesh, ordemP, fDim);
249 
250  int dofTotal = cmeshH1->NEquations();
251 
252  //condensar
253  for (int64_t iel=0; iel<cmeshH1->NElements(); iel++) {
254  TPZCompEl *cel = cmeshH1->Element(iel);
255  if(!cel) continue;
256  new TPZCondensedCompEl(cel);
257  }
258 
259  cmeshH1->ExpandSolution();
260  cmeshH1->CleanUpUnconnectedNodes();
261 
262  int dofCondensed = cmeshH1->NEquations();
263 
264  TPZAnalysis anh1(cmeshH1, true);
265 
266  SolveSyst(anh1, cmeshH1);
267 
268  ErrorH1(cmeshH1, ordemP, ndiv, output, dofTotal, dofCondensed);
269 
270  }
271  break;
272  case EHDiv:
273  {
274  DebugStop(); //Mudanca na topologia
275  }
276  break;
277  case EHDivStar:
278  {
279 
280  TPZCompMesh *cmesh1 = this->CMeshFlux(gmesh, ordemP, fDim);
281 
282  TPZCompMesh *cmesh2 = this->CMeshPressure(gmesh, ordemP, fDim);
283 
284  // para rodar P**
286 
287  int DofCond, DoFT;
288  DoFT = cmesh1->NEquations() + cmesh2->NEquations();
289 
290  //malha multifisica
291  TPZVec<TPZCompMesh *> meshvec(2);
292  meshvec[0] = cmesh1;
293  meshvec[1] = cmesh2;
294 
295  TPZCompMesh * mphysics = CMeshMixed(gmesh,meshvec);
296 
297  DofCond = mphysics->NEquations();
298 
299  TPZAnalysis an(mphysics, true);
300 
301  SolveSyst(an, mphysics);
302 
303  //Calculo do erro
305  TPZVec<REAL> erros;
306 
307  std::cout << "Computing Errors\n";
308 
309  ErrorPrimalDual( cmesh2, cmesh1, ordemP, ndiv, output, DoFT, DofCond);
310  }
311  break;
312 
313  case EHDivStarStar:
314  {
315 
316 
317  ordemP = ordemP + 1;
318 
319  TPZCompMesh *cmesh1 = this->CMeshFlux(gmesh, ordemP, fDim);
320 
321  TPZCompMesh *cmesh2 = this->CMeshPressure(gmesh, ordemP, fDim);
322 
323  // para rodar P**
325 
326  int DofCond, DoFT;
327  DoFT = cmesh1->NEquations() + cmesh2->NEquations();
328 
329  //malha multifisica
330  TPZVec<TPZCompMesh *> meshvec(2);
331  meshvec[0] = cmesh1;
332  meshvec[1] = cmesh2;
333 
334  TPZCompMesh * mphysics = CMeshMixed(gmesh,meshvec);
335 
336  DofCond = mphysics->NEquations();
337 
338  TPZAnalysis an(mphysics, true);
339 
340  SolveSyst(an, mphysics);
341 
342  //Calculo do erro
344  TPZVec<REAL> erros;
345 
346  std::cout << "Computing Errors\n";
347 
348  ErrorPrimalDual( cmesh2, cmesh1, ordemP, ndiv, output, DoFT, DofCond);
349  }
350  break;
351 
352  default:
353  break;
354  }
355 
356 
357  }
358 
359  output << "\n ----------------------------------------------------------------------------- " << endl;
360  std::cout<< " END (Quadrilateral Domain) - Polinomial degree: " << p << std::endl;
361 
362  }
363 
364  std::cout<< " The End " << std::endl;
365 
366 
367 }
368 
369 TPZGeoMesh *Hdiv2dPaper201504::GMesh(int dim, bool ftriang, int ndiv)
370 {
371 
372  if(dim!=2)
373  {
374  std::cout << "Wrong dimension" << std::endl;
375  dim = 2;
376  DebugStop();
377  }
378 
379  int Qnodes = 4;
380 
381  TPZGeoMesh * gmesh = new TPZGeoMesh;
382  gmesh->SetMaxNodeId(Qnodes-1);
383  gmesh->NodeVec().Resize(Qnodes);
384  TPZVec<TPZGeoNode> Node(Qnodes);
385 
386  gmesh->SetDimension(dim);
387 
388  TPZVec <int64_t> TopolQuad(4);
389  TPZVec <int64_t> TopolTriang(3);
390  TPZVec <int64_t> TopolLine(2);
391 
392  //indice dos nos
393  int64_t id = 0;
394 
395  TPZManVector<REAL,3> coord(2,0.);
396  int in = 0;
397  //c0
398  coord[0] = 0.0;
399  coord[1] = 0.0;
400  gmesh->NodeVec()[in].SetCoord(coord);
401  gmesh->NodeVec()[in].SetNodeId(in);
402  in++;
403  //c1
404  coord[0] = 1.0;
405  coord[1] = 0.0;
406  gmesh->NodeVec()[in].SetCoord(coord);
407  gmesh->NodeVec()[in].SetNodeId(in);
408  in++;
409  //c2
410  coord[0] = 0.0;
411  coord[1] = 1.0;
412  gmesh->NodeVec()[in].SetCoord(coord);
413  gmesh->NodeVec()[in].SetNodeId(in);
414  in++;
415  //c3
416  coord[0] = 1.0;
417  coord[1] = 1.0;
418  gmesh->NodeVec()[in].SetCoord(coord);
419  gmesh->NodeVec()[in].SetNodeId(in);
420  in++;
421  //indice dos elementos
422  id = 0;
423 
424  if(ftriang) // triangulo
425  {
426  TopolTriang[0] = 0;
427  TopolTriang[1] = 1;
428  TopolTriang[2] = 3;
429  new TPZGeoElRefPattern< pzgeom::TPZGeoTriangle > (id,TopolTriang,fmatId,*gmesh);
430  id++;
431 
432  TopolTriang[0] = 0;
433  TopolTriang[1] = 3;
434  TopolTriang[2] = 2;
435  new TPZGeoElRefPattern< pzgeom::TPZGeoTriangle> (id,TopolTriang,fmatId,*gmesh);
436  id++;
437 
438  }
439  else{
440 
441  TopolQuad[0] = 0;
442  TopolQuad[1] = 1;
443  TopolQuad[2] = 3;
444  TopolQuad[3] = 2;
445  new TPZGeoElRefPattern< pzgeom::TPZGeoQuad> (id,TopolQuad,fmatId,*gmesh);
446  id++;
447  }
448 
449  TopolLine[0] = 0;
450  TopolLine[1] = 1;
451  new TPZGeoElRefPattern< pzgeom::TPZGeoLinear > (id,TopolLine,fbc1,*gmesh);
452  id++;
453 
454  TopolLine[0] = 1;
455  TopolLine[1] = 3;
456  new TPZGeoElRefPattern< pzgeom::TPZGeoLinear > (id,TopolLine,fbc2,*gmesh);
457  id++;
458 
459  TopolLine[0] = 3;
460  TopolLine[1] = 2;
461  new TPZGeoElRefPattern< pzgeom::TPZGeoLinear > (id,TopolLine,fbc3,*gmesh);
462  id++;
463 
464  TopolLine[0] = 2;
465  TopolLine[1] = 0;
466  new TPZGeoElRefPattern< pzgeom::TPZGeoLinear > (id,TopolLine,fbc4,*gmesh);
467 
468 
469 
470  gmesh->BuildConnectivity();
471 
473 
474  TPZVec<TPZGeoEl *> sons;
475  for (int iref = 0; iref < ndiv; iref++) {
476  int nel = gmesh->NElements();
477  for (int iel = 0; iel < nel; iel++) {
478  TPZGeoEl *gel = gmesh->ElementVec()[iel];
479  if (gel->HasSubElement()) {
480  continue;
481  }
482  gel->Divide(sons);
483  }
484  }
485 
486  return gmesh;
487 }
488 
490 
491  solp.resize(1);
492  solp[0]=0.;
493 
494  int dim = 3; //getDimension();
495 
496  // tensor de permutacao
497  TPZFNMatrix<2,REAL> TP(dim,dim,0.0);
498  TPZFNMatrix<2,REAL> InvTP(dim,dim,0.0);
499 
500 
501  // Hard coded
502  for (int id = 0; id < dim; id++){
503  TP(id,id) = 1.0;
504  InvTP(id,id) = 1.0;
505  }
506 
507  flux.Resize(dim, 1);
508 
509  double x = pt[0];
510  double y = pt[1];
511 
512  solp[0] = sin(M_PI*x)*sin(M_PI*y);
513  flux(0,0) = -M_PI*cos(M_PI*x)*sin(M_PI*y);
514  flux(1,0) = -M_PI*cos(M_PI*y)*sin(M_PI*x);
515 
516 }
517 
519 
520  int dim = 3; //getDimension();
521 
522  // tensor de permutacao
523  TPZFNMatrix<2,REAL> TP(dim,dim,0.0);
524  TPZFNMatrix<2,REAL> InvTP(dim,dim,0.0);
525 
526 
527  // Hard coded
528  for (int id = 0; id < dim; id++){
529  TP(id,id) = 1.0;
530  InvTP(id,id) = 1.0;
531  }
532 
533  double x = pt[0];
534  double y = pt[1];
535 
536  ff[0] = 2.*M_PI*M_PI*sin(M_PI*x)*sin(M_PI*y);
537 
538 
539 
540 
541 }
542 
544 
545  solp.resize(1);
546  solp[0]=0.;
547 
548  int dim = 3; //getDimension();
549 
550  // tensor de permutacao
551  TPZFNMatrix<2,REAL> TP(dim,dim,0.0);
552  TPZFNMatrix<2,REAL> InvTP(dim,dim,0.0);
553 
554 
555  // Hard coded
556  for (int id = 0; id < dim; id++){
557  TP(id,id) = 1.0;
558  InvTP(id,id) = 1.0;
559  }
560 
561  flux.Resize(dim, 1);
562 
563  double x = pt[0];
564  double y = pt[1];
565 
566  solp[0] = sin(M_PI*x)*sin(M_PI*y);
567  flux(0,0) = -M_PI*cos(M_PI*x)*sin(M_PI*y);
568  flux(1,0) = -M_PI*cos(M_PI*y)*sin(M_PI*x);
569 
570 
571  flux(0,0) *= -1.;
572  flux(1,0) *= -1.;
573 
574 }
575 
577 {
578  int dim = 2; //getDimension();
579 
580  // tensor de permutacao
581  TPZFNMatrix<2,REAL> TP(dim,dim,0.0);
582  TPZFNMatrix<2,REAL> InvTP(dim,dim,0.0);
583 
584 
585  // Hard coded
586  for (int id = 0; id < dim; id++){
587  TP(id,id) = 1.0;
588  InvTP(id,id) = 1.0;
589  }
590 
591  flux.Resize(dim, 1);
592 
593  double x = pt[0];
594  double y = pt[1];
595 
596  ff[0] = -2.*M_PI*M_PI*sin(M_PI*x)*sin(M_PI*y);
597 
598 }
599 
600 
602 
603  solp[0] = 0.0;
604 
605 }
606 
608 
609  solp[0] = 0.0;
610 
611 }
612 
614 
615  solp[0] = 0.0;
616 
617 }
618 
620 
621 
622  solp[0] = 0.0;
623 
624 }
625 
626 
627 
628 TPZCompMesh *Hdiv2dPaper201504::CMeshH1(TPZGeoMesh *gmesh, int pOrder, int dim)
629 {
631  TPZMatPoisson3d *material = new TPZMatPoisson3d(fmatId,fDim);
632  TPZMaterial * mat(material);
633  material->NStateVariables();
634 
635  // //solucao exata
637  solexata = new TPZDummyFunction<STATE>(SolExataH1, 5);
638  material->SetForcingFunctionExact(solexata);
639 
640  //funcao do lado direito da equacao do problema
643  dum->SetPolynomialOrder(20);
644  forcef = dum;
645  material->SetForcingFunction(forcef);
646 
647  TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
648  cmesh->SetDimModel(fDim);
649  cmesh->SetDefaultOrder(pOrder);
650 
651  cmesh->InsertMaterialObject(mat);
652 
654  TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
655  val2(0,0) = 0.0;
656  val2(1,0) = 0.0;
657 
658  TPZMaterial * BCond1;
659  TPZMaterial * BCond2;
660  TPZMaterial * BCond3;
661  TPZMaterial * BCond4;
662 
663 
664  BCond1 = material->CreateBC(mat, fbc1,fdirichlet, val1, val2);
665  BCond2 = material->CreateBC(mat, fbc2,fdirichlet, val1, val2);
666  BCond3 = material->CreateBC(mat, fbc3,fdirichlet, val1, val2);
667  BCond4 = material->CreateBC(mat, fbc4,fdirichlet, val1, val2);
668 
669  cmesh->InsertMaterialObject(BCond1);
670  cmesh->InsertMaterialObject(BCond2);
671  cmesh->InsertMaterialObject(BCond3);
672  cmesh->InsertMaterialObject(BCond4);
673 
674 
676 
677  //Ajuste da estrutura de dados computacional
678  cmesh->AutoBuild();
679 
680  return cmesh;
681 
682 }
683 
684 
686 {
688  //TPZMatPoisson3d *material = new TPZMatPoisson3d(matId,fDim);
689  //TPZMatPoissonD3 *material = new TPZMatPoissonD3(fmatId,fDim);
691 
692  TPZMaterial * mat(material);
693  material->NStateVariables();
694 
695  TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
696 
697 
699  TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
700 
701  TPZMaterial * BCond1;
702  TPZMaterial * BCond2;
703  TPZMaterial * BCond3;
704  TPZMaterial * BCond4;
705 
706 
707  BCond1 = material->CreateBC(mat, fbc1,fdirichlet, val1, val2);
708  BCond2 = material->CreateBC(mat, fbc2,fdirichlet, val1, val2);
709  BCond3 = material->CreateBC(mat, fbc3,fdirichlet, val1, val2);
710  BCond4 = material->CreateBC(mat, fbc4,fdirichlet, val1, val2);
711 
712  cmesh->InsertMaterialObject(mat);
713 
714  cmesh->SetDimModel(fDim);
715 
716  cmesh->SetAllCreateFunctionsHDiv();
717 
718 
719  cmesh->InsertMaterialObject(BCond1);
720  cmesh->InsertMaterialObject(BCond2);
721  cmesh->InsertMaterialObject(BCond3);
722  cmesh->InsertMaterialObject(BCond4);
723 
724 
725  cmesh->SetDefaultOrder(pOrder);
726 
727 
729  TPZMaterial * mat2(matskelet);
730  cmesh->InsertMaterialObject(mat2);
731 
732 
733 
734  //Ajuste da estrutura de dados computacional
735  cmesh->AutoBuild();
736 
737  return cmesh;
738 
739 }
740 
742 {
744  //TPZMatPoisson3d *material = new TPZMatPoisson3d(fmatId,fDim);
745  //TPZMatPoissonD3 *material = new TPZMatPoissonD3(fmatId,fDim);
747  material->NStateVariables();
748 
749  TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
750  cmesh->SetDimModel(fDim);
751  TPZMaterial * mat(material);
752  cmesh->InsertMaterialObject(mat);
753 
755  TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
756 
757  cmesh->SetDefaultOrder(pOrder);
758 
759  bool h1function = true;// com esqueleto precisa disso
760  if(pOrder>0/*h1function*/){
763  }
764  else{
766  }
767 
768 
769  //Ajuste da estrutura de dados computacional
770  cmesh->AutoBuild();
771 
772 
773  int ncon = cmesh->NConnects();
774  for(int i=0; i<ncon; i++)
775  {
776  TPZConnect &newnod = cmesh->ConnectVec()[i];
777  //newnod.SetPressure(true);
778  newnod.SetLagrangeMultiplier(1);
779  }
780 
781  if(!h1function)
782  {
783 
784  int nel = cmesh->NElements();
785  for(int i=0; i<nel; i++){
786  TPZCompEl *cel = cmesh->ElementVec()[i];
787  TPZCompElDisc *celdisc = dynamic_cast<TPZCompElDisc *>(cel);
788  celdisc->SetConstC(1.);
789  celdisc->SetCenterPoint(0, 0.);
790  celdisc->SetCenterPoint(1, 0.);
791  celdisc->SetCenterPoint(2, 0.);
792  celdisc->SetTrueUseQsiEta();
793 
794  if(celdisc && celdisc->Reference()->Dimension() == cmesh->Dimension())
795  {
796  if(ftriang==true) celdisc->SetTotalOrderShape();
797  else celdisc->SetTensorialShape();
798  }
799 
800  }
801  }
802 
803 #ifdef PZDEBUG
804  int ncel = cmesh->NElements();
805  for(int i =0; i<ncel; i++){
806  TPZCompEl * compEl = cmesh->ElementVec()[i];
807  if(!compEl) continue;
808  TPZInterfaceElement * facel = dynamic_cast<TPZInterfaceElement *>(compEl);
809  if(facel)DebugStop();
810 
811  }
812 #endif
813 
814  return cmesh;
815 
816 }
817 
819 {
820 
821  //Creating computational mesh for multiphysic elements
822  gmesh->ResetReference();
823  TPZCompMesh *mphysics = new TPZCompMesh(gmesh);
824 
825  //criando material
826  int dim = gmesh->Dimension();
827 
828  TPZMatMixedPoisson3D *material = new TPZMatMixedPoisson3D(fmatId,dim);
829 
830  //incluindo os dados do problema
831  TPZFNMatrix<9,REAL> PermTensor(3,3,0.);
832  TPZFNMatrix<9,REAL> InvPermTensor(3,3,0.);
833 
834 
835  // tensor de permutacao
836  TPZFNMatrix<9,REAL> TP(3,3,0.0);
837  TPZFNMatrix<9,REAL> InvTP(3,3,0.0);
838 
839  // Hard coded
840  for (int id = 0; id < 3; id++){
841  TP(id,id) = 1.0;
842  InvTP(id,id) = 1.0;
843  }
844 
845  PermTensor = TP;
846  InvPermTensor = InvTP;
847 
848  material->SetPermeabilityTensor(PermTensor, InvPermTensor);
849 
850  //solucao exata
852 
853  solexata = new TPZDummyFunction<STATE>(SolExata,5);
854  material->SetForcingFunctionExact(solexata);
855  mphysics->SetDimModel(dim);
856  //funcao do lado direito da equacao do problema
859  dum->SetPolynomialOrder(10);
860  forcef = dum;
861  material->SetForcingFunction(forcef);
862 
863  //inserindo o material na malha computacional
864  TPZMaterial *mat(material);
865  mphysics->InsertMaterialObject(mat);
866 
867 
868  //Criando condicoes de contorno
869  TPZMaterial * BCond1;
870  TPZMaterial * BCond2;
871  TPZMaterial * BCond3;
872  TPZMaterial * BCond4;
873 
874 
875  TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
876 
877 
878  val2(0,0) = 0.0;
879  val2(1,0) = 0.0;
881  BCond1 = material->CreateBC(mat, fbc1,fdirichlet, val1, val2);
882  BCond1->SetForcingFunction(FBCond1);
883 
884  val2(0,0) = 0.0;
885  val2(1,0) = 0.0;
887  BCond2 = material->CreateBC(mat, fbc2,fdirichlet, val1, val2);
888  BCond2->SetForcingFunction(FBCond2);
889 
890  val2(0,0) = 0.0;
891  val2(1,0) = 0.0;
893  BCond3 = material->CreateBC(mat, fbc3,fdirichlet, val1, val2);
894  BCond3->SetForcingFunction(FBCond3);
895 
896  val2(0,0) = 0.0;
897  val2(1,0) = 0.0;
899  BCond4 = material->CreateBC(mat, fbc4,fdirichlet, val1, val2);
900  BCond4->SetForcingFunction(FBCond4);
901 
902 
903 
904 
906 
907  mphysics->InsertMaterialObject(BCond1);
908  mphysics->InsertMaterialObject(BCond2);
909  mphysics->InsertMaterialObject(BCond3);
910  mphysics->InsertMaterialObject(BCond4);
911 
912  //Fazendo auto build
913  mphysics->AutoBuild();
914  mphysics->AdjustBoundaryElements();
915  mphysics->CleanUpUnconnectedNodes();
916 
917  //Creating multiphysic elements containing skeletal elements.
918  TPZBuildMultiphysicsMesh::AddElements(meshvec, mphysics);
919  mphysics->Reference()->ResetReference();
920  mphysics->LoadReferences();
921 
922  int64_t nel = mphysics->ElementVec().NElements();
923 
924  std::map<int64_t, int64_t> bctoel, eltowrap;
925  for (int64_t el=0; el<nel; el++) {
926  TPZCompEl *cel = mphysics->Element(el);
927  TPZGeoEl *gel = cel->Reference();
928  int matid = gel->MaterialId();
929  if (matid < 0) {
930  TPZGeoElSide gelside(gel,gel->NSides()-1);
931  TPZGeoElSide neighbour = gelside.Neighbour();
932  while (neighbour != gelside) {
933  if (neighbour.Element()->Dimension() == dim && neighbour.Element()->Reference()) {
934  // got you!!
935  bctoel[el] = neighbour.Element()->Reference()->Index();
936  break;
937  }
938  neighbour = neighbour.Neighbour();
939  }
940  if (neighbour == gelside) {
941  DebugStop();
942  }
943  }
944  }
945 
947  for(int64_t el = 0; el < nel; el++)
948  {
949  TPZMultiphysicsElement *mfcel = dynamic_cast<TPZMultiphysicsElement *>(mphysics->Element(el));
950  if(mfcel->Dimension()==dim) TPZBuildMultiphysicsMesh::AddWrap(mfcel, fmatId, wrapEl);//criei elementos com o mesmo matId interno, portanto nao preciso criar elemento de contorno ou outro material do tipo TPZLagrangeMultiplier
951  }
952 
953  for (int64_t el =0; el < wrapEl.size(); el++) {
954  TPZCompEl *cel = wrapEl[el][0];
955  int64_t index = cel->Index();
956  eltowrap[index] = el;
957  }
958 
959  meshvec[0]->CleanUpUnconnectedNodes();
960  TPZBuildMultiphysicsMesh::AddConnects(meshvec,mphysics);
962 
963  std::map<int64_t, int64_t>::iterator it;
964  for (it = bctoel.begin(); it != bctoel.end(); it++) {
965  int64_t bcindex = it->first;
966  int64_t elindex = it->second;
967  if (eltowrap.find(elindex) == eltowrap.end()) {
968  DebugStop();
969  }
970  int64_t wrapindex = eltowrap[elindex];
971  TPZCompEl *bcel = mphysics->Element(bcindex);
972  TPZMultiphysicsElement *bcmf = dynamic_cast<TPZMultiphysicsElement *>(bcel);
973  if (!bcmf) {
974  DebugStop();
975  }
976  wrapEl[wrapindex].Push(bcmf);
977 
978  }
979 
980  //------- Create and add group elements -------
981  int64_t index, nenvel;
982  nenvel = wrapEl.NElements();
984  for(int64_t ienv=0; ienv<nenvel; ienv++){
985  TPZElementGroup *elgr = new TPZElementGroup(*wrapEl[ienv][0]->Mesh(),index);
986  elgroups.Push(elgr);
987  nel = wrapEl[ienv].NElements();
988  for(int jel=0; jel<nel; jel++){
989  elgr->AddElement(wrapEl[ienv][jel]);
990  }
991  }
992 
993  mphysics->ComputeNodElCon();
994  // create condensed elements
995  // increase the NumElConnected of one pressure connects in order to prevent condensation
996  for (int64_t ienv=0; ienv<nenvel; ienv++) {
997  TPZElementGroup *elgr = elgroups[ienv];
998  int nc = elgr->NConnects();
999  for (int ic=0; ic<nc; ic++) {
1000  TPZConnect &c = elgr->Connect(ic);
1001  if (c.LagrangeMultiplier() > 0) {
1003  break;
1004  }
1005  }
1006  new TPZCondensedCompEl(elgr);
1007  }
1008 
1009  mphysics->CleanUpUnconnectedNodes();
1010  mphysics->ExpandSolution();
1011 
1012  return mphysics;
1013 
1014 }
1015 
1016 
1017 void Hdiv2dPaper201504::ErrorH1(TPZCompMesh *l2mesh, int p, int ndiv, int pos, TPZFMatrix< REAL > &errors)
1018 {
1019 
1020  int64_t nel = l2mesh->NElements();
1021  int dim = l2mesh->Dimension();
1022  TPZManVector<REAL,10> globalerrors(10,0.);
1023  for (int64_t el=0; el<nel; el++) {
1024  TPZCompEl *cel = l2mesh->ElementVec()[el];
1025  if (!cel) {
1026  continue;
1027  }
1028  TPZGeoEl *gel = cel->Reference();
1029  if (!gel || gel->Dimension() != dim) {
1030  continue;
1031  }
1032  TPZManVector<REAL,10> elerror(10,0.);
1033  elerror.Fill(0.);
1034  cel->EvaluateError(SolExataH1, elerror, 0);
1035 
1036  int nerr = elerror.size();
1037  globalerrors.resize(nerr);
1038 
1039  for (int i=0; i<nerr; i++) {
1040  globalerrors[i] += elerror[i]*elerror[i];
1041  }
1042  }
1043  // sequence of storage
1044  // for each
1045  errors.PutVal(pos, 0, p); // polinomial order
1046  errors.PutVal(pos, 1, ndiv); // refinement
1047  errors.PutVal(pos, 2, sqrt(globalerrors[1])); // pressure
1048  errors.PutVal(pos, 3, sqrt(globalerrors[2])); // flux
1049 
1050 }
1051 
1052 void Hdiv2dPaper201504::ErrorH1(TPZCompMesh *l2mesh, int p, int ndiv, std::ostream &out, int DoFT, int DofCond)
1053 {
1054 
1055  int64_t nel = l2mesh->NElements();
1056  int dim = l2mesh->Dimension();
1057  TPZManVector<STATE,10> globalerrors(10,0.);
1058  for (int64_t el=0; el<nel; el++) {
1059  TPZCompEl *cel = l2mesh->ElementVec()[el];
1060  if (!cel) {
1061  continue;
1062  }
1063  TPZGeoEl *gel = cel->Reference();
1064  if (!gel || gel->Dimension() != dim) {
1065  continue;
1066  }
1067  TPZManVector<REAL,10> elerror(10,0.);
1068  elerror.Fill(0.);
1069  cel->EvaluateError(SolExataH1, elerror, 0);
1070 
1071  int nerr = elerror.size();
1072  globalerrors.resize(nerr);
1073 
1074  for (int i=0; i<nerr; i++) {
1075  globalerrors[i] += elerror[i]*elerror[i];
1076  }
1077  }
1078 
1079  out << ndiv << setw(10) << DoFT << setw(20) << DofCond << setw(28) << sqrt(globalerrors[1]) << setw(35) << sqrt(globalerrors[2]) << endl;
1080 
1081 }
1082 
1083 
1084 void Hdiv2dPaper201504::ErrorPrimalDual(TPZCompMesh *l2mesh, TPZCompMesh *hdivmesh, int p, int ndiv, int pos, TPZFMatrix< REAL > &errors)
1085 {
1086  int64_t nel = hdivmesh->NElements();
1087  int dim = hdivmesh->Dimension();
1088  TPZManVector<REAL,10> globalerrorsDual(10,0.);
1089  for (int64_t el=0; el<nel; el++) {
1090  TPZCompEl *cel = hdivmesh->ElementVec()[el];
1091  if(cel->Reference()->Dimension()!=dim) continue;
1092  TPZManVector<REAL,10> elerror(10,0.);
1093  elerror.Fill(0.);
1094  cel->EvaluateError(SolExata, elerror, 0);
1095  int nerr = elerror.size();
1096  for (int i=0; i<nerr; i++) {
1097  globalerrorsDual[i] += elerror[i]*elerror[i];
1098  }
1099 
1100 
1101  }
1102 
1103 
1104  nel = l2mesh->NElements();
1105 
1106  TPZManVector<REAL,10> globalerrorsPrimal(10,0.);
1107  for (int64_t el=0; el<nel; el++) {
1108  TPZCompEl *cel = l2mesh->ElementVec()[el];
1109  TPZManVector<REAL,10> elerror(10,0.);
1110  cel->EvaluateError(SolExata, elerror, 0);
1111  int nerr = elerror.size();
1112  globalerrorsPrimal.resize(nerr);
1113 
1114  for (int i=0; i<nerr; i++) {
1115  globalerrorsPrimal[i] += elerror[i]*elerror[i];
1116  }
1117 
1118  }
1119 
1120  // sequence of storage
1121  // for each
1122  errors.PutVal(pos, 0, p); // polinomial order
1123  errors.PutVal(pos, 1, ndiv); // refinement
1124  errors.PutVal(pos, 2, sqrt(globalerrorsPrimal[1])); // pressure
1125  errors.PutVal(pos, 3, sqrt(globalerrorsDual[1])); // flux
1126 
1127 }
1128 
1129 void Hdiv2dPaper201504::ErrorPrimalDual(TPZCompMesh *l2mesh, TPZCompMesh *hdivmesh, int p, int ndiv, std::ostream &out, int DoFT, int DofCond)
1130 {
1131  int64_t nel = hdivmesh->NElements();
1132  int dim = hdivmesh->Dimension();
1133  TPZManVector<STATE,10> globalerrorsDual(10,0.);
1134  for (int64_t el=0; el<nel; el++) {
1135  TPZCompEl *cel = hdivmesh->ElementVec()[el];
1136  if(cel->Reference()->Dimension()!=dim) continue;
1137  TPZManVector<REAL,10> elerror(10,0.);
1138  elerror.Fill(0.);
1139  cel->EvaluateError(SolExata, elerror, 0);
1140  int nerr = elerror.size();
1141  for (int i=0; i<nerr; i++) {
1142  globalerrorsDual[i] += elerror[i]*elerror[i];
1143  }
1144 
1145 
1146  }
1147 
1148 
1149  nel = l2mesh->NElements();
1150 
1151  TPZManVector<STATE,10> globalerrorsPrimal(10,0.);
1152  for (int64_t el=0; el<nel; el++) {
1153  TPZCompEl *cel = l2mesh->ElementVec()[el];
1154  TPZManVector<REAL,10> elerror(10,0.);
1155  cel->EvaluateError(SolExata, elerror, 0);
1156  int nerr = elerror.size();
1157  globalerrorsPrimal.resize(nerr);
1158 
1159  for (int i=0; i<nerr; i++) {
1160  globalerrorsPrimal[i] += elerror[i]*elerror[i];
1161  }
1162 
1163  }
1164 
1165  out << ndiv << setw(10) << DoFT << setw(20) << DofCond << setw(28) << sqrt(globalerrorsPrimal[1]) << setw(35) << sqrt(globalerrorsDual[1]) << endl;
1166 
1167 }
1168 
1170 
1171  int nEl= mesh-> NElements();
1172  int dim = mesh->Dimension();
1173 
1174  int cordermin = -1;
1175  for (int iel=0; iel<nEl; iel++) {
1176  TPZCompEl *cel = mesh->ElementVec()[iel];
1177  if (!cel) continue;
1178  int ncon = cel->NConnects();
1179  int corder = 0;
1180  int nshape = 0;
1181 
1182  if(cel->Dimension()== dim){
1183  for (int icon=0; icon<ncon-1; icon++){
1184  TPZConnect &co = cel->Connect(icon);
1185  corder = co.Order();
1186  nshape = co.NShape();
1187  if(corder!=cordermin){
1188  cordermin = corder-1;
1189  co.SetOrder(cordermin,cel->ConnectIndex(icon));
1190  co.SetNShape(nshape-1);
1191  mesh->Block().Set(co.SequenceNumber(),nshape-1);
1192  }
1193  }
1194  }
1195  }
1196  mesh->ExpandSolution();
1197  mesh->CleanUpUnconnectedNodes();
1198 }
1199 
1200 
1201 
1203 {
1204  std::cout <<"Numero de equacoes "<< fCmesh->NEquations()<< std::endl;
1205 
1206  bool isdirect = true;
1207  bool simetrico = true;
1208  bool isfrontal = false;
1209  if (isdirect)
1210  {
1211  if (simetrico)
1212  {
1213  //TPZSkylineStructMatrix strmat(fCmesh);
1214  if (isfrontal) {
1216  strmat.SetDecomposeType(ELDLt);
1217 
1218  int numthreads = 1;
1219 
1220  strmat.SetNumThreads(numthreads);
1221 
1222  an.SetStructuralMatrix(strmat);
1223  }
1224  else
1225  {
1226  //TPZBandStructMatrix full(fCmesh);
1227  TPZSkylineStructMatrix skylstr(fCmesh); //caso simetrico
1228  // TPZSkylineNSymStructMatrix full(fCmesh);
1229  an.SetStructuralMatrix(skylstr);
1230  }
1231 
1232 
1233  TPZStepSolver<STATE> step;
1234  step.SetDirect(ELDLt); //caso simetrico
1235  an.SetSolver(step);
1236  an.Run();
1237  }
1238  else
1239  {
1240  TPZBandStructMatrix full(fCmesh);
1241  an.SetStructuralMatrix(full);
1242  TPZStepSolver<STATE> step;
1243  step.SetDirect(ELU);
1244  an.SetSolver(step);
1245  an.Run();
1246  }
1247 
1248  }
1249  else
1250  {
1251  TPZSkylineStructMatrix skylstr(fCmesh); //caso simetrico
1252  skylstr.SetNumThreads(10);
1253  an.SetStructuralMatrix(skylstr);
1254 
1255  TPZAutoPointer<TPZMatrix<STATE> > matbeingcopied = skylstr.Create();
1256  TPZAutoPointer<TPZMatrix<STATE> > matClone = matbeingcopied->Clone();
1257 
1258  TPZStepSolver<STATE> *precond = new TPZStepSolver<STATE>(matClone);
1259  TPZStepSolver<STATE> *Solver = new TPZStepSolver<STATE>(matbeingcopied);
1260  precond->SetReferenceMatrix(matbeingcopied);
1261  precond->SetDirect(ELDLt);
1262  Solver->SetGMRES(20, 20, *precond, 1.e-18, 0);
1263  // Solver->SetCG(10, *precond, 1.0e-10, 0);
1264  an.SetSolver(*Solver);
1265  an.Run();
1266  }
1267 
1268 
1269 
1270 }
1271 
1272 
1273 
1274 
1275 
1276 
void SolveSyst(TPZAnalysis &an, TPZCompMesh *fCmesh)
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
TPZGeoMesh * Reference() const
Returns a pointer to the geometrical mesh associated.
Definition: pzcmesh.h:209
static void ForcingBC3D(const TPZVec< REAL > &pt, TPZVec< STATE > &disp)
Material which implements a Lagrange Multiplier.
void SetPermeabilityTensor(TPZFMatrix< REAL > K, TPZFMatrix< REAL > invK)
TPZCompMesh * CMeshFlux(TPZGeoMesh *gmesh, int pOrder, int dim)
void AdjustBoundaryElements()
Will refine the elements associated with a boundary condition till there are no elements constrained ...
Definition: pzcmesh.cpp:1423
void SetAllCreateFunctionsContinuous()
Definition: pzcmesh.h:508
void IncrementElConnected()
Increment fNElConnected.
Definition: pzconnect.h:260
int Set(const int index, const int dim, const int pos=-1)
Modifies existing block dimensions or creates a new block with given index.
Definition: pzblock.cpp:104
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Definition: pzconnect.h:30
Definition: pzmatrix.h:52
void SetStructuralMatrix(TPZAutoPointer< TPZStructMatrix > strmatrix)
Set structural matrix as auto pointer for analysis.
Definition: pzanalysis.cpp:82
Implements Banded Structural Matrices. Structural Matrix.
Definition: pzbstrmatrix.h:18
int MaterialId() const
Returns the material index of the element.
Definition: pzgeoel.h:250
void ChangeExternalOrderConnects(TPZCompMesh *mesh)
virtual void EvaluateError(std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &val, TPZFMatrix< STATE > &deriv)> func, TPZVec< REAL > &errors, bool store_error)
Performs an error estimate on the elemen.
Definition: pzcompel.cpp:415
virtual int NConnects() const override
Returns the number of nodes of the element.
virtual void resize(const int64_t newsize)
Definition: pzvec.h:213
static void AddElements(TPZVec< TPZCompMesh *> &cmeshVec, TPZCompMesh *MFMesh)
Creating multiphysic elements into mphysics computational mesh. Method to add elements in the mesh mu...
void SetOrder(int order, int64_t index)
Set the order of the shapefunction associated with the connect.
Definition: pzconnect.h:168
int64_t NEquations()
This computes the number of equations associated with non-restrained nodes.
Definition: pzcmesh.cpp:721
static void ForcingH1(const TPZVec< REAL > &pt, TPZVec< STATE > &ff, TPZFMatrix< STATE > &flux)
void ErrorH1(TPZCompMesh *l2mesh, int p, int ndiv, int pos, TPZFMatrix< REAL > &errors)
Defines step solvers class. Solver.
Definition: pzmganalysis.h:17
void SetSolver(TPZMatrixSolver< STATE > &solver)
Set solver matrix.
virtual int Dimension() const =0
Dimension of the element.
static void TransferFromMultiPhysics(TPZVec< TPZCompMesh *> &cmeshVec, TPZCompMesh *MFMesh)
Transfer information from a specific mesh multiphysics for the current specific set of meshes...
void SetLagrangeMultiplier(unsigned char mult)
Set the connect as a pressure connect or not.
Definition: pzconnect.h:236
int64_t NElements() const
Number of elements of the mesh.
Definition: pzgmesh.h:129
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
Class which groups elements to characterize dense matrices.
int64_t NElements() const
Access method to query the number of elements of the vector.
TPZGeoElSide Neighbour() const
Definition: pzgeoel.h:754
virtual int NSides() const =0
Returns the number of connectivities of the element.
virtual void Divide(TPZVec< TPZGeoEl *> &pv)
Divides the element and puts the resulting elements in the vector.
Definition: pzgeoel.h:742
void PrintErrors(ApproximationSpace problem, Eltype element, TPZVec< int > POrderBeginAndEnd, TPZVec< int > ndivinterval, TPZVec< REAL > &errors, std::ostream &output)
void SetDimension(int dim)
Set Dimension.
Definition: pzgmesh.h:285
void LoadReferences()
Map this grid in the geometric grid.
Definition: pzcmesh.cpp:482
void CreateDisconnectedElements(bool create)
Determine if the mesh will be created with disconnected elements After the mesh is created...
static void AddConnects(TPZVec< TPZCompMesh *> &cmeshVec, TPZCompMesh *MFMesh)
void SetDefaultOrder(int order)
Definition: pzcmesh.h:403
Implements SkyLine Structural Matrices. Structural Matrix.
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
static void ForcingBC4D(const TPZVec< REAL > &pt, TPZVec< STATE > &disp)
unsigned char LagrangeMultiplier() const
Access method to return the indication whether the connect is associated with a pressure lagrange mul...
Definition: pzconnect.h:230
static void SolExataH1(const TPZVec< REAL > &pt, TPZVec< STATE > &solp, TPZFMatrix< STATE > &flux)
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
void SetForcingFunctionExact(TPZAutoPointer< TPZFunction< STATE > > fp)
Sets a procedure as exact solution for the problem.
Definition: TPZMaterial.h:405
TPZCompEl * Element(int64_t iel)
Definition: pzcmesh.h:185
void Resize(const int newsize)
Increase the size of the chunk vector.
Definition: pzadmchunk.h:280
sin
Definition: fadfunc.h:63
unsigned char Order() const
Access function to return the order associated with the connect.
Definition: pzconnect.h:217
TPZCreateApproximationSpace & ApproxSpace()
Definition: pzcmesh.h:498
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
Definition: pzconnect.h:158
static void SetTensorialShape(TPZCompMesh *cmesh)
Sets tensorial shape functions for all Discontinuous elements in cmesh.
Implements the sequence of actions to perform a finite element analysis. Analysis.
Definition: pzanalysis.h:32
virtual TPZMatrix< STATE > * Create()
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
virtual void SetDecomposeType(DecomposeType dectype)
Set the decomposition type.
void SetMaxNodeId(int64_t id)
Used in patch meshes.
Definition: pzgmesh.h:120
Implements a generic geometric element which is refined according to a generic refinement pattern...
Definition: pzgmesh.h:35
static void TransferFromMeshes(TPZVec< TPZCompMesh *> &cmeshVec, TPZCompMesh *MFMesh)
Transfer information from a specific set of meshes for the current mesh multiphysics.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
void SetAllCreateFunctionsDiscontinuous()
Definition: pzcmesh.h:503
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
void Run(ApproximationSpace problem, Eltype element, TPZVec< int > POrderBeginAndEnd, TPZVec< int > ndivinterval, TPZFMatrix< REAL > &errors)
virtual void ExpandSolution()
Adapt the solution vector to new block dimensions.
Definition: pzcmesh.cpp:396
virtual void SetNumThreads(int n)
void SetAllCreateFunctionsHDiv()
Definition: pzcmesh.h:523
Definition: pzmatrix.h:52
int Dimension() const
Returns the dimension of the simulation.
Definition: pzcmesh.h:148
virtual void ComputeNodElCon()
Compute the number of elements connected to each connect object.
Definition: pzcmesh.cpp:668
TPZCompMesh * CMeshMixed(TPZGeoMesh *gmesh, TPZVec< TPZCompMesh *> meshvec)
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Definition: pzgmesh.h:140
TPZCompEl * Reference() const
Return a pointer to the element referenced by the geometric element.
Definition: pzgeoel.h:750
virtual void AutoBuild(const std::set< int > *MaterialIDs)
Creates the computational elements, and the degree of freedom nodes.
Definition: pzcmesh.cpp:308
unsigned int NShape() const
Definition: pzconnect.h:151
void SetNShape(int nshape)
Set the number of shape functions associated with the connect.
Definition: pzconnect.h:205
virtual void SetReferenceMatrix(TPZAutoPointer< TPZMatrix< TVar > > matrix)
This method gives a preconditioner to share a matrix with the referring solver object.
Definition: pzsolve.h:132
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
Definition: tfadfunc.h:120
void ErrorPrimalDual(TPZCompMesh *l2mesh, TPZCompMesh *hdivmesh, int p, int ndiv, int pos, TPZFMatrix< REAL > &errors)
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
int64_t NConnects() const
Number of connects allocated including free nodes.
Definition: pzcmesh.h:163
REAL co[8][3]
Coordinates of the eight nodes.
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
Definition: pzcmesh.h:198
Class which implements an element which condenses the internal connects.
int64_t Index() const
Returns element index of the mesh fELementVec list.
Definition: pzcompel.h:821
virtual TPZConnect & Connect(int i) const
Returns a pointer to the ith node.
Definition: pzcompel.cpp:298
void SetDimModel(int dim)
Set de dimension of the domain of the problem.
Definition: pzcmesh.h:139
static void SolExata(const TPZVec< REAL > &pt, TPZVec< STATE > &solp, TPZFMatrix< STATE > &flux)
virtual void Run(std::ostream &out=std::cout)
Calls the appropriate sequence of methods to build a solution or a time stepping sequence.
Definition: pzanalysis.cpp:920
virtual int64_t ConnectIndex(int i) const =0
Returns the index of the ith connectivity of the element.
Computes the contribution over an interface between two discontinuous elements. Computational Element...
virtual int HasSubElement() const =0
Return 1 if the element has subelements.
virtual int NConnects() const =0
Returns the number of nodes of the element.
TPZGeoEl * Element() const
Definition: pzgeoelside.h:162
void BuildConnectivity()
Build the connectivity of the grid.
Definition: pzgmesh.cpp:967
TPZCompMesh * CMeshPressure(TPZGeoMesh *gmesh, int pOrder, int dim)
virtual TPZBndCond * CreateBC(TPZMaterial *reference, int id, int typ, TPZFMatrix< STATE > &val1, TPZFMatrix< STATE > &val2)
Creates an object TPZBndCond derived of TPZMaterial.
int InsertMaterialObject(TPZMaterial *mat)
Insert a material object in the datastructure.
Definition: pzcmesh.cpp:287
static void SetTotalOrderShape(TPZCompMesh *cmesh)
Set total order shape functions for all Discontinuous elements in cmesh.
DESCRIBE PLEASE.
Definition: pzpoisson3d.h:26
virtual void CleanUpUnconnectedNodes()
Delete the nodes which have no elements connected to them.
Definition: pzcmesh.cpp:498
virtual int Dimension() const =0
Returns the dimension of the element.
int Dimension()
Get Dimension.
Definition: pzgmesh.h:291
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
This class implements a stack object. Utility.
Definition: pzcheckmesh.h:14
void SetForcingFunction(TPZAutoPointer< TPZFunction< STATE > > fp)
Sets a procedure as source function for the material.
Definition: TPZMaterial.h:368
void SetPolynomialOrder(int porder)
Definition: pzfunction.h:226
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
static void ForcingBC2D(const TPZVec< REAL > &pt, TPZVec< STATE > &disp)
static void Forcing(const TPZVec< REAL > &pt, TPZVec< STATE > &ff)
void SetConstC(REAL c)
TPZGeoMesh * GMesh(int dim, bool ftriang, int ndiv)
void Fill(const T &copy, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
Definition: pzvec.h:460
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
static void ForcingBC1D(const TPZVec< REAL > &pt, TPZVec< STATE > &disp)
void SetCenterPoint(int i, REAL x)
TPZCompMesh * CMeshH1(TPZGeoMesh *gmesh, int pOrder, int dim)
static void AddWrap(TPZMultiphysicsElement *mfcel, int matskeleton, TPZStack< TPZStack< TPZMultiphysicsElement *, 7 > > &ListGroupEl)
Create skeleton elements of the wrap of me.
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
Definition: pzpoisson3d.h:161
void SetDirect(const DecomposeType decomp)
void SetTrueUseQsiEta()
This class implements a discontinuous element (for use with discontinuous Galerkin). Computational Element.
Definition: TPZCompElDisc.h:35
void ResetReference()
Resets all load references in elements and nodes.
Definition: pzgmesh.cpp:197
Is a structural matrix with parallel techniques included. Structural Matrix Frontal.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
Material to solve a mixed poisson problem 3D by multiphysics simulation.
void SetAllCreateFunctionsMultiphysicElem()
Definition: pzcmesh.h:542
TPZFlopCounter cos(const TPZFlopCounter &orig)
Returns the cosine in radians and increments the counter of the Cosine.
Definition: pzreal.h:514
int PutVal(const int64_t row, const int64_t col, const TVar &value) override
Put values without bounds checking This method is faster than "Put" if DEBUG is defined.
Definition: pzfmatrix.h:548
virtual void AddElement(TPZCompEl *cel)
add an element to the element group
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
void SetGMRES(const int64_t numiterations, const int numvectors, const TPZMatrixSolver< TVar > &pre, const REAL tol, const int64_t FromCurrent)
TPZAdmChunkVector< TPZGeoEl * > & ElementVec()
Methods for handling pzlists.
Definition: pzgmesh.h:138
This class implements a reference counter mechanism to administer a dynamically allocated object...