-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemp.asv
92 lines (86 loc) · 4.61 KB
/
temp.asv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
function una_med=temp(vertices,elements,boundaries)
save_path = 'C:\Users\Ivan\Documents\temp_Ivan\';
load_path = 'C:\Users\Ivan\Dropbox\Elena&Ivan\AnEDP2\Progetto ANEDP2\saves\Ritter_rectang40x5_N192x24_1t5_100\';
load(strcat(load_path,'dati'))
tvec = linspace(tspan(1),tspan(2),tspan(3)+1);
ymin = min(vertices(2,:));
idxs_ymin = find(vertices(2,:) == ymin);
ymax = max(vertices(2,:));
idxs_ymax = find(vertices(2,:) == ymax);
[~,idx] = min(abs(vertices(2,:)-(ymax+ymin)/2));
ymed = vertices(2,idx);
idxs_ymed = find(vertices(2,:) == ymed);
t = 5;
[u_ex,h_ex,~] = exact_Stoker_Ritter(vertices,elements,boundaries,save_path,[t t 0],0,3,0,1,1); %<StRi<
load(strcat(load_path,num2str(t,'%.3f'),'.mat'))
pfig=figure(3110); set(gcf,'Visible','on'); %<StRi<
plot(vertices(1,idxs_ymin),cna(idxs_ymin),vertices(1,idxs_ymax),cna(idxs_ymax), ... %<StRi<
vertices(1,idxs_ymed),cna(idxs_ymed),vertices(1,idxs_ymed),sqrt(4*g*h_ex(idxs_ymed))) %<StRi<
legend('y = y_m_i_n','y = y_m_a_x','y = y_m_e_d','exact 1D solution') %<StRi<
title(strcat('c_n at t = ',num2str(t), ' - Predictor')); %<StRi<
%print(pfig,'-deps',strcat(save_path,'cn_wet_ysection',num2str(t,'%.3f'),'apred','.eps')); %<StRi<
print(pfig,'-djpeg',strcat(save_path,'cn_wet_ysection',num2str(t,'%.3f'),'apred','.jpeg')); %<StRi<
saveas(pfig,strcat(save_path,'cn_wet_ysection',num2str(t,'%.3f'),'apred','.fig')); %<StRi<
pfig=figure(3111); set(gcf,'Visible','on'); %<StRi<
plot(vertices(1,idxs_ymin),una(idxs_ymin),vertices(1,idxs_ymax),una(idxs_ymax), ... %<StRi<
vertices(1,idxs_ymed),una(idxs_ymed),vertices(1,idxs_ymed),u_ex(idxs_ymed)) %<StRi<
legend('y = y_m_i_n','y = y_m_a_x','y = y_m_e_d','exact 1D solution') %<StRi<
title(strcat('u_n at t = ',num2str(t), ' - Predictor')); %<StRi<
%print(pfig,'-deps',strcat(save_path,'un_wet_ysection',num2str(t,'%.3f'),'apred','.eps')); %<StRi<
print(pfig,'-djpeg',strcat(save_path,'un_wet_ysection',num2str(t,'%.3f'),'apred','.jpeg')); %<StRi<
saveas(pfig,strcat(save_path,'un_wet_ysection',num2str(t,'%.3f'),'apred','.fig')); %<StRi<
pfig=figure(3112); set(gcf,'Visible','on'); %<StRi<
plot(vertices(1,idxs_ymin),vna(idxs_ymin),vertices(1,idxs_ymax),vna(idxs_ymax), ... %<StRi<
vertices(1,idxs_ymed),vna(idxs_ymed),vertices(1,idxs_ymed),0) %<StRi<
legend('y = y_m_i_n','y = y_m_a_x','y = y_m_e_d','exact 1D solution') %<StRi<
title(strcat('v_n at t = ',num2str(t), ' - Predictor')); %<StRi<
%print(pfig,'-deps',strcat(save_path,'vn_wet_ysection',num2str(t,'%.3f'),'apred','.eps')); %<StRi<
print(pfig,'-djpeg',strcat(save_path,'vn_wet_ysection',num2str(t,'%.3f'),'apred','.jpeg')); %<StRi<
saveas(pfig,strcat(save_path,'vn_wet_ysection',num2str(t,'%.3f'),'apred','.fig')); %<StRi<
N=12;
fc = length(idxs_ymed)/40
fNyq = fc/2;
b=fir1(N,0.2);
una_med = una(idxs_ymed);
una_filtered=filter(b,fNyq,una(idxs_ymed));
ordine = 5;
una_filtered = una_med;
for iii=ordine:length(una_med)-ordine
una_filtered(iii) = mean(una_med())
end
b=fir1(N,0.2,'high');
una_non_filtered=filter(b,fNyq,una(idxs_ymed));
pfig=figure(1);
plot(vertices(1,idxs_ymed),una(idxs_ymed),vertices(1,idxs_ymed),una_filtered,vertices(1,idxs_ymed),una_non_filtered,vertices(1,idxs_ymed),una_non_filtered+una_filtered)
legend('originale','filtrata','"residuo"','orig+res')
title('una filtrata')
%
% [ar]=pdetrg(rppp,rttt);
% [u_ex,h_ex,frontvelocity_ex(1)] = exact_Stoker_Ritter(rppp,rttt,reee,save_path,[1 1 0],0,3,0,1);
% wdn_el=pdeintrp(rppp,rttt, h_ex);
% Vol(1)=sum(wdn_el.*ar);
%
% for i=2:length(tvec)
% load(strcat(save_path,num2str(tvec(i),'%.3f'),'.mat'),'vol_corr');
% Vol(i) = vol_corr;
% [u_ex,h_ex,frontvelocity_ex(i)] = exact_Stoker_Ritter(rppp,rttt,reee,save_path,[tvec(i) tvec(i) 0],0,3,0,1);
% end
%
% pfig=figure(1); % set(gcf,'Visible','off');
% plot(tvec,Vol)
% xlabel('t [s]'); ylabel('volume [m^3]')
% %print(pfig,'-deps',strcat(save_path,'volume.eps'));
% print(pfig,'-djpeg',strcat(save_path,'volume.jpeg'));
% saveas(pfig,strcat(save_path,'volume.fig'));
%
% load(strcat('C:\Users\Ivan\Documents\temp_Ivan\',num2str(tvec(end),'%.3f'),'.mat'));
% pfig=figure(2); % set(gcf,'Visible','off');
% plot(tvec,frontvelocity_pred,'.k',tvec,frontvelocity_corr,tvec,frontvelocity_ex,'--r')
% xlabel('t [s]'); ylabel('front velocity [m/s]')
% legend('predictor','corrector','exact','Location','SouthWest')
% %print(pfig,'-deps',strcat(save_path,'frontvelocity.eps'));
% print(pfig,'-djpeg',strcat(save_path,'frontvelocity.jpeg'));
% saveas(pfig,strcat(save_path,'frontvelocity.fig'));
%
% save(strcat(save_path,'Vol.mat'), 'Vol');
end