Professional Documents
Culture Documents
Assignment On 1D Shock Tube Problem (Computational Fluid Dynamics)
Assignment On 1D Shock Tube Problem (Computational Fluid Dynamics)
where the pressure, p, is related to the conserved quantities through the equation of
state
with
from
Write a program to find solution of 1D Shock Tube Problem with specified initial
conditions using MacCormack Scheme.
/*
Name Abhishek Mani
Branch - Mathematical Sciences
Roll No. - 11412EN003
Program - 1-D Shock tube Problem
*/
#include<stdio.h>
#include<math.h>
return uMax;
}
int main(){
int i,j,k;
dx = tubeLength / (N-1);
init(uMatrix);
calF(uMatrix, fMatrix);
boundaryCond(uTemp);
calF(uTemp, fTemp);
boundaryCond(uNp1);
calF(uNp1, fNp1);
for(j=0;j<N;j++){
rhoValues[j] = uMatrix[0][j];
energyValues[j] = uMatrix[2][j];
pValues[j] = (gamma-1)*(uMatrix[2][j] ((0.5)*uMatrix[1][j]*uMatrix[1][j])/uMatrix[0][j]);
fprintf(fp1,"%f",pValues[j]);
fprintf(fp1," ");
fprintf(fp2,"%f",energyValues[j]);
fprintf(fp2," ");
fprintf(fp3,"%f",uMatrix[1][j]/uMatrix[0][j]);
fprintf(fp3," ");
fprintf(fp4,"%f",uMatrix[0][j]);
fprintf(fp4," ");
}
fclose(fp1);
fclose(fp2);
fclose(fp3);
fclose(fp4);
}