NeoPZ
pzmaterialcoupling.cpp
Go to the documentation of this file.
1 /*
2  * @file
3  * @author Denise de Siqueira
4  * @brief Contains the implementation of the TPZMaterialCoupling methods.
5  */
6 
7 #include "pzmaterialcoupling.h"
8 #include "pzmaterialdata.h"
9 #include "pzmatrix.h"
10 #include "pzlog.h"
11 #include "pzpoisson3d.h"
12 #include "pzgeoel.h"
13 
14 #ifdef LOG4CXX
15 static LoggerPtr logger(Logger::getLogger("pz.material.poisson3d.materialcoupling"));
16 #endif
17 
20 TPZMatPoisson3d( nummat, dim){
21  this->NStateVariables();
22 
23 
24 }
25 
28 }
29 
31 }
32 
34 
35  TPZFMatrix<REAL> &phiH1 = dataright.phi;
36  TPZFMatrix<REAL> &phiHdiv = dataleft.phi;
37  int numvec=dataleft.fVecShapeIndex.NElements();
38  int nrowH1=phiH1.Rows();//Funcao a direita H1
39  int numdual = dataleft.numberdualfunctions;
40 
41  TPZFMatrix<REAL> ekCouple(numvec+numdual,nrowH1,0.);
42  //vou precisar da orientacao das normais na interface
43 
44  REAL leftX0=data.normal[0];
45  REAL leftX1=data.normal[1];
46  REAL leftX2=data.normal[2];
47 
48 
49  for(int ilinha=0; ilinha<numvec; ilinha++) {
50  int ivecind = dataleft.fVecShapeIndex[ilinha].first;
51  int ishapeind = dataleft.fVecShapeIndex[ilinha].second;
52  REAL prod=dataleft.fNormalVec(0,ivecind)*leftX0+dataleft.fNormalVec(1,ivecind)*leftX1+dataleft.fNormalVec(2,ivecind)*leftX2;
53 
54 
55  for(int jcol=0; jcol<nrowH1; jcol++) {
56 
57  REAL prod1 = phiHdiv(ishapeind,0)*phiH1(jcol,0)*prod;
58 
59 
60 #ifdef LOG4CXX
61  if (logger->isDebugEnabled())
62  {
63  std::stringstream sout;
64  sout << "prod phiHdiv[ " <<ishapeind << "]= " << phiHdiv(ishapeind,0)<< " phiH1[ "<< jcol << "] = " << phiH1(jcol,0)<< std::endl;
65  LOGPZ_DEBUG(logger, sout.str().c_str());
66  }
67 #endif
68  ekCouple(ilinha,jcol)+= weight * prod1;
69  ek(ilinha,numdual+ numvec+jcol) += weight * (prod1);
70 
71 #ifdef LOG4CXX
72  if (logger->isDebugEnabled())
73  {
74  std::stringstream sout;
75  sout << "-- PosJ " << numdual+ numvec+jcol<< std::endl;
76  LOGPZ_DEBUG(logger, sout.str().c_str());
77  }
78 #endif
79  ek(jcol+numvec+numdual,ilinha) += weight *(-prod1);
80  }
81  }
82 
83  ekCouple.Print("Matriz teste Acoplamento",std::cout);
84 #ifdef LOG4CXX
85  {
86  std::stringstream sout;
87  ekCouple.Print("Matriz teste Acoplamento",sout);
88  LOGPZ_DEBUG(logger, sout.str().c_str());
89  }
90 #endif
91 
92 }
93 
95  REAL weight,TPZFMatrix<REAL> &ek,TPZFMatrix<REAL> &ef){
96 
97  TPZFMatrix<REAL> &phixL = dataleft.phi;
98 
99  TPZFMatrix<REAL> &phixR = dataright.phi;
100 
101 
102 
103  int numvec=dataright.fVecShapeIndex.NElements();
104  int nrowR=phixR.Rows();//funcao a direita Hdiv
105  int nrowL=phixL.Rows();//Funcao a esquerda H1
106  int numdual = dataright.numberdualfunctions;
107 
108  std::cout << "numero de funcoes de Hdiv( direita ) " << nrowR<<std::endl;
109  std::cout << "numero de funcoes de de pressao(direita) " << numdual<<std::endl;
110  std::cout << "numero de funcoes de H1 (esquerda ) " << nrowL<<std::endl;
111 #ifdef LOG4CXX
112  if (logger->isDebugEnabled())
113  {
114  std::stringstream sout;
115  sout << "numero de funcoes de Hdiv( direita ) " << nrowR<<std::endl;
116  sout << "numero de funcoes de de pressao(direita) " << numdual<<std::endl;
117  sout << "numero de funcoes de H1 (esquerda ) " << nrowL<<std::endl;
118  LOGPZ_DEBUG(logger, sout.str().c_str());
119  }
120 #endif
121 
122  for(int ir=0; ir<nrowR-1; ir++) {
123  int ishapeind = dataright.fVecShapeIndex[ir].second;
124  for(int jl=0; jl<nrowL; jl++) {
125  REAL prod1 = phixR(ishapeind,0)* phixL(jl);
126 #ifdef LOG4CXX
127  if (logger->isDebugEnabled())
128  {
129  std::stringstream sout;
130  sout << "produto das phis " << prod1<<std::endl;
131  LOGPZ_DEBUG(logger, sout.str().c_str());
132  }
133 #endif
134  ek(ir,numvec+jl) += weight * prod1;
135  ek(numvec+jl,ir) += weight *(-prod1);
136  }
137  }
138 
139 
140 #ifdef LOG4CXX
141  if (logger->isDebugEnabled())
142  {
143  std::stringstream sout;
144  ek.Print("Matriz de Acoplamento",sout);
145  LOGPZ_DEBUG(logger, sout.str().c_str());
146  }
147 #endif
148 }
149 
151  return ;
152 }
153 
155  return Hash("TPZMaterialCoupling") ^ TPZMatPoisson3d::ClassId() << 1;
156 }
TPZManVector< REAL, 3 > normal
normal to the element at the 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.
virtual ~TPZMaterialCoupling()
Destructor.
int ClassId() const override
Unique identifier for serialization purposes.
Contains the TPZMatPoisson3d class.
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
virtual int ClassId() const override
Unique identifier for serialization purposes.
Implemented a Poisson Problem coupling the interpolation spaces H(div) and H1.
TPZFNMatrix< 180 > fNormalVec
list of normal vectors
virtual void ContributeInterface2(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< REAL > &ek, TPZFMatrix< REAL > &ef)
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
int numberdualfunctions
number of dual function (e.g. pressure in HDiv approximations)
virtual void InitMaterialData(TPZMaterialData &data)
Contains the TPZMaterialData class which implements an interface between TPZCompEl::CalcStiff and TPZ...
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
Contains TPZMatrix<TVar>class, root matrix class.
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
Method to possibilite the coupling between H(div) and H1.
DESCRIBE PLEASE.
Definition: pzpoisson3d.h:26
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
Definition: pzpoisson3d.h:161
TPZManVector< std::pair< int, int64_t > > fVecShapeIndex
correspondence between normal vector index and index of the shape functions
TPZMaterialCoupling()
Default constructor.