157 def Run_Serial_Fit(Compare_Serial, Consider_Modes, Num_Constants, P, Num_Elements, Nektar_Modes, Timings, Pressure, Velocity_1, Velocity_2, Velocity_3, Scheme):
163 for i
in range(0, len(Consider_Modes)):
164 Data.append(np.mean(Timings[str(Consider_Modes[i])])/10)
171 for i
in range(0, len(Consider_Modes)):
180 for j
in range(1, Consider_Modes[i] + 1):
189 N_P += Pressure[str(j)][0]
191 Turing =
'King of Computers'
194 N_V_1 += Velocity_1[str(j)][0]
196 Turing =
'King of Computers'
199 N_V_2 += Velocity_2[str(j)][0]
201 Turing =
'King of Computers'
204 N_V_3 += Velocity_3[str(j)][0]
206 Turing =
'King of Computers'
209 (t_a, t_e) =
Operation_Count(P, Num_Elements, Consider_Modes[i], N_P, N_V_1, N_V_2, N_V_3, Scheme)
214 Fit =
Fit_Model(Num_Constants, Data, T_A, T_E)
220 if Compare_Serial
is True:
225 for i
in range(1, len(Nektar_Modes)):
226 Data.append(np.mean(Timings[str(Nektar_Modes[i])])/10)
230 for i
in range(1, len(Nektar_Modes)):
236 for j
in range(1, Nektar_Modes[i] + 1):
242 N_P += Pressure[str(j)][0]
244 Turing =
'King of Computers'
247 N_V_1 += Velocity_1[str(j)][0]
249 Turing =
'King of Computers'
252 N_V_2 += Velocity_2[str(j)][0]
254 Turing =
'King of Computers'
257 N_V_3 += Velocity_3[str(j)][0]
259 Turing =
'King of Computers'
261 Time.append(
Serial_Computation(P, Num_Elements, Nektar_Modes[i], N_P, N_V_1, N_V_2, N_V_3, Num_Constants, Fit, Scheme))
263 Nektar_Modes = list(Nektar_Modes)
269 for i
in range(0, len(Nektar_Modes)):
270 difference.append(abs(Data[i] - Time[i]))
272 mean_diff = np.mean(difference)
273 std_dev_diff = np.std(difference)
274 var_diff = np.var(difference)
277 print(
'The mean of the differences between the Data and the Model is ' + str(mean_diff))
278 print(
'The standard deviation of the differences between the Data and the Model is ' + str(std_dev_diff))
279 print(
'The variance of the differences between the Data and the Model is ' + str(var_diff))
282 fig, ax = plt.subplots()
283 ax.plot(Nektar_Modes, Data, label =
'Data')
284 ax.errorbar(Nektar_Modes, Time, label =
'Model')
285 ax.set_xlabel(
'$ N_Z $')
286 ax.set_ylabel(
'Timestep (s)')
287 ax.set_title(
'Length of Single Timestep: Model vs Data')
289 fig.savefig(
"Output/Figures/Model_vs_Data.png")