NeoPZ
mixedpoisson.h
Go to the documentation of this file.
1 //
2 // mixedpoisson.h
3 // PZ
4 //
5 // Created by Agnaldo Farias on 5/28/12.
6 // Copyright (c) 2012 LabMec-Unicamp. All rights reserved.
7 //
8 
9 #ifndef PZ_mixedpoisson_h
10 #define PZ_mixedpoisson_h
11 
12 #include "TPZMaterial.h"
13 #include "pzdiscgal.h"
14 #include "pzpoisson3d.h"
15 #include "TPZMaterial.h"
16 #include "pzfunction.h"
17 
35 
36 protected:
38  REAL ff;
39 
42 
45 
47  REAL fvisc;
48 
51 
53  REAL fdelta1;
54  REAL fdelta2;
55 
57  REAL fh2;
58  bool fUseHdois;
64 
65 public:
67 
68  TPZMixedPoisson(int matid, int dim);
69 
70  virtual ~TPZMixedPoisson();
71 
73 
75 
76  virtual TPZMaterial * NewMaterial() override{
77  return new TPZMixedPoisson(*this);
78  }
79 
80 
81  virtual void Print(std::ostream & out) override;
82 
83  virtual std::string Name() override{ return "TPZMixedPoisson"; }
84 
85  virtual int NStateVariables() const override;
86 
87  void SetPermeability(REAL perm) {
88  fK = perm;
89  fTensorK.Zero();
90  fInvK.Zero();
91  for (int i=0; i<3; i++) {
92  fTensorK(i,i) = perm;
93  fInvK(i,i) = 1./perm;
94  }
95  }
96 
97  //Set the permeability tensor and inverser tensor
99 
100 // if(K.Rows() != fDim || K.Cols() != fDim) DebugStop();
101 // if(K.Rows()!=invK.Rows() || K.Cols()!=invK.Cols()) DebugStop();
102  if(K.Rows() != 3 || invK.Rows() != 3)
103  {
104  DebugStop();
105  }
106  fTensorK = K;
107  fInvK = invK;
108  fK = 0.;
109  }
110 
113 
114  void SetViscosity(REAL visc) {
115  fvisc = visc;
116  }
117 
118  void GetMaxPermeability(REAL &perm)
119  {
120  perm = 0;
121  for(int i=0; i<3; i++) perm = perm < fTensorK(i,i) ? fTensorK(i,i) : perm;
122  }
123 // void GetPermeability(REAL &perm) {
124 // perm = fK;
125 // }
126 
127  void SetInternalFlux(REAL flux) {
128  ff = flux;
129  }
130 
132  fIsStabilized = true;
133  }
134 
135  void SetHdois(){
136  fUseHdois = true;
137  }
138 
139  void SetStabilizationCoeficients(REAL delta1, REAL delta2){
140  fdelta1 = delta1;
141  fdelta2 = delta2;
142  }
143 
145  {
146  fPermeabilityFunction = fp;
147  }
148 
150  {
151  return fPermeabilityFunction;
152  }
153 
161  virtual void Contribute(TPZVec<TPZMaterialData> &datavec, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) override;
162 
163  virtual void ContributeBC(TPZVec<TPZMaterialData> &datavec, REAL weight, TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef,TPZBndCond &bc) override;
164 
165 
166  virtual int VariableIndex(const std::string &name) override;
167 
168  virtual int NSolutionVariables(int var) override;
169 
176  virtual void Solution(TPZVec<TPZMaterialData> &datavec, int var, TPZVec<STATE> &Solout) override;
177 
179  virtual void FillBoundaryConditionDataRequirement(int type,TPZVec<TPZMaterialData > &datavec) override
180  {
181  // default is no specific data requirements
182  int nref = datavec.size();
183  for (int iref = 0; iref <nref; iref++) {
184  datavec[iref].SetAllRequirements(false);
185  datavec[iref].fNeedsSol = true;
186  }
187  datavec[0].fNeedsNormal = true;
188  if(type == 50)
189  {
190  for(int iref = 0; iref<nref; iref++){
191  datavec[iref].fNeedsSol = true;
192  }
193  }
194  }
195 
196  virtual void FillDataRequirements(TPZVec<TPZMaterialData > &datavec) override;
197 
198 
199  virtual int NEvalErrors() override {return 3;}
200 
201  virtual void Errors(TPZVec<TPZMaterialData> &data, TPZVec<STATE> &u_exact, TPZFMatrix<STATE> &du_exact, TPZVec<REAL> &errors) override;
202 
203  public:
204 virtual int ClassId() const override;
205 
206 };
207 
208 #endif
virtual int NEvalErrors() override
Returns the number of norm errors. Default is 3: energy, L2 and H1.
Definition: mixedpoisson.h:199
TPZFNMatrix< 9, REAL > fInvK
inverse of the permeability tensor.
Definition: mixedpoisson.h:44
virtual TPZMaterial * NewMaterial() override
To create another material of the same type.
Definition: mixedpoisson.h:76
REAL fvisc
fluid viscosity
Definition: mixedpoisson.h:47
clarg::argBool bc("-bc", "binary checkpoints", false)
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...
Definition: mixedpoisson.h:179
void SetViscosity(REAL visc)
Definition: mixedpoisson.h:114
void GetPermeability(TPZVec< REAL > &x, TPZFMatrix< REAL > &K, TPZFMatrix< REAL > &invK)
return the permeability and compute it if there is permeability function
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...
REAL fh2
Coeficient that multiplies the Stabilization term fdelta1.
Definition: mixedpoisson.h:57
void SetStabilizationCoeficients(REAL delta1, REAL delta2)
Definition: mixedpoisson.h:139
TPZAutoPointer< TPZFunction< STATE > > PermeabilityFunction()
Definition: mixedpoisson.h:149
virtual std::string Name() override
Returns the name of the material.
Definition: mixedpoisson.h:83
Contains the TPZMatPoisson3d class.
void GetMaxPermeability(REAL &perm)
Definition: mixedpoisson.h:118
virtual int VariableIndex(const std::string &name) override
virtual void FillDataRequirements(TPZVec< TPZMaterialData > &datavec) override
Fill material data parameter with necessary requirements for the Contribute method. Here, in base class, all requirements are considered as necessary. Each derived class may optimize performance by selecting only the necessary data.
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
int Zero() override
Makes Zero all the elements.
Definition: pzfmatrix.h:651
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
virtual void Solution(TPZVec< TPZMaterialData > &datavec, int var, TPZVec< STATE > &Solout) override
It return a solution to multiphysics simulation.
STATE fK
Coeficient which multiplies the Laplacian operator.
Definition: pzpoisson3d.h:37
void SetPermeabilityFunction(TPZAutoPointer< TPZFunction< STATE > > fp)
Definition: mixedpoisson.h:144
#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
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
void SetInternalFlux(REAL flux)
Definition: mixedpoisson.h:127
REAL ff
Forcing function value.
Definition: mixedpoisson.h:38
Material to solve a mixed poisson problem 2d by multiphysics simulation.
Definition: mixedpoisson.h:34
void SetPermeability(REAL perm)
Definition: mixedpoisson.h:87
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 to multip...
DESCRIBE PLEASE.
Definition: pzpoisson3d.h:26
TPZFNMatrix< 9, REAL > fTensorK
permeability tensor. Coeficient which multiplies the gradient operator
Definition: mixedpoisson.h:41
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
TPZAutoPointer< TPZFunction< STATE > > fPermeabilityFunction
post-processing procedure for error estimation as Ainsworth
Definition: mixedpoisson.h:63
void SetPermeabilityTensor(const TPZFMatrix< REAL > &K, const TPZFMatrix< REAL > &invK)
Definition: mixedpoisson.h:98
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
virtual ~TPZMixedPoisson()
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...
void SetStabilizedMethod()
Definition: mixedpoisson.h:131
bool fIsStabilized
Choose Stabilized method.
Definition: mixedpoisson.h:50
REAL fdelta1
Coeficient of Stabilization.
Definition: mixedpoisson.h:53
virtual void Errors(TPZVec< TPZMaterialData > &data, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &errors) override
virtual int ClassId() const override
Unique identifier for serialization purposes.
TPZMixedPoisson & operator=(const TPZMixedPoisson &copy)
This class implements a reference counter mechanism to administer a dynamically allocated object...