rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
comsol_evol_plot_sim_data.m
1 function p = comsol_evol_plot_sim_data(model,model_data,sim_data,params)
2 %function p = comsol_evol_plot_sim_data(model,model_data,sim_data,params)
3 %
4 % function plotting simulation results for evolution problems.
5 % This function needs a plot group being defined in the comsol_model!
6 % it uses COMSOL plot routines to plot the results!
7 %
8 % Optional fileds of params:
9 % plot_title: Title of the plot
10 % plot_output_title: title of the output plot
11 % axis_equal: axis equal
12 %
13 % Oliver Zeeb, 2013/01/14
14 
15 
16 
17  sim_data.comsol_model=model_data.comsol_model;
18 % %get the current solution stored in the comsol model
19 % PVals_original = sim_data.comsol_model.sol('sol1').getPVals;
20 % U_original = zeros((sim_data.comsol_model.sol('sol1').getSize)');
21 % for i = 1:length(PVals_original)
22 % U_original(:,i) = sim_data.comsol_model.sol('sol1').getU(i);
23 % end
24 
25 %Write this solution into the model
26 PVals = 0:model.T/model.nt:model.T;
27 %set new solution
28 for i = 1:length(PVals)
29  sim_data.comsol_model.sol('sol1').setU(i,sim_data.U(:,i));
30 end
31 %set new time list
32 sim_data.comsol_model.sol('sol1').setPVals(PVals);
33 %create new solution vector:
34 sim_data.comsol_model.sol('sol1').createSolution;
35 
36 
37 p = comsol_plot_sequence(sim_data,params);
38 
39 % plot output functional
40 if model.compute_output_functional
41  p2 = figure;
42  plot(sim_data.s);
43  title('output functional sim\_data.s')
44  p = [p,p2];
45 end;
46 
47 
48 
49 %reset original solution
50 % for i = 1:length(PVals)
51 % sim_data.comsol_model.sol('sol1').setU(i,U_original(:,i));
52 % end
53 % %set new time list
54 % sim_data.comsol_model.sol('sol1').setPVals(PVals_original);
55 % %create new solution vector:
56 % sim_data.comsol_model.sol('sol1').createSolution;
57 
58 %%%