Esempio n. 1
0
TPZCompMesh * ComputationalMesh(TPZGeoMesh * gmesh, int p)
{
    int matid = 1;
    int dim = 2;
    REAL wavespeed = 1.0;

    ///Computational Mesh
    TPZCompEl::SetgOrder(p);
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDimModel(dim);    
    cmesh->SetAllCreateFunctionsContinuous();
    
    TPZMaterial * Air = new TPZLinearWave(matid,dim);
    cmesh->InsertMaterialObject(Air);
    
    {
        //Boundary Conditions
        TPZFMatrix<STATE> k1(dim,dim,0.), k2(dim,dim,0.);
        TPZMaterial * BCD = Air->CreateBC(Air, 2, 0, k1, k2);
        cmesh->InsertMaterialObject(BCD);
        
        TPZMaterial * BCN = Air->CreateBC(Air, 3, 1, k1, k2);
        cmesh->InsertMaterialObject(BCN);
    }   
        
    cmesh->AutoBuild();
    cmesh->AdjustBoundaryElements();
    cmesh->CleanUpUnconnectedNodes();    
    
    return cmesh;
}
Esempio n. 2
0
TPZCompMesh *MalhaCompDois(TPZGeoMesh * gmesh, int pOrder, bool isdiscontinuous)
{
    /// criar materiais
    int dim = 2;
    TPZMatPoisson3d *material;
    material = new TPZMatPoisson3d(matId,dim);
    TPZMaterial * mat(material);
    
    material->SetNoPenalty();
    material->SetNonSymmetric();
    
    REAL diff = -1.;
    REAL conv = 0.;
    TPZVec<REAL> convdir(3,0.);
    REAL flux = 0.;
    
    material->SetParameters(diff, conv, convdir);
    material->SetInternalFlux(flux);
    material->NStateVariables();
    
    TPZCompEl::SetgOrder(pOrder);
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDimModel(dim);
    //cmesh->SetAllCreateFunctionsContinuous();
    cmesh->InsertMaterialObject(mat);
    
    TPZAutoPointer<TPZFunction<STATE> > forcef = new TPZDummyFunction<STATE>(ForcingF, 5);
    material->SetForcingFunction(forcef);
    
    ///Inserir condicao de contorno
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
    TPZMaterial * BCond0 = material->CreateBC(mat, bc0,dirichlet, val1, val2);
    TPZMaterial * BCond2 = material->CreateBC(mat, bc2,dirichlet, val1, val2);
    TPZMaterial * BCond1 = material->CreateBC(mat, bc1,dirichlet, val1, val2);
    TPZMaterial * BCond3 = material->CreateBC(mat, bc3,dirichlet, val1, val2);
    
    cmesh->InsertMaterialObject(BCond0);
    cmesh->InsertMaterialObject(BCond1);
    cmesh->InsertMaterialObject(BCond2);
    cmesh->InsertMaterialObject(BCond3);
    
    //Ajuste da estrutura de dados computacional
    if (isdiscontinuous==true) {
        //Set discontinuous functions
        cmesh->SetAllCreateFunctionsDiscontinuous();
        cmesh->AutoBuild();
        cmesh->ExpandSolution();
        cmesh->AdjustBoundaryElements();
        cmesh->CleanUpUnconnectedNodes();
    }
    else{
        cmesh->SetAllCreateFunctionsContinuous();
        cmesh->AutoBuild();
        cmesh->ExpandSolution();
        cmesh->AdjustBoundaryElements();
        cmesh->CleanUpUnconnectedNodes();
    }
    
    return cmesh;
}
Esempio n. 3
0
TPZCompMesh *CompMesh1D(TPZGeoMesh *gmesh,int p, TPZMaterial *material,TPZVec<int> &bc,TPZVec<int> &bcType) {
	if(!material || bc.NElements()<2 || bcType.NElements() != bc.NElements()) return NULL;
	int dim = 1;
	
	
	TPZAutoPointer<TPZMaterial> mat(material);
	
	// related to interpolation space
	TPZCompEl::SetgOrder(p);
	TPZCompMesh *cmesh = new TPZCompMesh(gmesh);
	cmesh->SetDimModel(dim);
	cmesh->SetAllCreateFunctionsContinuous();
	cmesh->InsertMaterialObject(mat);
	
	// Related to boundary conditions
	//	REAL uN=1-cosh(1.)/sinh(1.);
	TPZFMatrix<STATE> val1(1,1,0.), val2(1,1,0.);
	if(!bcType[0])  // dirichlet
		val2.PutVal(0,0,0.0);
	TPZAutoPointer<TPZMaterial> BCond1 = material->CreateBC(mat, bc[0],bcType[0], val1, val2);
	cmesh->InsertMaterialObject(BCond1);
	
	if(!bcType[1])  // dirichlet
		val2.PutVal(0,0,0.0);
	TPZAutoPointer<TPZMaterial> BCond2 = material->CreateBC(mat, bc[1],bcType[1], val1, val2);
	cmesh->InsertMaterialObject(BCond2);
	
	//Adjusting data
	cmesh->AutoBuild();
	cmesh->AdjustBoundaryElements(); 
	cmesh->CleanUpUnconnectedNodes();
	
	return cmesh;
}
Esempio n. 4
0
TPZCompMesh *MeshH1(TPZGeoMesh *gmesh, int pOrder, int dim,bool hasbc)
{
    /// criar materiais
    dim = 2;
    TPZMatPoisson3d *material = new TPZMatPoisson3d( MatId,  dim);
    material->NStateVariables();
	
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDimModel(dim);
    TPZMaterial * mat(material);
    cmesh->InsertMaterialObject(mat);
	
    ///Inserir condicao de contorno
    if(hasbc){
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
	
        TPZMaterial * BCond0 = material->CreateBC(mat, bc0,dirichlet, val1, val2);
        TPZMaterial * BCond1 = material->CreateBC(mat, bc1,dirichlet, val1, val2);
        TPZMaterial * BCond2 = material->CreateBC(mat, bc2,dirichlet, val1, val2);
        TPZMaterial * BCond3 = material->CreateBC(mat, bc3,dirichlet, val1, val2);
	
        cmesh->InsertMaterialObject(BCond0);
        cmesh->InsertMaterialObject(BCond1);
        cmesh->InsertMaterialObject(BCond2);
        cmesh->InsertMaterialObject(BCond3);
    }
    
    //solucao exata
//    TPZAutoPointer<TPZFunction<STATE> > solexata;
//    solexata = new TPZDummyFunction<STATE>(EstadoAd);
//    material->SetForcingFunctionExact(solexata);
//
//    //funcao do lado direito da equacao do problema
//    TPZAutoPointer<TPZFunction<STATE> > force;
//    TPZDummyFunction<STATE> *dum;
//    
//    dum = new TPZDummyFunction<STATE>(ForcingOpt);
//    dum->SetPolynomialOrder(20);
//    force = dum;
//    material->SetForcingFunction(force);
	
    
    cmesh->SetDefaultOrder(pOrder);
    cmesh->SetDimModel(dim);
	
	
    cmesh->SetAllCreateFunctionsContinuous();
    
    //Ajuste da estrutura de dados computacional
    cmesh->AutoBuild();
    
    
    return cmesh;
    
}
Esempio n. 5
0
TPZCompMesh *L2ProjectionP(TPZGeoMesh *gmesh, int pOrder, TPZVec<STATE> &solini)
{
    /// criar materiais
    int dim = 2;
    TPZL2Projection *material;
    material = new TPZL2Projection(1, dim, 1, solini, pOrder);
    
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDimModel(dim);
    TPZMaterial * mat(material);
    cmesh->InsertMaterialObject(mat);
    TPZAutoPointer<TPZFunction<STATE> > forcef = new TPZDummyFunction<STATE>(InitialPressure);
    material->SetForcingFunction(forcef);
    cmesh->SetAllCreateFunctionsContinuous();
    cmesh->SetDefaultOrder(pOrder);
    cmesh->SetDimModel(dim);
    cmesh->AutoBuild();
    
    
    return cmesh;
    
}
Esempio n. 6
0
TPZCompMesh * ComputationalElasticityMesh3D(TPZGeoMesh *gmesh,int pOrder)
{
    // Getting mesh dimension
    const int dim = 3;
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDefaultOrder(pOrder);
    cmesh->SetDimModel(dim);
    
    {//material da chapa
        const REAL Ey = 205000.;
        const REAL poisson = 0.3;
        const int matid = matchapa;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetVonMises(300.);
        cmesh->InsertMaterialObject(mat);
    }
    
    {//material da trilho1
        const REAL Ey = 205000.;
        const REAL poisson = 0.3;
        const int matid = mattrilho1;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetVonMises(690.);
        cmesh->InsertMaterialObject(mat);
        //int bcsidex = 9;
        TPZFNMatrix<9,STATE> val1(3,3,0.), val2(3,1,0.);
        val2(0,0) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bctrilho1, 3, val1, val2));
    }
    
    if(1)
    {//material da trilho2
        const REAL Ey = 205000.;
        const REAL poisson = 0.3;
        const int matid = mattrilho2;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetVonMises(690.);
        cmesh->InsertMaterialObject(mat);
        
        //int bcsidex = 9;
        TPZFNMatrix<9,STATE> val1(3,3,0.), val2(3,1,0.);
        val2(0,0) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bctrilho2, 3, val1, val2));
    }
    
    REAL percTracao = 0.1;
    {//material do concreto de 40 MPa
        const REAL Ey = 35417.;
        const REAL poisson = 0.2;
        const int matid = matgraut;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetMohrCoulomb(40.,percTracao*40.);
        cmesh->InsertMaterialObject(mat);
    }
    
    {//material do concreto de 30 MPa
        const REAL Ey = 27000;
        const REAL poisson = 0.2;
        const int matid = matenchimento;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetMohrCoulomb(30.,percTracao*30.);
        cmesh->InsertMaterialObject(mat);
        
        //c.c.
        //int bcbottom = 8;
        TPZFNMatrix<9,STATE> val1(3,3,0.), val2(3,1,0.);
//        val1(0,0) = 1.e-3;
//        val1(1,1) = 1.e-3;
//        val1(2,2) = 1.e12;
        val2(2) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcbottom, 3, val1, val2));
        val1.Zero();
        val2.Zero();
        
        //int bcsidex = 9;
        val2.Zero();
        val2(0,0) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcsidex, 3, val1, val2));
        
        //int bcsidey = 10;
        val1.Zero();
        val2.Zero();
        val2(1,0) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcsidey, 3, val1, val2));
        
        //int bcloadtop = 11;
        val2.Zero();
        val2(2,0) = -800000./120.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcloadtop, 1, val1, val2));
        
