NeoPZ
TPZConsLawTest.h
Go to the documentation of this file.
1 
5 #ifndef CONSLAWTESTHPP
6 #define CONSLAWTESTHPP
7 
8 #include <iostream>
9 #include "TPZMaterial.h"
10 #include "pzfmatrix.h"
11 #include "pzvec.h"
12 #include "pzconslaw.h"
13 
14 
20 
24 
26  int fTest;
27 
28  STATE fDelta;
29 
30  public :
31 
32  TPZConsLawTest(int nummat, TPZVec<STATE> B,int artdiff,STATE delta_t,int dim,STATE delta,int test=0);
33 
34  virtual ~TPZConsLawTest();
35 
37  fXf = xfin;
38  }
39 
40  STATE DeltaOtimo();
41 
42  STATE CFL(int degree);
43 
44  STATE B(int i,TPZVec<REAL> &x);
45 
46  REAL Delta();
47 
48  STATE T(int jn,TPZVec<REAL> &x);
49 
50  virtual int NStateVariables() const override;
51 
52  virtual void Print(std::ostream & out) override;
53 
54  virtual std::string Name() override { return "TPZConsLawTest"; }
55 
56  virtual void Contribute(TPZMaterialData &data,REAL weight,
57  TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef) override;
58  virtual void Contribute(TPZMaterialData &data,REAL weight,
59  TPZFMatrix<STATE> &ef) override {
60  TPZConservationLaw::Contribute(data,weight,ef);
61  }
62 
63  virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright,
64  REAL weight,
66  TPZFMatrix<STATE> &ef) override;
67 
68  virtual void ContributeBC(TPZMaterialData &data,
69  REAL weight,
72  TPZBndCond &bc) override;
73  virtual void ContributeBC(TPZMaterialData &data,
74  REAL weight,
76  TPZBndCond &bc) override
77  {
78  TPZConservationLaw::ContributeBC(data,weight,ef,bc);
79  }
80 
81  virtual int VariableIndex(const std::string &name) override;
82 
83  virtual int NSolutionVariables(int var) override;
84 
85  virtual int NFluxes() override { return 1;}
86 
87 protected:
88  virtual void Solution(TPZVec<STATE> &Sol,TPZFMatrix<STATE> &DSol,TPZFMatrix<REAL> &axes,int var,TPZVec<STATE> &Solout) override;
89 public:
90  virtual void Solution(TPZMaterialData &data,int var,TPZVec<STATE> &Solout) override
91  {
92  int numbersol = data.sol.size();
93  if (numbersol != 1) {
94  DebugStop();
95  }
96 
97  Solution(data.sol[0],data.dsol[0],data.axes,var,Solout);
98  }
99 
101  virtual void Flux(TPZVec<REAL> &x, TPZVec<STATE> &Sol, TPZFMatrix<STATE> &DSol, TPZFMatrix<REAL> &axes, TPZVec<STATE> &flux) override;
102 
103  void Errors(TPZVec<REAL> &x,TPZVec<STATE> &u,
105  TPZVec<STATE> &u_exact,TPZFMatrix<STATE> &du_exact,TPZVec<REAL> &values) override;
106 
107  void ComputeSolRight(TPZVec<STATE> &solr,TPZVec<STATE> &soll,TPZVec<REAL> &normal,TPZBndCond *bcright);
108  void ComputeSolLeft(TPZVec<STATE> &solr,TPZVec<STATE> &soll,TPZVec<REAL> &normal,TPZBndCond *bcleft);
109 
110 };
111 
112 #endif
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.
void SetMaterial(TPZFMatrix< STATE > &xfin)
int fTest
Integer for integration degree of the initial solution.
clarg::argBool bc("-bc", "binary checkpoints", false)
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef) override
Contributes to the residual vector and tangent matrix the volume-based quantities.
Only to test a material as conservation law. It was used for testing purposes.
Templated vector implementation.
Definition: test.py:1
void ComputeSolRight(TPZVec< STATE > &solr, TPZVec< STATE > &soll, TPZVec< REAL > &normal, TPZBndCond *bcright)
void degree(int root, int adj_num, int adj_row[], int adj[], int mask[], int deg[], int *iccsze, int ls[], int node_num)
Definition: rcm.cpp:875
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
Contributes to the residual vector and tangent matrix the face-based quantities.
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
Contributes to the residual vector and tangent matrix the volume-based quantities.
virtual int NStateVariables() const override
Number of state variables according to the dimension.
virtual int VariableIndex(const std::string &name) override
virtual void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override
virtual void Print(std::ostream &out) override
Prints the state of internal variables.
void ComputeSolLeft(TPZVec< STATE > &solr, TPZVec< STATE > &soll, TPZVec< REAL > &normal, TPZBndCond *bcleft)
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
TPZFMatrix< STATE > fXf
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.
STATE B(int i, TPZVec< REAL > &x)
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override=0
Contributes to the residual vector and tangent matrix the volume-based quantities.
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
TPZConsLawTest(int nummat, TPZVec< STATE > B, int artdiff, STATE delta_t, int dim, STATE delta, int test=0)
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override=0
Contributes to the residual vector the boundary conditions.
virtual int NFluxes() override
Returns the number of fluxes associated to this material.
virtual ~TPZConsLawTest()
STATE T(int jn, TPZVec< REAL > &x)
Implements the interface for conservation laws, keeping track of the timestep as well.
Definition: pzconslaw.h:71
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...
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
Contributes to the residual vector the boundary conditions.
REAL CFL()
Returns the CFL number.
Definition: pzconslaw.h:281
TPZVec< STATE > fB
Contains the TPZConservationLaw class which implements the interface for conservation laws...
def values
Definition: rdt.py:119
TPZSolVec sol
vector of the solutions at the integration point
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
virtual std::string Name() override
Returns the material name.
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
Contributes to the residual vector the boundary conditions.