|
| 1 | + |
| 2 | +import numpy as np |
| 3 | +import pandas as pd |
| 4 | +import matplotlib.pyplot as plt |
| 5 | +import warnings |
| 6 | +import os |
| 7 | +from matplotlib.backends.backend_pdf import PdfPages |
| 8 | + |
| 9 | +# include FDS plot styles, etc. |
| 10 | +import fdsplotlib |
| 11 | + |
| 12 | +# Get plot style parameters |
| 13 | +plot_style = fdsplotlib.get_plot_style('fds') |
| 14 | + |
| 15 | +expdir = '../../../exp/FM_FPRF_Datacenter/' |
| 16 | +outdir = '../../../out/FM_FPRF_Datacenter/' |
| 17 | + |
| 18 | +git_file = outdir + 'FM_Datacenter_Veltest_High_git.txt' |
| 19 | +version_string = fdsplotlib.get_version_string(git_file) |
| 20 | + |
| 21 | +# High flow test |
| 22 | +exp_data = np.loadtxt(expdir + 'fm_datacenter_veltest_high.csv', delimiter=',', skiprows=1) |
| 23 | +fds_data = np.loadtxt(outdir + 'FM_Datacenter_Veltest_High_devc.csv', delimiter=',', skiprows=13) |
| 24 | +n_fds_data = fds_data.shape[0] |
| 25 | + |
| 26 | +# compute average velocity |
| 27 | +fds_avg = np.zeros(195) # 207-12 = 195 |
| 28 | +for i in range(13, 208): # MATLAB 13:207 -> Python 12:207 (inclusive) |
| 29 | + fds_avg[i-13] = np.mean(fds_data[:, i-1]) # MATLAB is 1-indexed, Python is 0-indexed |
| 30 | + |
| 31 | +fds_u = fds_avg[0:65] # MATLAB 1:65 -> Python 0:65 |
| 32 | +fds_v = fds_avg[65:130] # MATLAB 66:130 -> Python 65:130 |
| 33 | +fds_w = fds_avg[130:195] # MATLAB 131:195 -> Python 130:195 |
| 34 | +fds_u_rms = fds_data[n_fds_data-1, 195:260] # MATLAB 196:260 -> Python 195:260 |
| 35 | +fds_v_rms = fds_data[n_fds_data-1, 260:325] # MATLAB 261:325 -> Python 260:325 |
| 36 | +fds_w_rms = fds_data[n_fds_data-1, 325:390] # MATLAB 326:390 -> Python 325:390 |
| 37 | +fds_tot = (fds_u**2 + fds_v**2 + fds_w**2)**0.5 |
| 38 | +fds_tot_rms = (((fds_u * fds_u_rms)**2 + (fds_v * fds_v_rms)**2 + (fds_w * fds_w_rms)**2) / fds_tot**2)**0.5 |
| 39 | + |
| 40 | +# set plot error lines |
| 41 | +x_err = np.arange(-10, 11, 1) # MATLAB -10:1:10 |
| 42 | +y_err = (0.1773**2 + (0.05*x_err)**2 + (0.06*x_err)**2)**0.5 |
| 43 | +y_err_p = x_err + 2*y_err |
| 44 | +y_err_m = x_err - 2*y_err |
| 45 | + |
| 46 | +# Create figure and plot U-velocity comparison |
| 47 | + |
| 48 | +fig = fdsplotlib.plot_to_fig(x_data=x_err, y_data=x_err, |
| 49 | + marker_style='k-', |
| 50 | + x_min=-2, x_max=2, y_min=-2, y_max=2, |
| 51 | + figure_size=(plot_style['Scat_Paper_Width'],plot_style['Scat_Paper_Height']), |
| 52 | + plot_size=(plot_style['Scat_Plot_Width'],plot_style['Scat_Plot_Height']), |
| 53 | + plot_origin=(plot_style['Scat_Plot_X'],plot_style['Scat_Plot_Y']), |
| 54 | + revision_label=version_string, |
| 55 | + plot_title='High Flow', |
| 56 | + x_label='Measured U-Velocity (m/s)', |
| 57 | + y_label='Predicted U-Velocity (m/s)') |
| 58 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_p, marker_style='k--', figure_handle=fig) |
| 59 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_m, marker_style='k--', figure_handle=fig) |
| 60 | +fdsplotlib.plot_to_fig(x_data=exp_data[:, 0], y_data=fds_u, marker_style='ro', figure_handle=fig) |
| 61 | +#herrorbar(exp_data[:, 0], fds_u, exp_data[:, 3], 'ro') |
| 62 | +#plt.errorbar(exp_data[:, 0], fds_u, yerr=fds_u_rms, fmt='ro') |
| 63 | +plotname = '../../Manuals/FDS_Validation_Guide/SCRIPT_FIGURES/FM_FPRF_Datacenter/FM_Datacenter_Veltest_High_u' |
| 64 | +plt.savefig(plotname + '.pdf', format='pdf') |
| 65 | +plt.close() |
| 66 | + |
| 67 | +# Create figure and plot V-velocity comparison |
| 68 | + |
| 69 | +fig = fdsplotlib.plot_to_fig(x_data=x_err, y_data=x_err, |
| 70 | + marker_style='k-', |
| 71 | + x_min=-5, x_max=5, y_min=-5, y_max=5, |
| 72 | + figure_size=(plot_style['Scat_Paper_Width'],plot_style['Scat_Paper_Height']), |
| 73 | + plot_size=(plot_style['Scat_Plot_Width'],plot_style['Scat_Plot_Height']), |
| 74 | + plot_origin=(plot_style['Scat_Plot_X'],plot_style['Scat_Plot_Y']), |
| 75 | + revision_label=version_string, |
| 76 | + plot_title='High Flow', |
| 77 | + x_label='Measured V-Velocity (m/s)', |
| 78 | + y_label='Predicted V-Velocity (m/s)') |
| 79 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_p, marker_style='k--', figure_handle=fig) |
| 80 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_m, marker_style='k--', figure_handle=fig) |
| 81 | +fdsplotlib.plot_to_fig(x_data=exp_data[:, 1], y_data=fds_v, marker_style='ro', figure_handle=fig) |
| 82 | +#herrorbar(exp_data[:, 1], fds_v, exp_data[:, 4], 'ro') |
| 83 | +#plt.errorbar(exp_data[:, 1], fds_v, yerr=fds_v_rms, fmt='ro') |
| 84 | +plotname = '../../Manuals/FDS_Validation_Guide/SCRIPT_FIGURES/FM_FPRF_Datacenter/FM_Datacenter_Veltest_High_v' |
| 85 | +plt.savefig(plotname + '.pdf', format='pdf') |
| 86 | +plt.close() |
| 87 | + |
| 88 | +# Create figure and plot W-velocity comparison |
| 89 | + |
| 90 | +fig = fdsplotlib.plot_to_fig(x_data=x_err, y_data=x_err, |
| 91 | + marker_style='k-', |
| 92 | + x_min=-1, x_max=3, y_min=-1, y_max=3, |
| 93 | + figure_size=(plot_style['Scat_Paper_Width'],plot_style['Scat_Paper_Height']), |
| 94 | + plot_size=(plot_style['Scat_Plot_Width'],plot_style['Scat_Plot_Height']), |
| 95 | + plot_origin=(plot_style['Scat_Plot_X'],plot_style['Scat_Plot_Y']), |
| 96 | + revision_label=version_string, |
| 97 | + plot_title='High Flow', |
| 98 | + x_label='Measured W-Velocity (m/s)', |
| 99 | + y_label='Predicted W-Velocity (m/s)') |
| 100 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_p, marker_style='k--', figure_handle=fig) |
| 101 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_m, marker_style='k--', figure_handle=fig) |
| 102 | +fdsplotlib.plot_to_fig(x_data=exp_data[:, 2], y_data=fds_w, marker_style='ro', figure_handle=fig) |
| 103 | +#herrorbar(exp_data[:, 2], fds_w, exp_data[:, 5], 'ro') |
| 104 | +#plt.errorbar(exp_data[:, 2], fds_w, yerr=fds_w_rms, fmt='ro') |
| 105 | +plotname = '../../Manuals/FDS_Validation_Guide/SCRIPT_FIGURES/FM_FPRF_Datacenter/FM_Datacenter_Veltest_High_w' |
| 106 | +plt.savefig(plotname + '.pdf', format='pdf') |
| 107 | +plt.close() |
| 108 | + |
| 109 | +# Create figure and plot total velocity comparison |
| 110 | + |
| 111 | +fig = fdsplotlib.plot_to_fig(x_data=x_err, y_data=x_err, |
| 112 | + marker_style='k-', |
| 113 | + x_min=0, x_max=5, y_min=0, y_max=5, |
| 114 | + figure_size=(plot_style['Scat_Paper_Width'],plot_style['Scat_Paper_Height']), |
| 115 | + plot_size=(plot_style['Scat_Plot_Width'],plot_style['Scat_Plot_Height']), |
| 116 | + plot_origin=(plot_style['Scat_Plot_X'],plot_style['Scat_Plot_Y']), |
| 117 | + revision_label=version_string, |
| 118 | + plot_title='High Flow', |
| 119 | + x_label='Measured Total Velocity (m/s)', |
| 120 | + y_label='Predicted Total Velocity (m/s)') |
| 121 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_p, marker_style='k--', figure_handle=fig) |
| 122 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_m, marker_style='k--', figure_handle=fig) |
| 123 | +fdsplotlib.plot_to_fig(x_data=exp_data[:, 6], y_data=fds_tot, marker_style='ro', figure_handle=fig) |
| 124 | +#herrorbar(exp_data[:, 6], fds_tot, exp_data[:, 7], 'ro') |
| 125 | +#plt.errorbar(exp_data[:, 6], fds_tot, yerr=fds_tot_rms, fmt='ro') |
| 126 | +plotname = '../../Manuals/FDS_Validation_Guide/SCRIPT_FIGURES/FM_FPRF_Datacenter/FM_Datacenter_Veltest_High_vel' |
| 127 | +plt.savefig(plotname + '.pdf', format='pdf') |
| 128 | +plt.close() |
| 129 | + |
| 130 | + |
| 131 | +# Low Flow Tests |
| 132 | + |
| 133 | +exp_data = np.loadtxt(expdir + 'fm_datacenter_veltest_low.csv', delimiter=',', skiprows=1) |
| 134 | +fds_data = np.loadtxt(outdir + 'FM_Datacenter_Veltest_Low_devc.csv', delimiter=',', skiprows=13) |
| 135 | +n_fds_data = fds_data.shape[0] |
| 136 | + |
| 137 | +# compute average velocity |
| 138 | +fds_avg = np.zeros(183) # 195-12 = 183 |
| 139 | +for i in range(13, 196): # MATLAB 13:195 -> Python 12:195 (inclusive) |
| 140 | + fds_avg[i-13] = np.mean(fds_data[:, i-1]) # MATLAB is 1-indexed, Python is 0-indexed |
| 141 | + |
| 142 | +fds_u = fds_avg[0:61] # MATLAB 1:61 -> Python 0:61 |
| 143 | +fds_v = fds_avg[61:122] # MATLAB 62:122 -> Python 61:122 |
| 144 | +fds_w = fds_avg[122:183] # MATLAB 123:183 -> Python 122:183 |
| 145 | +fds_u_rms = fds_data[n_fds_data-1, 183:244] # MATLAB 184:244 -> Python 183:244 |
| 146 | +fds_v_rms = fds_data[n_fds_data-1, 244:305] # MATLAB 245:305 -> Python 244:305 |
| 147 | +fds_w_rms = fds_data[n_fds_data-1, 305:366] # MATLAB 306:366 -> Python 305:366 |
| 148 | +fds_tot = (fds_u**2 + fds_v**2 + fds_w**2)**0.5 |
| 149 | +fds_tot_rms = (((fds_u * fds_u_rms)**2 + (fds_v * fds_v_rms)**2 + (fds_w * fds_w_rms)**2) / fds_tot**2)**0.5 |
| 150 | + |
| 151 | +# Create figure and plot U-velocity comparison, low flow |
| 152 | + |
| 153 | +fig = fdsplotlib.plot_to_fig(x_data=x_err, y_data=x_err, |
| 154 | + marker_style='k-', |
| 155 | + x_min=-0.6, x_max=0.6, y_min=-0.6, y_max=0.6, |
| 156 | + figure_size=(plot_style['Scat_Paper_Width'],plot_style['Scat_Paper_Height']), |
| 157 | + plot_size=(plot_style['Scat_Plot_Width'],plot_style['Scat_Plot_Height']), |
| 158 | + plot_origin=(plot_style['Scat_Plot_X'],plot_style['Scat_Plot_Y']), |
| 159 | + revision_label=version_string, |
| 160 | + plot_title='Low Flow', |
| 161 | + x_label='Measured U-Velocity (m/s)', |
| 162 | + y_label='Predicted U-Velocity (m/s)') |
| 163 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_p, marker_style='k--', figure_handle=fig) |
| 164 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_m, marker_style='k--', figure_handle=fig) |
| 165 | +fdsplotlib.plot_to_fig(x_data=exp_data[:, 0], y_data=fds_u, marker_style='ro', figure_handle=fig) |
| 166 | +#herrorbar(exp_data[:, 0], fds_u, exp_data[:, 3], 'ro') |
| 167 | +#plt.errorbar(exp_data[:, 0], fds_u, yerr=fds_u_rms, fmt='ro') |
| 168 | +plotname = '../../Manuals/FDS_Validation_Guide/SCRIPT_FIGURES/FM_FPRF_Datacenter/FM_Datacenter_Veltest_Low_u' |
| 169 | +plt.savefig(plotname + '.pdf', format='pdf') |
| 170 | +plt.close() |
| 171 | + |
| 172 | +# Create figure and plot V-velocity comparison, low flow |
| 173 | + |
| 174 | +fig = fdsplotlib.plot_to_fig(x_data=x_err, y_data=x_err, |
| 175 | + marker_style='k-', |
| 176 | + x_min=-1.5, x_max=1.5, y_min=-1.5, y_max=1.5, |
| 177 | + figure_size=(plot_style['Scat_Paper_Width'],plot_style['Scat_Paper_Height']), |
| 178 | + plot_size=(plot_style['Scat_Plot_Width'],plot_style['Scat_Plot_Height']), |
| 179 | + plot_origin=(plot_style['Scat_Plot_X'],plot_style['Scat_Plot_Y']), |
| 180 | + revision_label=version_string, |
| 181 | + plot_title='Low Flow', |
| 182 | + x_label='Measured V-Velocity (m/s)', |
| 183 | + y_label='Predicted V-Velocity (m/s)') |
| 184 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_p, marker_style='k--', figure_handle=fig) |
| 185 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_m, marker_style='k--', figure_handle=fig) |
| 186 | +fdsplotlib.plot_to_fig(x_data=exp_data[:, 1], y_data=fds_v, marker_style='ro', figure_handle=fig) |
| 187 | +#herrorbar(exp_data[:, 1], fds_v, exp_data[:, 4], 'ro') |
| 188 | +#plt.errorbar(exp_data[:, 1], fds_v, yerr=fds_v_rms, fmt='ro') |
| 189 | +plotname = '../../Manuals/FDS_Validation_Guide/SCRIPT_FIGURES/FM_FPRF_Datacenter/FM_Datacenter_Veltest_Low_v' |
| 190 | +plt.savefig(plotname + '.pdf', format='pdf') |
| 191 | +plt.close() |
| 192 | + |
| 193 | +# Create figure and plot W-velocity comparison, low flow |
| 194 | + |
| 195 | +fig = fdsplotlib.plot_to_fig(x_data=x_err, y_data=x_err, |
| 196 | + marker_style='k-', |
| 197 | + x_min=-0.4, x_max=0.8, y_min=-0.4, y_max=0.8, |
| 198 | + figure_size=(plot_style['Scat_Paper_Width'],plot_style['Scat_Paper_Height']), |
| 199 | + plot_size=(plot_style['Scat_Plot_Width'],plot_style['Scat_Plot_Height']), |
| 200 | + plot_origin=(plot_style['Scat_Plot_X'],plot_style['Scat_Plot_Y']), |
| 201 | + revision_label=version_string, |
| 202 | + plot_title='Low Flow', |
| 203 | + x_label='Measured W-Velocity (m/s)', |
| 204 | + y_label='Predicted W-Velocity (m/s)') |
| 205 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_p, marker_style='k--', figure_handle=fig) |
| 206 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_m, marker_style='k--', figure_handle=fig) |
| 207 | +fdsplotlib.plot_to_fig(x_data=exp_data[:, 2], y_data=fds_w, marker_style='ro', figure_handle=fig) |
| 208 | +#herrorbar(exp_data[:, 2], fds_w, exp_data[:, 5], 'ro') |
| 209 | +#plt.errorbar(exp_data[:, 2], fds_w, yerr=fds_w_rms, fmt='ro') |
| 210 | +plotname = '../../Manuals/FDS_Validation_Guide/SCRIPT_FIGURES/FM_FPRF_Datacenter/FM_Datacenter_Veltest_Low_w' |
| 211 | +plt.savefig(plotname + '.pdf', format='pdf') |
| 212 | +plt.close() |
| 213 | + |
| 214 | +# Create figure and plot total velocity comparison |
| 215 | + |
| 216 | +fig = fdsplotlib.plot_to_fig(x_data=x_err, y_data=x_err, |
| 217 | + marker_style='k-', |
| 218 | + x_min=0, x_max=1.4, y_min=0, y_max=1.4, |
| 219 | + figure_size=(plot_style['Scat_Paper_Width'],plot_style['Scat_Paper_Height']), |
| 220 | + plot_size=(plot_style['Scat_Plot_Width'],plot_style['Scat_Plot_Height']), |
| 221 | + plot_origin=(plot_style['Scat_Plot_X'],plot_style['Scat_Plot_Y']), |
| 222 | + revision_label=version_string, |
| 223 | + plot_title='Low Flow', |
| 224 | + x_label='Measured Total Velocity (m/s)', |
| 225 | + y_label='Predicted Total Velocity (m/s)') |
| 226 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_p, marker_style='k--', figure_handle=fig) |
| 227 | +fdsplotlib.plot_to_fig(x_data=x_err, y_data=y_err_m, marker_style='k--', figure_handle=fig) |
| 228 | +fdsplotlib.plot_to_fig(x_data=exp_data[:, 6], y_data=fds_tot, marker_style='ro', figure_handle=fig) |
| 229 | +#herrorbar(exp_data[:, 6], fds_tot, exp_data[:, 7], 'ro') |
| 230 | +#plt.errorbar(exp_data[:, 6], fds_tot, yerr=fds_tot_rms, fmt='ro') |
| 231 | +plotname = '../../Manuals/FDS_Validation_Guide/SCRIPT_FIGURES/FM_FPRF_Datacenter/FM_Datacenter_Veltest_Low_vel' |
| 232 | +plt.savefig(plotname + '.pdf', format='pdf') |
| 233 | +plt.close() |
| 234 | + |
| 235 | + |
0 commit comments