17 TPZConsLawTest::TPZConsLawTest(
int nummat,
TPZVec<STATE> B,
int artdiff,STATE delta_t,
int dim,STATE delta,
int test) :
TPZConservationLaw(nummat,delta_t,dim), fXf(1,1,0.), fB(dim) {
19 if(artdiff<0 || artdiff>3){
20 PZError <<
"TPZConsLawTest::TPZConsLawTest artificial diffusion parameter, default 1\n";
24 PZError <<
"TPZConsLawTest::TPZConsLawTest error in dimension of B, default dimension " << dim << endl;
27 for(i=0;i<dim;i++) B[i] = 0.;
31 for(i=0;i<dim;i++)
fB[i] = B[i];
45 out <<
"name of material : " <<
Name() <<
"\n";
46 out <<
"properties : \n";
66 int numbersol = data.
sol.
size();
88 int dim = dphi.
Rows();
90 PZError <<
"TPZConsLawTest::Contribute dimension error, dimension = " << dim;
92 STATE sum1 = 0.,sum2=0.;
95 for(
int in = 0; in < phr; in++ ) {
97 sum1 = phi(in, 0) * sol[0];
100 for(i=0;i<dim;i++) sum2 +=
B(i,x) * dphi(i,in);
101 sum2 *= time * sol[0];
104 ef(in, 0) += weight *(sum1+sum2);
106 for(
int jn = 0; jn < phr; jn++ ) {
108 ek(in,jn) += weight * phi(in,0) * phi(jn,0);
109 for(
int ki=0; ki<dim; ki++) {
110 for(
int kj=0; kj<dim; kj++) {
112 ek(in,jn) += weight * time *
Delta() *
T(ki,x) *
B(kj,x) * ( dphi(kj,in) * dphi(ki,jn) );
133 return (1.0/(2.0*degree+1.0));
141 if(i==0)
return -x[1];
142 if(i==1)
return x[0];
146 if(i==0)
return -x[1];
147 if(i==1)
return x[0];
160 for(i=0;i<dim;i++) norm +=
B(i,x)*
B(i,x);
162 if(jn==0)
return B(0,x)/norm;
163 if(jn==1)
return B(1,x)/norm;
164 if(jn==2)
return B(2,x)/norm;
168 cout <<
"TPZConsLawTest::T artificial diffusion LS not implemented\n";
173 cout <<
"TPZConsLawTest::T artificial diffusion Bornhaus not implemented\n";
176 cout <<
"TPZConsLawTest::T case not implemented, case = " << jn << endl;
197 int numbersol = dataleft.
sol.
size();
198 if (numbersol != 1) {
212 int phrl = phiL.
Rows();
213 int phrr = phiR.
Rows();
218 if(phrl) solL[0] = res[0];
219 if(phrr) solR[0] = res[0];
225 for(i=0;i<dim;i++) Bn +=
B(i,x)*normal[i];
231 for(
int in = 0; in < phrl; in++ ) {
232 ef(efc , 0) += -time * weight * solL[0] * phiL(in, 0) * Bn;
235 for(
int in = 0; in < phrr; in++ ) {
236 ef(efc, 0) += -time * weight * solL[0] * phiR(in, 0) * -Bn;
240 for(
int in = 0; in < phrl; in++ ) {
241 ef(efc , 0) += -time * weight * solR[0] * phiL(in, 0) * Bn;
244 for(
int in = 0; in < phrr; in++ ) {
245 ef(efc, 0) += -time * weight * solR[0] * phiR(in, 0) * -Bn;
278 int phr = phi.
Rows();
281 v2[0] = bc.
Val2()(0,0);
285 for(in = 0 ; in < phr; in++) {
286 ef(in,0) +=
gBigNumber * v2[0] * phi(in,0) * weight;
287 for (jn = 0 ; jn < phr; jn++) {
288 ek(in,jn) +=
gBigNumber * phi(in,0) * phi(jn,0) * weight;
293 for(in = 0 ; in < phi.
Rows(); in++) {
294 ef(in,0) += v2[0] * phi(in,0) * weight;
298 for(in = 0 ; in < phi.
Rows(); in++) {
299 ef(in, 0) += v2[0] * phi(in, 0) * weight;
300 for (jn = 0 ; jn < phi.
Rows(); jn++) {
301 ek(in,jn) += bc.
Val1()(0,0) * phi(in,0) *
310 if(!strcmp(
"Solution",name.c_str()))
return 1;
311 if(!strcmp(
"Derivate",name.c_str()))
return 2;
312 cout <<
"TPZConsLawTest::VariableIndex Error\n";
318 if(var == 1)
return 1;
320 cout <<
"TPZConsLawTest::NSolutionVariables Error\n";
326 if(var == 0 || var == 1) Solout[0] = Sol[0];
328 Solout[0] = DSol(0,0);
329 Solout[1] = DSol(1,0);
330 Solout[2] = DSol(2,0);
345 REAL
dx = dsol[0]*axes(0,0)+dsol[1]*axes(1,0)+dsol[2]*axes(2,0);
346 REAL dy = dsol[0]*axes(0,1)+dsol[1]*axes(1,1)+dsol[2]*axes(2,1);
347 REAL dz = dsol[0]*axes(0,2)+dsol[1]*axes(1,2)+dsol[2]*axes(2,2);
349 values[1] =
pow(sol[0] - u_exact[0],(STATE)2.0);
351 values[2] = (dx - du_exact(0,0))*(dx - du_exact(0,0));
352 values[2] += ((dy - du_exact(1,0))*(dy - du_exact(1,0)));
353 values[2] += ((dz - du_exact(2,0))*dz - du_exact(2,0));
355 values[0] = values[1]+values[2];
361 PZError <<
"TPZConsLawTest::ComputeSolLeft null bundary condition return\n";
366 switch (bcleft->
Type()){
370 PZError <<
"TPZConsLawTest::ComputeSolLeft boundary condition error\n";
378 PZError <<
"TPZConsLawTest::ContributeInterface Boundary Condition Type Not Exists\n";
386 PZError <<
"TPZConsLawTest::ComputeSolLeft null bundary condition return\n";
391 switch (bcright->
Type()){
395 PZError <<
"TPZConsLawTest::ComputeSolLeft boundary condition error\n";
403 PZError <<
"TPZConsLawTest::ContributeInterface Boundary Condition Type Not Exists\n";
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
int fTest
Integer for integration degree of the initial solution.
TPZManVector< REAL, 3 > normal
normal to the element at the integration point
TPZManVector< REAL, 3 > x
value of the coordinate at the integration point
clarg::argBool bc("-bc", "binary checkpoints", false)
int Dimension() const override
Returns the dimension of the problem.
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)
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.
TPZFMatrix< STATE > & Val2(int loadcase=0)
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
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
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
virtual void Print(std::ostream &out=std::cout)
Prints out the data associated with the material.
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
virtual void Print(std::ostream &out) override
Prints the state of internal variables.
REAL TimeStep()
Returns the value of the time step.
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
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.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
expr_ dx(i) *cos(expr_.val())
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.
This class defines the boundary condition for TPZMaterial objects.
TPZConsLawTest(int nummat, TPZVec< STATE > B, int artdiff, STATE delta_t, int dim, STATE delta, int test=0)
int64_t Rows() const
Returns number of rows.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
TPZFMatrix< STATE > & Val1()
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
Contains TPZMatrix<TVar>class, root matrix class.
virtual ~TPZConsLawTest()
STATE T(int jn, TPZVec< REAL > &x)
Implements the interface for conservation laws, keeping track of the timestep as well.
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...
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
REAL CFL()
Returns the CFL number.
Contains the TPZConsLawTest class for test. Material as conservation law.
TPZAutoPointer< TPZFunction< STATE > > fForcingFunction
Pointer to forcing function, it is the right member at differential equation.
int64_t NElements() const
Returns the number of elements of the vector.
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.
#define PZError
Defines the output device to error messages and the DebugStop() function.