/** * @brief transform in low order Raviar Tomas */ void TPZCreateApproximationSpace::UndoMakeRaviartTomas(TPZCompMesh &cmesh) { int numcell = cmesh.NElements(); int el; for (el = 0; el<numcell ; el++) { TPZCompEl *cel = cmesh.ElementVec()[el]; TPZInterpolatedElement *intel = dynamic_cast<TPZInterpolatedElement *>(cel); if (!intel) { continue; } TPZGeoEl *gel = intel->Reference(); int geldim = gel->Dimension(); int is; int nsides = gel->NSides(); for (is=0; is<nsides; is++) { if (gel->SideDimension(is) != geldim-1) { continue; } int nsconnects = intel->NSideConnects(is); // only interested in HDiv elements if (nsconnects != 1) { continue; } // int cindex = intel->SideConnectIndex(0, is); TPZConnect &c = intel->Connect(intel->SideConnectLocId(0,is)); if (c.HasDependency()) { c.RemoveDepend(); } } } cmesh.ExpandSolution(); cmesh.CleanUpUnconnectedNodes(); }
void TPZMultiphysicsElement::CreateInterfaces() { //nao verifica-se caso o elemento de contorno //eh maior em tamanho que o interface associado //caso AdjustBoundaryElement nao for aplicado //a malha eh criada consistentemente TPZGeoEl *ref = Reference(); int nsides = ref->NSides(); int InterfaceDimension = Mesh()->Dimension() - 1; int side; nsides--;//last face for(side=nsides;side>=0;side--) { if(ref->SideDimension(side) != InterfaceDimension) continue; TPZCompElSide thisside(this,side); if(this->ExistsInterface(side)) { // cout << "TPZCompElDisc::CreateInterface inconsistent: interface already exists\n"; continue; } TPZStack<TPZCompElSide> highlist; thisside.HigherLevelElementList(highlist,0,1); //a interface se cria uma vez so quando existem ambos //elementos esquerdo e direito (compu tacionais) if(!highlist.NElements()) { this->CreateInterface(side);//s�tem iguais ou grande => pode criar a interface } else { int64_t ns = highlist.NElements(); int64_t is; for(is=0; is<ns; is++) {//existem pequenos ligados ao lado atual const int higheldim = highlist[is].Reference().Dimension(); if(higheldim != InterfaceDimension) continue; // TPZCompElDisc *del = dynamic_cast<TPZCompElDisc *> (highlist[is].Element()); // if(!del) continue; TPZCompEl *del = highlist[is].Element(); if(!del) continue; TPZCompElSide delside( del, highlist[is].Side() ); TPZMultiphysicsElement * delSp = dynamic_cast<TPZMultiphysicsElement *>(del); if (!delSp){ PZError << "\nERROR AT " << __PRETTY_FUNCTION__ << " - CASE NOT AVAILABLE\n"; return; } if ( delSp->ExistsInterface(highlist[is].Side()) ) { // cout << "TPZCompElDisc::CreateInterface inconsistent: interface already exists\n"; } else { delSp->CreateInterface(highlist[is].Side()); } } } } }
/** * @brief transform in low order Raviar Tomas */ void TPZCreateApproximationSpace::MakeRaviartTomas(TPZCompMesh &cmesh) { int numcell = cmesh.NElements(); int el; for (el = 0; el<numcell ; el++) { TPZCompEl *cel = cmesh.ElementVec()[el]; TPZInterpolationSpace *intel = dynamic_cast<TPZInterpolationSpace *>(cel); if (!intel) { continue; } intel->SetPreferredOrder(1); } cmesh.ExpandSolution(); for (el = 0; el<numcell ; el++) { TPZCompEl *cel = cmesh.ElementVec()[el]; TPZInterpolatedElement *intel = dynamic_cast<TPZInterpolatedElement *>(cel); if (!intel) { continue; } TPZGeoEl *gel = intel->Reference(); int geldim = gel->Dimension(); int is; int nsides = gel->NSides(); for (is=0; is<nsides; is++) { if (gel->SideDimension(is) != geldim-1) { continue; } int nsconnects = intel->NSideConnects(is); // only interested in HDiv elements if (nsconnects != 1) { continue; } int cindex = intel->SideConnectIndex(0, is); TPZConnect &c = intel->Connect(intel->SideConnectLocId(0,is)); if (c.HasDependency()) { continue; } int nshape = 1; int nstate = 1; int order = 0; int cindex2 = cmesh.AllocateNewConnect(nshape, nstate, order); // TPZConnect &c2 = cmesh.ConnectVec()[cindex]; TPZFNMatrix<2> depmat(2,1,1.); c.AddDependency(cindex, cindex2, depmat, 0, 0, 2, 1); } } cmesh.ExpandSolution(); }
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; }