def geometry_description(self): """This function calculates the geometry description. It is executed when the class is instantiated. Examples -------- >>> my_fluid_flow = fluid_flow_example() >>> my_fluid_flow.geometry_description() """ if self.shape_geometry == "cylindrical": start = (np.pi / 2) + self.attitude_angle else: start = 0 for i in range(0, self.nz): zno = i * self.dz self.z_list[i] = zno for j in range(0, self.ntheta): # fmt: off self.gama[i, j] = j * self.dtheta + start [radius_external, self.xre[i, j], self.yre[i, j]] = \ external_radius_function(self.gama[i, j], self.radius_stator, self.radius_rotor, shape=self.shape_geometry, preload=self.preload, displacement=self.displacement, max_depth=self.max_depth) [radius_internal, self.xri[i, j], self.yri[i, j]] = \ internal_radius_function(self.gama[i, j], self.attitude_angle, self.radius_rotor, self.eccentricity) self.re[i, j] = radius_external self.ri[i, j] = radius_internal
def geometry_description(self): """This function calculates the geometry description. It is executed when the class is instantiated. Examples -------- >>> my_fluid_flow = fluid_flow_example() >>> my_fluid_flow.geometry_description() """ for i in range(0, self.nz): zno = i * self.dz self.z_list[i] = zno for j in range(0, self.ntheta): # fmt: off self.gama[i, j] = j * self.dtheta + np.pi / 2 + self.attitude_angle [radius_external, self.xre[i, j], self.yre[i, j]] = \ external_radius_function(self.gama[i, j], self.radius_stator) [radius_internal, self.xri[i, j], self.yri[i, j]] = \ internal_radius_function(self.gama[i, j], self.attitude_angle, self.radius_rotor, self.eccentricity) self.re[i, j] = radius_external self.ri[i, j] = radius_internal
def calculate_coefficients(self, direction=None): """This function calculates the constants that form the Poisson equation of the discrete pressure (central differences in the second derivatives). It is executed when the class is instantiated. Examples -------- >>> my_fluid_flow = fluid_flow_example() >>> my_fluid_flow.calculate_coefficients() >>> my_fluid_flow.c0w # doctest: +ELLIPSIS array([[... """ for i in range(0, self.nz): zno = i * self.dz self.z_list[i] = zno eccentricity_error = False for j in range(0, self.ntheta): # fmt: off self.gama[i][j] = j * self.dtheta + np.pi / 2 + self.attitude_angle [radius_external, self.xre[i][j], self.yre[i][j]] = \ external_radius_function(self.gama[i][j], self.radius_stator) [radius_internal, self.xri[i][j], self.yri[i][j]] = \ internal_radius_function(self.gama[i][j], self.attitude_angle, self.radius_rotor, self.eccentricity) self.re[i][j] = radius_external self.ri[i][j] = radius_internal w = self.omega * self.radius_rotor k = (self.re[i][j] ** 2 * (np.log(self.re[i][j]) - 1 / 2) - self.ri[i][j] ** 2 * (np.log(self.ri[i][j]) - 1 / 2)) / (self.ri[i][j] ** 2 - self.re[i][j] ** 2) self.c1[i][j] = (1 / (4 * self.viscosity)) * ((self.re[i][j] ** 2 * np.log(self.re[i][j]) - self.ri[i][j] ** 2 * np.log(self.ri[i][j]) + (self.re[i][j] ** 2 - self.ri[i][j] ** 2) * (k - 1)) - 2 * self.re[i][j] ** 2 * ( (np.log(self.re[i][j]) + k - 1 / 2) * np.log( self.re[i][j] / self.ri[i][j]))) self.c2[i][j] = (- self.ri[i][j] ** 2) / (8 * self.viscosity) * \ ((self.re[i][j] ** 2 - self.ri[i][j] ** 2 - (self.re[i][j] ** 4 - self.ri[i][j] ** 4) / (2 * self.ri[i][j] ** 2)) + ((self.re[i][j] ** 2 - self.ri[i][j] ** 2) / (self.ri[i][j] ** 2 * np.log(self.re[i][j] / self.ri[i][j]))) * (self.re[i][j] ** 2 * np.log(self.re[i][j] / self.ri[i][j]) - (self.re[i][j] ** 2 - self.ri[i][j] ** 2) / 2)) self.c0w[i][j] = (- w * self.ri[i][j] * (np.log(self.re[i][j] / self.ri[i][j]) * (1 + (self.ri[i][j] ** 2) / (self.re[i][j] ** 2 - self.ri[i][j] ** 2)) - 1 / 2)) if direction == "x": a = self.omegap * (self.xp) * np.cos(self.omegap * self.t) self.c0w[i][j] += self.ri[i][j] * a * np.sin(self.gama[i][j]) elif direction == "y": b = self.omegap * (self.yp) * np.cos(self.omegap * self.t) self.c0w[i][j] -= self.ri[i][j] * b * np.cos(self.gama[i][j]) else: self.c0w[i][j] += 0 # fmt: on if not eccentricity_error: if abs(self.xri[i][j]) > abs(self.xre[i][j]) or abs( self.yri[i][j] ) > abs(self.yre[i][j]): eccentricity_error = True if eccentricity_error: raise ValueError( "Error: The given parameters create a rotor that is not inside the stator. " "Check parameters and fix accordingly." )