def __init__( self, nz, ntheta, length, omega, p_in, p_out, radius_rotor, radius_stator, viscosity, density, attitude_angle=None, eccentricity=None, load=None, omegap=None, immediately_calculate_pressure_matrix_numerically=True, bearing_type=None, shape_geometry="cylindrical", preload=0.4, displacement=0, max_depth=None, ): self.nz = nz self.ntheta = ntheta self.n_interv_z = nz - 1 self.n_interv_theta = ntheta - 1 self.length = length self.ltheta = 2.0 * np.pi self.dz = length / self.n_interv_z self.dtheta = self.ltheta / self.n_interv_theta self.ntotal = self.nz * self.ntheta self.omega = omega self.p_in = p_in self.p_out = p_out self.radius_rotor = radius_rotor self.radius_stator = radius_stator self.viscosity = viscosity self.density = density self.characteristic_speed = self.omega * self.radius_rotor self.radial_clearance = self.radius_stator - self.radius_rotor self.bearing_type = bearing_type if bearing_type is None: if self.length / (2 * self.radius_stator) <= 1 / 4: self.bearing_type = "short_bearing" elif self.length / (2 * self.radius_stator) > 4: self.bearing_type = "long_bearing" else: self.bearing_type = "medium_size" self.shape_geometry = shape_geometry self.preload = preload self.displacement = displacement self.max_depth = max_depth self.eccentricity = eccentricity self.attitude_angle = attitude_angle self.eccentricity_ratio = None self.load = load self.omegap = omegap if self.omegap is None: self.omegap = self.omega else: self.omegap = omegap self.z_list = np.zeros(self.nz) self.re = np.zeros([self.nz, self.ntheta]) self.ri = np.zeros([self.nz, self.ntheta]) self.xre = np.zeros([self.nz, self.ntheta]) self.xri = np.zeros([self.nz, self.ntheta]) self.yre = np.zeros([self.nz, self.ntheta]) self.yri = np.zeros([self.nz, self.ntheta]) self.gama = np.zeros([self.nz, self.ntheta]) self.t = 0 self.xp = 0 self.yp = 0 if (self.bearing_type == "short_bearing" and self.shape_geometry == "cylindrical"): if self.eccentricity is None and load is not None: modified_s = modified_sommerfeld_number( self.radius_stator, self.omega, self.viscosity, self.length, self.load, self.radial_clearance, ) self.eccentricity_ratio = calculate_eccentricity_ratio( modified_s) self.eccentricity = (calculate_eccentricity_ratio(modified_s) * self.radial_clearance) if attitude_angle is None: self.attitude_angle = calculate_attitude_angle( self.eccentricity_ratio) elif self.eccentricity is not None and load is not None: modified_s = modified_sommerfeld_number( self.radius_stator, self.omega, self.viscosity, self.length, self.load, self.radial_clearance, ) self.eccentricity_ratio = calculate_eccentricity_ratio( modified_s) if attitude_angle is None: self.attitude_angle = calculate_attitude_angle( self.eccentricity_ratio) elif eccentricity is not None and load is None: self.eccentricity_ratio = self.eccentricity / self.radial_clearance self.load = calculate_rotor_load( self.radius_stator, self.omega, self.viscosity, self.length, self.radial_clearance, self.eccentricity_ratio, ) if attitude_angle is None: self.attitude_angle = calculate_attitude_angle( self.eccentricity_ratio) else: sys.exit("Either load or eccentricity must be given.") self.xi = self.eccentricity * np.cos(3 * np.pi / 2 + self.attitude_angle) self.yi = self.eccentricity * np.sin(3 * np.pi / 2 + self.attitude_angle) self.geometry_description() else: if load is not None: find_equilibrium_position(self) if eccentricity is not None: self.eccentricity = eccentricity if attitude_angle is not None: self.attitude_angle = attitude_angle else: if attitude_angle is None: sys.exit("Attitude angle or load must be given.") if eccentricity is None: sys.exit("Eccentricity or load must be given.") self.geometry_description() self.eccentricity_ratio = self.eccentricity / self.radial_clearance self.xi = self.eccentricity * np.cos(3 * np.pi / 2 + self.attitude_angle) self.yi = self.eccentricity * np.sin(3 * np.pi / 2 + self.attitude_angle) self.p_mat_analytical = np.zeros([self.nz, self.ntheta]) self.p_mat_numerical = np.zeros([self.nz, self.ntheta]) self.analytical_pressure_matrix_available = False self.numerical_pressure_matrix_available = False if immediately_calculate_pressure_matrix_numerically: self.calculate_pressure_matrix_numerical()
def __init__( self, nz, ntheta, nradius, length, omega, p_in, p_out, radius_rotor, radius_stator, viscosity, density, attitude_angle=None, eccentricity=None, load=None, omegap=None, immediately_calculate_pressure_matrix_numerically=True, ): if load is None and eccentricity is None: sys.exit("Either load or eccentricity must be given.") self.nz = nz self.ntheta = ntheta self.nradius = nradius self.n_interv_z = nz - 1 self.n_interv_theta = ntheta - 1 self.n_interv_radius = nradius - 1 self.length = length self.ltheta = 2.0 * np.pi self.dz = length / self.n_interv_z self.dtheta = self.ltheta / self.n_interv_theta self.ntotal = self.nz * self.ntheta self.omega = omega self.p_in = p_in self.p_out = p_out self.radius_rotor = radius_rotor self.radius_stator = radius_stator self.viscosity = viscosity self.density = density self.characteristic_speed = self.omega * self.radius_rotor self.radial_clearance = self.radius_stator - self.radius_rotor self.bearing_type = "" if self.length / (2 * self.radius_stator) <= 1 / 4: self.bearing_type = "short_bearing" elif self.length / (2 * self.radius_stator) > 4: self.bearing_type = "long_bearing" else: self.bearing_type = "medium_size" self.eccentricity = eccentricity self.eccentricity_ratio = None self.load = load if self.eccentricity is None: modified_s = modified_sommerfeld_number( self.radius_stator, self.omega, self.viscosity, self.length, self.load, self.radial_clearance, ) self.eccentricity = ( calculate_eccentricity_ratio(modified_s) * self.radial_clearance ) self.omegap = omegap if self.omegap is None: self.omegap = self.omega else: self.omegap = omegap self.eccentricity_ratio = self.eccentricity / self.radial_clearance if self.load is None: self.load = calculate_rotor_load( self.radius_stator, self.omega, self.viscosity, self.length, self.radial_clearance, self.eccentricity_ratio, ) if attitude_angle is None: self.attitude_angle = calculate_attitude_angle(self.eccentricity_ratio) else: self.attitude_angle = attitude_angle self.xi = self.eccentricity * np.cos(3 * np.pi / 2 + self.attitude_angle) self.yi = self.eccentricity * np.sin(3 * np.pi / 2 + self.attitude_angle) self.re = np.zeros([self.nz, self.ntheta]) self.ri = np.zeros([self.nz, self.ntheta]) self.z_list = np.zeros(self.nz) self.xre = np.zeros([self.nz, self.ntheta]) self.xri = np.zeros([self.nz, self.ntheta]) self.yre = np.zeros([self.nz, self.ntheta]) self.yri = np.zeros([self.nz, self.ntheta]) self.p_mat_analytical = np.zeros([self.nz, self.ntheta]) self.c1 = np.zeros([self.nz, self.ntheta]) self.c2 = np.zeros([self.nz, self.ntheta]) self.c0w = np.zeros([self.nz, self.ntheta]) self.M = np.zeros([self.ntotal, self.ntotal]) self.f = np.zeros([self.ntotal, 1]) self.P = np.zeros([self.ntotal, 1]) self.p_mat_numerical = np.zeros([self.nz, self.ntheta]) self.gama = np.zeros([self.nz, self.ntheta]) self.calculate_coefficients() self.analytical_pressure_matrix_available = False self.numerical_pressure_matrix_available = False self.calculate_pressure_matrix_numerical() if immediately_calculate_pressure_matrix_numerically: self.calculate_pressure_matrix_numerical()
def find_equilibrium_position(fluid_flow_object, print_along=True, relative_tolerance=1e-07, numerical_fit=False): """This function returns an eccentricity value with calculated forces matching the load applied, meaning an equilibrium position of the rotor. Parameters ---------- fluid_flow_object: A FluidFlow object. print_along: bool, optional If True, prints the iteration process. relative_tolerance: float, optional numerical_fit: bool, optional If True, it makes sure the result matches numerically, changing attributes of the FluidFlow object. Returns ------- float Eccentricity of the equilibrium position. Examples -------- >>> from ross.fluid_flow.fluid_flow import fluid_flow_example2 >>> my_fluid_flow = fluid_flow_example2() >>> find_equilibrium_position(my_fluid_flow, print_along=False) # doctest: +ELLIPSIS 0.00010000... """ fluid_flow_object.calculate_pressure_matrix_numerical() load = calculate_rotor_load(fluid_flow_object.radius_stator, fluid_flow_object.omega, fluid_flow_object.viscosity, fluid_flow_object.length, fluid_flow_object.radial_clearance, fluid_flow_object.eccentricity_ratio) error = (load - fluid_flow_object.load) / fluid_flow_object.load increment = 0.1 k = 0 eccentricity = fluid_flow_object.eccentricity while np.abs(error) > relative_tolerance: eccentricity = eccentricity + (eccentricity * increment) eccentricity_ratio = eccentricity / fluid_flow_object.difference_between_radius load = calculate_rotor_load(fluid_flow_object.radius_stator, fluid_flow_object.omega, fluid_flow_object.viscosity, fluid_flow_object.length, fluid_flow_object.radial_clearance, eccentricity_ratio) new_error = (load - fluid_flow_object.load) / fluid_flow_object.load if print_along: print("Iteration " + str(k)) print("Eccentricity: " + str(eccentricity)) print("Load: " + str(load)) print("Error: " + str(new_error)) if error * new_error < 0: if print_along: print( "Error changed sign. Changing sign of increment and reducing it." ) increment = -increment / 10 elif abs(new_error) > abs(error): if print_along: print( "Error was greater than previous one. Changing sign of increment and slightly " "reducing it.") increment = -increment / 5 error = new_error k += 1 if print_along: print() return eccentricity