void AdjustBoundary(TPZGeoMesh *gmesh) { int64_t nel = gmesh->NElements(); for (int64_t el = 0; el<nel; el++) { TPZGeoEl *gel = gmesh->Element(el); if (gel->Dimension() == 3 || gel->HasSubElement()) { continue; } TPZGeoElSide gelside(gel,gel->NSides()-1); TPZGeoElSide neighbour = gelside.Neighbour(); bool should_refine = false; int nsub = -1; int numneigh = 0; while (gelside != neighbour) { nsub = neighbour.Element()->NSideSubElements(neighbour.Side()); if (neighbour.Element()->HasSubElement() && nsub > 1) { should_refine = true; } numneigh++; neighbour = neighbour.Neighbour(); } if (should_refine == true) { TPZAutoPointer<TPZRefPattern> match = TPZRefPatternTools::PerfectMatchRefPattern(gel); if (!match) { DebugStop(); } gel->SetRefPattern(match); TPZStack<TPZGeoEl *> subels; gel->Divide(subels); } } }
void TPZSurface::RefineMe(int i) { int nref = i; TPZVec<TPZGeoEl *> sons; for (int iref = 0; iref < nref; iref++) { int nel = fgeometricmesh->NElements(); for (int iel = 0; iel < nel; iel++) { TPZGeoEl *gel = fgeometricmesh->ElementVec()[iel]; if (gel->HasSubElement()) { continue; } gel->Divide(sons); } } }
void GetElIndexCoarseMesh(TPZAutoPointer<TPZGeoMesh> gmesh, std::set<int64_t> &coarseindex) { int nel = gmesh->NElements(); int iel; int hassubel=0; int dim = gmesh->Dimension(); int eldim; for(iel = 0; iel<nel; iel++) { TPZGeoEl * gel = gmesh->ElementVec()[iel]; if(!gel) DebugStop(); hassubel = gel->HasSubElement(); eldim = gel->Dimension(); if(!hassubel && eldim ==dim) { coarseindex.insert(gel->Index()); } } }
void TPZDarcyAnalysis::CreateInterfaces() { fgmesh->ResetReference(); fcmeshdarcy->LoadReferences(); // Creation of interface elements int nel = fcmeshdarcy->ElementVec().NElements(); for(int el = 0; el < nel; el++) { TPZCompEl * compEl = fcmeshdarcy->ElementVec()[el]; if(!compEl) continue; TPZGeoEl * gel = compEl->Reference(); if(!gel) {continue;} if(gel->HasSubElement()) {continue;} int index = compEl ->Index(); if(compEl->Dimension() == fcmeshdarcy->Dimension()) { TPZMultiphysicsElement * InterpEl = dynamic_cast<TPZMultiphysicsElement *>(fcmeshdarcy->ElementVec()[index]); if(!InterpEl) continue; InterpEl->CreateInterfaces(); } } }
void RefineGMesh(TPZGeoMesh *gmesh) { TPZManVector<REAL,3> center(3,0.), dir(3,0.); center[1] = 170.; dir[1] = 1.; CutByPlane(gmesh, 0, center, dir); CutByPlane(gmesh, 0, center, dir); CutByPlane(gmesh, 0, center, dir); center[1] = -170.; CutByPlane(gmesh, 0, center, dir); CutByPlane(gmesh, 0, center, dir); CutByPlane(gmesh, 0, center, dir); center[1] = 0.; center[2] = -35.; dir[1] = 0; dir[2] = 1.; CutByPlane(gmesh, 0, center, dir); CutByPlane(gmesh, 0, center, dir); CutByPlane(gmesh, 0, center, dir); CutByPlane(gmesh, 0, center, dir); dir[2] = 0; dir[0] = 1.; center[2] = 0.; for (int ndiv = 2; ndiv<16; ndiv *=2) { TPZManVector<REAL> xco(ndiv,0.); REAL delta = 740./ndiv; for (int i=0; i<ndiv; i++) { xco[i] = -370.+delta/2.+i*delta; } for (int i=0; i<ndiv; i++) { center[0] = xco[i]; CutByPlane(gmesh, 0, center, dir); } } center[0] = 0.; dir[0] = 0.; center[2] = 0.; dir[2] = 0.; dir[1] = 1.; CutByPlaneAbove(gmesh, 0, center, dir, -400.); center[1] = 3.; CutByPlaneAbove(gmesh, 0, center, dir, -100.); center[1] = -3.; CutByPlaneAbove(gmesh, 0, center, dir, -100.); PutEnvelope(gmesh, 6, -30., 161.); for (int pass = 0; pass <2; pass++) { int64_t nel = gmesh->NElements(); std::set<int> matids; matids.insert(6); for (int64_t el=0; el<nel; el++) { TPZGeoEl *gel = gmesh->Element(el); if (gel->HasSubElement()) { continue; } TPZRefPatternTools::RefineDirectional(gel, matids); } } }
void InsertBoundaryElements(TPZGeoMesh *gmesh) { REAL xplane = 1435; REAL yplane = 1161; REAL zplane = -1530; REAL ztop = 122.8; REAL minx = 0; REAL minz = 0; REAL maxz = 0; int64_t nel = gmesh->NElements(); for (int64_t el=0; el<nel; el++) { TPZGeoEl *gel = gmesh->Element(el); if (gel->HasSubElement()) { continue; } int nsides = gel->NSides(); for (int is=0; is<nsides; is++) { int bccreated = 999; TPZGeoElSide gelside(gel,is); if (gel->SideDimension(is) == 1) { TPZManVector<REAL,3> xcenter(3); gelside.CenterX(xcenter); if (xcenter[2] > maxz) { maxz = xcenter[2]; } if (fabs(xcenter[0]) < 1 && fabs(xcenter[2]-ztop) < 1) { bccreated = bcloadtop; TPZGeoElSide neighbour = gelside.Neighbour(); while (neighbour != gelside) { if (neighbour.Element()->MaterialId() == bcloadtop) { bccreated = 999; } neighbour = neighbour.Neighbour(); } if (bccreated == bcloadtop) { std::cout << "Added boundary bcloadtop xcenter = " << xcenter << std::endl; } } } if (gel->SideDimension(is) == 2) { TPZManVector<REAL,3> xcenter(3); gelside.CenterX(xcenter); if (xcenter[0] < minx) { minx = xcenter[0]; } if (xcenter[2] < minz) { minz = xcenter[2]; } if (fabs(xcenter[2] - zplane) < 1.) { bccreated = bcbottom; } if (fabs(fabs(xcenter[0])-xplane) < 1) { bccreated = bcsidex; } if (fabs(fabs(xcenter[1])-yplane) < 1) { bccreated = bcsidey; } if (fabs(xcenter[2]-ztop) <1) { bccreated = bctopsurface; } } if(bccreated != 999) { if (gelside.Dimension() == 2 && gelside.Neighbour() != gelside) { DebugStop();; } gel->CreateBCGeoEl(is, bccreated); } } } std::cout << "minx = " << minx << " minz = " << minz << " maxz " << maxz << std::endl; }