1 | clear
|
---|
2 |
|
---|
3 | syms r
|
---|
4 |
|
---|
5 | rCrit = 3.587091;
|
---|
6 | rZero = 1.386534;
|
---|
7 | rOb = 1.279937;
|
---|
8 | gamma = 1.66666667;
|
---|
9 | dx = 0.03125;
|
---|
10 |
|
---|
11 | %Read in pressure and density information
|
---|
12 | %%%%%%
|
---|
13 | density_file = fopen('density_equilibrium.vtk');
|
---|
14 | text = textscan(density_file,'%s');
|
---|
15 | text = text{1};
|
---|
16 |
|
---|
17 | index = find(strcmp(text,'POINTS')) + 1;
|
---|
18 | npoints = str2double(text{index});
|
---|
19 | index = find(strcmp(text,'double')) + 1;
|
---|
20 |
|
---|
21 | for point = 1:npoints
|
---|
22 | y(point) = str2double(text{index});
|
---|
23 | density(point) = str2double(text{index+1});
|
---|
24 | index = index + 3;
|
---|
25 | end
|
---|
26 |
|
---|
27 | pressure_file = fopen('pressure_equilibrium.vtk');
|
---|
28 | text = textscan(pressure_file,'%s');
|
---|
29 | text = text{1};
|
---|
30 |
|
---|
31 | index = find(strcmp(text,'POINTS')) + 1;
|
---|
32 | npoints = str2double(text{index});
|
---|
33 | index = find(strcmp(text,'double')) + 1;
|
---|
34 |
|
---|
35 | for point = 1:npoints
|
---|
36 | pressure(point) = str2double(text{index+1});
|
---|
37 | index = index + 3;
|
---|
38 | end
|
---|
39 | %%%%%%%
|
---|
40 |
|
---|
41 | for point = 1:npoints
|
---|
42 | r = y(point);
|
---|
43 | analytic_density(point) = real((rCrit*(1./r - 1./rZero))^(1./(gamma-1.)));
|
---|
44 | analytic_pressure(point) = real((rCrit*(1./r - 1./rZero))^(gamma/(gamma-1.)));
|
---|
45 | end
|
---|
46 |
|
---|
47 | % Plot density and pressure on separate graphs (can insert more plots here, change to log, etc.)
|
---|
48 | plot(y,density,'k','LineWidth',2)
|
---|
49 | hold on;
|
---|
50 | plot(y,analytic_density,'--')
|
---|
51 | xlabel('y (CU)')
|
---|
52 | ylabel('Density (CU)')
|
---|
53 |
|
---|
54 | figure
|
---|
55 |
|
---|
56 | semilogy(y,pressure,'k','LineWidth',2)
|
---|
57 | hold on;
|
---|
58 | semilogy(y,analytic_pressure,'--')
|
---|
59 | xlabel('y (CU)')
|
---|
60 | ylabel('Pressure (CU)') |
---|