NeoPZ
pzcoupledtransportdarcy.h
Go to the documentation of this file.
1 
6 #ifndef MATCOUPLEDTRANSPDARCY
7 #define MATCOUPLEDTRANSPDARCY
8 
9 #include <iostream>
10 #include "pzdiscgal.h"
11 #include "pzfmatrix.h"
12 #include "pzpoisson3d.h"
13 
30 
31  protected :
32 
34  REAL fAlpha;
35 
37  // @{
40  // @}
41 
42  static int gCurrentEq;
43 
44 public:
45 
46  virtual TPZBndCond *CreateBC(TPZMaterial * mat, int id, int typ, TPZFMatrix<STATE> &val1,TPZFMatrix<STATE> &val2) override {
47  PZError << "Error! - This method should not be called - " << __PRETTY_FUNCTION__ << std::endl;
48  return 0;
49  }
50 
52 
53  static void SetCurrentMaterial(const int i);
54 
55  static int CurrentEquation();
56 
58 
60 
61  virtual int HasForcingFunction() override {return this->GetCurrentMaterial()->HasForcingFunction();}
62 
64 #ifdef PZDEBUG
65  if (!this->fMaterials[0] || !this->fMaterials[1]){
66  PZError << "Error! - " << __PRETTY_FUNCTION__ << std::endl;
67  exit (-1);
68  }
69 #endif
72  else {
73  PZError << "Error! - " << __PRETTY_FUNCTION__ << std::endl;
74  exit (-1);
75  }
76  // the code will never reach this point
77  return 0;
78  }
79 
81 #ifdef PZDEBUG
82  if (!this->fMaterials[0] || !this->fMaterials[1]){
83  PZError << "Error! - " << __PRETTY_FUNCTION__ << std::endl;
84  exit (-1);
85  }
86 #endif
87  if (eq == 0 || eq ==1) return this->fMaterials[eq];
88  else {
89  PZError << " Error - " << __PRETTY_FUNCTION__ << std::endl;
90  exit (-1);
91  }
92  // the code will never reach this point
93  return 0;
94  }
95 
96  TPZCoupledTransportDarcy(int nummat, int nummat0, int nummat1, int dim);
97 
98  virtual ~TPZCoupledTransportDarcy();
99 
101  fAlpha(copy.fAlpha){
102  this->fMaterialRefs[0] = copy.fMaterialRefs[0];
103  this->fMaterialRefs[1] = copy.fMaterialRefs[1];
104  fMaterials[0] = copy.fMaterials[0];
105  fMaterials[1] = copy.fMaterials[1];
106  }
107 
108  virtual TPZMaterial * NewMaterial() override {
109  return new TPZCoupledTransportDarcy(*this);
110  }
111 
112  virtual int Dimension() const override {
113  return this->GetCurrentMaterial()->Dimension();
114  }
115 
116  virtual int NStateVariables() const override;
117 
118  void SetAlpha(REAL alpha);
119 
120  virtual void Print(std::ostream & out) override;
121 
122  virtual std::string Name() override { return "TPZCoupledTransportDarcy"; }
123 
124  virtual void Contribute(TPZMaterialData &data,
125  REAL weight,
126  TPZFMatrix<STATE> &ek,
127  TPZFMatrix<STATE> &ef) override;
128 
129  virtual void ContributeBC(TPZMaterialData &data,
130  REAL weight,
131  TPZFMatrix<STATE> &ek,
132  TPZFMatrix<STATE> &ef,
133  TPZBndCond &bc) override;
134 
135  virtual void Contribute(TPZMaterialData &data,
136  REAL weight,
137  TPZFMatrix<STATE> &ef) override
138  {
139  TPZDiscontinuousGalerkin::Contribute(data,weight,ef);
140  }
141  virtual void ContributeBC(TPZMaterialData &data,
142  REAL weight,
143  TPZFMatrix<STATE> &ef,
144  TPZBndCond &bc) override
145  {
146  TPZDiscontinuousGalerkin::ContributeBC(data,weight,ef,bc);
147  }
148 
149  virtual int VariableIndex(const std::string &name) override;
150 
151  virtual int NSolutionVariables(int var) override;
152 
153  virtual int NFluxes() override { return 3;}
154 
155 protected:
156  virtual void Solution(TPZVec<STATE> &Sol,TPZFMatrix<STATE> &DSol,TPZFMatrix<REAL> &axes,int var,TPZVec<STATE> &Solout) override;
157 public:
162  virtual void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec<STATE> &Solout)
163  {
164  TPZDiscontinuousGalerkin::SolutionDisc(data,dataleft,dataright,var,Solout);
165  }
166 
167 
169  virtual void Flux(TPZVec<REAL> &x, TPZVec<STATE> &Sol, TPZFMatrix<STATE> &DSol, TPZFMatrix<REAL> &axes, TPZVec<STATE> &flux) override;
170 
171  void Errors(TPZVec<REAL> &x,TPZVec<STATE> &u,
173  TPZVec<STATE> &u_exact,TPZFMatrix<STATE> &du_exact,TPZVec<REAL> &values) override;//Cedric
174 
175  virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright,
176  REAL weight,
177  TPZFMatrix<STATE> &ek,
178  TPZFMatrix<STATE> &ef) override;
179 
180  virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft,
181  REAL weight,
182  TPZFMatrix<STATE> &ek,
183  TPZFMatrix<STATE> &ef,
184  TPZBndCond &bc) override;
185 
186  virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright,
187  REAL weight,
188  TPZFMatrix<STATE> &ef) override
189  {
190  TPZDiscontinuousGalerkin::ContributeInterface(data,dataleft,dataright,weight,ef);
191  }
192 
194  REAL weight,
195  TPZFMatrix<STATE> &ef,
196  TPZBndCond &bc) override
197  {
198  TPZDiscontinuousGalerkin::ContributeBCInterface(data,dataleft,weight,ef,bc);
199  }
200 
201  void InterfaceErrors(TPZVec<REAL> &/*x*/,
202  TPZVec<STATE> &leftu, TPZFMatrix<STATE> &leftdudx, /* TPZFMatrix<REAL> &leftaxes,*/
203  TPZVec<STATE> &rightu, TPZFMatrix<STATE> &rightdudx, /* TPZFMatrix<REAL> &rightaxes,*/
204  TPZVec<STATE> &/*flux*/,
205  TPZVec<STATE> &u_exact,TPZFMatrix<STATE> &du_exact,TPZVec<REAL> &values,
206  TPZVec<REAL> normal, REAL elsize);
207 
208  virtual int IsInterfaceConservative() override { return 1;}
209 
210  virtual int ClassId() const override;
211 
212 };
213 
214 #endif
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
Definition: pzdiscgal.h:20
void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
Definition: pzdiscgal.h:176
TPZMatPoisson3d * GetCurrentMaterial() const
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to stiffness matrix and load vector at one BC integration point...
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...
clarg::argBool bc("-bc", "binary checkpoints", false)
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 TPZMaterial * NewMaterial() override
To create another material of the same type.
virtual void Flux(TPZVec< REAL > &x, TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, TPZVec< STATE > &flux) override
Compute the value of the flux function to be used by ZZ error estimator.
int Dimension() const override
Returns the integrable dimension of the material.
Definition: pzpoisson3d.h:158
TPZMatPoisson3d * GetMaterial(int eq)
virtual std::string Name() override
Returns the name of the material.
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...
TPZMatPoisson3d * fMaterials[2]
void UpdateConvectionDir(TPZFMatrix< STATE > &dsol)
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
static void SetCurrentMaterial(const int i)
Contains the TPZMatPoisson3d class.
virtual int VariableIndex(const std::string &name) override
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
virtual TPZBndCond * CreateBC(TPZMaterial *mat, int id, int typ, TPZFMatrix< STATE > &val1, TPZFMatrix< STATE > &val2) override
Creates an object TPZBndCond derived of TPZMaterial.
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
void InterfaceErrors(TPZVec< REAL > &, TPZVec< STATE > &leftu, TPZFMatrix< STATE > &leftdudx, TPZVec< STATE > &rightu, TPZFMatrix< STATE > &rightdudx, TPZVec< STATE > &, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &values, TPZVec< REAL > normal, REAL elsize)
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...
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override=0
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
Contains TPZMatrixclass which implements full matrix (using column major representation).
TPZCoupledTransportDarcy(TPZCoupledTransportDarcy &copy)
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
It computes a contribution to stiffness matrix and load vector at one integration point...
Definition: pzdiscgal.cpp:30
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef) override
It computes a contribution to the residual vector at one integration point.
void UpdateConvectionDirInterface(TPZFMatrix< STATE > &dsolL, TPZFMatrix< STATE > &dsolR)
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)=0
It computes a contribution to stiffness matrix and load vector at one BC integration point...
virtual int HasForcingFunction()
Directive that gives true if the material has a forcing function.
Definition: TPZMaterial.h:472
virtual int Dimension() const override
Returns the integrable dimension of the material.
Implements two equations where the second one requires the solution of the first. ...
DESCRIBE PLEASE.
Definition: pzpoisson3d.h:26
virtual int HasForcingFunction() override
Directive that gives true if the material has a forcing function.
virtual void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, 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 > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to the stiffness matrix and load vector at one integration point...
TPZCoupledTransportDarcyBC * CreateBC2(int id)
virtual int NFluxes() override
Returns the number of components which form the flux function.
TPZCoupledTransportDarcy(int nummat, int nummat0, int nummat1, int dim)
virtual int ClassId() const override
Unique identifier for serialization purposes.
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ef) override
It computes a contribution to residual vector at one integration point.
def values
Definition: rdt.py:119
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
Contains the TPZDiscontinuousGalerkin class which implements the interface for discontinuous Galerkin...
virtual void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override
virtual int IsInterfaceConservative() override
Dicontinuous galerkin materials implement contribution of discontinuous elements and interfaces...
REAL fAlpha
In second equation: . Here alpha is stored.
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override=0
It computes a contribution to the stiffness matrix and load vector at one integration point...
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to residual vector at one BC integration point.