void TPZMaterialTest::ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef, TPZBndCond &bc) { TPZFMatrix<REAL> &phi = data.phi; if(bc.Material() != this) { PZError << "TPZMat1dLin.apply_bc warning : this material didn't create the boundary condition!\n"; } if(bc.Type() < 0 && bc.Type() > 2){ PZError << "TPZMat1dLin.aplybc, unknown boundary condition type :" << bc.Type() << " boundary condition ignored\n"; } int numdof = NStateVariables(); int numnod = ek.Rows()/numdof; int r = numdof; int idf,jdf,in,jn; switch(bc.Type()) { case 0: for(in=0 ; in<numnod ; ++in){ for(idf = 0;idf<r;idf++) { (ef)(in*r+idf,0) += gBigNumber*phi(in,0)*bc.Val2()(idf,0)*weight; } for(jn=0 ; jn<numnod ; ++jn) { for(idf = 0;idf<r;idf++) { ek(in*r+idf,jn*r+idf) += gBigNumber*phi(in,0)*phi(jn,0)*weight; } } } break; case 1: for(in=0 ; in<numnod ; ++in){ for(idf = 0;idf<r;idf++) { (ef)(in*r+idf,0) += phi(in,0)*bc.Val2()(idf,0)*weight; } } break; case 2: for(in=0 ; in<numnod ; ++in){ for(idf = 0;idf<r;idf++) { (ef)(in*r+idf,0) += phi(in,0)*bc.Val2()(idf,0)*weight; } for(jn=0 ; jn<numnod ; ++jn) { for(idf = 0;idf<r;idf++) { for(jdf = 0;jdf<r;jdf++) { ek(in*r+idf,jn*r+jdf) += bc.Val1()(idf,jdf)*phi(in,0)*phi(jn,0)*weight; } } } }//fim switch } }
void TPZConsLawTest::ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix &ek, TPZFMatrix &ef, TPZBndCond &bc) { // TPZFMatrix &dphi = data.dphix; // TPZFMatrix &dphiL = data.dphixl; // TPZFMatrix &dphiR = data.dphixr; TPZFMatrix &phi = data.phi; // TPZFMatrix &phiL = data.phil; // TPZFMatrix &phiR = data.phir; // TPZManVector<REAL,3> &normal = data.normal; // TPZManVector<REAL,3> &x = data.x; // int &POrder=data.p; // int &LeftPOrder=data.leftp; // int &RightPOrder=data.rightp; // TPZVec<REAL> &sol=data.sol; // TPZVec<REAL> &solL=data.soll; // TPZVec<REAL> &solR=data.solr; // TPZFMatrix &dsol=data.dsol; // TPZFMatrix &dsolL=data.dsoll; // TPZFMatrix &dsolR=data.dsolr; // REAL &faceSize=data.HSize; // TPZFMatrix &daxesdksi=data.daxesdksi; // TPZFMatrix &axes=data.axes; int phr = phi.Rows(); short in,jn; REAL v2[1]; v2[0] = bc.Val2()(0,0); switch (bc.Type()) { case 0 : // Dirichlet condition for(in = 0 ; in < phr; in++) { ef(in,0) += gBigNumber * v2[0] * phi(in,0) * weight; for (jn = 0 ; jn < phr; jn++) { ek(in,jn) += gBigNumber * phi(in,0) * phi(jn,0) * weight; } } break; case 1 : // Neumann condition for(in = 0 ; in < phi.Rows(); in++) { ef(in,0) += v2[0] * phi(in,0) * weight; } break; case 2 : // condi�o mista for(in = 0 ; in < phi.Rows(); in++) { ef(in, 0) += v2[0] * phi(in, 0) * weight; for (jn = 0 ; jn < phi.Rows(); jn++) { ek(in,jn) += bc.Val1()(0,0) * phi(in,0) * phi(jn,0) * weight; // peso de contorno => integral de contorno } } } }
void TPZEulerConsLawDEP::ContributeBC(TPZMaterialData &data,REAL weight, TPZFMatrix &ek,TPZFMatrix &ef,TPZBndCond &bc) { TPZFMatrix dphi = data.dphix; TPZFMatrix dphiL = data.dphixl; TPZFMatrix dphiR = data.dphixr; TPZFMatrix phi = data.phi; TPZFMatrix phiL = data.phil; TPZFMatrix phiR = data.phir; TPZManVector<REAL,3> normal = data.normal; TPZManVector<REAL,3> x = data.x; // int POrder=data.p; // int LeftPOrder=data.leftp; // int RightPOrder=data.rightp; TPZVec<REAL> sol=data.sol; TPZVec<REAL> solL=data.soll; TPZVec<REAL> solR=data.solr; TPZFMatrix dsol=data.dsol; TPZFMatrix dsolL=data.dsoll; TPZFMatrix dsolR=data.dsolr; // REAL faceSize=data.HSize; int phr = phi.Rows(); short in,jn,i,j; int nstate = NStateVariables(); REAL v2[5];//m�imo nstate for(i=0;i<nstate;i++) v2[i] = bc.Val2()(i,0); switch (bc.Type()) { case 0 :// Dirichlet condition for(in = 0 ; in < phr; in++) { for(i = 0 ; i < nstate; i++) ef(in*nstate+i,0) += gBigNumber * weight * v2[i] * phi(in,0); for (jn = 0 ; jn < phr; jn++) { for(i = 0 ; i < nstate; i++) ek(in*nstate+i,jn*nstate+i) += gBigNumber * weight * phi(in,0) * phi(jn,0); } } break; case 1 :// Neumann condition for(in = 0 ; in < phi.Rows(); in++) { for(i = 0 ; i < nstate; i++) ef(in*nstate+i,0) += v2[i] * phi(in,0) * weight; } break; case 2 :// condi�o mista for(in = 0 ; in < phi.Rows(); in++) { for(i = 0 ; i < nstate; i++) ef(in*nstate+i, 0) += weight * v2[i] * phi(in, 0); for (jn = 0 ; jn < phi.Rows(); jn++) { for(i = 0 ; i < nstate; i++) for(j = 0 ; j < nstate; j++) ek(in*nstate+i,jn*nstate+j) += weight * bc.Val1()(i,j) * phi(in,0) * phi(jn,0); } } } }
void TPZTracerFlow::ContributeBC(TPZVec<TPZMaterialData> &datavec,REAL weight, TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef,TPZBndCond &bc){ if (fPressureEquationFilter == false) { return; } #ifdef PZDEBUG int nref = datavec.size(); if (nref != 3 ) { std::cout << " Erro.!! datavec tem que ser de tamanho 2 \n"; DebugStop(); } #endif TPZFMatrix<REAL> &phiQ = datavec[1].phi; int phrQ = phiQ.Rows();//datavec[1].fVecShapeIndex.NElements(); int phrS = datavec[0].phi.Rows(); REAL v2; v2 = bc.Val2()(1,0); STATE BigNum = gBigNumber; switch (bc.Type()) { case 0 : // Dirichlet condition //primeira equacao for(int iq=0; iq<phrQ; iq++) { //the contribution of the Dirichlet boundary condition appears in the flow equation ef(iq+phrS,0) += (-1.)*v2*phiQ(iq,0)*weight; } break; case 1 : // Neumann condition //primeira equacao if(IsZero(v2)) BigNum = 1.e10; for(int iq=0; iq<phrQ; iq++) { ef(iq+phrS,0)+= BigNum*v2*phiQ(iq,0)*weight; for (int jq=0; jq<phrQ; jq++) { ek(iq+phrS,jq+phrS)+= BigNum*phiQ(iq,0)*phiQ(jq,0)*weight; } } break; case 2 : // mixed condition for(int iq = 0; iq < phrQ; iq++) { ef(iq+phrS,0) += v2*phiQ(iq,0)*weight; for (int jq = 0; jq < phrQ; jq++) { ek(iq+phrS,jq+phrS) += weight*bc.Val1()(0,0)*phiQ(iq,0)*phiQ(jq,0); } } break; case 5 : // Neumann(pressure)-Inflow(saturation) //primeira equacao for(int iq=0; iq<phrQ; iq++) { ef(iq+phrS,0)+= BigNum*v2*phiQ(iq,0)*weight; for (int jq=0; jq<phrQ; jq++) { ek(iq+phrS,jq+phrS)+= BigNum*phiQ(iq,0)*phiQ(jq,0)*weight; } } break; case 6 : // Dirichlet(pressure)-Outflow(saturation) //primeira equacao for(int iq=0; iq<phrQ; iq++) { //the contribution of the Dirichlet boundary condition appears in the flow equation ef(iq+phrS,0) += (-1.)*v2*phiQ(iq,0)*weight; } break; case 7 : // Dirichlet(pressure)-Inflow(saturation) //primeira equacao for(int iq=0; iq<phrQ; iq++) { //the contribution of the Dirichlet boundary condition appears in the flow equation ef(iq+phrS,0) += (-1.)*v2*phiQ(iq,0)*weight; } break; } }
void TPZEuler::ContributeBC(TPZMaterialData &data,REAL weight, TPZFMatrix<REAL> &ek, TPZFMatrix<REAL> &ef,TPZBndCond &bc) { // TPZFMatrix<REAL> &dphi = data.dphix; // TPZFMatrix<REAL> &dphiL = data.dphixl; // TPZFMatrix<REAL> &dphiR = data.dphixr; TPZFMatrix<REAL> &phi = data.phi; // TPZFMatrix<REAL> &phiL = data.phil; // TPZFMatrix<REAL> &phiR = data.phir; // TPZManVector<REAL,3> &normal = data.normal; // TPZManVector<REAL,3> &x = data.x; // int &POrder=data.p; // int &LeftPOrder=data.leftp; // int &RightPOrder=data.rightp; int numbersol = data.sol.size(); if (numbersol != 1) { DebugStop(); } TPZVec<REAL> &sol=data.sol[0]; // TPZVec<REAL> &solL=data.soll; // TPZVec<REAL> &solR=data.solr; // TPZFMatrix<REAL> &dsol=data.dsol; // TPZFMatrix<REAL> &dsolL=data.dsoll; // TPZFMatrix<REAL> &dsolR=data.dsolr; // REAL &faceSize=data.HSize; // TPZFMatrix<REAL> &daxesdksi=data.daxesdksi; TPZFMatrix<REAL> &axes=data.axes; if(fState == 0) return; if(bc.Material().operator ->() != this){ PZError << "TPZMat1dLin.apply_bc warning : this material didn't create the boundary condition!\n"; } if(bc.Type() < 0 && bc.Type() > 3){ PZError << "TPZEuler.aplybc, unknown boundary condition type :" << bc.Type() << " boundary condition ignored\n"; return; } int numdof = NStateVariables(); int numnod = ek.Rows()/numdof; int r = numdof; TPZVec<REAL> flux(8); gEul.Flux(sol,flux); REAL normal[2] = {axes(0,1),-axes(0,0)}; /* int i; cout << " flux = " << x[0] << ' ' << x[1] << ' ' << "normal" << normal[0] << ' ' << normal[1] << ' '; for(i=0; i<4; i++) cout << flux[i+4] << ' '; cout << endl; */ int idf,jdf,in,jn; switch(bc.Type()){ case 0: for(in=0 ; in<numnod ; ++in){ for(idf = 0;idf<r;idf++) { (ef)(in*r+idf,0) += gBigNumber*phi(in,0)*bc.Val2()(idf,0)*weight; } for(jn=0 ; jn<numnod ; ++jn) { for(idf = 0;idf<r;idf++) { ek(in*r+idf,jn*r+idf) += gBigNumber*phi(in,0)*phi(jn,0)*weight; } } } break; case 1: for(in=0 ; in<numnod ; ++in){ for(idf = 0;idf<r;idf++) { (ef)(in*r+idf,0) += phi(in,0)*bc.Val2()(idf,0)*weight; } } break; case 2: for(in=0 ; in<numnod ; ++in){ for(idf = 0;idf<r;idf++) { (ef)(in*r+idf,0) += phi(in,0)*bc.Val2()(idf,0)*weight; } for(jn=0 ; jn<numnod ; ++jn) { for(idf = 0;idf<r;idf++) { for(jdf = 0;jdf<r;jdf++) { ek(in*r+idf,jn*r+jdf) += bc.Val1()(idf,jdf)*phi(in,0)*phi(jn,0)*weight; } } } case 3: { TPZFMatrix<REAL> A(4,4),B(4,4); gEul.JacobFlux(sol,A,B); for(in=0; in<numnod; in++) { for(idf=0; idf<4; idf++) { /* ef(4*in+idf) += weight*fDeltaT*( -phi(in,0)*flux[idf]*normal[0] -phi(in,0)*flux[idf+4]*normal[1] ); */ for(jn=0; jn<numnod; jn++) { for(jdf=0; jdf<4; jdf++) { ek(4*in+idf,4*jn+jdf) += weight*fDeltaT* (phi(in,0)*A(idf,jdf)*phi(jn,0)*normal[0] + phi(in,0)*B(idf,jdf)*phi(jn,0)*normal[1]); } } } } } }//fim switch } }
void TPZMatHybrid::ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix<REAL> &ek, TPZFMatrix<REAL> &ef, TPZBndCond &bc) { // TPZFMatrix<REAL> &dphi = data.dphix; // TPZFMatrix<REAL> &dphiL = data.dphixl; // TPZFMatrix<REAL> &dphiR = data.dphixr; TPZFMatrix<REAL> &phi = data.phi; // TPZFMatrix<REAL> &phiL = data.phil; // TPZFMatrix<REAL> &phiR = data.phir; // TPZManVector<REAL,3> &normal = data.normal; // TPZManVector<REAL,3> &x = data.x; // int &POrder=data.p; // int &LeftPOrder=data.leftp; // int &RightPOrder=data.rightp; // TPZVec<REAL> &sol=data.sol; // TPZVec<REAL> &solL=data.soll; // TPZVec<REAL> &solR=data.solr; // TPZFMatrix<REAL> &dsol=data.dsol; // TPZFMatrix<REAL> &dsolL=data.dsoll; // TPZFMatrix<REAL> &dsolR=data.dsolr; // REAL &faceSize=data.HSize; // TPZFMatrix<REAL> &daxesdksi=data.daxesdksi; // TPZFMatrix<REAL> &axes=data.axes; if(bc.Material().operator ->() != this){ PZError << "TPZMat1dLin.apply_bc warning : this material didn't create the boundary condition!\n"; } if(bc.Type() < 0 && bc.Type() > 2){ PZError << "TPZMat1dLin.aplybc, unknown boundary condition type :" << bc.Type() << " boundary condition ignored\n"; } int numdof = NStateVariables(); int numnod = ek.Rows()/numdof; int r = numdof; int idf,jdf,in,jn; switch(bc.Type()){ case 0: for(in=0 ; in<numnod ; ++in){ for(idf = 0;idf<r;idf++) { (ef)(in*r+idf,0) += gBigNumber*phi(in,0)*bc.Val2()(idf,0)*weight; } for(jn=0 ; jn<numnod ; ++jn) { for(idf = 0;idf<r;idf++) { ek(in*r+idf,jn*r+idf) += gBigNumber*phi(in,0)*phi(jn,0)*weight; } } } break; case 1: for(in=0 ; in<numnod ; ++in){ for(idf = 0;idf<r;idf++) { (ef)(in*r+idf,0) += phi(in,0)*bc.Val2()(idf,0)*weight; } } break; case 2: for(in=0 ; in<numnod ; ++in){ for(idf = 0;idf<r;idf++) { (ef)(in*r+idf,0) += phi(in,0)*bc.Val2()(idf,0)*weight; } for(jn=0 ; jn<numnod ; ++jn) { for(idf = 0;idf<r;idf++) { for(jdf = 0;jdf<r;jdf++) { ek(in*r+idf,jn*r+jdf) += bc.Val1()(idf,jdf)*phi(in,0)*phi(jn,0)*weight; } } } }//fim switch } }