Skip to content

Commit 51c77da

Browse files
committed
Added microscopic verification plot
1 parent 5050dd8 commit 51c77da

3 files changed

Lines changed: 46 additions & 8 deletions

File tree

pySDC/projects/RayleighBenard/README.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,19 @@ for all the configurations to generate the data and then run
5959
python analysis_scripts/RBC3D_order.py
6060
6161
to make the plot.
62+
63+
64+
Plotting microscopic verification
65+
---------------------------------
66+
After you have plotted the order of accuracy, you can make a plot for microscopic verification, which includes the order of accuracy plot and adds a plot for the spectrum.
67+
You need to run and analyse simulations with:
68+
- ``--res=32 --dt=0.06 --config=RBC3DG4R4SDC23Ra1e5``
69+
- ``--res=64 --dt=0.01 --config=RBC3DG4R4SDC23Ra1e6``
70+
- ``--res=128 --dt=0.005 --config=RBC3DG4R4SDC23Ra1e7``
71+
72+
The, just run
73+
74+
.. code-block:: bash
75+
python analysis_scripts/RBC3D_spectrum.py
76+
77+
to make the plot.

pySDC/projects/RayleighBenard/analysis_scripts/RBC3D_order.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ def plot_error_all_components(args): # pragma: no cover
7171
ax.set_ylabel(r'$e$')
7272

7373

74-
def compare_order(Ra): # pragma: no cover
75-
fig, ax = plt.subplots(figsize=figsize_by_journal('Nature_CS', 1, 0.6))
74+
def compare_order(Ra, ax=None): # pragma: no cover
75+
if ax is None:
76+
fig, ax = plt.subplots(figsize=figsize_by_journal('Nature_CS', 1, 0.6))
77+
else:
78+
fig = None
79+
7680
if Ra == 1e5:
77-
names = ['RK', 'Euler', 'SDC22', 'SDC23', 'SDC34', 'SDC44'][::-1]
81+
names = ['RK', 'Euler', 'SDC23', 'SDC44'][::-1]
7882
configs = [f'RBC3DG4R4{me}Ra1e5' for me in names]
7983
paths = [f'./data/RBC3DG4R4{me}Ra1e5-res-1-order.pickle' for me in names]
8084

@@ -99,7 +103,8 @@ def compare_order(Ra): # pragma: no cover
99103
ax.legend(frameon=False)
100104
ax.set_xlabel(r'$\Delta t$')
101105
ax.set_ylabel(r'$e$')
102-
savefig(fig, 'RBC3D_order_Ra1e5')
106+
if fig is not None:
107+
savefig(fig, 'RBC3D_order_Ra1e5')
103108

104109

105110
def run(args, dt, Tend):

pySDC/projects/RayleighBenard/analysis_scripts/RBC3D_spectrum.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ def plot_spectra_Ra1e6(): # pragma: no cover
5050
savefig(fig, 'RBC3D_spectrum_Ra1e6')
5151

5252

53-
def plot_all_spectra(): # pragma: no cover
54-
fig, ax = plt.subplots(figsize=figsize(scale=1, ratio=0.6))
53+
def plot_all_spectra(ax=None): # pragma: no cover
54+
if ax is None:
55+
fig, ax = plt.subplots(figsize=figsize(scale=1, ratio=0.6))
56+
else:
57+
fig = None
5558

5659
Ras = ['1e5', '1e6', '1e7']
5760
dts = [0.06, 0.01, 0.005]
@@ -68,12 +71,26 @@ def plot_all_spectra(): # pragma: no cover
6871
plot_spectrum(_res, dt, config, ax, label=f'$Ra$={Ra}', color=color, marker=marker)
6972

7073
ax.legend(frameon=False)
71-
savefig(fig, 'RBC3D_all_spectra')
74+
if fig is not None:
75+
savefig(fig, 'RBC3D_all_spectra')
76+
77+
78+
def plot_microscopic_verification(): # pragma: no cover
79+
from pySDC.projects.RayleighBenard.analysis_scripts.RBC3D_order import compare_order
80+
81+
fig, axs = plt.subplots(1, 2, figsize=figsize(scale=1, ratio=0.45))
82+
plot_all_spectra(axs[0])
83+
compare_order(1e5, axs[1])
84+
for ax in axs:
85+
ax.set_box_aspect(1)
86+
fig.tight_layout()
87+
savefig(fig, 'RBC3D_microscopic_verification')
7288

7389

7490
if __name__ == '__main__':
75-
plot_spectra_Ra1e5()
91+
# plot_spectra_Ra1e5()
7692
# plot_spectra_Ra1e6()
7793
# plot_all_spectra()
94+
plot_microscopic_verification()
7895

7996
plt.show()

0 commit comments

Comments
 (0)