NeoPZ
pzconslaw.cpp
Go to the documentation of this file.
1 
6 #include "pzconslaw.h"
7 #include "pzelmat.h"
8 #include "pzbndcond.h"
9 #include "pzmatrix.h"
10 #include "pzfmatrix.h"
11 #include "pzerror.h"
12 #include <math.h>
13 #include <stdlib.h>
14 using namespace std;
15 
16 
17 TPZConservationLaw::TPZConservationLaw(int nummat,REAL timeStep,int dim) :
19 fDim(dim),
20 fTimeStep(0),
21 fCFL(0),
22 fGamma(1.4),
23 fContributionTime(Last_CT),
24 fResidualType(Flux_RT)
25 
26 {
27  fTimeStep = timeStep;
28  if(timeStep < 0 || timeStep > 1)
29  {
30  PZError << "TPZConservationLaw::TPZConservationLaw time step parameter > 1 , default 1.0\n";
31  fTimeStep = 1.0;
32  }
33 
34  if(dim < 1 || dim > 3)
35  {
36  PZError << "TPZConservationLaw::TPZConservationLaw (abort) error dimension = " << dim << endl;
37  DebugStop();
38  }
39  fDim = dim;
41 
42 }
43 
44 
46 {
47 }
48 
49 void TPZConservationLaw::Print(std::ostream &out)
50 {
51  out << "name of material : " << Name() << "\n";
52  out << "properties : \n";
53  out << "\tdimension: " << fDim << endl;
54  out << "\ttime step: " << fTimeStep << endl;
55  out << "\tCFL: " << fCFL << endl;
56  // out << "\tDelta (diffusive term): " << fDelta << endl;
57  out << "\tGamma: " << fGamma << endl;
58  TPZMaterial::Print(out);
59 
60 
61  switch(fContributionTime)
62  {
63  case Advanced_CT:
64  out << "Advanced Contribution\n";
65  break;
66  case Last_CT:
67  out << "Last state Contribution\n";
68  break;
69  case None_CT:
70  out << "Contribution undefined\n";
71  }
72 }
73 
74 void TPZConservationLaw::Write(TPZStream &buf, int withclassid) const
75 {
76  TPZMaterial::Write(buf, withclassid);
77  buf.Write(&fDim,1);
78  buf.Write(&fTimeStep,1);
79  buf.Write(&fCFL,1);
80  buf.Write(&fGamma,1);
81 }
82 
83 void TPZConservationLaw::Read(TPZStream &buf, void *context)
84 {
85  TPZMaterial::Read(buf, context);
86  buf.Read(&fDim,1);
87  buf.Read(&fTimeStep,1);
88  buf.Read(&fCFL,1);
89  buf.Read(&fGamma,1);
90 
93 }
94 
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
Definition: pzdiscgal.h:20
void Read(TPZStream &buf, void *context) override
Read the element data from a stream.
Definition: pzconslaw.cpp:83
TPZResidualType fResidualType
Variable to indicate the type of residual to be computed by Assemble.
Definition: pzconslaw.h:268
Defines PZError.
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
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...
int fDim
Dimension of the problem.
Definition: pzconslaw.h:243
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
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
TPZConservationLaw(int nummat, REAL timeStep, int dim)
Simple constructor with material id, time step (dt) and dimension of the spatial domain.
Definition: pzconslaw.cpp:17
virtual ~TPZConservationLaw()
Default destructor.
Definition: pzconslaw.cpp:45
REAL fCFL
CFL number.
Definition: pzconslaw.h:249
Contains TPZMatrix<TVar>class, root matrix class.
virtual std::string Name() override=0
Returns the material name.
void Write(TPZStream &buf, int withclassid) const override
Save the element data to a stream.
Definition: pzconslaw.cpp:74
REAL fTimeStep
Time step used for time integration.
Definition: pzconslaw.h:246
REAL fGamma
Ratio between specific heat is constant and the specific heat the constant volume of a polytropic gas...
Definition: pzconslaw.h:255
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
Contains the TPZConservationLaw class which implements the interface for conservation laws...
TPZContributeTime fContributionTime
Variable indicating the context of the solution.
Definition: pzconslaw.h:261
virtual void Print(std::ostream &out) override
Prints the state of internal variables.
Definition: pzconslaw.cpp:49
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual void Read(bool &val)
Definition: TPZStream.cpp:91