1 function p = porsche_plot(model,model_data,sim_data,step)
4 %
function plot_porsche_mit_sim_data(model,model_data,sim_data,step)
6 %
function plotting the solution of the PDE on the reference or the original
7 % porsche domain or plotting gradient and pressure on the porsche domain
8 % by interpolating the given gradients on a regular grid and cutting out
9 % those parts, that ly inside the porsche. This depends on the value of
11 % 1: plotting the solution on the reference domain
12 % 2: plotting the solution on the reshaped/original domain
13 % 3: plotting velocity and pressure on the reference domain
14 % 4: plotting velocity and pressure on the reshaped/original domain
22 % needed fields of model:
23 % - xrange, yrange: defining the box
24 % - cp: list of the car points
26 % needed fields of model_data:
27 % - model_data.microgrid
29 % - model_data.pdetoolbox_mesh.e
30 % - model_data.pdetoolbox_mesh.t
31 % --> p, e, t exported from pdetoolbox, containing the grid information
33 % needed fields of sim_data (only
for step 3 and 4)
34 % - gradx: n-by-1 vector with the x component of the gradient of
35 % the solution of the potential flow equation
36 % n must be the number of vertices in the grid
38 % - pressure: n-by-1-vector with the values of the pressure correspnding to
39 % the vertices in the grid
41 % Oliver Zeeb, 16.02.11
47 case 1 %plot the solution on the reference domain
48 lin_stat_plot_sim_data(model,model_data,sim_data);
50 title(
'solution on the reference domain');
54 sim_data_work=sim_data;
55 sim_data_work.uh=copy(sim_data.uh);
56 sim_data_work.uh.grid=grid_reshape(model, sim_data_work.uh.grid);
57 lin_stat_plot_sim_data(model,model_data,sim_data_work);
58 title(
'solution on the original domain');
64 %%% Interpolate to a regular grid %%%
65 xi = linspace(model.xrange(1),model.xrange(2),17); % Interpolation points x
66 yi = linspace(model.yrange(1),model.yrange(2),20); % Interpolation points y
67 [XI,YI] = meshgrid(xi,yi);
68 gradxI = griddata(model_data.grid.X, model_data.grid.Y, sim_data.gradx, XI, YI);
69 gradyI = griddata(model_data.grid.X, model_data.grid.Y, sim_data.grady, XI, YI);
71 %check, which points are in the car,
do not plot velocity arrows there!
72 IN=inpolygon(XI,YI,model.cp(:,1),model.cp(:,2));
79 p = model_data.pdetoolbox_mesh.p;
80 e = model_data.pdetoolbox_mesh.e;
81 t = model_data.pdetoolbox_mesh.t;
83 pdeplot(p,e,t,
'xydata',sim_data.pressure,
'mesh',
'off')
86 quiver(XI,YI,gradxI,gradyI)
88 title('pressure and velocity, reference domain')
92 %%% Interpolate to a regular grid %%%
93 xi = linspace(model.xrange(1),model.xrange(2),17); % Interpolation points x
94 yi = linspace(model.yrange(1),model.yrange(2),20); % Interpolation points y
95 [XI,YI] = meshgrid(xi,yi);
96 gradxI = griddata(model_data.grid.X, model_data.grid.Y, sim_data.gradx, XI, YI);
97 gradyI = griddata(model_data.grid.X, model_data.grid.Y, sim_data.grady, XI, YI);
99 %transform the ppoints before checking which velocity arrows to
101 cp_trafo=points_trafo(model,model.cp);
103 %check, which points are in the car, do not plot velocity arrows there!
104 IN=inpolygon(XI,YI,cp_trafo(:,1),cp_trafo(:,2));
105 %IN=inpolygon(XI,YI,model.cp(:,1),model.cp(:,2));
112 p = model_data.pdetoolbox_mesh.p;
113 e = model_data.pdetoolbox_mesh.e;
114 t = model_data.pdetoolbox_mesh.t;
115 pts_transformed = points_trafo(model,p')';
117 pdeplot(pts_transformed,e,t,'xydata',sim_data.pressure,'mesh','off')
120 quiver(XI,YI,gradxI,gradyI)
122 title('pressure and velocity, reshaped domain')
125 error('unknown step!');