Skip to content

Commit 115ee63

Browse files
committed
New plot
1 parent fd7a6dc commit 115ee63

File tree

3 files changed

+58
-18
lines changed

3 files changed

+58
-18
lines changed

pySDC/implementations/convergence_controller_classes/estimate_polynomial_error.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ def post_iteration_processing(self, controller, S, **kwargs):
148148
L.status.order_embedded_estimate = coll.num_nodes * 1
149149

150150
if self.comm:
151-
# buf = np.array(abs(u_inter - high_order_sol) if self.comm.rank == rank else 0.0)
152-
buf = np.array(np.max([abs(u_inter[i] - high_order_sol[i]) for i in range(u_inter.shape[0]-1)]) if self.comm.rank == rank else 0.0)
151+
buf = np.array(abs(u_inter - high_order_sol) if self.comm.rank == rank else 0.0)
153152
self.comm.Bcast(buf, root=rank)
154153
L.status.error_embedded_estimate = float(buf)
155154
else:
Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,66 @@
11
from pySDC.implementations.problem_classes.RayleighBenard import RayleighBenard
22
import numpy as np
33
import matplotlib.pyplot as plt
4-
from pySDC.helpers.plot_helper import figsize_by_journal
4+
from pySDC.helpers.plot_helper import figsize_by_journal, setup_mpl
55

66

7-
P = RayleighBenard(nx=3, nz=5, Dirichlet_recombination=True, left_preconditioner=True)
8-
dt = 1.0
7+
def plot_preconditioners(): # pragma: no cover
8+
P = RayleighBenard(nx=3, nz=5, Dirichlet_recombination=True, left_preconditioner=True)
9+
dt = 1.0
910

11+
A = P.M + dt * P.L
12+
A_b = P.put_BCs_in_matrix(P.M + dt * P.L)
13+
A_r = P.spectral.put_BCs_in_matrix(A) @ P.Pr
14+
A_l = P.Pl @ P.spectral.put_BCs_in_matrix(A) @ P.Pr
1015

11-
A = P.M + dt * P.L
12-
A_b = P.put_BCs_in_matrix(P.M + dt * P.L)
13-
A_r = P.spectral.put_BCs_in_matrix(A) @ P.Pr
14-
A_l = P.Pl @ P.spectral.put_BCs_in_matrix(A) @ P.Pr
16+
fig, axs = plt.subplots(1, 4, figsize=figsize_by_journal('TUHH_thesis', 1, 0.4), sharex=True, sharey=True)
1517

16-
fig, axs = plt.subplots(1, 4, figsize=figsize_by_journal('TUHH_thesis', 1, 0.4), sharex=True, sharey=True)
18+
for M, ax in zip([A, A_b, A_r, A_l], axs):
19+
ax.imshow((M / abs(M)).real + (M / abs(M)).imag, rasterized=False, cmap='Spectral')
1720

18-
for M, ax in zip([A, A_b, A_r, A_l], axs):
19-
ax.imshow((M / abs(M)).real + (M / abs(M)).imag, rasterized=False, cmap='Spectral')
21+
for ax in axs:
22+
ax.set_xticks([])
23+
ax.set_yticks([])
24+
fig.savefig('plots/RBC_matrix.pdf', bbox_inches='tight', dpi=300)
25+
plt.show()
2026

21-
for ax in axs:
22-
ax.set_xticks([])
23-
ax.set_yticks([])
24-
fig.savefig('plots/RBC_matrix.pdf', bbox_inches='tight', dpi=300)
25-
plt.show()
27+
28+
def plot_ultraspherical():
29+
from pySDC.helpers.spectral_helper import ChebychevHelper, UltrasphericalHelper
30+
31+
N = 16
32+
cheby = ChebychevHelper(N=N)
33+
ultra = UltrasphericalHelper(N=N)
34+
35+
D_cheby = cheby.get_differentiation_matrix()
36+
I_cheby = cheby.get_Id()
37+
38+
fig, axs = plt.subplots(2, 3, figsize=figsize_by_journal('TUHH_thesis', 0.9, 0.65), sharex=True, sharey=True)
39+
40+
axs[0, 0].imshow(D_cheby / abs(D_cheby))
41+
axs[1, 0].imshow(I_cheby / abs(I_cheby))
42+
43+
for i in range(2):
44+
D_ultra = ultra.get_differentiation_matrix(p=i + 1)
45+
I_ultra = ultra.get_basis_change_matrix(0, i + 1)
46+
axs[0, i + 1].imshow(D_ultra / abs(D_ultra))
47+
axs[1, i + 1].imshow(I_ultra / abs(I_ultra))
48+
axs[1, i + 1].set_xlabel(rf'$T \rightarrow C^{{({{{i+1}}})}}$')
49+
for ax in axs.flatten():
50+
ax.set_xticks([])
51+
ax.set_yticks([])
52+
53+
axs[0, 0].set_ylabel('Differentiation')
54+
axs[1, 0].set_ylabel('Left preconditioner')
55+
axs[1, 0].set_xlabel(r'$T \rightarrow T$')
56+
57+
axs[0, 0].set_title('first derivative')
58+
axs[0, 1].set_title('first derivative')
59+
axs[0, 2].set_title('second derivative')
60+
fig.savefig('plots/ultraspherical_matrix.pdf', bbox_inches='tight', dpi=300)
61+
plt.show()
62+
63+
64+
if __name__ == '__main__':
65+
setup_mpl()
66+
plot_ultraspherical()

pySDC/projects/GPU/analysis_scripts/plot_large_simulations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def plot_series(self, test=False):
282282
indices = [0, 1, 2, 3, 4, 5]
283283
process = 0
284284
else:
285-
indices = [0, 10, 20, 30, 40, 90]
285+
indices = [0, 10, 20, 30, 40, 91]
286286
process = 96
287287

288288
from mpl_toolkits.axes_grid1 import make_axes_locatable

0 commit comments

Comments
 (0)