NeoPZ
pzpoisson3dreferred.cpp
Go to the documentation of this file.
1 
6 #include "pzpoisson3dreferred.h"
7 
8 using namespace std;
9 
12  this->falpha = -1.;
13 }
14 
16 
18  const int dim = this->Dimension();
19  TPZManVector<REAL,3> V(dim);
20  const int pos = 1; // first column stores current solution. second column stores previous solution which is requested here. Then pos = 1.
21  for(int i = 0; i < dim; i++){
22  V[i] = -1. * dsol(i,pos);
23  }//for
24 
25  for(int i = 0; i < 3; i++) this->fConvDir[i] = 0.;
26 
27  switch(dim) {
28  case 1:
29  this->fConvDir[0] = axes(0,0) * V[0];
30  this->fConvDir[1] = axes(0,1) * V[0];
31  this->fConvDir[2] = axes(0,2) * V[0];
32  break;
33  case 2:
34  this->fConvDir[0] = axes(0,0) * V[0] + axes(1,0) * V[1];
35  this->fConvDir[1] = axes(0,1) * V[0] + axes(1,1) * V[1];
36  this->fConvDir[2] = axes(0,2) * V[0] + axes(1,2) * V[1];
37  break;
38  case 3:
39  this->fConvDir[0] = axes(0,0) * V[0] + axes(1,0) * V[1] + axes(2,0) * V[2];
40  this->fConvDir[1] = axes(0,1) * V[0] + axes(1,1) * V[1] + axes(2,1) * V[2];
41  this->fConvDir[2] = axes(0,2) * V[0] + axes(1,2) * V[1] + axes(2,2) * V[2];
42  break;
43  default:
44  PZError << "TPZMatPoisson3dReferred::SetConvectionTerm - Dimension error " << fDim << endl;
45  }
46 
47  this->fC = this->falpha;
48 }
49 
51  const int dim = this->Dimension();
52  const int pos = 1; // first column stores current solution. second column stores previous solution which is requested here. Then pos = 1.
53  for(int i = 0; i < dim; i++){
54  this->fConvDir[i] = -1. * ( 0.5 * ( dsolL(i,pos) + dsolR(i,pos) ) );
55  }//for
56  this->fC = this->falpha;
57 }
58 
60  REAL weight,
61  TPZFMatrix<STATE> &ek,
62  TPZFMatrix<STATE> &ef){
63  int numbersol = data.dsol.size();
64  if (numbersol != 1) {
65  DebugStop();
66  }
67 
68  SetConvectionTerm(data.dsol[0], data.axes);
69  TPZMatPoisson3d::Contribute(data, weight, ek, ef);
70 }
71 
73  REAL weight,
76  TPZBndCond &bc){
77  TPZMatPoisson3d::ContributeBC(data, weight, ek, ef, bc);
78 }
79 
81  REAL weight,
83  TPZFMatrix<STATE> &ef){
84  int numbersol = dataleft.dsol.size();
85  if (numbersol != 1) {
86  DebugStop();
87  }
88 
89  TPZFMatrix<STATE> dsolL=dataleft.dsol[0];
90  TPZFMatrix<STATE> dsolR=dataright.dsol[0];
91  SetConvectionTermInterface(dsolL, dsolR);
92  TPZMatPoisson3d::ContributeInterface(data, dataleft, dataright, weight, ek, ef);
93 }
94 
96  REAL weight,
99  TPZBndCond &bc){
100  int numbersol = dataleft.dsol.size();
101  if (numbersol != 1) {
102  DebugStop();
103  }
104 
105  SetConvectionTermInterface(dataleft.dsol[0], dataleft.dsol[0]);
106  TPZMatPoisson3d::ContributeBCInterface(data, dataleft, weight, ek, ef, bc);
107 }
108 
110  return Hash("TPZMatPoisson3dReferred") ^ TPZMatPoisson3d::ClassId() << 1;
111 }
clarg::argBool bc("-bc", "binary checkpoints", false)
int Dimension() const override
Returns the integrable dimension of the material.
Definition: pzpoisson3d.h:158
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to stiffness matrix and load vector at one integration point...
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to stiffness matrix and load vector at one integration point...
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
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...
void SetConvectionTermInterface(TPZFMatrix< STATE > &dsolL, TPZFMatrix< STATE > &dsolR)
Sets convection term for ContributeInterface methods.
REAL fC
Variable which multiplies the convection term of the equation.
Definition: pzpoisson3d.h:40
virtual int ClassId() const override
Unique identifier for serialization purposes.
virtual void ContributeBC(TPZMaterialData &data, 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...
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef) override
It computes a contribution to the residual vector at one integration point.
Definition: pzpoisson3d.h:199
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
Contains the TPZMatPoisson3dReferred class which implements a version of TPZMatPoisson3d (convection...
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...
Definition: pzpoisson3d.h:207
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
TPZMatPoisson3dReferred(int nummat, int dim)
DESCRIBE PLEASE.
Definition: pzpoisson3d.h:26
REAL fConvDir[3]
Direction of the convection operator.
Definition: pzpoisson3d.h:43
int fDim
Problem dimension.
Definition: pzpoisson3d.h:34
void SetConvectionTerm(TPZFMatrix< STATE > &dsol, TPZFMatrix< REAL > &axes)
Sets convection term.
This class implements a version of TPZMatPoisson3d where the convection term is given at each integr...
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual int ClassId() const override
Unique identifier for serialization purposes.