109 if (POrderBeginAndEnd.
size()!=2)
111 std::cout <<
" POrderBeginAndEnd Vector must have size == 2 and contain just two values, the first and last approximation orders. " << std::endl;
112 std::cout <<
" Some like POrderBeginAndEnd[0] = 1, POrderBeginAndEnd[1] = 3 " << std::endl;
116 if (ndivinterval.
size()!=2)
118 std::cout <<
" ndivinterval Vector must have size == 2 and contain just two values, the first and last number of uniform refinements. " << std::endl;
119 std::cout <<
" Some like ndivinterval[0] = 0, ndivinterval[1] = 3 for simulations with 0, 1, 2 and 3 refinements " << std::endl;
120 std::cout <<
" Some like ndivinterval[0] = 1, ndivinterval[1] = 1 for simulations with 1 refinement " << std::endl;
124 int sizeErrorMatrix = (ndivinterval[1]-ndivinterval[0])*(POrderBeginAndEnd[1] - POrderBeginAndEnd[0]) + 1;
125 int errorposition = 0;
127 errors.
Resize(sizeErrorMatrix, 4);
129 for(
int p = POrderBeginAndEnd[0]; p <= POrderBeginAndEnd[1]; p++)
132 for (
int ndiv = ndivinterval[0]; ndiv<=ndivinterval[1]; ndiv++)
136 std::cout<<
" BEGIN - Polinomial degree: " << ordemP <<
" rerfinement size (h): " << ndiv << std::endl;
197 for (int64_t iel=0; iel<cmeshH1->
NElements(); iel++) {
210 ErrorH1(cmeshH1, ordemP, ndiv, errorposition, errors);
245 std::cout <<
"Computing Errors\n";
277 std::cout <<
"Computing Errors\n";
287 std::cout<<
" END - polinomial degree: " << ordemP <<
" refinement size (h): " << ndiv << std::endl;
294 std::cout<<
" The End " << std::endl;
301 if (POrderBeginAndEnd.
size()!=2)
303 std::cout <<
" POrderBeginAndEnd Vector must have size == 2 and contain just two values, the first and last approximation orders. " << std::endl;
304 std::cout <<
" Some like POrderBeginAndEnd[0] = 1, POrderBeginAndEnd[1] = 3 " << std::endl;
308 if (ndivinterval.
size()!=2)
310 std::cout <<
" ndivinterval Vector must have size == 2 and contain just two values, the first and last number of uniform refinements. " << std::endl;
311 std::cout <<
" Some like ndivinterval[0] = 0, ndivinterval[1] = 3 for simulations with 0, 1, 2 and 3 refinements " << std::endl;
312 std::cout <<
" Some like ndivinterval[0] = 1, ndivinterval[1] = 1 for simulations with 1 refinement " << std::endl;
316 for(
int p = POrderBeginAndEnd[0]; p <= POrderBeginAndEnd[1]; p++)
318 output <<
"\n WHEN p = " << p <<
" \n " << endl;
319 output <<
"ndiv " << setw(6) <<
"DoFTot" << setw(20) <<
"DofCond" << setw(28) <<
"PrimalL2Error" << setw(35) <<
"L2DualError" << endl;
321 for (
int ndiv = ndivinterval[0]; ndiv<=ndivinterval[1]; ndiv++)
325 std::cout<<
" BEGIN (Quadrilateral Domain) - Polinomial degree: " << ordemP <<
" rerfinement size (h): " << ndiv << std::endl;
375 for (int64_t iel=0; iel<cmeshH1->
NElements(); iel++) {
390 ErrorH1(cmeshH1, ordemP, ndiv, output, dofTotal, dofCondensed);
429 std::cout <<
"Computing Errors\n";
468 std::cout <<
"Computing Errors\n";
481 output <<
"\n ----------------------------------------------------------------------------- " << endl;
482 std::cout<<
" END (Quadrilateral Domain) - Polinomial degree: " << p << std::endl;
486 std::cout<<
" The End " << std::endl;
503 REAL innerradius = radius/2.0;
519 for (
int inode = 0; inode < 8 ; inode++) {
522 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
523 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
527 for (
int inode = 0; inode < 8 ; inode++) {
530 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
531 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
535 for (
int inode = 0; inode < 4 ; inode++) {
538 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
539 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
543 for (
int inode = 0; inode < 4 ; inode++) {
546 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
547 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
553 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
554 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
561 TopolQuadrilateral[0] = 0;
562 TopolQuadrilateral[1] = 8;
563 TopolQuadrilateral[2] = 10;
564 TopolQuadrilateral[3] = 2;
568 TopolQuadrilateral[0] = 2;
569 TopolQuadrilateral[1] = 10;
570 TopolQuadrilateral[2] = 12;
571 TopolQuadrilateral[3] = 4;
575 TopolQuadrilateral[0] = 4;
576 TopolQuadrilateral[1] = 12;
577 TopolQuadrilateral[2] = 14;
578 TopolQuadrilateral[3] = 6;
583 TopolQuadrilateral[0] = 6;
584 TopolQuadrilateral[1] = 14;
585 TopolQuadrilateral[2] = 8;
586 TopolQuadrilateral[3] = 0;
594 TopolQTriangle[0] = 0;
595 TopolQTriangle[1] = 2;
596 TopolQTriangle[2] = 24;
597 TopolQTriangle[3] = 1;
598 TopolQTriangle[4] = 17;
599 TopolQTriangle[5] = 16;
603 TopolQTriangle[0] = 2;
604 TopolQTriangle[1] = 4;
605 TopolQTriangle[2] = 24;
606 TopolQTriangle[3] = 3;
607 TopolQTriangle[4] = 18;
608 TopolQTriangle[5] = 17;
612 TopolQTriangle[0] = 4;
613 TopolQTriangle[1] = 6;
614 TopolQTriangle[2] = 24;
615 TopolQTriangle[3] = 5;
616 TopolQTriangle[4] = 19;
617 TopolQTriangle[5] = 18;
621 TopolQTriangle[0] = 6;
622 TopolQTriangle[1] = 0;
623 TopolQTriangle[2] = 24;
624 TopolQTriangle[3] = 7;
625 TopolQTriangle[4] = 16;
626 TopolQTriangle[5] = 19;
664 for (
int iref = 0; iref < nref; iref++) {
666 for (
int iel = 0; iel < nel; iel++) {
676 std::ofstream out(
"CircleMixed.vtk");
685 xcoor[0] = radius *
cos(theta);
686 xcoor[1] = radius *
sin(theta);
712 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
713 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
717 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
718 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
722 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
723 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
727 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
728 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
733 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
734 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
738 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
739 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
743 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
744 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
748 geomesh->
NodeVec()[nodeindex].SetCoord(coord);
749 geomesh->
NodeVec()[nodeindex].SetNodeId(nodeindex);
761 quad1->
Geom().SetData(radius, xc);
769 quad2->
Geom().SetData(radius, xc);
777 quad3->
Geom().SetData(radius, xc);
785 quad4->
Geom().SetData(radius, xc);
793 quad5->
Geom().SetData(radius, xc);
801 quad6->
Geom().SetData(radius, xc);
830 const int nref = ndiv;
831 for (
int iref = 0; iref < nref; iref++) {
833 for (
int iel = 0; iel < nel; iel++) {
861 REAL theta = (M_PI/180.0)*CounterClockwiseAngle;
909 int NumberofGeoNodes = gmesh->
NNodes();
910 for (
int inode = 0; inode < NumberofGeoNodes; inode++)
919 gmesh->
NodeVec()[inode] = GeoNode;
929 xcoor[0] = radius *
cos(theta) *
sin(phi);
930 xcoor[1] = radius *
sin(theta) *
sin(phi);
931 xcoor[2] = radius *
cos(phi) ;
961 coord[0] = r*
cos(theta0);
962 coord[1] = r*
sin(theta0);
966 gmesh->
NodeVec()[id].SetNodeId(
id);
967 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
968 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
969 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
973 coord[0] = r*
cos(theta1);
974 coord[1] = r*
sin(theta1);
978 gmesh->
NodeVec()[id].SetNodeId(
id);
979 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
980 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
981 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
985 coord[0] = r*
cos(theta1);
986 coord[1] = r*
sin(theta1);
990 gmesh->
NodeVec()[id].SetNodeId(
id);
991 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
992 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
993 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
997 coord[0] = r*
cos(theta0);
998 coord[1] = r*
sin(theta0);
1002 gmesh->
NodeVec()[id].SetNodeId(
id);
1003 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
1004 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
1005 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
1009 coord[0] = r*
cos(M_PI/4.0);
1010 coord[1] = r*
sin(M_PI/4.0);
1014 gmesh->
NodeVec()[id].SetNodeId(
id);
1015 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
1016 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
1017 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
1021 coord[0] = r*
cos(M_PI/2.0);
1022 coord[1] = r*
sin(M_PI/2.0);
1026 gmesh->
NodeVec()[id].SetNodeId(
id);
1027 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
1028 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
1029 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
1033 coord[0] = r*
cos(3.0*M_PI/4.0);
1034 coord[1] = r*
sin(3.0*M_PI/4.0);
1038 gmesh->
NodeVec()[id].SetNodeId(
id);
1039 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
1040 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
1041 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
1045 coord[0] = r*
cos(M_PI/4.0);
1046 coord[1] = r*
sin(M_PI/4.0);
1050 gmesh->
NodeVec()[id].SetNodeId(
id);
1051 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
1052 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
1053 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
1057 coord[0] = r*
cos(M_PI/2.0);
1058 coord[1] = r*
sin(M_PI/2.0);
1062 gmesh->
NodeVec()[id].SetNodeId(
id);
1063 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
1064 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
1065 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
1069 coord[0] = r*
cos(3.0*M_PI/4.0);
1070 coord[1] = r*
sin(3.0*M_PI/4.0);
1074 gmesh->
NodeVec()[id].SetNodeId(
id);
1075 gmesh->
NodeVec()[id].SetCoord(0,coord[0]);
1076 gmesh->
NodeVec()[id].SetCoord(1,coord[1]);
1077 gmesh->
NodeVec()[id].SetCoord(2,coord[2]);
1094 nodeindex.resize(3);
1109 nodeindex.resize(2);
1116 nodeindex.resize(3);
1132 nodeindex.resize(4);
1156 const int nref = ndiv;
1157 for (
int iref = 0; iref < nref; iref++) {
1159 for (
int iel = 0; iel < nel; iel++) {
1174 REAL theta = (M_PI/180.0)*CounterClockwiseAngle;
1222 iCoords = iCoordsRotated;
1246 REAL r =
sqrt(x*x+y*y+z*z);
1247 REAL theta =
atan2(y,x);
1249 REAL costheta =
cos(theta);
1250 REAL sintheta =
sin(theta);
1251 REAL cos2theta =
cos(2.0*theta);
1252 REAL sin2theta =
sin(2.0*theta);
1257 solp[0] = r4*cos2theta*sin2theta;
1261 REAL Runitx = costheta;
1262 REAL Runity = sintheta;
1265 REAL Thetaunitx = -sintheta;
1266 REAL Thetaunity = costheta;
1267 REAL Thetaunitz = 0.0;
1273 REAL dfdR = 4.0*r*r*r*cos2theta*sin2theta;
1274 REAL dfdTheta = (1.0)*(2.0*r*r*r*(cos2theta*cos2theta-sin2theta*sin2theta));
1277 flux(0,0) = -1.0*(dfdR * Runitx + dfdTheta * Thetaunitx + dfdZ * Zunitx);
1278 flux(1,0) = -1.0*(dfdR * Runity + dfdTheta * Thetaunity + dfdZ * Zunity);
1279 flux(2,0) = -1.0*(dfdR * Runitz + dfdTheta * Thetaunitz + dfdZ * Zunitz);
1285 REAL r =
sqrt(x*x+y*y);
1286 REAL theta =
atan2(y,x);
1288 solp[0] =
sin(theta)*
sin(z + M_PI/2.0);
1289 flux(0,0) = -((
cos(theta)*
cos(z)*
sin(theta))/r);
1290 flux(1,0) = (
cos(theta)*
cos(theta)*
cos(z))/r;
1291 flux(2,0) = -
sin(theta)*
sin(z);
1300 REAL r =
sqrt(x*x+y*y+z*z);
1301 REAL theta =
acos(z/r);
1302 REAL phi =
atan2(y,x);
1304 REAL costheta =
cos(theta);
1305 REAL sintheta =
sin(theta);
1310 REAL sinphi =
sin(phi);
1311 REAL cosphi =
cos(phi);
1312 REAL sin2phi =
sin(2.0*phi);
1314 REAL oneminuscosphicosphi = (1.0-cosphi*cosphi);
1316 REAL npowerofsintheta = 1.0;
1318 for (
int i = 1; i <
norder ; i++)
1320 npowerofsintheta *= sintheta;
1323 solp[0] = npowerofsintheta*sintheta*oneminuscosphicosphi;
1326 REAL Thetaunitx = cosphi*costheta;
1327 REAL Thetaunity = costheta*sinphi;
1328 REAL Thetaunitz = -sintheta;
1330 REAL Phiunitx = -sinphi;
1331 REAL Phiunity = cosphi;
1332 REAL Phiunitz = 0.0;
1334 REAL dfdTheta = (REAL(norder)/r)*costheta*npowerofsintheta*sinphi*sinphi;
1335 REAL dfdPhi = (1.0/r)*npowerofsintheta*sin2phi;
1337 flux(0,0) = -1.0*(dfdTheta * Thetaunitx + dfdPhi * Phiunitx);
1338 flux(1,0) = -1.0*(dfdTheta * Thetaunity + dfdPhi * Phiunity);
1339 flux(2,0) = -1.0*(dfdTheta * Thetaunitz + dfdPhi * Phiunitz);
1343 std::cout <<
" Something is wrong " << std::endl;
1367 REAL r =
sqrt(x*x+y*y);
1368 REAL theta =
atan2(y,x);
1369 ff[0] = ((1.0 + r*r)*
cos(z)*
sin(theta))/(r*r);
1375 REAL r =
sqrt(x*x+y*y+z*z);
1376 REAL theta =
acos(z/r);
1377 REAL phi =
atan2(y,x);
1379 REAL sintheta =
sin(theta);
1380 REAL sinphi =
sin(phi);
1381 REAL cosphi =
cos(phi);
1382 REAL costheta =
cos(theta);
1384 REAL npowerofsintheta = 1.0;
1385 for (
int i = 1; i <
norder - 1; i++)
1387 npowerofsintheta *= sintheta;
1390 ff[0] = -(npowerofsintheta/r*r)*(- REAL(norder) * sintheta*sintheta + cosphi*cosphi*(2.0 + REAL(norder)*sintheta*sintheta)
1391 + (-2.0 + REAL(norder)*REAL(norder)*costheta*costheta)*sinphi*sinphi);
1395 std::cout <<
" Something is wrong " << std::endl;
1425 std::cout <<
" Something is wrong " << std::endl;
1452 std::cout <<
" Something is wrong " << std::endl;
1473 REAL r =
sqrt(x*x+y*y+z*z);
1474 REAL theta =
atan2(y,x);
1476 REAL cos2theta =
cos(2.0*theta);
1477 REAL sin2theta =
sin(2.0*theta);
1480 solp[0] = r4*cos2theta*sin2theta;
1487 REAL theta =
atan2(y,x);
1489 solp[0] =
sin(theta)*
sin(z + M_PI/2.0);
1500 solp[0] = (a-theta)*
sin(theta)*
sin(theta);
1504 std::cout <<
" Something is wrong " << std::endl;
1525 REAL r =
sqrt(x*x+y*y+z*z);
1526 REAL theta =
atan2(y,x);
1528 REAL cos2theta =
cos(2.0*theta);
1529 REAL sin2theta =
sin(2.0*theta);
1532 solp[0] = r4*cos2theta*sin2theta;
1539 REAL theta =
atan2(y,x);
1541 solp[0] =
sin(theta)*
sin(z + M_PI/2.0);
1552 solp[0] = (a-theta)*
sin(theta)*
sin(theta);
1556 std::cout <<
" Something is wrong " << std::endl;
1578 REAL r =
sqrt(x*x+y*y+z*z);
1579 REAL theta =
atan2(y,x);
1581 REAL cos2theta =
cos(2.0*theta);
1582 REAL sin2theta =
sin(2.0*theta);
1585 solp[0] = r4*cos2theta*sin2theta;
1592 REAL theta =
atan2(y,x);
1594 solp[0] =
sin(theta)*
sin(z + M_PI/2.0);
1605 solp[0] = (a-theta)*
sin(theta)*
sin(theta);
1609 std::cout <<
" Something is wrong " << std::endl;
1631 REAL r =
sqrt(x*x+y*y+z*z);
1632 REAL theta =
atan2(y,x);
1634 REAL cos2theta =
cos(2.0*theta);
1635 REAL sin2theta =
sin(2.0*theta);
1638 solp[0] = r4*cos2theta*sin2theta;
1644 REAL theta =
atan2(y,x);
1646 solp[0] =
sin(theta)*
sin(z + M_PI/2.0);
1656 solp[0] = (a-theta)*
sin(theta)*
sin(theta);
1660 std::cout <<
" Something is wrong " << std::endl;
1673 REAL r =
sqrt(x*x+y*y+z*z);
1674 REAL theta =
acos(z/r);
1675 REAL phi =
atan2(y,x);
1678 REAL sintheta =
sin(theta);
1682 REAL cosphi =
cos(phi);
1685 REAL oneminuscosphicosphi = (1.0-cosphi*cosphi);
1687 REAL npowerofsintheta = 1.0;
1689 for (
int i = 1; i <
norder ; i++)
1691 npowerofsintheta *= sintheta;
1694 solp[0] = npowerofsintheta*sintheta*oneminuscosphicosphi;
1888 std::cout <<
" Something is wrong " << std::endl;
1899 for (int64_t icel = 0; icel < ncels; icel++) {
1921 gelside.EqualLevelCompElementList(celstack, 1, 0);
1923 int64_t sz = celstack.
size();
1928 for (int64_t iside=0; iside < sz; iside++) {
1935 if(nsideconnects != 1 )
1977 bool h1function =
true;
1991 for(
int i=0; i<ncon; i++)
2002 for(
int i=0; i<nel; i++){
2023 for(
int i =0; i<ncel; i++){
2025 if(!compEl)
continue;
2056 bool h1function =
true;
2071 for(
int i=0; i<ncon; i++)
2082 for(
int i=0; i<nel; i++){
2103 for(
int i =0; i<ncel; i++){
2105 if(!compEl)
continue;
2131 bool h1function =
true;
2146 for(
int i=0; i<ncon; i++)
2157 for(
int i=0; i<nel; i++){
2182 std::cout <<
" Something is wrong " << std::endl;
2217 for (
int id = 0;
id < dim;
id++){
2223 InvPermTensor = InvTP;
2260 BCond1->SetForcingFunction(FBCond1);
2288 for(
int el = 0; el < nel; el++)
2291 if(!compEl)
continue;
2292 int index = compEl ->
Index();
2296 if(!InterpEl)
continue;
2307 bool condensacaoestatica =
true;
2328 for (
int id = 0;
id < 3;
id++){
2334 InvPermTensor = InvTP;
2370 BCond1->SetForcingFunction(FBCond1);
2377 BCond2->SetForcingFunction(FBCond2);
2386 BCond3->SetForcingFunction(FBCond3);
2393 BCond4->SetForcingFunction(FBCond4);
2412 if (condensacaoestatica)
2421 std::map<int64_t, int64_t> bctoel, eltowrap;
2422 for (int64_t el=0; el<nel; el++) {
2429 while (neighbour != gelside) {
2430 if (neighbour.Element()->Dimension() == dim && neighbour.Element()->Reference()) {
2435 neighbour = neighbour.Neighbour();
2437 if (neighbour == gelside) {
2444 for(int64_t el = 0; el < nel; el++)
2450 for (int64_t el =0; el < wrapEl.
size(); el++) {
2452 int64_t index = cel->
Index();
2453 eltowrap[index] = el;
2456 meshvec[0]->CleanUpUnconnectedNodes();
2460 std::map<int64_t, int64_t>::iterator it;
2461 for (it = bctoel.begin(); it != bctoel.end(); it++) {
2462 int64_t bcindex = it->first;
2463 int64_t elindex = it->second;
2464 if (eltowrap.find(elindex) == eltowrap.end()) {
2467 int64_t wrapindex = eltowrap[elindex];
2473 wrapEl[wrapindex].
Push(bcmf);
2478 int64_t index, nenvel;
2481 for(int64_t ienv=0; ienv<nenvel; ienv++){
2483 elgroups.
Push(elgr);
2485 for(
int jel=0; jel<nel; jel++){
2493 for (int64_t ienv=0; ienv<nenvel; ienv++) {
2496 for (
int ic=0; ic<nc; ic++) {
2525 for(
int el = 0; el < nel; el++)
2531 meshvec[0]->CleanUpUnconnectedNodes();
2553 bool condensacaoestatica =
true;
2571 for (
int id = 0;
id < 3;
id++){
2572 PermTensor(
id,
id) = 1.0;
2573 InvPermTensor(
id,
id) = 1.0;
2628 if (condensacaoestatica)
2637 std::map<int64_t, int64_t> bctoel, eltowrap;
2638 for (int64_t el=0; el<nel; el++) {
2645 while (neighbour != gelside) {
2646 if (neighbour.Element()->Dimension() == dim && neighbour.Element()->Reference()) {
2651 neighbour = neighbour.Neighbour();
2653 if (neighbour == gelside) {
2660 for(int64_t el = 0; el < nel; el++)
2666 for (int64_t el =0; el < wrapEl.
size(); el++) {
2668 int64_t index = cel->
Index();
2669 eltowrap[index] = el;
2672 meshvec[0]->CleanUpUnconnectedNodes();
2676 std::map<int64_t, int64_t>::iterator it;
2677 for (it = bctoel.begin(); it != bctoel.end(); it++) {
2678 int64_t bcindex = it->first;
2679 int64_t elindex = it->second;
2680 if (eltowrap.find(elindex) == eltowrap.end()) {
2683 int64_t wrapindex = eltowrap[elindex];
2689 wrapEl[wrapindex].
Push(bcmf);
2694 int64_t index, nenvel;
2697 for(int64_t ienv=0; ienv<nenvel; ienv++){
2699 elgroups.
Push(elgr);
2701 for(
int jel=0; jel<nel; jel++){
2709 for (int64_t ienv=0; ienv<nenvel; ienv++) {
2712 for (
int ic=0; ic<nc; ic++) {
2734 for(
int el = 0; el < nel; el++)
2740 meshvec[0]->CleanUpUnconnectedNodes();
2756 std::cout <<
" Something is wrong " << std::endl;
2770 for (int64_t el=0; el<nel; el++) {
2783 int nerr = elerror.
size();
2784 globalerrors.
resize(nerr);
2786 for (
int i=0; i<nerr; i++) {
2787 globalerrors[i] += elerror[i]*elerror[i];
2792 errors.
PutVal(pos, 0, p);
2793 errors.
PutVal(pos, 1, ndiv);
2794 errors.
PutVal(pos, 2,
sqrt(globalerrors[1]));
2795 errors.
PutVal(pos, 3,
sqrt(globalerrors[2]));
2805 for (int64_t el=0; el<nel; el++) {
2818 int nerr = elerror.
size();
2819 globalerrors.
resize(nerr);
2821 for (
int i=0; i<nerr; i++) {
2822 globalerrors[i] += elerror[i]*elerror[i];
2826 out << ndiv << setw(10) << DoFT << setw(20) << DofCond << setw(28) <<
sqrt(globalerrors[1]) << setw(35) <<
sqrt(globalerrors[2]) << endl;
2836 for (int64_t el=0; el<nel; el++) {
2842 int nerr = elerror.
size();
2843 for (
int i=0; i<nerr; i++) {
2844 globalerrorsDual[i] += elerror[i]*elerror[i];
2854 for (int64_t el=0; el<nel; el++) {
2858 int nerr = elerror.
size();
2859 globalerrorsPrimal.
resize(nerr);
2861 for (
int i=0; i<nerr; i++) {
2862 globalerrorsPrimal[i] += elerror[i]*elerror[i];
2869 errors.
PutVal(pos, 0, p);
2870 errors.
PutVal(pos, 1, ndiv);
2871 errors.
PutVal(pos, 2,
sqrt(globalerrorsPrimal[1]));
2872 errors.
PutVal(pos, 3,
sqrt(globalerrorsDual[1]));
2881 for (int64_t el=0; el<nel; el++) {
2887 int nerr = elerror.
size();
2888 for (
int i=0; i<nerr; i++) {
2889 globalerrorsDual[i] += elerror[i]*elerror[i];
2899 for (int64_t el=0; el<nel; el++) {
2903 int nerr = elerror.
size();
2904 globalerrorsPrimal.
resize(nerr);
2906 for (
int i=0; i<nerr; i++) {
2907 globalerrorsPrimal[i] += elerror[i]*elerror[i];
2912 out << ndiv << setw(10) << DoFT << setw(20) << DofCond << setw(28) <<
sqrt(globalerrorsPrimal[1]) << setw(35) <<
sqrt(globalerrorsDual[1]) << endl;
2918 int nEl= mesh-> NElements();
2922 for (
int iel=0; iel<nEl; iel++) {
2930 for (
int icon=0; icon<ncon-1; icon++){
2932 corder = co.
Order();
2934 if(corder!=cordermin){
2935 cordermin = corder-1;
2951 std::cout <<
"Numero de equacoes "<< fCmesh->
NEquations()<< std::endl;
2953 bool isdirect =
true;
2954 bool simetrico =
true;
2955 bool isfrontal =
false;
3009 Solver->
SetGMRES(20, 20, *precond, 1.e-18, 0);
void RotationMatrix(TPZFMatrix< REAL > &R, REAL thetaRad, int axis)
int64_t NElements() const
Number of computational elements allocated.
TPZGeoMesh * Reference() const
Returns a pointer to the geometrical mesh associated.
static bool probAtCylinder
~hdivCurvedJCompAppMath()
static void ForcingBC2D(const TPZVec< REAL > &pt, TPZVec< STATE > &disp)
TPZFlopCounter atan2(const TPZFlopCounter &val1, const TPZFlopCounter &val2)
Returns the arc tangent in radians and increments the counter of the Arc Tangent. ATAN2 returns the ...
Material which implements a Lagrange Multiplier.
void SetPermeabilityTensor(TPZFMatrix< REAL > K, TPZFMatrix< REAL > invK)
void AdjustBoundaryElements()
Will refine the elements associated with a boundary condition till there are no elements constrained ...
void SetCoord(const TPZVec< REAL > &x)
Sets all coordinates into the current node. It gets the dim values from x.
void SetAllCreateFunctionsContinuous()
TPZManVector< REAL, 3 > ParametricSphere(REAL radius, REAL phi, REAL theta)
void IncrementElConnected()
Increment fNElConnected.
Implements computational element and a side. Computational Element.
int Set(const int index, const int dim, const int pos=-1)
Modifies existing block dimensions or creates a new block with given index.
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
void SetStructuralMatrix(TPZAutoPointer< TPZStructMatrix > strmatrix)
Set structural matrix as auto pointer for analysis.
Implements a vector class which allows to use external storage provided by the user. Utility.
Implements Banded Structural Matrices. Structural Matrix.
TPZCompMesh * CMeshFlux(TPZGeoMesh *gmesh, int pOrder, int dim)
virtual void SetConnectIndex(int inode, int64_t index)=0
Set the index i to node inode.
int MaterialId() const
Returns the material index of the element.
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.
virtual int NConnects() const override
Returns the number of nodes of the element.
virtual void resize(const int64_t newsize)
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.
int64_t NEquations()
This computes the number of equations associated with non-restrained nodes.
virtual int64_t AllocateNewConnect(int nshape, int nstate, int order)
Returns an index to a new connect.
Defines step solvers class. Solver.
void SetSolver(TPZMatrixSolver< STATE > &solver)
Set solver matrix.
virtual int Dimension() const =0
Dimension of the element.
TPZGeoMesh * MakeCircle(int ndiv)
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.
int64_t NElements() const
Number of elements of the mesh.
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Class which groups elements to characterize dense matrices.
void ErrorPrimalDual(TPZCompMesh *l2mesh, TPZCompMesh *hdivmesh, int p, int ndiv, int pos, TPZFMatrix< REAL > &errors)
static void SolExataH1(const TPZVec< REAL > &pt, TPZVec< STATE > &solp, TPZFMatrix< STATE > &flux)
void ErrorH1(TPZCompMesh *l2mesh, int p, int ndiv, int pos, TPZFMatrix< REAL > &errors)
int64_t NElements() const
Access method to query the number of elements of the vector.
TPZGeoElSide Neighbour() const
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.
static void ForcingBC4D(const TPZVec< REAL > &pt, TPZVec< STATE > &disp)
void SetDimension(int dim)
Set Dimension.
void LoadReferences()
Map this grid in the geometric grid.
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)
Implements SkyLine Structural Matrices. Structural Matrix.
This abstract class defines the behaviour which each derived class needs to implement.
void PrintErrors(geomDomain geodomain, ApproximationSpace problem, Eltype element, TPZVec< int > POrderBeginAndEnd, TPZVec< int > ndivinterval, TPZVec< REAL > &errors, std::ostream &output)
unsigned char LagrangeMultiplier() const
Access method to return the indication whether the connect is associated with a pressure lagrange mul...
int64_t size() const
Returns the number of elements of the vector.
void SetForcingFunctionExact(TPZAutoPointer< TPZFunction< STATE > > fp)
Sets a procedure as exact solution for the problem.
expr_ expr_ expr_ expr_ acos
TPZCompEl * Element(int64_t iel)
void Resize(const int newsize)
Increase the size of the chunk vector.
unsigned char Order() const
Access function to return the order associated with the connect.
TPZCreateApproximationSpace & ApproxSpace()
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
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.
virtual TPZMatrix< STATE > * Create()
void Push(const T object)
Pushes a copy of the object on the stack.
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.
static void ForcingH1(const TPZVec< REAL > &pt, TPZVec< STATE > &ff, TPZFMatrix< STATE > &flux)
Implements a generic geometric element which is refined according to a generic refinement pattern...
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...
virtual int NSideConnects(int iside) const =0
Returns the number of dof nodes along side iside.
void SetAllCreateFunctionsDiscontinuous()
#define DebugStop()
Returns a message to user put a breakpoint in.
void RotateGeomesh(TPZGeoMesh *gmesh, REAL CounterClockwiseAngle, int &Axis)
int64_t NNodes() const
Number of nodes of the mesh.
virtual void ExpandSolution()
Adapt the solution vector to new block dimensions.
virtual void SetNumThreads(int n)
TPZCompMesh * CMeshMixed(TPZGeoMesh *gmesh, TPZVec< TPZCompMesh *> meshvec)
void SetAllCreateFunctionsHDiv()
int Dimension() const
Returns the dimension of the simulation.
virtual void ComputeNodElCon()
Compute the number of elements connected to each connect object.
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
TPZCompEl * Reference() const
Return a pointer to the element referenced by the geometric element.
virtual void AutoBuild(const std::set< int > *MaterialIDs)
Creates the computational elements, and the degree of freedom nodes.
unsigned int NShape() const
TPZManVector< REAL, 3 > ParametricCircle(REAL radius, REAL theta)
void SetNShape(int nshape)
Set the number of shape functions associated with the connect.
virtual void SetReferenceMatrix(TPZAutoPointer< TPZMatrix< TVar > > matrix)
This method gives a preconditioner to share a matrix with the referring solver object.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
TPZCompMesh * CMeshH1(TPZGeoMesh *gmesh, int pOrder, int dim)
void SolveSyst(TPZAnalysis &an, TPZCompMesh *fCmesh)
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
int64_t NConnects() const
Number of connects allocated including free nodes.
REAL co[8][3]
Coordinates of the eight nodes.
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
Class which implements an element which condenses the internal connects.
int64_t Index() const
Returns element index of the mesh fELementVec list.
static void PrintGMeshVTK(TPZGeoMesh *gmesh, std::ofstream &file, bool matColor=true)
Default constructor for graphical mesh with VTK format.
static void Forcing(const TPZVec< REAL > &pt, TPZVec< STATE > &ff)
virtual TPZConnect & Connect(int i) const
Returns a pointer to the ith node.
void SetDimModel(int dim)
Set de dimension of the domain of the problem.
virtual void Run(std::ostream &out=std::cout)
Calls the appropriate sequence of methods to build a solution or a time stepping sequence.
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.
static void ForcingBC3D(const TPZVec< REAL > &pt, TPZVec< STATE > &disp)
void Run(geomDomain geodomain, ApproximationSpace problem, Eltype element, TPZVec< int > POrderBeginAndEnd, TPZVec< int > ndivinterval, TPZFMatrix< REAL > &errors)
static REAL angle
Angle in radians to test.
Implements the interfaces for TPZCompElDisc, TPZInterfaceElement and TPZInterpolatedElement. Computational element.
void SetupDisconnectedHdivboud(const int left, const int rigth, TPZCompMesh *cmesh)
TPZGeoMesh * GMeshCilindricalMesh(int ndiv)
virtual int NConnects() const =0
Returns the number of nodes of the element.
static void ForcingBC1D(const TPZVec< REAL > &pt, TPZVec< STATE > &disp)
TPZGeoEl * Element() const
TPZGeoMesh * MakeSphereFromQuadrilateral(int dimensao, bool triang, int ndiv)
void BuildConnectivity()
Build the connectivity of the grid.
virtual TPZBndCond * CreateBC(TPZMaterial *reference, int id, int typ, TPZFMatrix< STATE > &val1, TPZFMatrix< STATE > &val2)
Creates an object TPZBndCond derived of TPZMaterial.
virtual void SetSideOrient(int side, int sideorient)
It set the normal orientation of the element by the side. Only side that has dimension equal to my di...
int InsertMaterialObject(TPZMaterial *mat)
Insert a material object in the datastructure.
static void SetTotalOrderShape(TPZCompMesh *cmesh)
Set total order shape functions for all Discontinuous elements in cmesh.
virtual int SideConnectLocId(int icon, int is) const =0
Returns the local node number of icon along is.
virtual void CleanUpUnconnectedNodes()
Delete the nodes which have no elements connected to them.
virtual int Dimension() const =0
Returns the dimension of the element.
TPZCompEl * Element() const
Gives a pointer to the reference computational element.
int Dimension()
Get Dimension.
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Implements a geometric node in the pz environment. Geometry.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ atan
This class implements a geometric mesh for the pz environment. Geometry.
void SetForcingFunction(TPZAutoPointer< TPZFunction< STATE > > fp)
Sets a procedure as source function for the material.
void SetPolynomialOrder(int porder)
Implements computational mesh. Computational Mesh.
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
void Fill(const T ©, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
int Side() const
Returns the side index.
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
int64_t NElements() const
Returns the number of elements of the vector.
static void SolExata(const TPZVec< REAL > &pt, TPZVec< STATE > &solp, TPZFMatrix< STATE > &flux)
void ChangeExternalOrderConnects(TPZCompMesh *mesh)
void SetCenterPoint(int i, REAL x)
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.
void SetDirect(const DecomposeType decomp)
This class implements a discontinuous element (for use with discontinuous Galerkin). Computational Element.
void GetCoordinates(TPZVec< REAL > &co)
Fill the coordinates of the node.
static void ForcingBC5D(const TPZVec< REAL > &pt, TPZVec< STATE > &solp)
void ResetReference()
Resets all load references in elements and nodes.
Is a structural matrix with parallel techniques included. Structural Matrix Frontal.
TPZCompMesh * CMeshPressure(TPZGeoMesh *gmesh, int pOrder, int dim)
Defines the interface of a computational element. Computational Element.
Material to solve a mixed poisson problem 3D by multiphysics simulation.
void SetAllCreateFunctionsMultiphysicElem()
TPZFlopCounter cos(const TPZFlopCounter &orig)
Returns the cosine in radians and increments the counter of the Cosine.
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.
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...
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.
void RotateNode(TPZVec< REAL > &iCoords, REAL CounterClockwiseAngle, int &Axis)
This class implements a reference counter mechanism to administer a dynamically allocated object...