20 static LoggerPtr logdata(Logger::getLogger(
"pz.TPZMatMixedPoisson3D.data"));
119 out <<
"name of material : " <<
Name() <<
"\n";
120 out <<
"Dimesion of problem " <<
fDim << endl;
121 out <<
"Material ID "<<
fMatId << endl;
122 out <<
"Forcing function "<<
fF << endl;
123 out <<
"Base Class properties :";
134 int phrq = datavec[0].fVecShapeIndex.
NElements();
139 std::cout <<
"\n Error.\n";
140 std::cout <<
"If you want to use the variational formulation with second integration by parts, you need to set fSecondIntegration==true\n";
149 int nref = datavec.
size();
151 std::cout <<
" Erro. The size of the datavec is different from 2 \n";
171 int phrp = phip.
Rows();
175 int nr = phiQ.
Rows();
177 REAL multiplier = -1.;
197 for(
int id=0;
id<
fDim;
id++){
198 for(
int jd=0; jd<
fDim; jd++){
200 PermTensor(
id,jd) = resultMat(
id,jd);
201 InvPermTensor(
id,jd) = resultMat(
id+fDim,jd);
208 for (
int iq = 0; iq<phrq; iq++)
210 int ivecind = datavec[0].fVecShapeIndex[iq].first;
211 int ishapeind = datavec[0].fVecShapeIndex[iq].second;
213 ivec(0,0) = datavec[0].fNormalVec(0,ivecind);
214 ivec(1,0) = datavec[0].fNormalVec(1,ivecind);
215 ivec(2,0) = datavec[0].fNormalVec(2,ivecind);
219 for (
int jq=0; jq<phrq; jq++)
222 int jvecind = datavec[0].fVecShapeIndex[jq].first;
223 int jshapeind = datavec[0].fVecShapeIndex[jq].second;
224 jvec(0,0) = datavec[0].fNormalVec(0,jvecind);
225 jvec(1,0) = datavec[0].fNormalVec(1,jvecind);
226 jvec(2,0) = datavec[0].fNormalVec(2,jvecind);
231 for(
int id=0;
id<3;
id++){
232 for(
int jd=0; jd<3; jd++){
233 jvecZ(
id,0) += InvPermTensor(
id,jd)*jvec(jd,0);
237 for(
int id=0;
id < 3;
id++) prod += ivec(
id,0)*jvecZ(
id,0);
238 ek(iq,jq) +=
fvisc*weight*phiQ(ishapeind,0)*phiQ(jshapeind,0)*prod;
247 for (
int ip = 0; ip<dphip.
Cols(); ip++) {
248 for (
int d = 0; d<dphipLoc.
Rows(); d++) {
249 for (
int j=0; j< 3; j++) {
250 dphip(j,ip)+=datavec[1].axes(d,j)*dphipLoc(d,ip);
255 for(
int iq=0; iq<phrq; iq++)
257 int ivecind = datavec[0].fVecShapeIndex[iq].first;
258 int ishapeind = datavec[0].fVecShapeIndex[iq].second;
260 ivec(0,0) = datavec[0].fNormalVec(0,ivecind);
261 ivec(1,0) = datavec[0].fNormalVec(1,ivecind);
262 ivec(2,0) = datavec[0].fNormalVec(2,ivecind);
264 for (
int jp=0; jp<phrp; jp++)
268 for(
int iloc=0; iloc<3; iloc++)
270 prod += (ivec(iloc,0)*phiQ(ishapeind,0))*GradofPhiL2(iloc,jp);
273 REAL fact = weight*prod;
275 ek(iq, phrq+jp) += fact;
278 ek(phrq+jp,iq) += fact;
296 for(
int ip=0; ip<phrp; ip++)
298 for (
int jp=0; jp<phrp; jp++)
300 REAL fact = (-1.)*weight*phip(ip,0)*phip(jp,0);
302 ek(phrq+ip, phrq+jp) += alpha*fact;
309 for(
int ip=0; ip<phrp; ip++){
310 ef(phrq+ip,0) += (-1.)*weight*force*phip(ip,0);
318 int nref = datavec.
size();
320 std::cout <<
" Erro. The size of the datavec is different from 2 \n";
342 for(
int id=0;
id<
fDim;
id++){
343 for(
int jd=0; jd<
fDim; jd++){
345 PermTensor(
id,jd) = resultMat(
id,jd);
346 InvPermTensor(
id,jd) = resultMat(
id+fDim,jd);
360 phrq = datavec[0].fVecShapeIndex.
NElements();
363 for(
int iq=0; iq<phrq; iq++)
365 int ivecind = datavec[0].fVecShapeIndex[iq].first;
366 int ishapeind = datavec[0].fVecShapeIndex[iq].second;
368 for(
int id=0;
id<
fDim;
id++){
369 ivec(
id,0) = datavec[0].fNormalVec(
id,ivecind);
374 for (
int jq=0; jq<phrq; jq++)
377 int jvecind = datavec[0].fVecShapeIndex[jq].first;
378 int jshapeind = datavec[0].fVecShapeIndex[jq].second;
380 for(
int id=0;
id<
fDim;
id++){
381 jvec(
id,0) = datavec[0].fNormalVec(
id,jvecind);
386 for(
int id=0;
id<
fDim;
id++){
387 for(
int jd=0; jd<
fDim; jd++){
388 jvecZ(
id,0) += InvPermTensor(
id,jd)*jvec(jd,0);
392 REAL prod1 = ivec(0,0)*jvecZ(0,0) + ivec(1,0)*jvecZ(1,0) + ivec(2,0)*jvecZ(2,0);
393 ek(iq,jq) +=
fvisc*weight*phiQ(ishapeind,0)*phiQ(jshapeind,0)*prod1;
398 for(
int iq=0; iq<phrq; iq++)
401 REAL divwq = divphi(iq,0)/datavec[0].detjac;
403 for (
int jp=0; jp<phrp; jp++) {
405 REAL fact = (-1.)*weight*phip(jp,0)*divwq;
407 ek(iq, phrq+jp) += fact;
410 ek(phrq+jp,iq) += fact;
427 for(
int ip=0; ip<phrp; ip++)
429 for (
int jp=0; jp<phrp; jp++)
432 REAL fact = (-1.)*weight*phip(ip,0)*phip(jp,0);
434 ek(phrq+ip, phrq+jp) += alpha*fact;
441 for(
int ip=0; ip<phrp; ip++){
442 ef(phrq+ip,0) += (-1.)*weight*force*phip(ip,0);
462 int nref = datavec.
size();
464 std::cout <<
" Erro.!! datavec tem que ser de tamanho 2 \n";
475 int phrq = phiQ.
Rows();
493 for(
int iq=0; iq<phrq; iq++)
496 ef(iq,0) += (-1.)*v2*phiQ(iq,0)*weight;
502 for(
int iq=0; iq<phrq; iq++)
505 for (
int jq=0; jq<phrq; jq++) {
507 ek(iq,jq)+=
gBigNumber*phiQ(iq,0)*phiQ(jq,0)*weight;
513 for(
int iq = 0; iq < phrq; iq++) {
515 ef(iq,0) += v2*phiQ(iq,0)*weight;
516 for (
int jq = 0; jq < phrq; jq++) {
517 ek(iq,jq) += weight*bc.
Val1()(0,0)*phiQ(iq,0)*phiQ(jq,0);
532 std::cout <<
"Boundary condition not found!";
544 int nref = datavec.
size();
545 for(
int i = 0; i<nref; i++)
547 datavec[i].fNeedsSol =
false;
548 datavec[i].fNeedsNormal =
false;
554 if(!strcmp(
"Flux",name.c_str()))
return 1;
555 if(!strcmp(
"Pressure",name.c_str()))
return 2;
556 if(!strcmp(
"GradFluxX",name.c_str()))
return 3;
557 if(!strcmp(
"GradFluxY",name.c_str()))
return 4;
558 if(!strcmp(
"GradFluxZ",name.c_str()))
return 5;
559 if(!strcmp(
"ExactPressure",name.c_str()))
return 6;
560 if(!strcmp(
"ExactFlux",name.c_str()))
return 7;
561 if(!strcmp(
"Rhs",name.c_str()))
return 8;
562 if(!strcmp(
"GradP",name.c_str()))
return 9;
563 if(!strcmp(
"Divergence",name.c_str()))
return 10;
564 if(!strcmp(
"ExactDiv",name.c_str()))
return 11;
565 if(!strcmp(
"POrder",name.c_str()))
return 12;
571 if(var == 1)
return fDim;
572 if(var == 2 || var == 12)
return 1;
573 if(var == 3)
return 3;
574 if(var == 4)
return 3;
575 if(var == 5)
return 3;
576 if(var == 6)
return 1;
577 if(var == 7)
return fDim;
578 if(var == 8 || var == 10 || var == 11)
return 1;
579 if(var == 9)
return fDim;
591 SolP = datavec[1].sol[0];
595 for (
int ip = 0; ip<
fDim; ip++)
597 Solout[ip] = datavec[0].sol[0][ip];
610 Solout[ip] = datavec[0].dsol[0](ip,0);
618 Solout[ip] = datavec[0].dsol[0](ip,1);
626 Solout[ip] = datavec[0].dsol[0](ip,2);
638 Solout[0] = solExata[0];
644 for (
int ip = 0; ip<
fDim; ip++)
646 Solout[ip] = flux(ip,0);
670 for (
int ip = 0; ip<
fDim; ip++)
672 Solout[ip] = -1.0*GradofP(ip,0);
679 for(
int i=0; i<
fDim; i++){
680 val += datavec[0].dsol[0](i,i);
688 Solout[0]=flux(
fDim,0);
693 Solout[0] = datavec[1].p;
705 for (
int ip = 0; ip<3; ip++)
707 Solout[ip] = data.
sol[0][ip];
728 #ifndef STATE_COMPLEX 733 for(
id=0 ;
id<
fDim;
id++) {
736 Solout[id] = dsoldx(
id,0);
752 int nref = datavec.
size();
753 for(
int i = 0; i<nref; i++)
755 datavec[i].SetAllRequirements(
false);
756 datavec[i].fNeedsSol =
false;
757 datavec[i].fNeedsNeighborSol =
false;
758 datavec[i].fNeedsNeighborCenter =
false;
759 datavec[i].fNeedsNormal =
false;
770 for(
int id=0;
id<3;
id++) {
771 REAL diffFlux =
abs(dual[
id] - du_exact(
id,0));
773 values[1] += diffFlux*diffFlux;
792 REAL diff =
fabs(sol[0] - u_exact[0]);
793 values[1] = diff*diff;
796 for(
id=0;
id<
fDim;
id++) {
802 values[0] = values[1]+values[2];
void Print(std::ostream &out) override
Prints out the data associated with the material.
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to the stiffness matrix and load vector at one integration point...
TPZMatMixedPoisson3D & operator=(const TPZMatMixedPoisson3D ©)
Material which implements a Lagrange Multiplier.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
void ContributeWithoutSecondIntegration(TPZVec< TPZMaterialData > &datavec, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
This method use piola contravariant mapping for nonlinear mappings.
TPZFMatrix< REAL > fTensorK
permeability tensor. Coeficient which multiplies the gradient operator
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...
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)
TPZMaterial & operator=(const TPZMaterial ©)
operator =
virtual void Identity()
Converts the matrix in an identity matrix.
virtual int VariableIndex(const std::string &name)
Returns the variable index associated with the name.
TPZFMatrix< REAL > fInvK
inverse of the permeability tensor.
virtual void FillBoundaryConditionDataRequirement(int type, TPZVec< TPZMaterialData > &datavec) override
This method defines which parameters need to be initialized in order to compute the contribution of t...
bool fSecondIntegration
Parameter to choose the second integration by parts in the variational formulation.
TinyFad< 8, T > abs(const TinyFad< 8, T > &in)
This class implements a simple vector storage scheme for a templated class T. Utility.
REAL val(STATE &number)
Returns value of the variable.
virtual int ClassId() const override
Define the class id associated with the class.
TPZFMatrix< STATE > & Val2(int loadcase=0)
virtual void Print(std::ostream &out=std::cout)
Prints out the data associated with the material.
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...
This abstract class defines the behaviour which each derived class needs to implement.
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 int NEvalErrors()
Returns the number of norm errors. Default is 3: energy, L2 and H1.
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
virtual void FillDataRequirements(TPZVec< TPZMaterialData > &datavec) override
It computes a contribution to stiffness matrix and load vector at one BC integration point...
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.
This class defines the boundary condition for TPZMaterial objects.
void ErrorsHdiv(TPZMaterialData &data, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &values) override
virtual std::string Name() override
Returns the name of the material.
int64_t Rows() const
Returns number of rows.
int Dimension() const override
Returns the integrable dimension of the material.
TPZFMatrix< STATE > & Val1()
Contains the TPZMaterialData class which implements an interface between TPZCompEl::CalcStiff and TPZ...
virtual int HasForcingFunction()
Directive that gives true if the material has a forcing function.
TPZAutoPointer< TPZFunction< STATE > > fPermeabilityFunction
Pointer to forcing function, it is the Permeability and its inverse.
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.
TPZLagrangeMultiplier * fmatLagr
virtual void SetMultiplier(STATE mult)
int32_t Hash(std::string str)
int ClassId() const override
Unique identifier for serialization purposes.
int VariableIndex(const std::string &name) override
virtual ~TPZMatMixedPoisson3D()
virtual int NSolutionVariables(int var)
Returns the number of variables associated with the variable indexed by var.
void Errors(TPZVec< REAL > &x, TPZVec< STATE > &u, TPZFMatrix< STATE > &dudx, TPZFMatrix< REAL > &axes, TPZVec< STATE > &, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &values) override
Computes the error due to the difference between the interpolated flux and the flux computed based o...
TPZAutoPointer< TPZFunction< STATE > > fForcingFunction
Pointer to forcing function, it is the right member at differential equation.
REAL fvisc
fluid viscosity
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.
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
int64_t NElements() const
Returns the number of elements of the vector.
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.
Material to solve a mixed poisson problem 3D by multiphysics simulation.
TPZSolVec sol
vector of the solutions at the integration point
TPZAutoPointer< TPZFunction< STATE > > fReactionTermFunction
Pointer to forcing function, it is the reaction term.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.