23 #ifdef LinearConvection 25 std::map<int, TPZMaterial * >::iterator w;
30 cout <<
"old celerity = ";
31 for(
int i = 0; i < matcast->fCelerity.NElements(); i++) cout << matcast->fCelerity[i] <<
" ";
33 matcast->fCelerity = Celerity;
34 cout <<
"new celerity = ";
35 for(
int i = 0; i < matcast->fCelerity.NElements(); i++) cout << matcast->fCelerity[i] <<
" ";
44 #ifdef LinearConvection 48 double keepP = sol[4];
50 double rhoE = 0.5*sol[0]*(sol[1]*sol[1]+sol[2]*sol[2]+sol[3]*sol[3])+sol[4]/(gamma-1.);
51 sol[1] = sol[1]*sol[0];
52 sol[2] = sol[2]*sol[0];
53 sol[3] = sol[3]*sol[0];
56 if(
fabs(p-keepP) > 1e-4){
57 std::cout <<
"\np = " << p <<
" keepP = " << keepP <<
"\n";
63 #ifdef LinearConvection 68 PZError <<
"\nTPZEulerEquation::FromConservativeToPrimitive: Density almost null\n" <<
"Density = " << sol[0] << std::endl;
73 sol[1] = sol[1]/sol[0];
74 sol[2] = sol[2]/sol[0];
75 sol[3] = sol[3]/sol[0];
115 out <<
"gGamma = " <<
gGamma <<
"\n";
119 if( !strcmp(name.c_str(),
"density") )
return 1;
120 if( !strcmp(name.c_str(),
"velocity") )
return 2;
121 if( !strcmp(name.c_str(),
"energy") )
return 3;
122 if( !strcmp(name.c_str(),
"pressure") )
return 4;
123 if( !strcmp(name.c_str(),
"solution") )
return 5;
124 if( !strcmp(name.c_str(),
"normvelocity") )
return 6;
125 if( !strcmp(name.c_str(),
"Mach") )
return 7;
126 std::cout <<
"TPZEulerEquation::VariableIndex not defined\n";
132 if(var == 1 || var == 3 || var == 4 || var == 6 || var == 7)
return 1;
136 std::cout <<
"TPZEulerEquation::NSolutionVariables not defined\n";
142 #ifndef LinearConvection 144 PZError <<
"\nTPZEulerEquation::Solution: Density almost null\n" <<
"Density = " << Sol[0] << std::endl;
153 }
else if(var == 2) {
156 for(
int i=0;i<dim;i++) Solout[i] = Sol[i+1]/Sol[0];
158 }
else if(var == 3) {
161 Solout[0] = Sol[pos];
163 }
else if(var == 4) {
167 }
else if(var == 5) {
170 for(
int i=0;i<nstate;i++) Solout[i] = Sol[i];
172 }
else if(var == 6) {
175 REAL ro2 = Sol[0]*Sol[0];
177 for(
int i=1;i<nstate-1;i++) veloc += Sol[i]*Sol[i];
178 Solout[0] =
sqrt(veloc/ro2);
180 }
else if(var == 7) {
183 const REAL cspeed = this->
cSpeed(Sol);
184 const REAL us = this->
uRes(Sol);
185 Solout[0] = us / cspeed;
195 std::cout <<
"\nWarning at " << __PRETTY_FUNCTION__ <<
" - this method should not be called";
200 std::cout <<
"\nWarning at " << __PRETTY_FUNCTION__ <<
" - this method should not be called";
205 std::cout <<
"\nWarning at " << __PRETTY_FUNCTION__ <<
" - this method should not be called";
210 #ifdef LinearConvection 215 for(
int i = 0; i < 3; i++) dot += data.
normal[i]*fCelerity[i];
217 Flux[0] = dot*dataleft.
sol[0];
220 Flux[0] = dot*dataright.
sol[0];
223 for(
int i = 0; i < 5; i++) ef(i,0) += +1. * weight*Flux[i];
224 for(
int i = 0; i < 5; i++) ef(i+20,0) += -1. * weight*Flux[i];
230 for(
int i = 0; i < 15; i++) ef(i+5,0) += +1. * weight*Flux[i];
231 for(
int i = 0; i < 15; i++) ef(i+20+5,0) += -1. * weight*Flux[i];
235 int numbersol = dataleft.
sol.
size();
236 if (numbersol != 1) {
247 for(
int i = 0; i < 5; i++) ef(i,0) += +1. * weight*Flux[i];
248 for(
int i = 0; i < 5; i++) ef(i+20,0) += -1. * weight*Flux[i];
254 for(
int i = 0; i < 15; i++) ef(i+5,0) += +1. * weight*Flux[i];
255 for(
int i = 0; i < 15; i++) ef(i+20+5,0) += -1. * weight*Flux[i];
264 std::cout << __PRETTY_FUNCTION__ <<
" - this method should not be called for Finite Volume Method\n";
273 std::cout <<
"\nWarning at " << __PRETTY_FUNCTION__ <<
" - this method should not be called";
281 int numbersol = dataleft.
sol.
size();
282 if (numbersol != 1) {
286 #ifdef LinearConvection 290 dataright.sol = dataleft.
sol;
292 for(
int i = 0; i < ef.
Rows(); i++) ef(i,0) += fakeef(i,0);
299 for(
int i = 0; i < 15; i++) ef(i+5,0) += +1. * weight*Flux[i];
310 for(
int i = 0; i < 5; i++) ef(i,0) += +1. * weight*Flux[i];
317 for(
int i = 0; i < 15; i++) ef(i+5,0) += +1. * weight*Flux[i];
324 if(U[0] < REAL(1e-10)){
325 PZError <<
"TPZEulerEquation::Pressure - Negative or too small density " 326 << U[0] << std::endl;
333 REAL rho_velocity = ( U[1]*U[1] + U[2]*U[2] + U[3]*U[3] )/U[0];
334 press = ((gamma-1.)*( U[4] - 0.5 * rho_velocity ));
337 REAL temp = (gamma-1.)*U[4];
338 PZError <<
"TPZEulerEquation::Pressure Negative pressure: " << press <<
" (gama-1)*E = " << temp << std::endl;
348 if(sol[0] < REAL(1e-10)){
349 PZError <<
"TPZEulerEquation(::cSpeed Too small or negative density " << sol[0] << std::endl;
354 const REAL temp =
gGamma * press;
356 if(temp < REAL(1e-10))
358 PZError <<
"TPZEulerEquation::cSpeed Too low or negative numerator\n";
366 const REAL temp = sol[1]*sol[1] + sol[2]*sol[2] + sol[3]*sol[3];
367 if(temp < REAL(1e-40)){
368 PZError <<
"TPZEulerEquation::uRes Zero Velocity\n";
371 const REAL us =
sqrt(temp)/sol[0];
376 const double rho = sol[0];
377 const double rhoU = sol[1];
378 const double rhoV = sol[2];
379 const double rhoW = sol[3];
380 const double rhoE = sol[4];
381 const double u = rhoU/rho;
382 const double v = rhoV/rho;
383 const double w = rhoW/rho;
386 F(0,0) = rhoU; F(0,1) = rhoV; F(0,2) = rhoW;
387 F(1,0) = rhoU*u+p; F(1,1) = rhoU*v; F(1,2) = rhoU*w;
388 F(2,0) = rhoV*u; F(2,1) = rhoV*v+p; F(2,2) = rhoV*w;
389 F(3,0) = rhoW*u; F(3,1) = rhoW*v; F(3,2) = rhoW*w+p;
390 F(4,0) = (rhoE+p)*u; F(4,1) = (rhoE+p)*v; F(4,2) = (rhoE+p)*w;
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
Contains the TPZEulerEquation class which implements the weak statement of the compressible euler equ...
static void FromPrimitiveToConservative(TPZVec< STATE > &sol, STATE gamma)
Convert from primitive to conservative variables.
CALCType
Type of flux computing.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to stiffness matrix and load vector at one integration point...
int ClassId() const override
Unique identifier for serialization purposes.
TPZManVector< REAL, 3 > normal
normal to the element at the integration point
bool IsZero(long double a)
Returns if the value a is close Zero as the allowable tolerance.
Implements a vector class which allows to use external storage provided by the user. Utility.
This material implements the weak statement of the three-dimensional compressible euler equations...
clarg::argBool bc("-bc", "binary checkpoints", false)
static REAL Pressure(TPZVec< STATE > &U, double gamma)
Returns the pressure value.
virtual void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override
void ApplyLimiter(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright)
Apply limiter.
TPZAUSMFlux fAUSMFlux
Convective flux object.
virtual int VariableIndex(const std::string &name)
Returns the variable index associated with the name.
void ComputeFlux(TPZVec< STATE > &solL, TPZVec< STATE > &solR, const TPZVec< REAL > &normal, TPZVec< STATE > &F)
Computes numerical flux.
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to the stiffness matrix and load vector at one integration point...
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to stiffness matrix and load vector at one BC integration point...
virtual void Print(std::ostream &out=std::cout)
Prints out the data associated with the material.
This abstract class defines the behaviour which each derived class needs to implement.
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
virtual int Dimension() const override
Object-based overload.
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
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...
virtual void Flux(TPZVec< REAL > &x, TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, TPZVec< STATE > &flux)
Computes the value of the flux function to be used by ZZ error estimator.
TPZMaterial * NewMaterial() override
Creates a copy of this.
static STATE gGamma
Ratio between specific heat at constant pressure and the specific heat at constant volume of a polytr...
virtual int ClassId() const override
Unique identifier for serialization purposes.
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
STATE uRes(TPZVec< STATE > &sol)
Returns .
This class defines the boundary condition for TPZMaterial objects.
~TPZEulerEquation()
Default destructor.
int64_t Rows() const
Returns number of rows.
TPZGradientFlux fGradientFlux
Gradient flux object.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
STATE cSpeed(TPZVec< STATE > &sol)
Computes sound speed.
virtual int NStateVariables() const override
Object-based overload.
int32_t Hash(std::string str)
std::map< int,TPZMaterial *> & MaterialVec()
Returns a reference to the material pointers vector.
long double gamma(unsigned int n)
Evaluate the factorial of a integer.
Contains TPZMatrix<TVar>class, root matrix class.
Contains the TPZArtDiff class which implements a numerical diffusivity coefficient.
TPZEulerEquation()
Default constructor.
void ComputeEulerFlux(TPZVec< STATE > &sol, TPZFMatrix< STATE > &F)
Compute Euler Flux.
void ComputeFlux(TPZVec< STATE > &solL, TPZVec< STATE > &solR, TPZVec< REAL > &normal, TPZVec< STATE > &F)
Computes numerical flux.
static void FromConservativeToPrimitive(TPZVec< STATE > &sol, STATE gamma)
Convert from conservative to primitive variables.
virtual int VariableIndex(const std::string &name) override
Returns the variable index associated with the name.
Implements computational mesh. Computational Mesh.
int64_t Cols() const
Returns number of cols.
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
virtual void ContributeBC(TPZMaterialData &data, 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...
TPZSolVec sol
vector of the solutions at the integration point
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
#define PZError
Defines the output device to error messages and the DebugStop() function.