def calc_pv(self, ui=None, res_dir=None): """Calculate product of local maximum pressure and local maximum relative velocity""" print_it("calculating pv_rel") self.pv = np.multiply(abs(self.rel_vel), self.sun.max_press) / 1000 dat_dict = dict(x_axis=self.sun.x_axis, pv_rel=self.pv) save_to_matlab(dat_dict, res_dir, 'pv-rel')
def save_pressure_to_matlab(self, res_dir): dat_dict = dict(contact_pressures_IR=self.ring1.press, contact_pressures_OR=self.ring2.press, x_axis=self.roller.x_axis, y_axis=self.roller.y_axis, roller_number=np.linspace(1, self.num_rollers, self.num_rollers), roller_position=np.linspace(1, self.num_roller_pos, self.num_roller_pos)) save_to_matlab(dat_dict, res_dir, 'pressure-field')
def calc_load_distribution(self, ui=None, res_dir=None): """Calculate the load distribution for all roller positions by calling the function 'load_distr_cyl_rol_bear' while changing the polar position of the rollers with respect to the inner/outer ring""" print_it('calculating {} load distributions'.format( self.num_roller_pos)) # initialise variables count = 0 x_profile = abs(self.roller.x_profile + self.ring1.x_profile) self.roller_norm_forces = np.zeros( (self.num_roller_pos, self.num_rollers)) self.roller_norm_displ = np.zeros( (self.num_roller_pos, self.num_rollers)) # get all load distributions for all roller positions for roller_pos in range(self.num_roller_pos): self.roller_norm_forces[roller_pos, :], self.roller_norm_displ[ roller_pos, :] = \ load_distr_cyl_rol_bear(self.phi_mat[roller_pos, :], self.num_rollers, self.roller.length, self.roller.res_x, x_profile, self.roller.x_axis, self.rad_clear, self.init_force) count = print_progress(count, self.num_roller_pos) self.normal_forces = np.transpose(self.roller_norm_forces).reshape( (self.roller_norm_forces.size, 1)) self.norm_displ = np.transpose(self.roller_norm_displ).reshape( (self.roller_norm_displ.size, 1)) # get unique normal forces and unique normal displacements self.uniq_norm_forces, self.uniq_force_idx = np.unique( np.round(self.roller_norm_forces), return_inverse=True) uniq_norm_displ = np.zeros(len(self.uniq_norm_forces)) for i in range(len(self.uniq_norm_forces)): uniq_norm_displ[i] = np.mean( self.norm_displ[self.uniq_force_idx == i]) self.uniq_norm_displ = sorted(np.absolute(uniq_norm_displ) / 10) # save load distribution data to matlab database dat_dict = { 'roller_positions': self.num_roller_pos, 'rollers': self.num_rollers, 'roller_normal_forces': self.roller_norm_forces, 'uniq_norm_forces': self.uniq_norm_forces, 'normal_forces': self.normal_forces, 'polar_coordinates': self.phi_mat } save_to_matlab(dat_dict, res_dir, 'load-distribution')
def calc_pv(self, ui=None, res_dir=None): """Calculate product of local maximum pressure and local maximum relative velocity""" print_it("calculating pv_rel") self.ring1.pv = np.absolute( np.multiply(self.ring1.max_press, self.roller.rel_vel) / 1000) self.ring2.pv = np.absolute( np.multiply(self.ring2.max_press, self.roller.rel_vel) / 1000) dat_dict = dict(x_axis=self.roller.x_axis, pv_rel_ir_3d=self.ring1.pv, pv_rel_ir_2d=np.amax(self.ring1.pv, axis=1), pv_rel_or_3d=self.ring2.pv, pv_rel_or_2d=np.amax(self.ring2.pv, axis=1), axis_pol=self.pol_ax) save_to_matlab(dat_dict, res_dir, 'pv_rel_ring2')
def calc_contact_pressure(self, ui=None, res_dir=None): """Calculate contact pressure distribution between sun and planet ring(s)""" print_it('calculating 1 pressure distribution') init_displ = self.get_grid_size(ui, res_dir) [self.influ_mat_db_1] = load_influ_mat(ui, res_dir, 1) print_it('solving first half space', PrintOpts.lvl1.value) self.sun.press, self.influ_mat_db_1 = \ solve_half_space(self.sun.profile, self.planet.profile, self.sun.x_axis, self.sun.y_axis, self.sun.res_x, self.sun.res_y, self.sun.delta_x, self.sun.delta_y, self.sun.e, self.planet.e, self.sun.ny, self.planet.ny, self.sun.norm_forces[0], res_dir, init_displ=init_displ, influ_mat_db=self.influ_mat_db_1) cache_influ_mat(ui, [self.influ_mat_db_1], res_dir) self.sun.max_press = np.amax(self.sun.press, axis=1) dat_dict = dict(x_axis=self.sun.x_axis, y_axis=self.sun.y_axis, contact_pressure=self.sun.press) save_to_matlab(dat_dict, res_dir, 'pressure_field')
def save_pressure_to_matlab(self, res_dir): dat_dict = dict(contact_pressure=self.ball.press, x_axis=self.ball.x_axis, y_axis=self.ball.y_axis) save_to_matlab(dat_dict, res_dir, 'pressure-field')