//        somente para teste de tensao uniforme
//        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcloadtopTESTE, 1, val1, val2));//toto
        
        
    }
    
    
    cmesh->SetAllCreateFunctionsContinuous();
    cmesh->AutoBuild();
    return cmesh;
    
}
Esempio n. 7
0
TPZCompMesh *ComputationalElasticityMesh2D(TPZAutoPointer<TPZGeoMesh>  gmesh,int pOrder)
{
    
    // remove some connectivities 3, 5
    TPZGeoEl *gel = gmesh->Element(0);
    TPZGeoElSide gelside(gel,3);
    gelside.RemoveConnectivity();
    gelside.SetSide(5);
    gelside.RemoveConnectivity();
    gelside.SetSide(4);
    TPZGeoElSide neighbour = gelside.NNeighbours();
    int matid = neighbour.Element()->MaterialId();
    gel->SetMaterialId(matid);
    neighbour.Element()->RemoveConnectivities();
    int64_t index = neighbour.Element()->Index();
    delete neighbour.Element();
    gmesh->ElementVec()[index] = 0;
    
    
    // Plane strain assumption
    int planestress = 0;
    
    // Getting mesh dimension
    int dim = 2;
    
    TPZMatElasticity2D *materialConcrete;
    materialConcrete = new TPZMatElasticity2D(EMatConcrete);
    
    TPZMatElasticity2D *materialSteel;
    materialSteel = new TPZMatElasticity2D(EMatSteel);
    
    
    // Setting up paremeters
    materialConcrete->SetfPlaneProblem(planestress);
    materialConcrete->SetElasticity(25.e6, 0.25);
    materialSteel->SetElasticity(205.e6, 0.25);
    
    //material->SetBiotAlpha(Alpha);cade o metodo?
    
    
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDefaultOrder(pOrder);
    cmesh->SetDimModel(dim);
    
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
    
    val2(0,0) = 0.0;
    val2(1,0) = 0.0;
    val1(1,1) = 1.e12;
    TPZMaterial * BCond2 = materialConcrete->CreateBC(materialConcrete,EBottom,3, val1, val2);
    
    val2(0,0) = 0.0;
    val2(1,0) = 0.0;
    val1.Zero();
    val1(0,0) = 1.e12;
    TPZMaterial * BCond3 = materialConcrete->CreateBC(materialConcrete,ELateral,3, val1, val2);
    
    val2(0,0) = 0.0;
    val2(1,0) = -1000.0;
    val1.Zero();
    TPZMaterial * BCond4 = materialSteel->CreateBC(materialSteel,EBeam,1, val1, val2);
    
    cmesh->SetAllCreateFunctionsContinuous();
    cmesh->InsertMaterialObject(materialConcrete);
    cmesh->InsertMaterialObject(materialSteel);
    cmesh->InsertMaterialObject(BCond2);
    cmesh->InsertMaterialObject(BCond3);
    cmesh->InsertMaterialObject(BCond4);
    cmesh->AutoBuild();
    return cmesh;
    
}
Esempio n. 8
0
TPZCompMesh * CompMesh(TPZGeoMesh *gmesh, int porder)
{
    /// criar materiais
	int dim = gmesh->Dimension();
    
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    
    TPZMatLaplacian *material = new TPZMatLaplacian(1,dim);
    
//    TPZAutoPointer<TPZFunction<REAL> > forcef = new TPZDummyFunction<REAL>(ForceSuave);
//    material->SetForcingFunction(forcef);
    
    TPZAutoPointer<TPZFunction<STATE> > force;
    TPZDummyFunction<STATE> *dum;
    dum = new TPZDummyFunction<STATE>(ForceSuave);
    dum->SetPolynomialOrder(20);
    force = dum;
    material->SetForcingFunction(force);
    
    
    TPZAutoPointer<TPZFunction<STATE> > solExata= new TPZDummyFunction<STATE>(SolSuave);
    material->SetForcingFunctionExact(solExata);
    
    TPZMaterial * mat(material);
    cmesh->InsertMaterialObject(mat);
    
    cmesh->SetDimModel(dim);
    cmesh->SetDefaultOrder(porder);

	///Inserir condicao de contorno
	TPZFMatrix<STATE> val1(2,2,1.), val2(2,1,0.);
	
    //BC -1
    TPZMaterial * BCondD1 = material->CreateBC(mat, bc1,dirichlet, val1, val2);
    TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet1 = new TPZDummyFunction<REAL>(DirichletSuave);
    BCondD1->SetForcingFunction(bcmatDirichlet1);
    cmesh->InsertMaterialObject(BCondD1);
    
    //BC -2
	TPZMaterial * BCondD2 = material->CreateBC(mat, bc2,dirichlet, val1, val2);
    TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet2 = new TPZDummyFunction<REAL>(DirichletSuave);
    BCondD2->SetForcingFunction(bcmatDirichlet2);
    cmesh->InsertMaterialObject(BCondD2);
    
    //BC -3
	TPZMaterial * BCondD3 = material->CreateBC(mat, bc3,dirichlet, val1, val2);
    TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet3 = new TPZDummyFunction<REAL>(DirichletSuave);
    BCondD3->SetForcingFunction(bcmatDirichlet3);
    cmesh->InsertMaterialObject(BCondD3);
    
    //BC -4
	TPZMaterial * BCondD4 = material->CreateBC(mat, bc4,dirichlet, val1, val2);
    TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet4 = new TPZDummyFunction<REAL>(DirichletSuave);
    BCondD4->SetForcingFunction(bcmatDirichlet4);
    cmesh->InsertMaterialObject(BCondD4);
    
    
    //Fazendo auto build
    cmesh->SetAllCreateFunctionsContinuous();
    cmesh->AutoBuild();
	cmesh->AdjustBoundaryElements();
	cmesh->CleanUpUnconnectedNodes();
    
    return cmesh;
}
Esempio n. 9
0
TPZCompMesh*MalhaComp(TPZGeoMesh * gmesh, int pOrder)
{
	/// criar materiais
	int dim = 2;
    TPZElasticityHybridMaterial *material = new TPZElasticityHybridMaterial(matInterno, 1., 1., 10., 10.);
    TPZElasticityHybridMaterial *matlagrange = new TPZElasticityHybridMaterial(lagrangemat, 1., 1., 0., 0.);
    TPZElasticityHybridMaterial *matinterface = new TPZElasticityHybridMaterial(interfacemat, 1., 1., 0., 0.);


    
	TPZMaterial * mat1(material);
	TPZMaterial * mat2(matlagrange);
    TPZMaterial * mat3(matinterface);
    
	material->NStateVariables();
	matlagrange->NStateVariables();
   	matinterface->NStateVariables();
    
	TPZCompEl::SetgOrder(pOrder);
	TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
	cmesh->SetDimModel(dim);
    
	cmesh->InsertMaterialObject(mat1);
	cmesh->InsertMaterialObject(mat2);
    cmesh->InsertMaterialObject(mat3);
	
	///Inserir condicao de contorno
	TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
	REAL uN=0.;
	val2(0,0)=uN;
	TPZMaterial * BCondN1 = material->CreateBC(mat1, bc1,neumann, val1, val2);
	cmesh->InsertMaterialObject(BCondN1);
    
    TPZMaterial * BCondN2 = material->CreateBC(mat1, bc3,neumann, val1, val2);
    cmesh->InsertMaterialObject(BCondN2);
	
	TPZFMatrix<STATE> val12(2,2,0.), val22(2,1,0.);
	REAL uD=0.;
	val22(0,0)=uD;
	TPZMaterial * BCondD1 = material->CreateBC(mat1, bc2,dirichlet, val12, val22);
	cmesh->InsertMaterialObject(BCondD1);
	
	TPZMaterial * BCondD2 = material->CreateBC(mat1, bc4,dirichlet, val12, val22);
	cmesh->InsertMaterialObject(BCondD2);
	
    cmesh->SetAllCreateFunctionsContinuous();

	set<int> SETmat1;
	SETmat1.insert(bc1);
    SETmat1.insert(bc2);
    SETmat1.insert(bc3);
    SETmat1.insert(bc4);
    
	//criar set dos materiais
    std::set<int> MaterialIDs;
    std::set<int> BCMaterialIDs;
    MaterialIDs.insert(matInterno);
//     MaterialIDs.insert(lagrangemat);
//     MaterialIDs.insert(interfacemat);
//     MaterialIDs.insert(bc1);
//     MaterialIDs.insert(bc2);
//     MaterialIDs.insert(bc3);
//     MaterialIDs.insert(bc4);
    BCMaterialIDs.insert(bc1);
    BCMaterialIDs.insert(bc2);
    BCMaterialIDs.insert(bc3);
    BCMaterialIDs.insert(bc4);

    
    TPZBuildMultiphysicsMesh::BuildHybridMesh(cmesh, MaterialIDs, BCMaterialIDs, lagrangemat, interfacemat);
        
	return cmesh;
}