NeoPZ
pzdiscgal.cpp
Go to the documentation of this file.
1 
6 #include "pzdiscgal.h"
7 #include "pzmaterialdata.h"
8 #include <algorithm>
9 
10 
11 
13 
15 
17 
19 
20 std::string TPZDiscontinuousGalerkin::Name() { return "TPZDiscontinuousGalerkin"; }
21 
23  data.SetAllRequirements(true);
24  data.fNeedsSol = false;
25  if(fLinearContext == false){
26  data.fNeedsNeighborSol = true;
27  }
28 }
29 
31  REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef){
32  std::cout << __PRETTY_FUNCTION__ << " please implement me\n";
33  DebugStop();
34 }
35 
37  REAL weight, TPZFMatrix<STATE> &ef){
38  TPZFMatrix<STATE> fakeek(ef.Rows(), ef.Rows(), 0.);
39  this->ContributeInterface(data, dataleft, dataright, weight, fakeek, ef);
40 }
41 
43  REAL weight, TPZFMatrix<STATE> &ef){
44  TPZFMatrix<STATE> fakeek(ef.Rows(), ef.Rows(), 0.);
45  this->ContributeInterface(data, dataleft, dataright, weight, fakeek, ef);
46 }
47 
49 {
50  TPZFMatrix<STATE> fakeek(ef.Rows(), ef.Rows(), 0.);
51  this->ContributeInterface(data, dataleft, dataright, weight, fakeek, ef);
52 
53 }
55  REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) {
56  std::cout << __PRETTY_FUNCTION__ << " please implement me\n";
57  DebugStop();
58 }
59 
61 
62  TPZFMatrix<STATE> fakeek(ef.Rows(), ef.Rows(), 0.);
63  this->ContributeBCInterface(data, dataleft, weight, fakeek, ef, bc);
64 }
65 
66 
67 
69  TPZFMatrix<STATE> fakeek(ef.Rows(), ef.Rows(), 0.);
70  this->ContributeBCInterface(data, dataleft, weight, fakeek, ef, bc);
71 }
72 
74  return 0;
75 }
76 
78  TPZSolVec &leftu,
79  TPZSolVec &rightu,
80  TPZSolVec &jump){
81  int numbersol = leftu.size();
82  for (int is=0; is<numbersol; is++) {
83  const int n = leftu[is].NElements();
84  jump[is].Resize(n);
85  for(int i = 0; i < n; i++){
86  jump[is][i] = leftu[is][i] - rightu[is][i];
87  }
88  }
89 }
90 
92 {
93  TPZMaterial::Errors(data,u_exact,du_exact,errors);
94 }
95 
97 {
98  TPZMaterial::Errors(data[0],u_exact,du_exact,errors);
99 }
100 
101 
103  TPZSolVec &leftu,
104  TPZBndCond &bc,
105  TPZSolVec & jump){
106  PZError << __PRETTY_FUNCTION__ << " - method not implemented in derived class" << std::endl;
107  DebugStop();
108 }
109 
111  return Hash("TPZDiscontinuousGalerkin") ^ TPZMaterial::ClassId() << 1;
112 }
113 
114 void TPZDiscontinuousGalerkin::Write(TPZStream &buf, int withclassid) const{
115  TPZMaterial::Write(buf, withclassid);
116 }
117 
118 void TPZDiscontinuousGalerkin::Read(TPZStream &buf, void *context){
119  TPZMaterial::Read(buf, context);
120 }
121 
124 {
125  int maxl = 0, maxr = 0;
126  for (auto porder: porder_left) {
127  maxl = std::max(maxl,porder);
128  }
129  for (auto porder: porder_right) {
130  maxr = std::max(maxr,porder);
131  }
132  return maxl+maxr;
133 }
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
Definition: pzdiscgal.h:20
bool fLinearContext
Defines whether the equation context is linear solver or non linear.
Definition: TPZMaterial.h:70
int ClassId() const override
Unique identifier for serialization purposes.
Definition: pzdiscgal.cpp:110
virtual void Errors(TPZMaterialData &data, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &errors)
Definition: TPZMaterial.h:496
TPZDiscontinuousGalerkin()
Simple constructor.
Definition: pzdiscgal.cpp:12
clarg::argBool bc("-bc", "binary checkpoints", false)
virtual 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: pzdiscgal.h:228
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
Definition: pzdiscgal.cpp:118
virtual ~TPZDiscontinuousGalerkin()
Destructor.
Definition: pzdiscgal.cpp:18
void SetAllRequirements(bool set)
Set all flags at once.
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
virtual void FillDataRequirementsInterface(TPZMaterialData &data) override
Fill material data parameter with necessary requirements for the ContributeInterface method...
Definition: pzdiscgal.cpp:22
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
virtual std::string Name() override
Returns the name of the material.
Definition: pzdiscgal.cpp:20
virtual void BCInterfaceJump(TPZVec< REAL > &x, TPZSolVec &leftu, TPZBndCond &bc, TPZSolVec &jump)
Computes interface jump from element to Dirichlet boundary condition. It has to reimplemented.
Definition: pzdiscgal.cpp:102
virtual int GetIntegrationOrder(TPZVec< int > &porder_left, TPZVec< int > &porder_right) const
return the integration order as a function of interpolation orders of the left and right elements ...
Definition: pzdiscgal.cpp:123
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
Definition: pzdiscgal.cpp:114
#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
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
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
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...
Contains the TPZMaterialData class which implements an interface between TPZCompEl::CalcStiff and TPZ...
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
virtual void InterfaceJump(TPZVec< REAL > &x, TPZSolVec &leftu, TPZSolVec &rightu, TPZSolVec &jump)
Computes interface jump = leftu - rightu.
Definition: pzdiscgal.cpp:77
int ClassId() const override
Unique identifier for serialization purposes.
virtual int IsInterfaceConservative()
Dicontinuous galerkin materials implement contribution of discontinuous elements and interfaces...
Definition: pzdiscgal.cpp:73
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
clarg::argInt porder("-porder", "polinomial order", 1)
Contains the TPZDiscontinuousGalerkin class which implements the interface for discontinuous Galerkin...
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15