Skip to content

Commit 84cb1d7

Browse files
committed
Added tests for processing of 3D RBC
1 parent e6ef73e commit 84cb1d7

File tree

4 files changed

+328
-225
lines changed

4 files changed

+328
-225
lines changed

pySDC/projects/GPU/analysis_scripts/compute_RBC3D_data.py

Lines changed: 0 additions & 207 deletions
This file was deleted.

pySDC/projects/GPU/analysis_scripts/plot_Nu.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,8 @@
77
setup_mpl()
88

99

10-
def get_pySDC_data(Ra, RK=False, res=-1, dt=-1, config_name='RBC3DG4'):
11-
assert type(Ra) == str
12-
13-
base_path = 'data/RBC_time_averaged'
14-
15-
if RK:
16-
config_name = f'{config_name}RK'
17-
18-
path = f'{base_path}/{config_name}Ra{Ra}-res{res}-dt{dt:.0e}.pickle'
10+
def get_pySDC_data(res=-1, dt=-1, config_name='RBC3DG4', base_path='data/RBC_time_averaged'):
11+
path = f'{base_path}/{config_name}-res{res}-dt{dt:.0e}.pickle'
1912
with open(path, 'rb') as file:
2013
data = pickle.load(file)
2114

@@ -32,13 +25,13 @@ def interpolate_NuV_to_reference_times(data, reference_data, order=12):
3225
return interpolation_matrix @ t_in, interpolation_matrix @ data['Nu']['V']
3326

3427

35-
def plot_Nu(Ra, res, dts, config_name, ref, ax, title): # pragma: no cover
28+
def plot_Nu(res, dts, config_name, ref, ax, title): # pragma: no cover
3629
ax.plot(ref['t'], ref['Nu']['V'], color='black', ls='--')
3730
ax.set_title(title)
3831
Nu_ref = np.array(ref['Nu']['V'])
3932

4033
for dt in dts:
41-
data = get_pySDC_data(Ra=Ra, res=res, dt=dt, config_name=config_name)
34+
data = get_pySDC_data(res=res, dt=dt, config_name=config_name)
4235
t_i, Nu_i = interpolate_NuV_to_reference_times(data, ref)
4336
ax.plot(t_i, Nu_i, label=rf'$\Delta t={{{dt}}}$')
4437

@@ -62,29 +55,27 @@ def plot_Nu(Ra, res, dts, config_name, ref, ax, title): # pragma: no cover
6255
def plot_Nu_over_time_Ra1e5(): # pragma: no cover
6356
Nu_fig, Nu_axs = plt.subplots(4, 1, sharex=True, sharey=True, figsize=figsize_by_journal('Nature_CS', 1, 1.4))
6457

65-
Ra = '1e5'
6658
res = 32
6759

68-
ref_data = get_pySDC_data(Ra, res=res, dt=0.01, config_name='RBC3DG4R4')
60+
ref_data = get_pySDC_data(res=res, dt=0.01, config_name='RBC3DG4R4Ra1e5')
6961

7062
_Nu_axs = {'SDC 3': Nu_axs[1], 'SDC': Nu_axs[0], 'RK': Nu_axs[2], 'Euler': Nu_axs[3]}
7163

7264
plot_Nu(
73-
'1e5',
7465
32,
7566
[
7667
0.06,
7768
0.04,
7869
0.02,
7970
],
80-
'RBC3DG4R4SDC34',
71+
'RBC3DG4R4SDC34Ra1e5',
8172
ref_data,
8273
Nu_axs[0],
8374
'SDC34',
8475
)
85-
plot_Nu('1e5', 32, [0.06, 0.05, 0.02, 0.01], 'RBC3DG4R4SDC23', ref_data, Nu_axs[1], 'SDC23')
86-
plot_Nu('1e5', 32, [0.05, 0.04, 0.02, 0.01, 0.005], 'RBC3DG4R4RK', ref_data, Nu_axs[2], 'RK443')
87-
plot_Nu('1e5', 32, [0.02, 0.01, 0.005], 'RBC3DG4R4Euler', ref_data, Nu_axs[3], 'RK111')
76+
plot_Nu(32, [0.06, 0.05, 0.02, 0.01], 'RBC3DG4R4SDC23Ra1e5', ref_data, Nu_axs[1], 'SDC23')
77+
plot_Nu(32, [0.05, 0.04, 0.02, 0.01, 0.005], 'RBC3DG4R4RKRa1e5', ref_data, Nu_axs[2], 'RK443')
78+
plot_Nu(32, [0.02, 0.01, 0.005], 'RBC3DG4R4EulerRa1e5', ref_data, Nu_axs[3], 'RK111')
8879

8980
Nu_axs[-1].set_xlabel('$t$')
9081
Nu_axs[-1].set_ylabel('$Nu$')

0 commit comments

Comments
 (0)