6 #ifndef TPZEULERCONSLAW_H 7 #define TPZEULERCONSLAW_H 20 extern LoggerPtr fluxroe;
21 extern LoggerPtr fluxappr;
71 virtual REAL
SetTimeStep(REAL maxveloc,REAL deltax,
int degree)
override;
113 virtual void Print(std::ostream & out)
override;
115 virtual std::string
Name()
override;
121 virtual int NFluxes()
override;
202 static void Roe_Flux(
const T & rho_f,
220 T & flux_rhoE,
int entropyFix = 1);
223 static void Roe_Flux(
const T & rho_f,
237 T &flux_rhoE,
int entropyFix = 1);
258 T & flux_rhoE,
int entropyFix = 1);
275 T &flux_rhoE,
int entropyFix = 1);
306 void PrepareInterfaceFAD(
321 void PrepareFastestInterfaceFAD(
422 void ContributeFastestImplDiff(
int dim,
460 void ContributeFastestImplConvFace(
int dim,
468 void ContributeFastestImplConvFace_dim(
525 virtual void Write(
TPZStream &buf,
int withclassid)
const override;
532 virtual int ClassId()
const override;
552 return "TPZEulerConsLaw";
561 if(nstate < 3 && nstate > 5){
562 PZError <<
"TPZEulerConsLaw::Flux case not implemented\n";
575 Fx[1] = (U[1]/U[0])*U[1] + press;
576 Fx[2] = U[1]*(U[2]/U[0]);
577 Fx[3] = U[1]*(U[3]/U[0]);
578 Fx[4] = (U[4]+press)*(U[1]/U[0]);
581 Fy[1] = U[2]*(U[1]/U[0]);
582 Fy[2] = (U[2]/U[0])*U[2] + press;
583 Fy[3] = U[2]*(U[3]/U[0]);
584 Fy[4] = (U[4] + press)*(U[2]/U[0]);
587 Fz[1] = U[3]*(U[1]/U[0]);
588 Fz[2] = U[3]*(U[2]/U[0]);
589 Fz[3] = (U[3]/U[0])*U[3] + press;
590 Fz[4] = (U[4] + press)*(U[3]/U[0]);
596 Fx[1] = U[1]*U[1] / U[0] + press;
597 Fx[2] = U[1]*U[2] / U[0];
598 Fx[3] = (U[3]+press)*U[1] / U[0];
601 Fy[1] = U[1]*U[2] / U[0];
602 Fy[2] = U[2]*U[2] / U[0] + press;
603 Fy[3] = (U[3] + press)*U[2] / U[0];
609 Fx[1] = (U[1]/U[0])*U[1] + press;
610 Fx[2] = (U[2]+press)*(U[1]/U[0]);
622 if(U[0] < REAL(1.e-6)) {
623 PZError <<
"TPZEulerConsLaw::JacobFlux: Density negative " << U[0] << std::endl;
629 REAL gamma1 = gamma-1.;
630 REAL gamma2 = gamma1/2.;
631 REAL gamma3 = gamma-3;
651 Ai[0](1,0) = gamma2*vel-u2;
652 Ai[0](1,1) = -gamma3*u;
653 Ai[0](1,2) = -gamma1*v;
654 Ai[0](1,3) = -gamma1*w;
669 Ai[0](4,0) = -gamma*e*u + gamma1*u*vel;
670 Ai[0](4,1) = gamma*e - gamma1*u2 - gamma2*vel;
671 Ai[0](4,2) = -gamma1*u*v;
672 Ai[0](4,3) = -gamma1*u*w;
673 Ai[0](4,4) = gamma*u;
687 Ai[1](2,0) = gamma2*vel-v2;
688 Ai[1](2,1) = -gamma1*u;
689 Ai[1](2,2) = -gamma3*v;
690 Ai[1](2,3) = -gamma1*w;
699 Ai[1](4,0) = -gamma*e*v + gamma1*v*vel;
700 Ai[1](4,1) = -gamma1*u*v;
701 Ai[1](4,2) = gamma*e - gamma1*v2 - gamma2*vel;
702 Ai[1](4,3) = -gamma1*v*w;
703 Ai[1](4,4) = gamma*v;
723 Ai[2](3,0) = gamma2*vel-w2;
724 Ai[2](3,1) = -gamma1*u;
725 Ai[2](3,2) = -gamma1*v;
726 Ai[2](3,3) = -gamma3*w;
729 Ai[2](4,0) = -gamma*e*w + gamma1*w*vel;
730 Ai[2](4,1) = -gamma1*u*w;
731 Ai[2](4,2) = -gamma1*v*w;
732 Ai[2](4,3) = gamma*e - gamma1*w2 - gamma2*vel;
733 Ai[2](4,4) = gamma*w;
750 Ai[0](1,0) = gamma2*vel-u2;
751 Ai[0](1,1) = -gamma3*u;
752 Ai[0](1,2) = -gamma1*v;
760 Ai[0](3,0) = -gamma*e*u + gamma1*u*vel;
761 Ai[0](3,1) = gamma*e - gamma1*u2 - gamma2*vel;
762 Ai[0](3,2) = -gamma1*u*v;
763 Ai[0](3,3) = gamma*u;
775 Ai[1](2,0) = gamma2*vel-v2;
776 Ai[1](2,1) = -gamma1*u;
777 Ai[1](2,2) = -gamma3*v;
780 Ai[1](3,0) = -gamma*e*v + gamma1*v*vel;
781 Ai[1](3,1) = -gamma1*u*v;
782 Ai[1](3,2) = gamma*e - gamma1*v2 - gamma2*vel;
783 Ai[1](3,3) = gamma*v;
797 Ai[0](1,0) = gamma2*vel-u2;
798 Ai[0](1,1) = -gamma3*u;
801 Ai[0](2,0) = -gamma*e*u + gamma1*u*vel;
802 Ai[0](2,1) = gamma*e - gamma1*u2 - gamma2*vel;
803 Ai[0](2,2) = gamma*u;
810 inline REAL
val(T & number)
820 PZError <<
"\nTPZEulerConsLaw::Pressure> Density negative " 821 << U[0] << std::endl;
833 T rho_velocity = ( U[1]*U[1] + U[2]*U[2] + U[3]*U[3] )/U[0];
834 press = ((gamma-1.)*( U[4] - REAL(0.5) * rho_velocity ));
838 T rho_velocity = ( U[1]*U[1] + U[2]*U[2] )/U[0];
839 press = ((gamma-1.)*( U[3] - REAL(0.5) * rho_velocity ));
843 T rho_velocity = ( U[1]*U[1] )/U[0];
844 press = ((gamma-1.)*( U[2] - REAL(0.5) * rho_velocity ));
846 std::cout <<
"\nTPZEulerConsLaw::Pressure> Unknown case - returning zero\n";
851 T temp = ((T)(gamma-1.))*U[nstate-1];
852 PZError <<
"TPZEulerConsLaw::Pressure> Negative pressure: " << press <<
" (gama-1)*E = " << temp << std::endl;
863 for(
int i = 0; i < nState; i++)
865 flux[i] = (solR[i]-solL[i]);
881 Roe_Flux(solL[0], solL[1], solL[2], solL[3], solL[4],
882 solR[0], solR[1], solR[2], solR[3], solR[4],
883 normal[0], normal[1], normal[2],
885 flux[0], flux[1], flux[2], flux[3], flux[4], entropyFix);
887 }
else if(nState == 4)
889 Roe_Flux(solL[0], solL[1], solL[2], solL[3],
890 solR[0], solR[1], solR[2], solR[3],
891 normal[0], normal[1],
893 flux[0], flux[1], flux[2], flux[3], entropyFix);
894 }
else if(nState == 3)
901 Roe_Flux(solL[0], solL[1], auxL, solL[2],
902 solR[0], solR[1], auxR, solR[2],
905 flux[0], flux[1], fluxaux, flux[2], entropyFix);
908 PZError <<
"No flux on " << nState <<
" state variables.\n";
916 const T & rho_f,
const T & rhou_f,
const T & rhov_f,
const T & rhow_f,
917 const T & rhoE_f,
const T & rho_t,
const T & rhou_t,
const T & rhov_t,
const T & rhow_t,
918 const T & rhoE_t,
const REAL nx,
const REAL ny,
const REAL nz,
const REAL gam,
919 T & flux_rho, T &flux_rhou, T &flux_rhov,
920 T & flux_rhow, T &flux_rhoE,
int entropyFix){
922 T alpha1,alpha2,alpha3,alpha4,alpha5,alpha;
923 T a1,a2,a3,a4,a5,b1,b2,b3,b4,b5;
924 T ep_t, ep_f, p_t, p_f;
925 T rhouv_t, rhouv_f, rhouw_t, rhouw_f, rhovw_t, rhovw_f;
926 T lambda_f, lambda_t;
927 T delta_rho, delta_rhou, delta_rhov, delta_rhow, delta_rhoE;
937 REAL gam1 = gam - 1.0;
938 T irho_f = REAL(1.0)/rho_f;
939 T irho_t = REAL(1.0)/rho_t;
945 T coef1 =
sqrt(rho_f);
946 T coef2 =
sqrt(rho_t);
947 T somme_coef = coef1 + coef2;
948 T isomme_coef = REAL(1.0)/somme_coef;
949 T u_f = rhou_f*irho_f;
950 T v_f = rhov_f*irho_f;
951 T w_f = rhow_f*irho_f;
952 T h_f = (gam * rhoE_f*irho_f) - (.5*gam1) * (u_f * u_f + v_f * v_f + w_f * w_f);
953 T u_t = rhou_t*irho_t;
954 T v_t = rhov_t*irho_t;
955 T w_t = rhow_t*irho_t;
956 T h_t = (gam * rhoE_t*irho_t) - (.5*gam1) * (u_t * u_t + v_t * v_t + w_t * w_t);
960 T u_ave = (coef1 * u_f + coef2 * u_t) * isomme_coef;
961 T v_ave = (coef1 * v_f + coef2 * v_t) * isomme_coef;
962 T w_ave = (coef1 * w_f + coef2 * w_t) * isomme_coef;
963 T h_ave = (coef1 * h_f + coef2 * h_t) * isomme_coef;
966 T scal = u_ave * nx + v_ave * ny + w_ave * nz;
967 T norme =
sqrt(nx * nx + ny * ny + nz * nz);
968 T inorme = REAL(1.0)/norme;
969 T u2pv2pw2 = u_ave * u_ave + v_ave * v_ave + w_ave * w_ave;
970 T c_speed = gam1 * (h_ave - REAL(0.5) * u2pv2pw2);
971 if(c_speed < REAL(1e-6)) c_speed = 1e-6;
972 c_speed =
sqrt(c_speed);
973 T c_speed2 = c_speed * norme;
976 T eig_val1 = scal - c_speed2;
978 T eig_val3 = scal + c_speed2;
987 if(eig_val2 <= REAL(0.0)) {
988 p_t = gam1 * (rhoE_t - REAL(0.5) * (rhou_t * rhou_t +
989 rhov_t * rhov_t + rhow_t * rhow_t) * irho_t);
991 rhouv_t = rhou_t * v_t;
992 rhouw_t = rhou_t * w_t;
993 rhovw_t = rhov_t * w_t;
994 flux_rho = rhou_t * nx + rhov_t * ny + rhow_t * nz;
995 flux_rhou = (rhou_t * u_t + p_t) * nx + rhouv_t * ny + rhouw_t * nz;
996 flux_rhov = rhouv_t * nx + (rhov_t * v_t + p_t) * ny + rhovw_t * nz;
997 flux_rhow = rhouw_t * nx + rhovw_t * ny + (rhow_t * w_t + p_t) * nz;
998 flux_rhoE = ep_t * (u_t * nx + v_t * ny + w_t * nz);
1002 p_f = gam1 * (rhoE_f - REAL(0.5) * (rhou_f * rhou_f + rhov_f * rhov_f
1003 + rhow_f * rhow_f) * irho_f);
1004 lambda_f = u_f * nx + v_f * ny + w_f * nz + norme
1005 *
sqrt(gam * p_f * irho_f);
1006 lambda_t = u_t * nx + v_t * ny + w_t * nz + norme
1007 *
sqrt(gam * p_t * irho_t);
1008 if (entropyFix && (lambda_f < REAL(0.)) && (lambda_t > REAL(0.))) {
1009 eig_val3 = lambda_t * (eig_val3 - lambda_f) / (lambda_t - lambda_f);
1012 if (eig_val3 > REAL(0.0)) {
1015 delta_rho = rho_t - rho_f;
1016 delta_rhou = rhou_t - rhou_f;
1017 delta_rhov = rhov_t - rhov_f;
1018 delta_rhow = rhow_t - rhow_f;
1019 delta_rhoE = rhoE_t - rhoE_f;
1021 scal = scal * inorme;
1025 usc = REAL(1.0)/c_speed;
1026 tempo11 = gam1 * usc;
1029 a2 = u_ave * usc + hnx;
1030 a3 = v_ave * usc + hny;
1031 a4 = w_ave * usc + hnz;
1032 a5 = REAL(0.5) * u2pv2pw2 * usc + REAL(2.5) * c_speed + scal;
1034 b1 = REAL(0.5) * (REAL(0.5) * tempo11 * u2pv2pw2 - scal);
1035 b2 = REAL(0.5) * (hnx - tempo11 * u_ave);
1036 b3 = REAL(0.5) * (hny - tempo11 * v_ave);
1037 b4 = REAL(0.5) * (hnz - tempo11 * w_ave);
1038 b5 = REAL(0.5) * tempo11;
1040 alpha1 = b1 * delta_rho;
1041 alpha2 = b2 * delta_rhou;
1042 alpha3 = b3 * delta_rhov;
1043 alpha4 = b4 * delta_rhow;
1044 alpha5 = b5 * delta_rhoE;
1045 alpha = eig_val3 * (alpha1 + alpha2 + alpha3 + alpha4 + alpha5);
1047 flux_rho -= a1 * alpha;
1048 flux_rhou -= a2 * alpha;
1049 flux_rhov -= a3 * alpha;
1050 flux_rhow -= a4 * alpha;
1051 flux_rhoE -= a5 * alpha;
1055 if(eig_val2 > REAL(0.0)) {
1056 p_f = gam1 * (rhoE_f - REAL(0.5) * (rhou_f * rhou_f +
1057 rhov_f * rhov_f + rhow_f * rhow_f) * irho_f);
1058 ep_f = rhoE_f + p_f;
1059 rhouv_f = rhou_f * v_f;
1060 rhouw_f = rhou_f * w_f;
1061 rhovw_f = rhov_f * w_f;
1062 flux_rho = rhou_f * nx + rhov_f * ny + rhow_f * nz;
1063 flux_rhou = (rhou_f * u_f + p_f) * nx + rhouv_f * ny + rhouw_f * nz;
1064 flux_rhov = rhouv_f * nx + (rhov_f * v_f + p_f) * ny + rhovw_f * nz;
1065 flux_rhow = rhouw_f * nx + rhovw_f * ny + (rhow_f * w_f + p_f) * nz;
1066 flux_rhoE = ep_f * (u_f * nx + v_f * ny + w_f * nz);
1070 p_t = gam1 * (rhoE_t - REAL(0.5) * (rhou_t * rhou_t +
1071 rhov_t * rhov_t + rhow_t * rhow_t) * irho_t);
1072 lambda_f = u_f * nx + v_f * ny + w_f * nz - norme
1073 *
sqrt(gam * p_f * irho_f);
1074 lambda_t = u_t * nx + v_t * ny + w_t * nz - norme
1075 *
sqrt(gam * p_t * irho_t);
1076 if (entropyFix && (lambda_f < REAL(0.)) && (lambda_t > REAL(0.))) {
1077 eig_val1 = lambda_f * (lambda_t - eig_val1) / (lambda_t - lambda_f);
1080 if (eig_val1 < REAL(0.0)) {
1083 delta_rho = rho_t - rho_f;
1084 delta_rhou = rhou_t - rhou_f;
1085 delta_rhov = rhov_t - rhov_f;
1086 delta_rhow = rhow_t - rhow_f;
1087 delta_rhoE = rhoE_t - rhoE_f;
1089 scal = scal * inorme;
1093 usc = REAL(1.0)/c_speed;
1094 tempo11 = gam1 * usc;
1097 a2 = u_ave * usc - hnx;
1098 a3 = v_ave * usc - hny;
1099 a4 = w_ave * usc - hnz;
1100 a5 = REAL(0.5) * u2pv2pw2 * usc + REAL(2.5) * c_speed - scal;
1102 b1 = REAL(0.5) * (REAL(0.5) * tempo11 * u2pv2pw2 + scal);
1103 b2 = -REAL(0.5) * (hnx + tempo11 * u_ave);
1104 b3 = -REAL(0.5) * (hny + tempo11 * v_ave);
1105 b4 = -REAL(0.5) * (hnz + tempo11 * w_ave);
1106 b5 = REAL(0.5) * tempo11;
1108 alpha1 = b1 * delta_rho;
1109 alpha2 = b2 * delta_rhou;
1110 alpha3 = b3 * delta_rhov;
1111 alpha4 = b4 * delta_rhow;
1112 alpha5 = b5 * delta_rhoE;
1113 alpha = eig_val1 * (alpha1 + alpha2 + alpha3 + alpha4 + alpha5);
1115 flux_rho += a1 * alpha;
1116 flux_rhou += a2 * alpha;
1117 flux_rhov += a3 * alpha;
1118 flux_rhow += a4 * alpha;
1119 flux_rhoE += a5 * alpha;
1127 const T & rho_t,
const T & rhou_t,
const T & rhov_t,
const T & rhoE_t,
1128 const REAL nx,
const REAL ny,
const REAL gam,
1129 T & flux_rho, T & flux_rhou,T & flux_rhov, T & flux_rhoE,
int entropyFix){
1131 T alpha1,alpha2,alpha3,alpha4,a1,a2,a3,a4,b1,b2,b3,b4,alpha;
1132 T ep_t, ep_f, p_t, p_f;
1134 T lambda_f, lambda_t;
1135 T delta_rho, delta_rhou,delta_rhov, delta_rhoE;
1144 REAL gam1 = gam - REAL(1.0);
1152 T coef1 =
sqrt(rho_f);
1153 T coef2 =
sqrt(rho_t);
1154 T somme_coef = coef1 + coef2;
1155 T u_f = rhou_f/rho_f;
1156 T v_f = rhov_f/rho_f;
1157 T h_f = (gam * rhoE_f/rho_f) - (u_f * u_f + v_f * v_f) * (gam1 / REAL(2.0));
1158 T u_t = rhou_t/rho_t;
1159 T v_t = rhov_t/rho_t;
1160 T h_t = (gam * rhoE_t/rho_t) - (u_t * u_t + v_t * v_t) * (gam1 / REAL(2.0));
1164 T u_ave = (coef1 * u_f + coef2 * u_t) / somme_coef;
1165 T v_ave = (coef1 * v_f + coef2 * v_t) / somme_coef;
1166 T h_ave = (coef1 * h_f + coef2 * h_t) / somme_coef;
1171 T scal = u_ave * nx + v_ave * ny;
1172 REAL norme =
sqrt(nx * nx + ny * ny);
1173 T u2pv2 = u_ave * u_ave + v_ave * v_ave;
1174 T c_speed = gam1 * (h_ave - REAL(0.5) * u2pv2);
1177 if(c_speed < REAL(1e-6)) c_speed = REAL(1e-6);
1178 c_speed =
sqrt(c_speed);
1179 T c_speed2 = c_speed * norme;
1182 T eig_val1 = scal - c_speed2;
1184 T eig_val3 = scal + c_speed2;
1196 if(eig_val2 <= REAL(0.0)) {
1197 p_t = gam1 * (rhoE_t - REAL(0.5) * (rhou_t * rhou_t + rhov_t * rhov_t) / rho_t);
1198 ep_t = rhoE_t + p_t;
1199 rhouv_t = rhou_t * v_t;
1200 flux_rho = rhou_t * nx + rhov_t * ny;
1201 flux_rhou = (rhou_t * u_t + p_t) * nx + rhouv_t * ny;
1202 flux_rhov = rhouv_t * nx + (rhov_t * v_t + p_t) * ny;
1203 flux_rhoE = ep_t * (u_t * nx + v_t * ny);
1207 p_f = gam1 * (rhoE_f - REAL(0.5) * (rhou_f * rhou_f + rhov_f * rhov_f) / rho_f);
1208 lambda_f = u_f * nx + v_f * ny + norme *
sqrt(gam * p_f / rho_f);
1209 lambda_t = u_t * nx + v_t * ny + norme
1210 *
sqrt(gam * p_t / rho_t);
1211 if (entropyFix && (lambda_f < REAL(0.)) && (lambda_t > REAL(0.))) {
1212 eig_val3 = lambda_t * (eig_val3 - lambda_f) / (lambda_t - lambda_f);
1215 if (eig_val3 > REAL(0.0)) {
1218 delta_rho = rho_t - rho_f;
1219 delta_rhou = rhou_t - rhou_f;
1220 delta_rhov = rhov_t - rhov_f;
1221 delta_rhoE = rhoE_t - rhoE_f;
1223 scal = scal / norme;
1226 usc = REAL(1.0)/c_speed;
1227 tempo11 = gam1 * usc;
1230 a2 = u_ave * usc + hnx;
1231 a3 = v_ave * usc + hny;
1232 a4 = REAL(0.5) * u2pv2 * usc + REAL(2.5) * c_speed + scal;
1234 b1 = REAL(0.5) * eig_val3 * (REAL(0.5) * tempo11 * u2pv2 - scal);
1235 b2 = REAL(0.5) * eig_val3 * (hnx - tempo11 * u_ave);
1236 b3 = REAL(0.5) * eig_val3 * (hny - tempo11 * v_ave);
1237 b4 = REAL(0.5) * eig_val3 * tempo11;
1239 alpha1 = a1 * b1 * delta_rho;
1240 alpha2 = a1 * b2 * delta_rhou;
1241 alpha3 = a1 * b3 * delta_rhov;
1242 alpha4 = a1 * b4 * delta_rhoE;
1243 alpha = alpha1 + alpha2 + alpha3 + alpha4;
1246 flux_rhou -= a2 * b1 * delta_rho + a2 * b2 * delta_rhou +
1247 a2 * b3 * delta_rhov + a2 * b4 * delta_rhoE;
1248 flux_rhov -= a3 * b1 * delta_rho + a3 * b2 * delta_rhou +
1249 a3 * b3 * delta_rhov + a3 * b4 * delta_rhoE;
1250 flux_rhoE -= a4 * b1 * delta_rho + a4 * b2 * delta_rhou +
1251 a4 * b3 * delta_rhov + a4 * b4 * delta_rhoE;
1255 if(eig_val2 > REAL(0.0)) {
1256 p_f = gam1 * (rhoE_f - REAL(0.5) * (rhou_f * rhou_f +
1257 rhov_f * rhov_f) / rho_f);
1258 ep_f = rhoE_f + p_f;
1259 rhouv_f = rhou_f * v_f;
1260 flux_rho = rhou_f * nx + rhov_f * ny;
1261 flux_rhou = (rhou_f * u_f + p_f) * nx + rhouv_f * ny;
1262 flux_rhov = rhouv_f * nx + (rhov_f * v_f + p_f) * ny;
1263 flux_rhoE = ep_f * (u_f * nx + v_f * ny);
1267 p_t = gam1 * (rhoE_t - REAL(0.5) * (rhou_t * rhou_t +
1268 rhov_t * rhov_t) / rho_t);
1269 lambda_f = u_f * nx + v_f * ny - norme *
sqrt(gam * p_f / rho_f);
1270 lambda_t = u_t * nx + v_t * ny - norme *
sqrt(gam * p_t / rho_t);
1271 if (entropyFix && (lambda_f < REAL(0.)) && (lambda_t > REAL(0.))) {
1272 eig_val1 = lambda_f * (lambda_t - eig_val1) / (lambda_t - lambda_f);
1275 if (eig_val1 < REAL(0.0)) {
1278 delta_rho = rho_t - rho_f;
1279 delta_rhou = rhou_t - rhou_f;
1280 delta_rhov = rhov_t - rhov_f;
1281 delta_rhoE = rhoE_t - rhoE_f;
1283 scal = scal / norme;
1286 usc = REAL(1.0)/c_speed;
1287 tempo11 = gam1 * usc;
1290 a2 = u_ave * usc - hnx;
1291 a3 = v_ave * usc - hny;
1292 a4 = REAL(0.5) * u2pv2 * usc + REAL(2.5) * c_speed - scal;
1294 b1 = REAL(0.5) * eig_val1 * (REAL(0.5) * tempo11 * u2pv2 + scal);
1295 b2 = -REAL(0.5) * eig_val1 * (hnx + tempo11 * u_ave);
1296 b3 = -REAL(0.5) * eig_val1 * (hny + tempo11 * v_ave);
1297 b4 = REAL(0.5) * eig_val1 * tempo11;
1299 alpha1 = a1 * b1 * delta_rho;
1300 alpha2 = a1 * b2 * delta_rhou;
1301 alpha3 = a1 * b3 * delta_rhov;
1302 alpha4 = a1 * b4 * delta_rhoE;
1303 alpha = alpha1 + alpha2 + alpha3 + alpha4;
1306 flux_rhou += a2 * b1 * delta_rho + a2 * b2 * delta_rhou +
1307 a2 * b3 * delta_rhov + a2 * b4 * delta_rhoE;
1308 flux_rhov += a3 * b1 * delta_rho + a3 * b2 * delta_rhou +
1309 a3 * b3 * delta_rhov + a3 * b4 * delta_rhoE;
1310 flux_rhoE += a4 * b1 * delta_rho + a4 * b2 * delta_rhou +
1311 a4 * b3 * delta_rhov + a4 * b4 * delta_rhoE;
1320 if(sol[0] < REAL(1e-10))
1322 PZError <<
"TPZEulerConsLaw::cSpeed Too low or negative density\n";
1330 temp = gamma * press;
1332 if(temp < REAL(1e-10))
1334 PZError <<
"TPZEulerConsLaw::cSpeed Too low or negative numerator\n";
1336 c =
sqrt(gamma * press/ sol[0]);
1342 if(sol[0] < REAL(1e-10))
1344 PZError <<
"TPZEulerConsLaw::cSpeed Too low or negative density\n";
1355 temp = sol[1]*sol[1] + sol[2]*sol[2];
1356 if(temp < REAL(1e-40))
1358 PZError <<
"TPZEulerConsLaw::uRes Zero Velocity\n";
1363 us =
sqrt(temp)/sol[0];
1366 temp = sol[1]*sol[1] + sol[2]*sol[2] + sol[3]*sol[3];
1367 if(temp < REAL(1e-40))
1369 PZError <<
"TPZEulerConsLaw::uRes Zero Velocity\n";
1374 us =
sqrt(temp)/sol[0];
1377 PZError <<
"TPZEulerConsLaw::uRes Error: invalid Dimension\n";
virtual void ContributeAdv(TPZVec< REAL > &x, TPZFMatrix< REAL > &jacinv, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, REAL weight, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
This material implements the weak statement of the compressible euler equations.
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 JacobFlux(REAL gamma, int dim, TPZVec< T > &U, TPZVec< TPZDiffMatrix< T > > &Ai)
Jacobian of the tensor flux of Euler.
virtual int VariableIndex(const std::string &name) override
Returns the relative index of a variable according to its name.
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 ...
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
void Test_Flux(TPZVec< T > &solL, TPZVec< T > &solR, TPZVec< REAL > &normal, REAL gamma, TPZVec< T > &flux)
Test flux -> returns the averaged state variables across an interface.
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...
clarg::argBool bc("-bc", "binary checkpoints", false)
This class is used as an exception thrown on an outofrange condition.
virtual int ClassId() const override
Class identificator.
Templated vector implementation.
virtual std::string Name() override
Returns the material name.
void ContributeExplConvFace(TPZVec< REAL > &x, TPZVec< STATE > &solL, TPZVec< STATE > &solR, REAL weight, TPZVec< REAL > &normal, TPZFMatrix< REAL > &phiL, TPZFMatrix< REAL > &phiR, TPZFMatrix< STATE > &ef, int entropyFix=1)
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
Contributes to the residual vector the boundary conditions.
void ComputeGhostState(TPZVec< T > &solL, TPZVec< T > &solR, TPZVec< REAL > &normal, TPZBndCond &bc, int &entropyFix)
Computes the ghost state variables bsed on the BC type.
TPZEulerConsLaw(const TPZEulerConsLaw &cp)
void SetDelta(REAL delta)
Sets the delta parameter inside the artifficial diffusion term.
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 ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
Contributes to the residual vector the boundary conditions.
void Flux(TPZVec< T > &U, TPZVec< T > &Fx, TPZVec< T > &Fy, TPZVec< T > &Fz)
tensor of the three-dimensional flux of Euler
This class implements a simple vector storage scheme for a templated class T. Utility.
REAL val(STATE &number)
Returns value of the variable.
TPZTimeDiscr
Indicates the type of time discretization.
This class adds to the term of diffusion to the variacional formulation of the differential equation...
static void uRes(TPZVec< T > &sol, T &us)
void ContributeApproxImplDiff(TPZVec< REAL > &x, TPZFMatrix< REAL > &jacinv, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, REAL weight, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
void ContributeApproxImplConvFace(TPZVec< REAL > &x, REAL faceSize, TPZVec< STATE > &solL, TPZVec< STATE > &solR, REAL weight, TPZVec< REAL > &normal, TPZFMatrix< REAL > &phiL, TPZFMatrix< REAL > &phiR, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, int entropyFix=1)
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
virtual int NFluxes() override
Returns the number of fluxes associated to this material.
static void ApproxRoe_Flux(TPZVec< T > &solL, TPZVec< T > &solR, TPZVec< REAL > &normal, REAL gamma, TPZVec< T > &flux, int entropyFix=1)
This flux encapsulates the two and three dimensional fluxes acquired from the Mouse program...
virtual void Print(std::ostream &out) override
Prints the state of internal variables.
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
REAL Det(TPZFMatrix< REAL > &Mat)
Computes the determinant of a 2d or 3d matrix. Used by recompute the element size.
void ContributeImplT1(TPZVec< REAL > &x, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, REAL weight, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
This abstract class defines the behaviour which each derived class needs to implement.
int fDim
Dimension of the problem.
void ContributeExplT2(TPZVec< REAL > &x, TPZVec< STATE > &sol, REAL weight, TPZFMatrix< REAL > &phi, TPZFMatrix< STATE > &ef)
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...
void ContributeFastestBCInterface(int dim, TPZVec< REAL > &x, TPZVec< STATE > &solL, TPZFMatrix< STATE > &dsolL, REAL weight, TPZVec< REAL > &normal, TPZFMatrix< REAL > &phiL, TPZFMatrix< REAL > &dphiL, TPZFMatrix< REAL > &axesleft, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
REAL DeltaX(REAL detJac)
Estimates the deltax (element diameter) based on the inverse of the jacobian.
TPZArtDiff fArtDiff
diffusive term
void SetTimeDiscr(TPZTimeDiscr Diff, TPZTimeDiscr ConvVol, TPZTimeDiscr ConvFace)
Configures the time discretization of some contributions.
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override=0
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
Contains TPZMatrixclass which implements full matrix (using column major representation).
This class defines the boundary condition for TPZMaterial objects.
virtual void ContributeLast(TPZVec< REAL > &x, TPZFMatrix< REAL > &jacinv, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, REAL weight, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ef)
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
void ContributeFastestBCInterface_dim(TPZVec< REAL > &x, TPZVec< STATE > &solL, TPZFMatrix< STATE > &dsolL, REAL weight, TPZVec< REAL > &normal, TPZFMatrix< REAL > &phiL, TPZFMatrix< REAL > &dphiL, TPZFMatrix< REAL > &axesleft, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
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.
void ContributeExplT1(TPZVec< REAL > &x, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, REAL weight, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ef)
virtual int NStateVariables() const override
Object-based overload.
REAL OptimalCFL(int degree)
returns the best value for the CFL number based on the interpolation degree.
long double gamma(unsigned int n)
Evaluate the factorial of a integer.
void ContributeExplDiff(TPZVec< REAL > &x, TPZFMatrix< REAL > &jacinv, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, REAL weight, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ef)
Implements the interface for conservation laws, keeping track of the timestep as well.
Contains the TPZArtDiff class which implements a numerical diffusivity coefficient.
static void cSpeed(TPZVec< T > &sol, REAL gamma, T &c)
Evaluates the speed of sound in the fluid.
virtual void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override=0
Matrix class to hold the flux derivatives A B C and diffusive matrix coefficients. Matrix.
virtual void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override
void ContributeExplConvVol(TPZVec< REAL > &x, TPZVec< STATE > &sol, REAL weight, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ef)
TPZTimeDiscr fDiff
variables indication whether the following terms are implicit
static void Roe_Flux(TPZVec< T > &solL, TPZVec< T > &solR, TPZVec< REAL > &normal, REAL gamma, TPZVec< T > &flux, int entropyFix=1)
This flux encapsulates the two and three dimensional fluxes acquired from the Mouse program...
REAL fGamma
Ratio between specific heat is constant and the specific heat the constant volume of a polytropic gas...
virtual TPZMaterial * NewMaterial() override
To create another material of the same type.
Defines the interface for saving and reading data. Persistency.
Contains the TPZOutofRange class.
int64_t NElements() const
Returns the number of elements of the vector.
Contains the TPZConservationLaw class which implements the interface for conservation laws...
void ContributeImplConvVol(TPZVec< REAL > &x, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, REAL weight, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
TPZArtDiff & ArtDiff()
Returns a reference to the artificial diffusion term.
static void Pressure(REAL gamma, int dim, T &press, TPZVec< T > &U)
Thermodynamic pressure determined by the law of an ideal gas.
TPZArtDiffType
Enumerate to define the possible types of artificial diffusion term to stabilize the numerical scheme...
#define PZError
Defines the output device to error messages and the DebugStop() function.
virtual REAL SetTimeStep(REAL maxveloc, REAL deltax, int degree) override
See declaration in base class.
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.