NeoPZ
pzmat2dlin.h
Go to the documentation of this file.
1 
6 #ifndef MAT2DLINHPP
7 #define MAT2DLINHPP
8 
9 #include <iostream>
10 #include "TPZMaterial.h"
11 #include "pzfmatrix.h"
12 
13 struct TPZElementMatrix;
14 class TPZBndCond;
15 template<class T>
16 class TPZVec;
17 
22 class TPZMat2dLin : public TPZMaterial {
23 
25  public :
26 
28  TPZMaterial(num), fKxx(), fKxy(),
29  fKyx() , fKyy(), fKx0(), fK0x(), fKy0(), fK0y(), fK00(), fXf() {
30  }
31 
33  TPZMaterial(copy),
34  fKxx(copy.fKxx), fKxy(copy.fKxy), fKyx(copy.fKyx), fKyy(copy.fKyy),
35  fKx0(copy.fKx0), fK0x(copy.fK0x), fKy0(copy.fKy0),
36  fK0y(copy.fK0y), fK00(copy.fK00), fXf(copy.fXf){}
37 
38  virtual int NStateVariables() const override { return fKxx.Rows(); }
39 
40  virtual int Dimension() const override { return 2; }
41 
42  void Print(std::ostream & out = std::cout) override;
43 
45  int r = xkin.Rows();
46  fKxx = xkin;
47  fKyy = xkin;
48  fK00 = xcin;
49  fXf = xfin;
50  fKxy.Redim(r,r);
51  fKyx.Redim(r,r);
52  fKx0.Redim(r,r);
53  fK0x.Redim(r,r);
54  fKy0.Redim(r,r);
55  fK0y.Redim(r,r);
56  }
57 
58  void ConvectionDiffusion(REAL angle,REAL diff);
59 
60  TPZFMatrix<STATE> &Xk() {return fKxx;}
61  TPZFMatrix<STATE> &Ck() {return fK00;}
62  TPZFMatrix<STATE> &Xf() {return fXf;}
63 
64  virtual std::string Name() override { return "TPZMat2dLin"; }
65 
66  virtual void Contribute(TPZMaterialData &data,REAL weight,
67  TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef) override;
68 
69  virtual void Contribute(TPZMaterialData &data,REAL weight,
70  TPZFMatrix<STATE> &ef) override
71  {
72  TPZMaterial::Contribute(data,weight,ef);
73  }
74 
75  virtual void ContributeBC(TPZMaterialData &data, REAL weight,
77 
78  virtual void ContributeBC(TPZMaterialData &data, REAL weight,
79  TPZFMatrix<STATE> &ef,TPZBndCond &bc) override
80  {
81  TPZMaterial::ContributeBC(data,weight,ef,bc);
82  }
83 
84  virtual int NFluxes() override;
85 
86  virtual void Flux(TPZVec<REAL> &x, TPZVec<STATE> &u, TPZFMatrix<STATE> &dudx, TPZFMatrix<REAL> &axes, TPZVec<STATE> &fl) override;
87 
89  TPZVec<STATE> &u_exact,TPZFMatrix<STATE> &du_exact,TPZVec<REAL> &values) override;
90 
91  virtual int VariableIndex(const std::string &name) override;
92 
93  virtual int NSolutionVariables(int index) override;
94 
95 protected:
96  void Solution(TPZVec<STATE> &Sol,TPZFMatrix<STATE> &DSol,TPZFMatrix<REAL> &axes, int var,TPZVec<STATE> &Solout) override;
97 public:
98  virtual void Solution(TPZMaterialData &data, int var, TPZVec<STATE> &Solout) override
99  {
100  TPZMaterial::Solution(data,var,Solout);
101  }
103  virtual TPZMaterial * NewMaterial() override;
104 
105  TPZBndCond *OutflowFlux(TPZMaterial * &reference, int bc);
106 
112  public:
113 virtual int ClassId() const override;
114 
115 
117  virtual void Write(TPZStream &buf, int withclassid) const override;
118 
120  virtual void Read(TPZStream &buf, void *context) override;
121 
125 };
126 
127 #endif
void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override
Definition: pzmat2dlin.cpp:177
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 Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef) override
It computes a contribution to the residual vector at one integration point.
Definition: pzmat2dlin.h:69
TPZFMatrix< STATE > fKxy
Definition: pzmat2dlin.h:24
virtual int VariableIndex(const std::string &name) override
Returns the variable index associated with the name.
Definition: pzmat2dlin.cpp:161
clarg::argBool bc("-bc", "binary checkpoints", false)
TPZFMatrix< STATE > fXf
Definition: pzmat2dlin.h:24
virtual std::string Name() override
Returns the name of the material.
Definition: pzmat2dlin.h:64
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout) override
Returns the solution associated with the var index based on the finite element approximation.
Definition: pzmat2dlin.h:98
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
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...
Definition: pzmat2dlin.cpp:19
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)=0
It computes a contribution to the stiffness matrix and load vector at one integration point...
TPZFMatrix< STATE > fK0y
Definition: pzmat2dlin.h:24
TPZFMatrix< STATE > fKx0
Definition: pzmat2dlin.h:24
TPZFMatrix< STATE > fK00
Definition: pzmat2dlin.h:24
TPZFMatrix< STATE > fKyx
Definition: pzmat2dlin.h:24
void Errors(TPZVec< REAL > &x, TPZVec< STATE > &u, TPZFMatrix< STATE > &dudx, TPZFMatrix< REAL > &axes, TPZVec< STATE > &flux, 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...
Definition: pzmat2dlin.cpp:218
virtual int ClassId() const override
returns the unique identifier for reading/writing objects to streams
Definition: pzmat2dlin.cpp:267
TPZBndCond * OutflowFlux(TPZMaterial *&reference, int bc)
Definition: pzmat2dlin.cpp:257
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
TPZFMatrix< STATE > fK0x
Definition: pzmat2dlin.h:24
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
Definition: pzmat2dlin.cpp:272
TPZFMatrix< STATE > & Xf()
Definition: pzmat2dlin.h:62
TPZFMatrix< STATE > fKyy
Definition: pzmat2dlin.h:24
virtual int NSolutionVariables(int index) override
Returns the number of variables associated with the variable indexed by var.
Definition: pzmat2dlin.cpp:169
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
Definition: pzmat2dlin.h:38
Contains TPZMatrixclass which implements full matrix (using column major representation).
virtual TPZMaterial * NewMaterial() override
Creates a copy of the material object.
Definition: pzmat2dlin.cpp:232
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
Definition: pzmat2dlin.cpp:305
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
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...
Definition: pzmat2dlin.cpp:74
void ConvectionDiffusion(REAL angle, REAL diff)
Definition: pzmat2dlin.cpp:236
TPZFMatrix< STATE > fKy0
Definition: pzmat2dlin.h:24
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)=0
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
void SetMaterial(TPZFMatrix< STATE > &xkin, TPZFMatrix< STATE > &xcin, TPZFMatrix< STATE > &xfin)
Definition: pzmat2dlin.h:44
void Print(std::ostream &out=std::cout) override
Prints out the data associated with the material.
Definition: pzmat2dlin.cpp:147
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Definition: pzelmat.h:30
static REAL angle
Angle in radians to test.
Definition: pzsubcmesh.cpp:53
virtual int Dimension() const override
Returns the integrable dimension of the material.
Definition: pzmat2dlin.h:40
TPZFMatrix< STATE > & Xk()
Definition: pzmat2dlin.h:60
virtual void Flux(TPZVec< REAL > &x, TPZVec< STATE > &u, TPZFMatrix< STATE > &dudx, TPZFMatrix< REAL > &axes, TPZVec< STATE > &fl) override
Computes the value of the flux function to be used by ZZ error estimator.
Definition: pzmat2dlin.cpp:143
TPZMat2dLin(TPZMat2dLin &copy)
Definition: pzmat2dlin.h:32
Implements a bi-dimensional linear problem.
Definition: pzmat2dlin.h:22
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
Definition: pzmat2dlin.h:78
TPZMat2dLin(int num=1)
Definition: pzmat2dlin.h:27
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
def values
Definition: rdt.py:119
virtual int NFluxes() override
Returns the number of components which form the flux function.
Definition: pzmat2dlin.cpp:141
TPZFMatrix< STATE > & Ck()
Definition: pzmat2dlin.h:61
TPZFMatrix< STATE > fKxx
Definition: pzmat2dlin.h:24