15 if(U[0] > -1.e-6 && U[0] < 1.e-6)
return (fGamma-1.)*U[3];
16 STATE velocity = (U[1]*U[1]+U[2]*U[2])/U[0];
17 return (fGamma-1.)*(U[3]-(.5*velocity));
25 STATE pressao = Pressure(U);
26 if(U[0] > -1.e-6 && U[0] < 1.e-6) {
27 flux[0] = flux[2] = flux[3] = flux[4] = flux[5] = flux[7] = 0.;
28 cout <<
"EulerLaw2D::Flux find nule density.\n";
29 flux[1] = flux[6] = pressao;
34 flux[1] = ((U[1]/U[0])*U[1]) + pressao;
35 flux[2] = U[1]*(U[2]/U[0]);
36 flux[3] = (U[1]/U[0])*(U[3]+pressao);
38 flux[5] = U[2]*(U[1]/U[0]);
39 flux[6] = ((U[2]/U[0])*U[2]) + pressao;
40 flux[7] = (U[2]/U[0])*(U[3] + pressao);
44 if(U[0] > -1.e-6 && U[0] < 1.e-6) {
45 cout <<
"\nERRO : Densidade NULA. Falla jacobiano.\n";
49 STATE velx, vely, ener, aux, gammam1 = fGamma-1.;
54 Ajacob(0,0)=Ajacob(0,2)=Ajacob(0,3)=Ajacob(2,3)=0.;
55 Bjacob(0,0)=Bjacob(0,1)=Bjacob(0,3)=Bjacob(1,3)=0.;
56 Ajacob(0,1)=Bjacob(0,2)=1.;
57 Ajacob(1,3)=Bjacob(2,3)=gammam1;
58 Ajacob(1,1)=(3.-fGamma)*velx;
59 Bjacob(2,2)=(3.-fGamma)*vely;
60 Ajacob(1,2)=-1.*gammam1*vely;
61 Bjacob(2,1)=-1.*gammam1*velx;
62 Ajacob(3,2)=Bjacob(3,1)=Ajacob(1,2)*velx;
63 Ajacob(2,0)=Bjacob(1,0)=-1.*velx*vely;
64 Ajacob(2,1)=Bjacob(1,1)=vely;
65 Ajacob(2,2)=Bjacob(1,2)=velx;
66 Ajacob(3,3)=fGamma*velx;
67 Bjacob(3,3)=fGamma*vely;
68 aux = gammam1*(velx*velx+vely*vely);
69 Ajacob(1,0) = 0.5*aux - (velx*velx);
70 Ajacob(3,1) = (fGamma*ener) - (.5*gammam1*(3*velx*velx+vely*vely));
71 Bjacob(3,2) = (fGamma*ener) - (.5*gammam1*(velx*velx+3*vely*vely));
72 Bjacob(2,0) = 0.5*aux - (vely*vely);
73 Ajacob(3,0) = (aux-(fGamma*ener))*velx;
74 Bjacob(3,0) = (aux-(fGamma*ener))*vely;
80 STATE vx, vy, cval, cval2, u, kt, st, aa, bb;
81 STATE gM1 = fGamma-1.;
84 cval2 = (fGamma*Pressure(U))/rho;
86 cout <<
"TEulerLaw2D::ValJacobFlux. velocidade do som negativa.\n";
93 u =
sqrt(vx*vx + vy*vy);
95 STATE Mach2 = u*u/cval2;
96 if(u>-1.e-6 && u< 1.e-6) {
103 aa = normal[0]*kt + normal[1]*st;
104 bb = normal[1]*kt - normal[0]*st;
111 STATE aabbnorm2 = aa*aa+bb*bb;
112 STATE aabbnorm =
sqrt(aabbnorm2);
116 STATE aascal = aa/aabbnorm;
117 STATE bbscal = bb/aabbnorm;
118 right(0,0) = -(bbscal*cval*Mach);
119 right(0,1) = bbscal*kt + aascal*st;
120 right(0,2) = -(aascal*kt) + bbscal*st;
123 right(1,0) = 1 - gM1*Mach2/2.;
124 right(1,1) = (gM1*kt*Mach)/cval;
125 right(1,2) = (gM1*Mach*st)/cval;
126 right(1,3) = -gM1/cval2;
128 right(2,0) = (cval2*Mach*(2*aascal + gM1*Mach))/4.;
129 right(2,1) = -(cval*(aascal*kt + gM1*kt*Mach - bbscal*st))/2.;
130 right(2,2) = -(cval*(bbscal*kt + (aascal + gM1*Mach)*st))/2.;
133 right(3,0) = (cval2*Mach*(-2*aascal + gM1*Mach))/4.;
134 right(3,1) = (cval*(aascal*kt - gM1*kt*Mach - bbscal*st))/2.;
135 right(3,2) = (cval*(bbscal*kt + (aascal - gM1*Mach)*st))/2.;
145 left(1,0) = bbscal*kt + aascal*st;
146 left(1,1) = cval*kt*Mach;
147 left(1,2) = (-(aascal*kt) + kt*Mach + bbscal*st)/cval;
148 left(1,3) = (aascal*kt + kt*Mach - bbscal*st)/cval;
150 left(2,0) = -(aascal*kt) + bbscal*st;
151 left(2,1) = cval*Mach*st;
152 left(2,2) = -((bbscal*kt + aascal*st - Mach*st)/cval);
153 left(2,3) = (bbscal*kt + (aascal + Mach)*st)/cval;
156 left(3,0) = bbscal*cval*Mach;
157 left(3,1) = (cval2*Mach2)/2.;
158 left(3,2) = 1/gM1 + (Mach*(-2*aascal + Mach))/2.;
159 left(3,3) = 1/gM1 + (Mach*(2*aascal + Mach))/2.;
163 diag[0] =
fabs(aa*cval*Mach);
164 diag[1] =
fabs(aa*cval*Mach);
165 diag[2] =
fabs(-(aabbnorm*cval) + aa*cval*Mach);
166 diag[3] =
fabs(cval*(aabbnorm + aa*Mach));
173 valjacob(i,j) += left(i,k)*diag[k]*right(k,j);
187 STATE BHDF = b*
h-d*
f, BKCJ = b*k-c*j, BSDN = b*s-d*n, CFBG = c*f-b*g;
188 STATE CLDK = c*l-d*k, CNBR = c*n-b*r, DGCH = d*g-c*
h, DJBL = d*j-b*l;
189 STATE DRCS = d*r-c*s, FRGN = f*r-g*n, GJFK = g*j-f*k, GSHR = g*s-h*r;
190 STATE FSHN = f*s-h*n, LNJS = l*n-j*s, HJFL = h*j-f*l, HKGL = h*k-g*l;
191 STATE KNJR = k*n-j*r, LRKS = l*r-k*s;
192 STATE det = DJBL*(g*m-e*r)+BHDF*(k*m-i*r)+BSDN*(g*i-e*k);
193 det += (FSHN*(a*k-c*i)+LNJS*(a*g-c*e)+HJFL*(a*r-c*
m));
194 if(det > -1.e-6 && det < 1.e-6) {
195 cout <<
"TEulerLaw2D::InverseJacob. Determinante zero, matriz singular.\n";
200 jac(0,0) = det*(k*FSHN+g*LNJS+r*HJFL);
201 jac(1,0) = det*(m*HKGL+i*GSHR+e*LRKS);
202 jac(2,0) = (-det)*(m*HJFL+i*FSHN+e*LNJS);
203 jac(3,0) = det*(m*GJFK+i*FRGN+e*KNJR);
204 jac(0,1) = det*(d*KNJR+b*LRKS-c*LNJS);
205 jac(1,1) = det*(m*CLDK+i*DRCS-a*LRKS);
206 jac(2,1) = det*(m*DJBL+i*BSDN+a*LNJS);
207 jac(3,1) = det*(m*BKCJ+i*CNBR-a*KNJR);
208 jac(0,2) = det*(d*FRGN-c*FSHN+b*GSHR);
209 jac(1,2) = det*(m*DGCH-e*DRCS-a*GSHR);
210 jac(2,2) = det*(m*BHDF-e*BSDN+a*FSHN);
211 jac(3,2) = det*(m*CFBG-e*CNBR-a*FRGN);
212 jac(0,3) = det*(d*GJFK-c*HJFL+b*HKGL);
213 jac(1,3) = (-det)*(i*DGCH+e*CLDK+a*HKGL);
214 jac(2,3) = det*(a*HJFL-i*BHDF-e*DJBL);
215 jac(3,3) = (-det)*(i*CFBG+e*BKCJ+a*GJFK);
222 tmp[0][0] = jacinv(0,0)*axes(0,0)+jacinv(0,1)*axes(1,0);
224 tmp[0][1] = jacinv(0,0)*axes(0,1)+jacinv(0,1)*axes(1,1);
226 tmp[1][0] = jacinv(1,0)*axes(0,0)+jacinv(1,1)*axes(1,0);
228 tmp[1][1] = jacinv(1,0)*axes(0,1)+jacinv(1,1)*axes(1,1);
230 jacinv(0,0) = tmp[0][0];
231 jacinv(0,1) = tmp[0][1];
232 jacinv(1,0) = tmp[1][0];
233 jacinv(1,1) = tmp[1][1];
241 InvJacob2d(axes,jacinv);
252 JacobFlux(sol,Ajacob,Bjacob);
256 Beta[0] = jacinv(0,0); Beta[1] = jacinv(0,1);
257 ValJacobFlux(sol,valjacob,Beta);
260 invvaljacob = valjacob;
261 Beta[0] = jacinv(1,0); Beta[1] = jacinv(1,1);
262 ValJacobFlux(sol,valjacob,Beta);
265 invvaljacob += valjacob;
266 InverseJacob(invvaljacob);
278 ATauA(i,j) += Ajacob(i,k)*invvaljacob(k,l)*Ajacob(l,j);
279 ATauB(i,j) += Ajacob(i,k)*invvaljacob(k,l)*Bjacob(l,j);
280 BTauA(i,j) += Bjacob(i,k)*invvaljacob(k,l)*Ajacob(l,j);
281 BTauB(i,j) += Bjacob(i,k)*invvaljacob(k,l)*Bjacob(l,j);
291 STATE velx, vely, ener, aux, gammam1 = fGamma-1.;
295 STATE alfa = normal[0], beta= normal[1];
296 aux = gammam1*(velx*velx+vely*vely);
298 jacob(0,0)=jacob(0,3)=0.;
299 jacob(0,1)=alfa; jacob(0,2)=beta;
300 jacob(1,3)= alfa*gammam1;
301 jacob(2,3)= beta*gammam1;
302 jacob(1,1)= alfa*((3.-fGamma)*velx)+beta*vely;
303 jacob(1,2)=-alfa*gammam1*vely+beta*velx;
304 jacob(3,2)=-alfa*gammam1*velx*vely+beta*((fGamma*ener) - .5*gammam1*(3*vely*vely+velx*velx));
305 jacob(2,0)=-alfa*velx*vely+beta*(0.5*aux - (vely*vely));
306 jacob(2,1)=alfa*vely-beta*gammam1*velx;
307 jacob(2,2)=alfa*velx+beta*(3.-fGamma)*vely;
308 jacob(3,3)=fGamma*(alfa*velx+beta*vely);
309 jacob(1,0) = alfa*(0.5*aux - (velx*velx))-beta*(velx*vely);
310 jacob(3,1) = alfa*((fGamma*ener) - .5*gammam1*(3*velx*velx+vely*vely))-beta*gammam1*vely*velx;
311 jacob(3,0) = (alfa*velx+beta*vely)*(aux - fGamma*ener);
327 normal[1] =
sqrt(.75);
341 jacob.
Print(
"ValJacob");
344 axes(0,0)=1.5; axes(0,1)=2.3; axes(1,0)=.1; axes(1,1)=-1.9;
345 jacinv(0,0) = 1.3;jacinv(0,1) = -2.4;jacinv(1,0)=3.5;jacinv(1,1)=5.2;
346 eul.
MatrixDiff(U,axes,jacinv,ATA,ATB,BTA,BTB);
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
static void Flux(TPZVec< STATE > &u, TPZVec< STATE > &flux)
Calculates the fluxes and .
static STATE fGamma
Polytropic gas constant.
Templated vector implementation.
static void JacobFlux(TPZVec< STATE > &u, TPZFMatrix< STATE > &Ajacob, TPZFMatrix< STATE > &Bjacob)
clarg::argBool h("-h", "help message", false)
AutoPointerMutexArrayInit tmp
int Zero() override
Makes Zero all the elements.
static void ValJacobFlux(TPZVec< STATE > &u, TPZFMatrix< STATE > &valjacob, TPZVec< REAL > &normal)
static STATE Pressure(TPZVec< STATE > &U)
Calculates the pressure from equation of state. It is expected: .
Contains TPZMatrixclass which implements full matrix (using column major representation).
Implements a numerical diffusivity coeficient for the SUPG method. Analysis: Solving process Analysis...
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
static void MatrixDiff(TPZVec< STATE > &sol, TPZFMatrix< REAL > &axes, TPZFMatrix< REAL > &jacinv, TPZFMatrix< STATE > &ATauA, TPZFMatrix< STATE > &ATauB, TPZFMatrix< STATE > &BTauA, TPZFMatrix< STATE > &BTauB)
static int main()
Static main for test.
Contains the TEulerDiffusivity class which implements a numerical diffusivity coefficient for SUPG...
virtual void Print(std::ostream &out) const
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
clarg::argString m("-m", "input matrix file name (text format)", "matrix.txt")
static void InvJacob2d(TPZFMatrix< REAL > &axes, TPZFMatrix< REAL > &jacinv)
static void InverseJacob(TPZFMatrix< STATE > &jac)
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...