def plot_it(self, ui=None, res_dir=None): """Orchestrate output plot generation""" print_it("plotting results") plt_profiles(res_dir) print_it("plotting other", PrintOpts.lvl1.value) plt_contact(self.pin, self.disk, PltOpts.DD.value, res_dir, SubDir.contacts.value) plt_contact(self.pin, self.disk, PltOpts.DDD.value, res_dir, SubDir.contacts.value) plt_3d(self.pin.x_axis, self.pin.y_axis, self.pin.press, self.pin.x_label, self.pin.y_label, 'pressure in MPa', 'contact_pressure_pin', res_dir, SubDir.pressures.value, 'contact_pressure') plt_2d(self.pin.x_axis, self.pin.rel_vel, self.pin.x_label, 'rel vel', 'rel vel', res_dir, SubDir.energy.value, 'rel_vel') plt_2d(self.pin.x_axis, self.pv, self.pin.x_label, 'pv_rel in {}'.format(Unit.pvrel.value), 'pv_rel', res_dir, SubDir.energy.value, 'pv_rel') plt_2d_scatt_line(self.pin.x_axis, self.e_akin, self.pin.x_axis, self.e_akin, self.pin.x_label, 'e_akin in W $m^{-2}$', 'e_akin', res_dir, SubDir.energy.value, 'e_akin') plt_2d_2y_ax(self.pin.x_axis, self.e_akin, self.pin.x_axis, self.pv, self.pin.x_label, 'e_akin vs pv_rel', 'e_akin in {}'.format(Unit.eakin.value), 'pv_rel in {}'.format(Unit.eakin.value), res_dir, SubDir.energy.value, 'e_akin_vs_pv_rel') plt_cum_dist(self.pin.press, 'pressure in {}'.format(Unit.press.value), res_dir, SubDir.pressures.value, 'cumulative pressure distribution')
def plot_it(self, ui=None, res_dir=None): """Orchestrate output plot generation""" print_it("plotting results") plt_profile(self.sun, PltOpts.DD.value, res_dir, SubDir.profiles.value) plt_profile(self.sun, PltOpts.DDD.value, res_dir, SubDir.profiles.value) plt_profile(self.planet, PltOpts.DD.value, res_dir, SubDir.profiles.value) plt_profile(self.planet, PltOpts.DDD.value, res_dir, SubDir.profiles.value) plt_profile_approx(res_dir, SubDir.profiles.value) plt_contact(self.sun, self.planet, PltOpts.DD.value, res_dir, SubDir.contacts.value) plt_contact(self.sun, self.planet, PltOpts.DDD.value, res_dir, SubDir.contacts.value) plt_3d(self.sun.x_axis, self.sun.y_axis, self.sun.press, self.sun.x_label, self.sun.y_label, 'pressure in MPa', 'contact_pressure_sun', res_dir, SubDir.pressures.value, 'contact_pressure_sun') plt_2d_scatt_line(self.sun.x_axis, self.pv, self.sun.x_axis, self.pv, self.sun.x_label, 'pv_rel in {}'.format(Unit.pvrel.value), 'pv_rel', res_dir, SubDir.energy.value, 'pv_rel') plt_2d_scatt_line(self.sun.x_axis, self.sun.e_akin, self.sun.x_axis, self.sun.e_akin, self.sun.x_label, 'e_akin in {}'.format(Unit.eakin.value), 'e_akin', res_dir, SubDir.energy.value, 'sun.e_akin') plt_2d_scatt_line(self.planet.x_axis, self.planet.e_akin, self.planet.x_axis, self.planet.e_akin, self.planet.x_label, 'e_akin in {}'.format(Unit.eakin.value), 'e_akin', res_dir, SubDir.energy.value, 'planet.e_akin') plt_energy_ring_on_ring(self, res_dir, SubDir.energy.value, 'e-akin-vs-pv-rel')
def plot_it(self, ui=None, res_dir=None): """Orchestrate output plot generation""" print_it("plotting results and finishing up") plt_profile(self.ball, PltOpts.DD.value, res_dir, SubDir.profiles.value) plt_profile(self.ball, PltOpts.DDD.value, res_dir, SubDir.profiles.value) plt_profile(self.plate, PltOpts.DD.value, res_dir, SubDir.profiles.value) plt_profile(self.plate, PltOpts.DDD.value, res_dir, SubDir.profiles.value) plt_profile_approx(res_dir, SubDir.profiles.value) plt_contact(self.ball, self.plate, PltOpts.DD.value, res_dir, SubDir.contacts.value) plt_contact(self.ball, self.plate, PltOpts.DDD.value, res_dir, SubDir.contacts.value) plt_3d(self.ball.x_axis, self.ball.y_axis, self.ball.press, self.ball.x_label, self.ball.y_label, 'pressure in MPa', 'contact pressure', res_dir, SubDir.pressures.value, 'contact-pressure') plt_2d(self.ball.x_axis, self.pv, self.ball.x_label, 'pv_rel in {}'.format(Unit.pvrel.value), 'pv_rel', res_dir, SubDir.energy.value, 'pv_rel') plt_2d_scatt_line(self.ball.x_axis, self.e_akin, self.ball.x_axis, self.e_akin, self.ball.x_label, 'e_akin in {}'.format(Unit.eakin.value), 'e_akin', res_dir, SubDir.energy.value, 'e_akin') plt_2d_2y_ax(self.ball.x_axis, self.e_akin, self.ball.x_axis, self.pv, self.ball.x_label, 'e_akin vs pv_rel', 'e_akin in {}'.format(Unit.eakin.value), 'pv_rel in {}'.format(Unit.pvrel.value), res_dir, SubDir.energy.value, 'e_akin_vs_pv_rel')
def plt_eakin(self, res_dir): """Plot kinetic friction energy accumulation""" print_it("plotting energy figures", PrintOpts.lvl1.value) # e_a,kin plt_ax_pol = np.linspace(-math.pi, math.pi - 2 * math.pi / self.res_pol, int(self.res_pol)) if self.rot_vel1 == 0: plot_data = np.concatenate( (self.ring1.e_akin.transpose()[round(self.res_pol / 2) - 1:-1, :], self.ring1.e_akin.transpose()[0:round(self.res_pol / 2), :]), axis=0) plt_3d(plt_ax_pol, self.roller.x_axis, plot_data, 'polar ring coordinate', 'roller length in mm', 'e_a,kin in {}'.format(Unit.eakin.value), 'e_a,kin inner ring', res_dir, SubDir.energy.value, 'e-a-kin-inner-ring', None, PltOpts.azim.value) polplt_line(plt_ax_pol, plot_data[:, round(self.roller.res_x / 2) - 1], 'e_a,kin_rel max in {}'.format(Unit.eakin.value), 'e_a,kin max inner ring', res_dir, SubDir.energy.value, 'max-e-a-kin-inner-ring') else: plt_2d_scatt_line(self.roller.x_axis, self.ring1.e_akin, self.roller.x_axis, self.ring1.e_akin, self.roller.x_label, 'average e_a,kin in {}'.format(Unit.eakin.value), 'average e_a,kin inner ring', res_dir, SubDir.energy.value, 'average-e-a-kin-inner-ring') if self.rot_vel2 == 0: plot_data = np.concatenate( (self.ring2.e_akin.transpose()[round(self.res_pol / 2) - 1:-1, :], self.ring2.e_akin.transpose()[0:round(self.res_pol / 2), :]), axis=0) plt_3d(plt_ax_pol, self.roller.x_axis, plot_data, 'polar ring coordinate', 'roller length in mm', 'e_a,kin in {}'.format(Unit.eakin.value), 'e_a,kin outer ring', res_dir, SubDir.energy.value, 'e-a-kin-outer-ring', None, PltOpts.azim.value) polplt_line(plt_ax_pol, plot_data[:, round(self.roller.res_x / 2) - 1], 'e_a,kin_rel max in {}'.format(Unit.eakin.value), 'e_a,kin max outer ring', res_dir, SubDir.energy.value, 'max-e-a-kin-outer-ring') else: plt_2d_scatt_line(self.roller.x_axis, self.ring2.e_akin, self.roller.x_axis, self.ring2.e_akin, self.roller.x_label, 'average e_a,kin in {}'.format(Unit.eakin.value), 'average e_a,kin outer ring', res_dir, SubDir.energy.value, 'average-e-a-kin-outer-ring')
def generate_latex_figures(self, ui=None, res_dir=None): """Generate calculation-specific figures for LaTeX report""" plt_contact(self.sun, self.planet, PltOpts.DDD.value, res_dir, SubDir.tex_figs.value, 'contact1') plt_profile_approx(res_dir, SubDir.tex_figs.value) plt_3d(self.sun.x_axis, self.sun.y_axis, self.sun.press, self.sun.x_label, self.sun.y_label, 'pressure in MPa', 'contact_pressure_sun', res_dir, SubDir.tex_figs.value, 'pressure1') plt_energy_ring_on_ring(self, res_dir, SubDir.tex_figs.value, 'energy1')
def generate_latex_figures(self, ui=None, res_dir=None): """Generate calculation-specific figures for LaTeX report""" plt_profile_approx(res_dir, SubDir.tex_figs.value) plt_contact(self.ball, self.plate, PltOpts.DDD.value, res_dir, SubDir.tex_figs.value, 'contact1') plt_3d(self.ball.x_axis, self.ball.y_axis, self.ball.press, self.ball.x_label, self.ball.y_label, 'pressure in MPa', 'contact pressure', res_dir, SubDir.tex_figs.value, 'pressure1') plt_2d_2y_ax(self.ball.x_axis, self.e_akin, self.ball.x_axis, self.pv, self.ball.x_label, 'e_akin vs pv_rel', 'e_akin in {}'.format(UnitTex.eakin.value), 'pv_rel in {}'.format(UnitTex.pvrel.value), res_dir, SubDir.tex_figs.value, 'energy1')
def generate_latex_figures(self, ui=None, res_dir=None): """Generate calculation-specific figures for LaTeX report""" plt_contact(self.pin, self.disk, PltOpts.DDD.value, res_dir, SubDir.tex_figs.value, 'contact1') plt_profile_approx(res_dir, SubDir.tex_figs.value) plt_3d(self.pin.x_axis, self.pin.y_axis, self.pin.press, self.pin.x_label, self.pin.y_label, 'pressure in MPa', 'contact_pressure_pin', res_dir, SubDir.tex_figs.value, 'pressure1') plt_2d_2y_ax(self.pin.x_axis, self.e_akin, self.pin.x_axis, self.pv, self.pin.x_label, 'e_akin vs pv_rel', 'e_akin in W $\mathregular{m^{-2}}$', 'pv_rel in W $\mathregular{m^{-2}}$', res_dir, SubDir.tex_figs.value, 'energy1')
def generate_latex_figures(self, ui=None, res_dir=None): """Generate calculation-specific figures for LaTeX report""" plt_profile_approx(res_dir, SubDir.tex_figs.value) plt_contact(self.roller, self.ring1, PltOpts.DDD.value, res_dir, SubDir.tex_figs.value, 'contact1') plt_3d(self.roller.x_axis, self.roller.y_axis, self.ring1.press[:, :], self.roller.x_label, self.roller.y_label, 'pressure in MPa', 'pressure at highest normal force', res_dir, SubDir.tex_figs.value, 'pressure1') plt_2d_scatt_line(self.roller.x_axis, self.roller.slip, self.roller.x_axis, self.roller.slip, self.roller.x_label, "roller slip in percent (0-1)", "roller slip", res_dir, SubDir.tex_figs.value, "slip1") plt_2d_2y_ax(self.roller.x_axis, self.e_akin, self.roller.x_axis, self.pv, self.roller.x_label, 'e_akin vs pv_rel', 'e_akin in {}'.format(Unit.eakin.value), 'pv_rel in {}'.format(Unit.pvrel.value), res_dir, SubDir.tex_figs.value, 'energy1')
def generate_latex_figures(self, ui=None, res_dir=None): """Generate calculation-specific part of the LaTeX output file""" plt_profile_approx(res_dir, SubDir.tex_figs.value) plt_contact(self.ball, self.disk, PltOpts.DDD.value, res_dir, SubDir.tex_figs.value, 'contact1') plt_3d(self.ball.x_axis, self.ball.y_axis, self.ball.press, self.ball.x_label, self.ball.y_label, 'pressure in {}'.format(UnitTex.pressure.value), 'contact_pressure_ball', res_dir, SubDir.tex_figs.value, 'pressure1') plt_2d_2y_ax(self.ball.x_axis, self.ball.e_akin, self.ball.x_axis, self.pv, self.ball.x_label, 'e_akin vs pv_rel', 'e_akin in {}'.format(UnitTex.eakin.value), 'pv_rel in {}'.format(UnitTex.pvrel.value), res_dir, SubDir.tex_figs.value, 'energy1') plt_2d_2y_ax(self.disk.x_axis, self.disk.e_akin, self.disk.x_axis, self.pv, self.disk.x_label, 'e_akin vs pv_rel', 'e_akin in {}'.format(UnitTex.eakin.value), 'pv_rel in {}'.format(UnitTex.pvrel.value), res_dir, SubDir.tex_figs.value, 'energy2')
def plt_pv(self, res_dir): """Plot pv""" plt_ax_pol = np.linspace(-math.pi, math.pi - 2 * math.pi / self.res_pol, int(self.res_pol)) plot_data_ring1 = np.concatenate( (self.ring1.pv[round(self.res_pol / 2) - 1:-1, :], self.ring2.pv[0:round(self.res_pol / 2), :]), axis=0) plot_data_ring2 = np.concatenate( (self.ring2.pv[round(self.res_pol / 2) - 1:-1, :], self.ring2.pv[0:round(self.res_pol / 2), :]), axis=0) plt_3d(plt_ax_pol, self.roller.x_axis, plot_data_ring1, 'polar ring coordinate', 'roller length in mm', 'pv in {}'.format(Unit.pvrel.value), 'pv inner ring', res_dir, SubDir.energy.value, 'max_pv_inner_ring', None, PltOpts.azim.value) plt_3d(plt_ax_pol, self.roller.x_axis, plot_data_ring2, 'polar ring coordinate', 'roller length in mm', 'pv in {}'.format(Unit.pvrel.value), 'pv outer ring', res_dir, SubDir.energy.value, 'pv_outer_ring', None, PltOpts.azim.value) polplt_line_line( plt_ax_pol, plot_data_ring1[:, round(self.roller.res_x / 2) - 1], plt_ax_pol, plot_data_ring2[:, round(self.roller.res_x / 2) - 1], 'pv in {}'.format(Unit.pvrel.value), 'pv_rel inner (max) and outer ring', 'inner ring (max)', 'outer ring', res_dir, SubDir.energy.value, 'pv-rel-max') scipy.io.savemat( res_dir + '{}{}{}pv_rel_ring2.mat'.format( os.sep, SubDir.matlab.value, os.sep), dict(plot_axis_pol=plt_ax_pol, plot_axis_x=self.roller.x_axis, plot_data_pv_rel_ir_3d=plot_data_ring1, plot_data_pv_rel_ir_2d=np.amax(plot_data_ring1, axis=1), plot_data_pv_rel_or_3d=plot_data_ring2, plot_data_pv_rel_or_2d=np.amax(plot_data_ring2, axis=1), axis_pol=self.pol_ax, axis_x=self.roller.x_axis, data_pv_rel_or=self.ring2.pv))
def plt_pres(self, res_dir): """Generate contact pressure plots""" print_it("plotting pressure distributions", PrintOpts.lvl1.value) press_count = 0 z_limit = np.amax( self.ring1.uniq_press[:, :, self.uniq_norm_forces.shape[0] - 1]) for uniq_norm_force in range(self.uniq_norm_forces.shape[0] - 1, -1, -1): plt_3d(self.roller.x_axis, self.roller.y_axis, self.ring1.uniq_press[:, :, uniq_norm_force], self.roller.x_label, self.roller.y_label, 'pressure in MPa', ('contact_pressure_ir_' + str(int(press_count))), res_dir, SubDir.pressures.value, ('contact_pressure_ir_' + str(int(press_count))), [0, z_limit]) plt_3d(self.roller.x_axis, self.roller.y_axis, self.ring2.uniq_press[:, :, uniq_norm_force], self.roller.x_label, self.roller.y_label, 'pressure in MPa', ('contact_pressure_or_' + str(int(press_count))), res_dir, SubDir.pressures.value, ('contact_pressure_or_' + str(int(press_count))), [0, z_limit]) press_count = print_progress(press_count, self.uniq_norm_forces.shape[0])
def plot_it(self, ui=None, res_dir=None): """Orchestrate output plot generation""" print_it("plotting results and finishing up") plt_profile(self.rot_ball, PltOpts.DD.value, res_dir, SubDir.profiles.value) plt_profile(self.rot_ball, PltOpts.DDD.value, res_dir, SubDir.profiles.value) plt_profile(self.stat_ball, PltOpts.DD.value, res_dir, SubDir.profiles.value) plt_profile(self.stat_ball, PltOpts.DDD.value, res_dir, SubDir.profiles.value) plt_profile_approx(res_dir, SubDir.profiles.value) plt_contact(self.rot_ball, self.stat_ball, PltOpts.DD.value, res_dir, SubDir.contacts.value) plt_contact(self.rot_ball, self.stat_ball, PltOpts.DDD.value, res_dir, SubDir.contacts.value) plt_3d(self.rot_ball.x_axis, self.rot_ball.y_axis, self.rot_ball.press, self.rot_ball.x_label, self.rot_ball.y_label, 'pressure in MPa', 'contact_pressure', res_dir, SubDir.pressures.value, 'contact-pressure') plt_2d_scatt_line(self.rot_ball.x_axis, self.pv, self.rot_ball.x_axis, self.pv, self.rot_ball.x_label, 'pv_rel in W $\mathregular{m^{-2}}$', 'pv_rel', res_dir, SubDir.energy.value, 'pv_rel') plt_2d_scatt_line(self.stat_ball.x_axis, self.e_akin, self.stat_ball.x_axis, self.e_akin, self.stat_ball.x_label, 'a_akin in W $m^{-2}$', 'e_akin', res_dir, SubDir.energy.value, 'e_akin') plt_2d_2y_ax(self.stat_ball.x_axis, self.e_akin, self.stat_ball.x_axis, self.pv, self.stat_ball.x_label, 'e_akin vs pv_rel', 'e_akin in W $\mathregular{m^{-2}}$', 'pv_rel in W $\mathregular{m^{-2}}$', res_dir, SubDir.energy.value, 'e_akin_vs_pv_rel')
def generate_latex_figures(self, ui=None, res_dir=None): """Append system-specific output data to latex file""" max_press_field_ring1 = self.ring1.press[:, :, 0, 0] max_press_field_ring2 = self.ring2.press[:, :, 0, 0] plt_profile_approx(res_dir, SubDir.tex_figs.value) plt_contact(self.roller, self.ring1, PltOpts.DDD.value, res_dir, SubDir.tex_figs.value, 'contact1') plt_contact(self.roller, self.ring2, PltOpts.DDD.value, res_dir, SubDir.tex_figs.value, 'contact2') polplt_scatt_line(self.pol_coords_slip, self.slip_data, self.pol_ax, self.roller.slip, 'roller slip', 'roller slip', res_dir, SubDir.tex_figs.value, 'slip1') plt_3d(self.roller.x_axis, self.roller.y_axis, max_press_field_ring1, self.roller.x_label, self.roller.y_label, 'Pressure in MPa', 'pressure at highest normal force', res_dir, SubDir.tex_figs.value, 'pressure1') plt_3d(self.roller.x_axis, self.roller.y_axis, max_press_field_ring2, self.roller.x_label, self.roller.y_label, 'Pressure in MPa', 'pressure at highest normal force', res_dir, SubDir.tex_figs.value, 'pressure2') polplt_scatt_line( np.append(self.phi_mat[0, :], self.phi_mat[0, 0]), np.append(self.roller_norm_forces[0, :], self.roller_norm_forces[0, 0]), np.append(self.phi_mat[0, :], self.phi_mat[0, 0]), np.append(self.roller_norm_forces[0, :], self.roller_norm_forces[0, 0]), 'normal force in N', 'load distribution', res_dir, SubDir.tex_figs.value, 'load1') plot_axis_pol = np.linspace(-math.pi, math.pi - 2 * math.pi / self.res_pol, int(self.res_pol)) plot_data_ring1 = np.concatenate( (self.ring1.pv[round(self.res_pol / 2) - 1:-1, :], self.ring2.pv[0:round(self.res_pol / 2), :]), axis=0) plot_data_ring2 = np.concatenate( (self.ring2.pv[round(self.res_pol / 2) - 1:-1, :], self.ring2.pv[0:round(self.res_pol / 2), :]), axis=0) polplt_line_line( plot_axis_pol, plot_data_ring1[:, round(self.roller.res_x / 2) - 1], plot_axis_pol, plot_data_ring2[:, round(self.roller.res_x / 2) - 1], 'pv in {}'.format(Unit.pvrel.value), 'pv_rel inner (max) and outer ring', 'inner ring (max)', 'outer ring', res_dir, SubDir.tex_figs.value, 'energy1') if self.rot_vel1 == 0: plot_data = np.concatenate( (self.ring1.e_akin.transpose()[round(self.res_pol / 2) - 1:-1, :], self.ring1.e_akin.transpose()[0:round(self.res_pol / 2), :]), axis=0) polplt_line(plot_axis_pol, plot_data[:, round(self.roller.res_x / 2) - 1], 'e_a,kin_rel max in {}'.format(Unit.eakin.value), 'e_a,kin max inner ring', res_dir, SubDir.tex_figs.value, 'energy2') else: plt_2d_scatt_line(self.roller.x_axis, self.ring1.e_akin, self.roller.x_axis, self.ring1.e_akin, self.roller.x_label, 'average e_a,kin in {}'.format(Unit.eakin.value), 'average e_a,kin inner ring', res_dir, SubDir.tex_figs.value, 'energy2') if self.rot_vel2 == 0: plot_data = np.concatenate( (self.ring2.e_akin.transpose()[round(self.res_pol / 2) - 1:-1, :], self.ring2.e_akin.transpose()[0:round(self.res_pol / 2), :]), axis=0) polplt_line(plot_axis_pol, plot_data[:, round(self.roller.res_x / 2) - 1], 'e_a,kin_rel max in {}'.format(Unit.eakin.value), 'e_a,kin max outer ring', res_dir, SubDir.tex_figs.value, 'energy3') else: plt_2d_scatt_line(self.roller.x_axis, self.ring2.e_akin, self.roller.x_axis, self.ring2.e_akin, self.roller.x_label, 'average e_a,kin in {}'.format(Unit.eakin.value), 'average e_a,kin outer ring', res_dir, SubDir.tex_figs.value, 'energy3')
def plt_pres(self, res_dir): """Plot contact pressure distribution""" plt_3d(self.roller.x_axis, self.roller.y_axis, self.ring1.press, self.roller.x_label, self.roller.y_label, 'pressure in MPa', 'contact pressure', res_dir, SubDir.pressures.value, 'contact-pressure')