18 static LoggerPtr logdata(Logger::getLogger(
"pz.mixedpoisson.data"));
19 static LoggerPtr logerror(Logger::getLogger(
"pz.mixedpoisson.error"));
95 out <<
"name of material : " <<
Name() <<
"\n";
96 out <<
"Base Class properties :";
107 InvPermTensor = this->
fInvK;
111 InvPermTensor.
Zero();
116 for(
int id=0;
id<3;
id++){
117 for(
int jd=0; jd<3; jd++){
119 PermTensor(
id,jd) = resultMat(
id,jd);
120 InvPermTensor(
id,jd) = resultMat(
id+
fDim,jd);
161 REAL &faceSize = datavec[0].HSize;
163 fh2 = faceSize*faceSize;
168 phrq = datavec[0].fVecShapeIndex.
NElements();
171 for (
int i=0; i<datavec.
size(); i++) {
172 if (datavec[i].fActiveApproxSpace) {
179 int phrgb = datavec[2].phi.Rows();
180 int phrub = datavec[3].phi.Rows();
181 if(phrp+phrq+phrgb+phrub != ek.
Rows())
187 if(phrp+phrq != ek.
Rows())
194 for(
int iq=0; iq<phrq; iq++)
197 int ivecind = datavec[0].fVecShapeIndex[iq].first;
198 int ishapeind = datavec[0].fVecShapeIndex[iq].second;
200 for(
int id=0;
id<3;
id++){
201 ivec(
id,0) = datavec[0].fNormalVec(
id,ivecind);
210 datavec[0].axes.Multiply(ivec,axesvec);
211 for(
int iloc=0; iloc<
fDim; iloc++)
213 divqi += axesvec(iloc,0)*dphiQ(iloc,ishapeind);
215 ef(iq, 0) += weight*(
fdelta2*divqi*force);
220 for (
int jq=0; jq<phrq; jq++)
223 int jvecind = datavec[0].fVecShapeIndex[jq].first;
224 int jshapeind = datavec[0].fVecShapeIndex[jq].second;
226 for(
int id=0;
id<3;
id++){
227 jvec(
id,0) = datavec[0].fNormalVec(
id,jvecind);
232 for(
int id=0;
id<
fDim;
id++){
233 for(
int jd=0; jd<
fDim; jd++){
234 jvecZ(
id,0) += InvPermTensor(
id,jd)*jvec(jd,0);
238 REAL prod1 = ivec(0,0)*jvecZ(0,0) + ivec(1,0)*jvecZ(1,0) + ivec(2,0)*jvecZ(2,0);
239 ek(iq,jq) +=
fvisc*weight*phiQ(ishapeind,0)*phiQ(jshapeind,0)*prod1;
248 for(
int id=0;
id<
fDim;
id++){
249 for(
int jd=0; jd<
fDim; jd++){
250 ivecZ(
id,0) += InvPermTensor(
id,jd)*ivec(jd,0);
254 REAL prod2 = ivecZ(0,0)*jvec(0,0) + ivecZ(1,0)*jvec(1,0) + ivecZ(2,0)*jvec(2,0);
255 ek(iq,jq) += (-1.)*weight*
fh2*
fdelta1*
fvisc*phiQ(ishapeind,0)*phiQ(jshapeind,0)*prod2;
261 datavec[0].axes.Multiply(jvec,axesvec);
263 for(
int jloc=0; jloc<
fDim; jloc++)
265 divqj += axesvec(jloc,0)*dphiQ(jloc,jshapeind);
267 ek(iq,jq) += weight*
fdelta2*divqi*divqj;
275 for(
int iq=0; iq<phrq; iq++)
277 int ivecind = datavec[0].fVecShapeIndex[iq].first;
278 int ishapeind = datavec[0].fVecShapeIndex[iq].second;
281 for(
int id=0;
id<3;
id++){
282 ivec(
id,0) = datavec[0].fNormalVec(
id,ivecind);
287 datavec[0].axes.Multiply(ivec,axesvec);
290 for(
int iloc=0; iloc<
fDim; iloc++)
292 divwq += axesvec(iloc,0)*dphiQ(iloc,ishapeind);
294 for (
int jp=0; jp<phrp; jp++) {
296 REAL fact = (-1.)*weight*phip(jp,0)*divwq;
298 ek(iq, phrq+jp) += fact;
301 ek(phrq+jp,iq) += fact;
310 for(
int k =0; k<
fDim; k++)
312 dotVGradP += ivec(k,0)*phiQ(ishapeind,0)*dphiP(k,jp);
315 REAL integration = (-1.)*weight*
fh2*
fdelta1*dotVGradP;
318 ek(iq, phrq+jp) += integration;
321 ek(phrq+jp,iq) += integration;
327 for(
int ip=0; ip<phrp; ip++){
328 ef(phrq+ip,0) += (-1.)*weight*force*phip(ip,0);
336 PermTensor.
Multiply(dphiPXY, dphiPuZ);
338 REAL umSobreVisc = 1./
fvisc;
339 for(
int ip=0; ip<phrp; ip++)
341 for(
int jp=0; jp<phrp; jp++)
343 for(
int k =0; k<3; k++)
345 ek(phrq+ip, phrq+jp) += (-1.)*weight*
fh2*
fdelta1*umSobreVisc*dphiPuZ(k,ip)*dphiPXY(k,jp);
353 for(
int ip=0; ip<phrp; ip++)
355 ek(phrq+ip,phrq+phrp) += phip(ip,0)*weight;
356 ek(phrq+phrp,phrq+ip) += phip(ip,0)*weight;
358 ek(phrp+phrq+1,phrq+phrp) += -weight;
359 ek(phrq+phrp,phrp+phrq+1) += -weight;
557 int nref = datavec.
size();
562 if (bc.
Type() > 2 ) {
563 std::cout <<
" Erro.!! Neste material utiliza-se apenas condicoes de Neumann e Dirichlet\n";
572 int phrq = phiQ.
Rows();
574 REAL v2 = bc.
Val2()(0,0);
575 REAL v1 = bc.
Val1()(0,0);
585 else if(bc.
Type() == 1 || bc.
Type() == 2)
590 for(
int i=0; i<3; i++)
592 for(
int j=0; j<3; j++)
594 normflux -= datavec[0].normal[i]*PermTensor(i,j)*gradu(j,0);
615 for(
int iq=0; iq<phrq; iq++)
618 ef(iq,0) += (-1.)*v2*phiQ(iq,0)*weight;
624 for(
int iq=0; iq<phrq; iq++)
627 for (
int jq=0; jq<phrq; jq++) {
629 ek(iq,jq)+=
gBigNumber*phiQ(iq,0)*phiQ(jq,0)*weight;
635 for(
int iq = 0; iq < phrq; iq++) {
637 ef(iq,0) += v2*phiQ(iq,0)*weight;
638 for (
int jq = 0; jq < phrq; jq++) {
639 ek(iq,jq) += weight/v1*phiQ(iq,0)*phiQ(jq,0);
649 if(!strcmp(
"Flux",name.c_str()))
return 31;
650 if(!strcmp(
"Pressure",name.c_str()))
return 32;
651 if(!strcmp(
"GradFluxX",name.c_str()))
return 33;
652 if(!strcmp(
"GradFluxY",name.c_str()))
return 34;
653 if(!strcmp(
"DivFlux",name.c_str()))
return 35;
655 if(!strcmp(
"ExactPressure",name.c_str()))
return 36;
656 if(!strcmp(
"ExactFlux",name.c_str()))
return 37;
658 if(!strcmp(
"POrder",name.c_str()))
return 38;
659 if(!strcmp(
"GradPressure",name.c_str()))
return 39;
660 if(!strcmp(
"Divergence",name.c_str()))
return 40;
661 if(!strcmp(
"ExactDiv",name.c_str()))
return 41;
662 if (!strcmp(
"Derivative",name.c_str())) {
665 if (!strcmp(
"Permeability",name.c_str())) {
668 if(!strcmp(
"g_average",name.c_str()))
return 44;
669 if(!strcmp(
"u_average",name.c_str()))
return 45;
675 if(var == 31)
return 3;
676 if(var == 32 || var==8)
return 1;
677 if(var == 33)
return 3;
678 if(var == 34)
return 3;
679 if(var == 35)
return 1;
680 if(var == 36)
return 1;
681 if(var == 37)
return fDim;
682 if(var == 38)
return 1;
683 if(var == 39)
return fDim;
684 if(var == 40 || var == 41)
return 1;
685 if(var == 42)
return 3;
686 if(var == 43)
return 1;
687 if(var == 44)
return 1;
688 if(var == 45)
return 1;
702 PermTensor.
Redim(3,3);
703 InvPermTensor.
Redim(3,3);
708 for(
int id=0;
id<3;
id++){
709 for(
int jd=0; jd<3; jd++){
711 PermTensor(
id,jd) = resultMat(
id,jd);
712 InvPermTensor(
id,jd) = resultMat(
id+3,jd);
720 SolP = datavec[1].sol[0];
723 for (
int i=0; i<3; i++)
725 Solout[i] = datavec[0].sol[0][i];
737 Solout[0]=datavec[0].dsol[0](0,0);
738 Solout[1]=datavec[0].dsol[0](1,0);
739 Solout[2]=datavec[0].dsol[0](2,0);
744 Solout[0]=datavec[0].dsol[0](0,1);
745 Solout[1]=datavec[0].dsol[0](1,1);
746 Solout[2]=datavec[0].dsol[0](2,1);
751 Solout[0]=datavec[0].dsol[0](0,0)+datavec[0].dsol[0](1,1);
766 Solout[0] = solExata[0];
781 for (
int idi = 0; idi < gradu.
Rows(); idi++)
782 for (
int jdi = 0; jdi < gradu.
Cols(); jdi++)
783 gradutmp(idi, jdi) = gradu(idi, jdi);
785 PermTensor.
Multiply(gradutmp, fluxtmp);
787 for (
int i=0; i<
fDim; i++)
789 Solout[i] = fluxtmp(i,0);
796 Solout[0] = datavec[1].p;
806 for (
int i=0; i<
fDim; i++)
808 dsoldaxes(i,0) = datavec[1].dsol[0][i];;
815 for (
int i=0; i<
fDim; i++)
817 Solout[i] = dsoldx(i,0);
825 Solout[0]=datavec[0].dsol[0](0,0)+datavec[0].dsol[0](1,1);
836 for(
int i=0; i<
fDim; i++)
840 for (
int i=0; i<
fDim; i++) {
841 for (
int j=0; j<
fDim; j++) {
842 Solout[i] -= InvPermTensor(i,j)*datavec[0].sol[0][i];
849 Solout[0] = PermTensor(0,0);
853 if(datavec.
size() == 4)
857 Solout[0] = datavec[2].sol[0][0];
862 Solout[0] = datavec[3].sol[0][0];
874 int nref = datavec.
size();
875 for(
int i = 0; i<nref; i++ )
877 datavec[i].SetAllRequirements(
false);
878 datavec[i].fNeedsNeighborSol =
false;
879 datavec[i].fNeedsNeighborCenter =
false;
880 datavec[i].fNeedsNormal =
true;
881 datavec[i].fNeedsHSize =
true;
907 for (
int i=0; i<3; i++) {
908 for (
int j=0; j<3; j++)
911 perm(3+i,j) = this->
fInvK(i,j);
917 if(logerror->isDebugEnabled())
919 std::stringstream sout;
921 sout <<
"x " << data[0].x << std::endl;
922 sout <<
"u_exact " << u_exact << std::endl;
923 du_exact.
Print(
"du_exact",sout);
924 sout <<
"deriv " << deriv << std::endl;
925 sout <<
"pressure " << pressure << std::endl;
931 STATE diff = pressure[0] - u_exact[0];
932 errors[1] = diff*diff;
935 for(
id=0;
id<3;
id++) {
936 diff = deriv[id] - du_exact(
id,0);
937 errors[2] +=
fK*diff*diff;
942 for (
int i=0; i<3; i++) {
943 for (
int j=0; j<3; j++) {
944 errors[0] += (deriv[i] - du_exact(i,0))*perm(i,j)*(deriv[i] - du_exact(j,0));
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
virtual int NEvalErrors() override
Returns the number of norm errors. Default is 3: energy, L2 and H1.
TPZFNMatrix< 9, REAL > fInvK
inverse of the permeability tensor.
REAL fvisc
fluid viscosity
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
Implements a vector class which allows to use external storage provided by the user. Utility.
clarg::argBool bc("-bc", "binary checkpoints", false)
int Dimension() const override
Returns the integrable dimension of the material.
virtual void Identity()
Converts the matrix in an identity matrix.
void GetPermeability(TPZVec< REAL > &x, TPZFMatrix< REAL > &K, TPZFMatrix< REAL > &invK)
return the permeability and compute it if there is permeability function
virtual void ContributeBC(TPZVec< TPZMaterialData > &datavec, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to the stiffness matrix and load vector at one BC integration point to mul...
REAL fh2
Coeficient that multiplies the Stabilization term fdelta1.
REAL val(STATE &number)
Returns value of the variable.
virtual std::string Name() override
Returns the name of the material.
TPZFMatrix< STATE > & Val2(int loadcase=0)
virtual int VariableIndex(const std::string &name) override
virtual void FillDataRequirements(TPZVec< TPZMaterialData > &datavec) override
Fill material data parameter with necessary requirements for the Contribute method. Here, in base class, all requirements are considered as necessary. Each derived class may optimize performance by selecting only the necessary data.
virtual int ClassId() const override
Unique identifier for serialization purposes.
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
TPZAutoPointer< TPZFunction< STATE > > & ForcingFunction()
Returns a procedure as source function for the material.
int Zero() override
Makes Zero all the elements.
int64_t size() const
Returns the number of elements of the vector.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
virtual void Solution(TPZVec< TPZMaterialData > &datavec, int var, TPZVec< STATE > &Solout) override
It return a solution to multiphysics simulation.
STATE fK
Coeficient which multiplies the Laplacian operator.
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
TPZAutoPointer< TPZFunction< STATE > > fForcingFunctionExact
Pointer to exact solution function, needed to calculate exact error.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
This class defines the boundary condition for TPZMaterial objects.
int64_t Rows() const
Returns number of rows.
TPZFMatrix< STATE > & Val1()
REAL ff
Forcing function value.
virtual int VariableIndex(const std::string &name) override
virtual int HasForcingFunction()
Directive that gives true if the material has a forcing function.
virtual void Solution(TPZVec< TPZMaterialData > &datavec, int var, TPZVec< STATE > &Solout) override
Returns the solution associated with the var index based on the finite element approximation.
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
int32_t Hash(std::string str)
Material to solve a mixed poisson problem 2d by multiphysics simulation.
virtual void Contribute(TPZVec< TPZMaterialData > &datavec, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to the stiffness matrix and load vector at one integration point to multip...
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
TPZFNMatrix< 9, REAL > fTensorK
permeability tensor. Coeficient which multiplies the gradient operator
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
TPZAutoPointer< TPZFunction< STATE > > fPermeabilityFunction
post-processing procedure for error estimation as Ainsworth
virtual void Multiply(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &res, int opt=0) const
It mutiplies itself by TPZMatrix<TVar>A putting the result in res.
TPZAutoPointer< TPZFunction< STATE > > fForcingFunction
Pointer to forcing function, it is the right member at differential equation.
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
void Fill(const T ©, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
int64_t Cols() const
Returns number of cols.
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
virtual void Print(std::ostream &out) const
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
int fDim
Problem dimension.
TPZMatPoisson3d & operator=(const TPZMatPoisson3d ©)
int64_t NElements() const
Returns the number of elements of the vector.
virtual ~TPZMixedPoisson()
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
bool fIsStabilized
Choose Stabilized method.
REAL fdelta1
Coeficient of Stabilization.
virtual void Errors(TPZVec< TPZMaterialData > &data, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &errors) override
virtual int ClassId() const override
Unique identifier for serialization purposes.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
TPZMixedPoisson & operator=(const TPZMixedPoisson ©)