@@ -52,6 +52,7 @@ def normalise(R, T, target):
5252
5353 phase = np .zeros ((6 ,Nsamples ))
5454 amp_factor = np .zeros ((6 ,Nsamples ))
55+ svds = np .zeros ((3 ,Nsamples ))
5556 u0_val = np .array ([[1.0 ]], dtype = 'complex' )
5657 targets = np .zeros ((3 ,Nsamples ))
5758
@@ -89,13 +90,13 @@ def normalise(R, T, target):
8990 amp_factor [2 ,i ] = np .exp (sol_coarse .imag )
9091
9192 # Compute Parareal phase velocity and amplification factor
92-
93+ svds [ 0 , i ] = para . get_max_svd ( ucoarse = ucoarse )
9394 for jj in range (0 ,3 ):
9495 stab_para = para .get_parareal_stab_function (k = niter_v [jj ], ucoarse = ucoarse )
9596
9697 if i == 0 :
9798 targets [jj ,0 ] = np .angle (stab_ex )
98-
99+
99100 stab_para_norm = normalise (stab_para [0 ,0 ], Tend , targets [jj ,i ])
100101 # Make sure that stab_norm*dt = stab
101102 err = abs (stab_para_norm ** Tend - stab_para )
@@ -112,7 +113,6 @@ def normalise(R, T, target):
112113 phase [3 + jj ,i ] = sol_para .real / k_vec [i ]
113114 amp_factor [3 + jj ,i ] = np .exp (sol_para .imag )
114115
115-
116116 ###
117117 rcParams ['figure.figsize' ] = 2.5 , 2.5
118118 fs = 8
@@ -155,3 +155,17 @@ def normalise(R, T, target):
155155 plt .gcf ().savefig (filename , bbox_inches = 'tight' )
156156 call (["pdfcrop" , filename , filename ])
157157
158+ fig = plt .figure ()
159+ plt .plot (k_vec , svds [0 ,:], '-s' , color = 'r' , linewidth = 1.5 , markevery = (1 ,6 ), mew = 1.0 , markersize = fs / 2 )
160+ plt .xlabel ('Wave number' , fontsize = fs , labelpad = 0.25 )
161+ plt .ylabel ('Maximal singular value' , fontsize = fs , labelpad = 0.5 )
162+ fig .gca ().tick_params (axis = 'both' , labelsize = fs )
163+ plt .xlim ([k_vec [0 ], k_vec [- 1 :]])
164+ plt .ylim ([0 , 2.0 ])
165+ # plt.legend(loc='lower left', fontsize=fs, prop={'size':fs-2})
166+ plt .gca ().set_ylim ([0.0 , 2.0 ])
167+ plt .xticks ([0 , 1 , 2 , 3 ], fontsize = fs )
168+ #plt.show()
169+ filename = 'parareal-dispersion-svd.pdf'
170+ plt .gcf ().savefig (filename , bbox_inches = 'tight' )
171+ call (["pdfcrop" , filename , filename ])
0 commit comments