Beispiel #1
0
TPZCompMesh *MeshL2(TPZGeoMesh *gmesh, int pOrder, int dim)
{
    /// 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
//    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>(OptForcing);
//    dum->SetPolynomialOrder(20);
//    force = dum;
//    material->SetForcingFunction(force);
    
    
    cmesh->SetDefaultOrder(pOrder);
    cmesh->SetDimModel(dim);
    
    
    cmesh->SetAllCreateFunctionsDiscontinuous();
    
    //cmesh->SetAllCreateFunctionsContinuous();
    
    //Ajuste da estrutura de dados computacional
    cmesh->AutoBuild();
    
    
    return cmesh;
    
}
Beispiel #2
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;
}
Beispiel #3
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;
}
Beispiel #4
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;
}
Beispiel #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;
    
}
Beispiel #6
0
TPZCompMesh *CMesh(TPZGeoMesh *gmesh, int pOrder)
{
	const int dim = 2; //dimensao do problema
	const int matId = 1, bc0 = -1, bc1 = -2, bc2=-3, bc3=-4; //MESMOS ids da malha geometrica
    const int dirichlet = 0, neumann = 1;
//    const int mixed = 2; //tipo da condicao de contorno do problema ->default dirichlet na esquerda e na direita
	
    
	///criar malha computacional
	TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
	cmesh->SetDefaultOrder(pOrder);//seta ordem polimonial de aproximacao
	cmesh->SetDimModel(dim);//seta dimensao do modelo
	
    // Criando material
    TPZMatExSimples2D *material = new TPZMatExSimples2D(matId);//criando material que implementa a formulacao fraca do problema modelo
    
	// Inserindo material na malha
	cmesh->InsertMaterialObject(material);
		
	///Inserir condicao de contorno esquerda
	TPZFMatrix<STATE> val1(1,1,0.), val2(1,1,0.);
	TPZMaterial * BCond0 = material->CreateBC(material, bc0, neumann, val1, val2);//cria material que implementa a condicao de contorno da esquerda
	
    cmesh->InsertMaterialObject(BCond0);//insere material na malha
    
	// Condicao de contorno da direita
	TPZMaterial * BCond1 = material->CreateBC(material, bc1, neumann, val1, val2);//cria material que implementa a condicao de contorno da direita
    
    cmesh->InsertMaterialObject(BCond1);//insere material na malha
    
    val2(0,0) = 1.0;//potencial na placa inferior
    // Condicao de contorno da placa inferior
    TPZMaterial * BCond2 = material->CreateBC(material, bc2, dirichlet, val1, val2);//cria material que implementa a condicao de contorno da placa inferior
    
    cmesh->InsertMaterialObject(BCond2);//insere material na malha
    
    val2(0,0) = 1.5;//potencial na placa superior
    // Condicao de contorno da placa superior
    TPZMaterial * BCond3 = material->CreateBC(material, bc3, dirichlet, val1, val2);//cria material que implementa a condicao de contorno da placa superior
	
    cmesh->InsertMaterialObject(BCond3);//insere material na malha
	
	//Cria elementos computacionais que gerenciarao o espaco de aproximacao da malha
	cmesh->AutoBuild();
	
	return cmesh;
	
}
Beispiel #7
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;
    
}
Beispiel #8
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;
    
}
Beispiel #9
0
TPZCompMesh *MalhaMultifisicaOpt(TPZVec<TPZCompMesh *> meshvec, TPZGeoMesh *gmesh){
    
    //Creating computational mesh for multiphysic elements
    gmesh->ResetReference();
    TPZCompMesh *mphysics = new TPZCompMesh(gmesh);
    
    //criando material
    int dim =2;
    
    TPZMatPoissonControl *material = new TPZMatPoissonControl(MatId,dim);
    
    
    //incluindo os dados do problema
    REAL k=1;
    REAL alpha=1;
    material-> SetParameters( k, alpha);
    
    //solucao exata
    TPZAutoPointer<TPZFunction<STATE> > solexata;
    solexata = new TPZDummyFunction<STATE>(StateAd, 5);
    material->SetForcingFunctionExact(solexata);
    
    //funcao do lado direito da equacao do problema
    TPZAutoPointer<TPZFunction<STATE> > force;
    TPZDummyFunction<STATE> *dum;
    dum = new TPZDummyFunction<STATE>(OptForcing, 5);
    dum->SetPolynomialOrder(20);
    force = dum;
    material->SetForcingFunction(force);
    
    //inserindo o material na malha computacional
    TPZMaterial *mat(material);
    mphysics->InsertMaterialObject(mat);
    mphysics->SetDimModel(dim);
    
    //Criando condicoes de contorno
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
    
    
    TPZMaterial * BCond0 = material->CreateBC(mat, bc0, bcdirichlet, val1, val2);
    TPZMaterial * BCond1 = material->CreateBC(mat, bc1, bcdirichlet, val1, val2);
    TPZMaterial * BCond2 = material->CreateBC(mat, bc2, bcdirichlet, val1, val2);
    TPZMaterial * BCond3 = material->CreateBC(mat, bc3, bcdirichlet, val1, val2);
    
    ///Inserir condicoes de contorno
    mphysics->InsertMaterialObject(BCond0);
    mphysics->InsertMaterialObject(BCond1);
    mphysics->InsertMaterialObject(BCond2);
    mphysics->InsertMaterialObject(BCond3);
    
    mphysics->SetAllCreateFunctionsMultiphysicElem();
    
    //Fazendo auto build
    mphysics->AutoBuild();
    mphysics->AdjustBoundaryElements();
    mphysics->CleanUpUnconnectedNodes();
    
    TPZBuildMultiphysicsMesh::AddElements(meshvec, mphysics);
    TPZBuildMultiphysicsMesh::AddConnects(meshvec,mphysics);
    TPZBuildMultiphysicsMesh::TransferFromMeshes(meshvec, mphysics);
    
    return mphysics;
    
}
Beispiel #10
0
//malha multifisica para o metodo da dupla projecao
TPZCompMesh *MalhaMDP(TPZVec<TPZCompMesh *> meshvec,TPZGeoMesh * gmesh){
    
    //Creating computational mesh for multiphysic elements
	gmesh->ResetReference();
	TPZCompMesh *mphysics = new TPZCompMesh(gmesh);
    
    //criando material
    int dim =2;
    TPZMDPMaterial *material = new TPZMDPMaterial(1,dim);
    
    //incluindo os dados do problema
    REAL coefk = 1.;
    material->SetParameters(coefk, 0.);
    
    //solucao exata
    TPZAutoPointer<TPZFunction<STATE> > solexata;
    solexata = new TPZDummyFunction<STATE>(SolSuave);
    material->SetForcingFunctionExact(solexata);
    
    //funcao do lado direito da equacao do problema
    TPZAutoPointer<TPZFunction<STATE> > force;
    TPZDummyFunction<STATE> *dum;
    dum = new TPZDummyFunction<STATE>(ForceSuave);
    dum->SetPolynomialOrder(20);
    force = dum;
    material->SetForcingFunction(force);
    
    //inserindo o material na malha computacional
    TPZMaterial *mat(material);
    mphysics->InsertMaterialObject(mat);
    
    //Criando condicoes de contorno
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
    int boundcond = dirichlet;
    //BC -1
    TPZMaterial * BCondD1 = material->CreateBC(mat, bc1,boundcond, val1, val2);
    TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet1 = new TPZDummyFunction<REAL>(DirichletSuave);
    BCondD1->SetForcingFunction(bcmatDirichlet1);
    mphysics->InsertMaterialObject(BCondD1);
    
    //BC -2
	TPZMaterial * BCondD2 = material->CreateBC(mat, bc2,boundcond, val1, val2);
    TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet2 = new TPZDummyFunction<REAL>(DirichletSuave);
    BCondD2->SetForcingFunction(bcmatDirichlet2);
    mphysics->InsertMaterialObject(BCondD2);
    
    //BC -3
	TPZMaterial * BCondD3 = material->CreateBC(mat, bc3,boundcond, val1, val2);
    TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet3 = new TPZDummyFunction<REAL>(DirichletSuave);
    BCondD3->SetForcingFunction(bcmatDirichlet3);
    mphysics->InsertMaterialObject(BCondD3);
    
    //BC -4
	TPZMaterial * BCondD4 = material->CreateBC(mat, bc4,boundcond, val1, val2);
    TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet4 = new TPZDummyFunction<REAL>(DirichletSuave);
    BCondD4->SetForcingFunction(bcmatDirichlet4);
    mphysics->InsertMaterialObject(BCondD4);

    
    mphysics->InsertMaterialObject(BCondD1);
    mphysics->InsertMaterialObject(BCondD2);
    mphysics->InsertMaterialObject(BCondD3);
    mphysics->InsertMaterialObject(BCondD4);
    
    
    //set multiphysics element
    mphysics->SetDimModel(dim);
    mphysics->SetAllCreateFunctionsMultiphysicElem();
    
    //Fazendo auto build
    mphysics->AutoBuild();
	mphysics->AdjustBoundaryElements();
	mphysics->CleanUpUnconnectedNodes();
    
    // Creating multiphysic elements into mphysics computational mesh
	TPZBuildMultiphysicsMesh::AddElements(meshvec, mphysics);
	TPZBuildMultiphysicsMesh::AddConnects(meshvec,mphysics);
	TPZBuildMultiphysicsMesh::TransferFromMeshes(meshvec, mphysics);
    
    return mphysics;
}
Beispiel #11
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;
}
Beispiel #12
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;
}
Beispiel #13
0
TPZCompMesh * CMeshFooting2D(TPZGeoMesh * gmesh, int p_order){
    
    unsigned int dim  = gmesh->Dimension();
    const std::string name("ElastoPlastic Footing Problem ");

    // Setting up attributes
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetName(name);
    cmesh->SetDefaultOrder(p_order);
    cmesh->SetDimModel(dim);
    
    // Mohr Coulomb data
    REAL mc_cohesion    = 10.0;
    REAL mc_phi         = (20.0*M_PI/180);
    REAL mc_psi         = mc_phi;
    
    /// ElastoPlastic Material using Mohr Coulomb
    // Elastic predictor
    TPZElasticResponse ER;
    REAL G = 400*mc_cohesion;
    REAL nu = 0.3;
    REAL E = 2.0*G*(1+nu);
    

    TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse> LEMC;
    ER.SetEngineeringData(E, nu);
    LEMC.SetElasticResponse(ER);
    LEMC.fYC.SetUp(mc_phi, mc_psi, mc_cohesion, ER);
    int PlaneStrain = 1;
    
//    TPZElasticCriterion MatEla;
//    MatEla.SetElasticResponse(ER);
//    TPZMatElastoPlastic2D < TPZElasticCriterion, TPZElastoPlasticMem > * material = new TPZMatElastoPlastic2D < TPZElasticCriterion, TPZElastoPlasticMem >(ERock,PlaneStrain);
//    material->SetPlasticityModel(MatEla);
//    cmesh->InsertMaterialObject(material);
    
    TPZMatElastoPlastic2D < TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, TPZElastoPlasticMem > * material = new TPZMatElastoPlastic2D < TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, TPZElastoPlasticMem >(ERock,PlaneStrain);
    material->SetPlasticityModel(LEMC);
    cmesh->InsertMaterialObject(material);
    
    
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
    
    val2(0,0) = 0;
    val2(1,0) = 1;
    TPZBndCond * bc_bottom = material->CreateBC(material, EBottomBC, Eu_null, val1, val2);
    
    val2(0,0) = 1;
    val2(1,0) = 0;
    TPZBndCond * bc_lateral = material->CreateBC(material, ELateralBC, Eu_null, val1, val2);
    
//    val2(0,0) = 0;
//    val2(1,0) = 0;
//    val1(0,0) = 0;
//    val1(1,1) = 1;
    val2(0,0) = 0;
    val2(1,0) = 0;
    TPZBndCond * bc_top = material->CreateBC(material, ETopBC, ETn, val1, val2);
    
    val2(0,0) = 0;
    val2(1,0) = 0;
    TPZBndCond * bc_top_null = material->CreateBC(material, ETopNullBC, ETn, val1, val2);
    
    cmesh->InsertMaterialObject(bc_bottom);
    cmesh->InsertMaterialObject(bc_lateral);
    cmesh->InsertMaterialObject(bc_top);
//    cmesh->InsertMaterialObject(bc_top_null);
    
    cmesh->SetAllCreateFunctionsContinuousWithMem();
    cmesh->AutoBuild();
    
#ifdef PZDEBUG
    std::ofstream out("cmesh.txt");
    cmesh->Print(out);
#endif
    
    return cmesh;
}
Beispiel #14
0
TPZCompMesh *MalhaCompMultifisica(TPZGeoMesh * gmesh,TPZVec<TPZCompMesh *> meshvec, TPZMatUncoupledPoissonDisc* &mymaterial){
    
    
    // Creating computational mesh for multiphysic elements
    gmesh->ResetReference();
    TPZCompMesh *mphysics = new TPZCompMesh(gmesh);
    
    mphysics->SetAllCreateFunctionsMultiphysicElem();
    
    int dim = 2;
    mphysics->SetDimModel(dim);
    mymaterial = new TPZMatUncoupledPoissonDisc(matId, mphysics->Dimension());
    
    mymaterial->SetParameters(1., 1.);
    mymaterial->SetInternalFlux(-8.,0.);
    //mymaterial->SetInternalFlux(0.,0.);
    
    mymaterial->SetNonSymmetricOne();
    mymaterial->SetNonSymmetricTwo();
    mymaterial->SetPenaltyConstant(0., 0.);
    
    TPZMaterial * mat(mymaterial);
    mphysics->InsertMaterialObject(mat);
    
    TPZAutoPointer<TPZFunction<STATE> > forcef = new TPZDummyFunction<STATE>(ForcingF, 5);
    
    //
    //    TPZAutoPointer<TPZFunction<STATE> > forcef = new TPZDummyFunction<STATE>(ForcingF);
    mymaterial->SetForcingFunction(forcef);
    
    
    ///Inserir condicao de contorno
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
    
    TPZMaterial * BCond0 = mymaterial->CreateBC(mat, bc0,neumann_dirichlet, val1, val2);
    TPZMaterial * BCond2 = mymaterial->CreateBC(mat, bc2,neumann_dirichlet, val1, val2);
    TPZMaterial * BCond1 = mymaterial->CreateBC(mat, bc1,dirichlet, val1, val2);
    TPZMaterial * BCond3 = mymaterial->CreateBC(mat, bc3,dirichlet, val1, val2);
    
    //    TPZMaterial * BCond0 = mymaterial->CreateBC(mat, bc0,dirichlet, val1, val2);
    //    TPZMaterial * BCond2 = mymaterial->CreateBC(mat, bc2,dirichlet, val1, val2);
    //    TPZMaterial * BCond1 = mymaterial->CreateBC(mat, bc1,dirichlet, val1, val2);
    //    TPZMaterial * BCond3 = mymaterial->CreateBC(mat, bc3,dirichlet, val1, val2);
    
    
    mphysics->InsertMaterialObject(BCond0);
    mphysics->InsertMaterialObject(BCond1);
    mphysics->InsertMaterialObject(BCond2);
    mphysics->InsertMaterialObject(BCond3);
    
    mphysics->AutoBuild();
    mphysics->AdjustBoundaryElements();
    mphysics->CleanUpUnconnectedNodes();
    
    //Creating multiphysic elements into mphysics computational mesh
    TPZBuildMultiphysicsMesh::AddElements(meshvec, mphysics);
    TPZBuildMultiphysicsMesh::AddConnects(meshvec,mphysics);
    TPZBuildMultiphysicsMesh::TransferFromMeshes(meshvec, mphysics);
    
    mphysics->Reference()->ResetReference();
    mphysics->LoadReferences();
    
    if (disc_functions==true){
        //criar elementos de interface
        int nel = mphysics->ElementVec().NElements();
        for(int el = 0; el < nel; el++)
        {
            TPZCompEl * compEl = mphysics->ElementVec()[el];
            if(!compEl) continue;
            int index = compEl ->Index();
            if(compEl->Dimension() == mphysics->Dimension())
            {
                TPZMultiphysicsElement * InterpEl = dynamic_cast<TPZMultiphysicsElement *>(mphysics->ElementVec()[index]);
                if(!InterpEl) continue;
                InterpEl->CreateInterfaces();
                
            }
        }
    }
    
    return mphysics;
    
}