rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
plot_sim_data.m
1 function p = plot_sim_data(dmodel, model_data, sim_data, plot_params)
2 %function plot_sim_data(descr, model_data, sim_data, plot_params)
3 % plots the simulation data as returned by detailed_simulation()
4 %
5 % Parameters:
6 % sim_data: simulation data structure as returned by detailed_simulation()
7 % plot_params: structure which controls the plot output
8 %
9 % Optional fields of plot_params:
10 % plot: function pointer to a function plotting a single snapshot
11 % for a specific time instant. (default = 'descr.plot')
12 %
13 % Return values:
14 % p : Matlab GUI handle to figure window
15 %
16 % function plotting simulation results
17 
18  if isfield(plot_params,'plot')
19  pplot = plot_params.plot;
20  else
21  if isfield(dmodel.descr, 'plot')
22  pplot = dmodel.descr.plot;
23  else
24  pplot = @fv_plot;
25  end
26  end
27 
28  UP_data.P = sim_data.P;
29  UP_data.U = sim_data.U;
30  UP_data.gEI = model_data.gEI;
31 
32  data = { sim_data.S, sim_data.S, sim_data.P, UP_data };
33  plot_params.index = { 1, 2, 3, 4 };
34  plot_params.plot_type = { 'contour', 'patch', 'patch', 'contour' };
35  plot_params.plot = { pplot, pplot, pplot, @pu_plot };
36  plot_params.sp_x = 2;
37  plot_params.sp_y = 2;
38 
39  p = plot_subplot_sequence(data, model_data.grid, plot_params);
40 
41 function p = pu_plot(grid, sim_data, plot_params)
42 
43  plot_params.plot_type = 'contour';
44  p = fv_plot(grid, sim_data.P(:, sim_data.t), plot_params);
45  hold on;
46  NBI_pos_dir = grid.NBI > repmat((1:grid.nelements)', 1, 4) | grid.NBI < 0;
47  UU = sim_data.U(:, sim_data.t);
48  UU = UU(sim_data.gEI(NBI_pos_dir));
49  ECX = grid.ECX(NBI_pos_dir);
50  ECY = grid.ECY(NBI_pos_dir);
51  NX = grid.NX (NBI_pos_dir);
52  NY = grid.NY (NBI_pos_dir);
53  quiver(ECX(:), ECY(:), UU.*NX(:), UU.*NY(:));
54  hold off;
55 
function p = fv_plot(gridbase grid, dofs, params)
routine plotting a single fv function of fv_functions.
Definition: fv_plot.m:17
function p = plot_subplot_sequence(varargin)
plotting a sequence of data slices on polygonal 2d grid (constructed from params if empty) and provid...
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.
Definition: plot_sim_data.m:17