def f_angles(angles, one, two, thr, stator, rotor, gamma, cp, R, GR, psi, DeltaH_prod): alpha = angles[0] beta = angles[1] # assume an two.alpha and project velocities two.vel.Vx, two.vel.Vu = f.velocity_projections(two.vel.V, alpha) # assume a loading factor and calculate peripheral speed two.vel.U = np.sqrt(DeltaH_prod / psi) # velocity triangle (pithagoras) two.vel.Wu = two.vel.Vu - two.vel.U two.vel.Wx = two.vel.Vx two.vel.W = f.mag(two.vel.Wu, two.vel.Wx) # relative inlet angle and relative Mach number two.vel.Mr = two.vel.W / two.vel.a # relative total quantities at rotor inlet two.T0r, two.P0r = f.relative_temperature_pressure( two.T, two.P, two.vel.Mr, gamma) ############ ROTOR ############# # in the rotor, the relative total temperature is constant (se conservan rotalpías) thr.T0r = two.T0r # ideal outlet temperature, real outlet temperature # assuming the expanse to thr.P, calculated with the assumed M3 thr.Ts = f.P2T(thr.T0r, thr.P, two.P0r, gamma) # = thr.T0r*(thr.P/two.P0r)**((gamma-1)/gamma) thr.T = f.stage_efficiency( rotor.eta, thr.T0r, thr.Ts) # = thr.T0r - rotor.eta*(thr.T0r - thr.Ts) # velocities thr.vel.W = f.isen_velocity(cp, thr.T0r, thr.T) # = np.sqrt(2*cp*(thr.T0r - thr.T)) # velocity projections, axial and tangential thr.vel.Wx, thr.vel.Wu = f.velocity_projections(thr.vel.W, beta) # constant radius, constant peripheral speed thr.vel.U = two.vel.U # tangential outlet speed thr.vel.Vu = thr.vel.Wu + thr.vel.U # V3u_euler = -DeltaH_prod/two.vel.U + two.vel.Vu # find work, check for angle iteration DeltaH_calculated = two.vel.U * (two.vel.Vu - thr.vel.Vu) diff = DeltaH_calculated - DeltaH_prod return np.array([diff[0], 0])
def f_mach3(Mach3, one, two, thr, stator, rotor, gamma, cp, R, GR, phi, DeltaH_prod, bounds_angles): thr.vel.M = Mach3 # using mach, find static pressure thr.P = f.static_pressure( thr.P0, gamma, thr.vel.M ) # = thr.P0/(1+(gamma-1)/2*thr.vel.M**2)**(gamma/(gamma-1)) thr.Ts = f.P2T(thr.T0, thr.P, thr.P0, gamma) # = thr.T0*(thr.P/thr.P0)**((gamma-1)/gamma) # find intermediate static pressure two.P = one.P0 * ((GR - 1) * (1 - (thr.P / one.P0)**( (gamma - 1) / gamma)) + 1)**(gamma / (gamma - 1)) # GP rp definition ### where does that definition come from? doublecheck GR definition # isentropic evolution in stator: absolute total temperature is same two.T0 = one.T0 two.Ts = f.P2T(one.T0, two.P, one.P0, gamma) # = one.T0*(two.P/one.P0)**((gamma-1)/gamma) two.vel.Vs = f.isen_velocity( cp, two.T0, two.Ts) # = np.sqrt(2*cp*(two.T0 - two.Ts)) # assume rotor efficiency two.T = f.stage_efficiency( stator.eta, two.T0, two.Ts) # = two.T0 - stator.eta*(two.T0-two.Ts) two.vel.V = f.isen_velocity(cp, two.T0, two.T) # = np.sqrt(2*cp*(two.T0 - two.T)) # density (from static quantities) two.rho = f.static_density(two.P, two.T, R) # = two.P/two.T/R # speed of sound and Mach two.vel.a, two.vel.M = f.sonic( gamma, R, two.T, two.vel.V) # = np.sqrt(gamma*R*two.T), = two.vel.V/two.vel.a # get initial guess for angles angles_init = np.array([two.alpha, thr.beta]) angles = solve_angles(angles_init, one, two, thr, stator, rotor, gamma, cp, R, GR, phi, DeltaH_prod, bounds_angles) two.alpha = angles[0] thr.beta = angles[1] two.vel.Vx, two.vel.Vu = f.velocity_projections(two.vel.V, two.alpha) # assume a loading factor and calculate peripheral speed two.vel.U = np.sqrt(DeltaH_prod / phi) # velocity triangle (pithagoras) two.vel.Wu = two.vel.Vu - two.vel.U two.vel.Wx = two.vel.Vx two.vel.W = f.mag(two.vel.Wu, two.vel.Wx) # relative inlet angle and relative Mach number two.vel.Mr = two.vel.W / two.vel.a # relative total quantities at rotor inlet two.T0r, two.P0r = f.relative_temperature_pressure( two.T, two.P, two.vel.Mr, gamma) ############ ROTOR ############# # in the rotor, the relative total temperature is constant (se conservan rotalpías) thr.T0r = two.T0r # ideal outlet temperature, real outlet temperature # assuming the expanse to thr.P, calculated with the assumed M3 thr.Ts = f.P2T(thr.T0r, thr.P, two.P0r, gamma) # = thr.T0r*(thr.P/two.P0r)**((gamma-1)/gamma) thr.T = f.stage_efficiency( rotor.eta, thr.T0r, thr.Ts) # = thr.T0r - rotor.eta*(thr.T0r - thr.Ts) # velocities thr.vel.W = f.isen_velocity(cp, thr.T0r, thr.T) # = np.sqrt(2*cp*(thr.T0r - thr.T)) # speed of sound and relative mach number thr.vel.a, thr.vel.Mr = f.sonic(gamma, R, thr.T, thr.vel.W) # = np.sqrt(gamma*R*thr.T) # velocity projections, axial and tangential thr.vel.Wx, thr.vel.Wu = f.velocity_projections(thr.vel.W, thr.beta) # constant radius, constant peripheral speed thr.vel.U = two.vel.U # tangential outlet speed thr.vel.Vu = thr.vel.Wu + thr.vel.U # V3u_euler = -DeltaH_prod/two.vel.U + two.vel.Vu # assume axial speed constant thr.vel.Vx = thr.vel.Wx thr.vel.V = f.mag( thr.vel.Vx, thr.vel.Vu) # = np.sqrt(thr.vel.Vx**2 + thr.vel.Vu**2) Mach3_calculated = thr.vel.V / thr.vel.a return Mach3_calculated - Mach3
def converge_mach3(one, two, thr, stator, rotor, gamma, cp, R, GR, psi, DeltaH_prod): def f_mach3(Mach3, one, two, thr, stator, rotor, gamma, cp, R, GR, psi, DeltaH_prod): thr.vel.M = Mach3 # using mach, find static pressure thr.P = f.static_pressure( thr.P0, gamma, thr.vel.M ) # = thr.P0/(1+(gamma-1)/2*thr.vel.M**2)**(gamma/(gamma-1)) thr.Ts = f.P2T(thr.T0, thr.P, thr.P0, gamma) # = thr.T0*(thr.P/thr.P0)**((gamma-1)/gamma) # find intermediate static pressure two.P = one.P0 * ((GR - 1) * (1 - (thr.P / one.P0)**( (gamma - 1) / gamma)) + 1)**(gamma / (gamma - 1)) # GP rp definition ### where does that definition come from? doublecheck GR definition # isentropic evolution in stator: absolute total temperature is same two.T0 = one.T0 two.Ts = f.P2T(one.T0, two.P, one.P0, gamma) # = one.T0*(two.P/one.P0)**((gamma-1)/gamma) two.vel.Vs = f.isen_velocity( cp, two.T0, two.Ts) # = np.sqrt(2*cp*(two.T0 - two.Ts)) # assume rotor efficiency two.T = f.stage_efficiency( stator.eta, two.T0, two.Ts) # = two.T0 - stator.eta*(two.T0-two.Ts) two.vel.V = f.isen_velocity(cp, two.T0, two.T) # = np.sqrt(2*cp*(two.T0 - two.T)) # density (from static quantities) two.rho = f.static_density(two.P, two.T, R) # = two.P/two.T/R # speed of sound and Mach two.vel.a, two.vel.M = f.sonic( gamma, R, two.T, two.vel.V) # = np.sqrt(gamma*R*two.T), = two.vel.V/two.vel.a ## ANGLE CONVERGENCE FOR ALPHA2 AND BETA3 solve_angles(one, two, thr, stator, rotor, gamma, cp, R, GR, psi, DeltaH_prod) two.vel.Vx, two.vel.Vu = f.velocity_projections(two.vel.V, two.alpha) # assume a loading factor and calculate peripheral speed two.vel.U = np.sqrt(DeltaH_prod / psi) # velocity triangle (pithagoras) two.vel.Wu = two.vel.Vu - two.vel.U two.vel.Wx = two.vel.Vx two.vel.W = f.mag(two.vel.Wu, two.vel.Wx) # relative inlet angle and relative Mach number two.vel.Mr = two.vel.W / two.vel.a # relative total quantities at rotor inlet two.T0r, two.P0r = f.relative_temperature_pressure( two.T, two.P, two.vel.Mr, gamma) ############ ROTOR ############# # in the rotor, the relative total temperature is constant (se conservan rotalpías) thr.T0r = two.T0r # ideal outlet temperature, real outlet temperature # assuming the expanse to thr.P, calculated with the assumed M3 thr.Ts = f.P2T(thr.T0r, thr.P, two.P0r, gamma) # = thr.T0r*(thr.P/two.P0r)**((gamma-1)/gamma) thr.T = f.stage_efficiency( rotor.eta, thr.T0r, thr.Ts) # = thr.T0r - rotor.eta*(thr.T0r - thr.Ts) # velocities thr.vel.W = f.isen_velocity(cp, thr.T0r, thr.T) # = np.sqrt(2*cp*(thr.T0r - thr.T)) # speed of sound and relative mach number thr.vel.a, thr.vel.Mr = f.sonic(gamma, R, thr.T, thr.vel.W) # = np.sqrt(gamma*R*thr.T) # velocity projections, axial and tangential thr.vel.Wx, thr.vel.Wu = f.velocity_projections(thr.vel.W, thr.beta) # constant radius, constant peripheral speed thr.vel.U = two.vel.U # tangential outlet speed thr.vel.Vu = thr.vel.Wu + thr.vel.U # V3u_euler = -DeltaH_prod/two.vel.U + two.vel.Vu # assume axial speed constant thr.vel.Vx = thr.vel.Wx thr.vel.V = f.mag( thr.vel.Vx, thr.vel.Vu) # = np.sqrt(thr.vel.Vx**2 + thr.vel.Vu**2) Mach3_calculated = thr.vel.V / thr.vel.a return Mach3_calculated - Mach3 thr.vel.M = fsolve(f_mach3, thr.vel.M, args=(one, two, thr, stator, rotor, gamma, cp, R, GR, psi, DeltaH_prod))[0] # speed of sound and relative mach number AT 3 thr.vel.a, thr.vel.Mr = f.sonic(gamma, R, thr.T, thr.vel.W) # = np.sqrt(gamma*R*thr.T) # using mach, find static pressure thr.P = f.static_pressure( thr.P0, gamma, thr.vel.M) # = thr.P0/(1+(gamma-1)/2*thr.vel.M**2)**(gamma/(gamma-1)) thr.Ts = f.P2T(thr.T0, thr.P, thr.P0, gamma) # = thr.T0*(thr.P/thr.P0)**((gamma-1)/gamma) # find intermediate static pressure two.P = one.P0 * ((GR - 1) * (1 - (thr.P / one.P0)**( (gamma - 1) / gamma)) + 1)**(gamma / (gamma - 1)) # GP rp definition # isentropic evolution in stator: absolute total temperature is same two.T0 = one.T0 two.Ts = f.P2T(one.T0, two.P, one.P0, gamma) # = one.T0*(two.P/one.P0)**((gamma-1)/gamma) two.vel.Vs = f.isen_velocity(cp, two.T0, two.Ts) # = np.sqrt(2*cp*(two.T0 - two.Ts)) # assume rotor efficiency two.T = f.stage_efficiency(stator.eta, two.T0, two.Ts) # = two.T0 - stator.eta*(two.T0-two.Ts) two.vel.V = f.isen_velocity(cp, two.T0, two.T) # = np.sqrt(2*cp*(two.T0 - two.T)) # density (from static quantities) two.rho = f.static_density(two.P, two.T, R) # = two.P/two.T/R # speed of sound and Mach two.vel.a, two.vel.M = f.sonic( gamma, R, two.T, two.vel.V) # = np.sqrt(gamma*R*two.T), = two.vel.V/two.vel.a two.P0 = f.T2P(two.P, two.T0, two.T, gamma) # = two.P*(two.T0/two.T)**(gamma/(gamma-1)) # assume an two.alpha and project velocities two.vel.Vx, two.vel.Vu = f.velocity_projections(two.vel.V, two.alpha) if two.vel.Vx == 0: two.vel.Vx = 0.00000001 # assume a loading factor and calculate peripheral speed two.vel.U = np.sqrt(DeltaH_prod / psi) # velocity triangle (pithagoras) two.vel.Wu = two.vel.Vu - two.vel.U two.vel.Wx = two.vel.Vx two.vel.W = f.mag(two.vel.Wu, two.vel.Wx) # relative inlet angle and relative Mach number two.beta = np.arctan(two.vel.Wu / two.vel.Vx) two.vel.Mr = two.vel.W / two.vel.a # relative total quantities at rotor inlet # (add relative speed to static conditions) # two.T0r = two.T*(1 + two.vel.Mr**2*(gamma-1)/2) # total temperature is conserved # two.P0r = two.P*(1 + (gamma-1)/2*two.vel.Mr**2)**(gamma/(gamma-1)) two.T0r, two.P0r = f.relative_temperature_pressure(two.T, two.P, two.vel.Mr, gamma) ############ ROTOR ############# # in the rotor, the relative total temperature is constant (se conservan rotalpías) thr.T0r = two.T0r # ideal outlet temperature, real outlet temperature # assuming the expanse to thr.P, calculated with the assumed M3 thr.Ts = f.P2T(thr.T0r, thr.P, two.P0r, gamma) # = thr.T0r*(thr.P/two.P0r)**((gamma-1)/gamma) thr.T = f.stage_efficiency( rotor.eta, thr.T0r, thr.Ts) # = thr.T0r - rotor.eta*(thr.T0r - thr.Ts) # velocities thr.vel.W = f.isen_velocity(cp, thr.T0r, thr.T) # = np.sqrt(2*cp*(thr.T0r - thr.T)) thr.vel.Ws = f.isen_velocity(cp, thr.T0r, thr.Ts) # = np.sqrt(2*cp*(thr.T0r - thr.Ts)) # density thr.rho = f.static_density(thr.P, thr.T, R) # = thr.P/thr.T/R # speed of sound and relative mach number thr.vel.a, thr.vel.Mr = f.sonic(gamma, R, thr.T, thr.vel.W) # = np.sqrt(gamma*R*thr.T) # total absolute pressure thr.P0r = f.T2P(thr.P, thr.T0r, thr.T, gamma) # = thr.P*(thr.T0r/thr.T)**(gamma/(gamma-1)) # assume a value for thr.beta # velocity projections, axial and tangential thr.vel.Wx, thr.vel.Wu = f.velocity_projections(thr.vel.W, thr.beta) # constant radius, constant peripheral speed thr.vel.U = two.vel.U # tangential outlet speed thr.vel.Vu = thr.vel.Wu + thr.vel.U # V3u_euler = -DeltaH_prod/two.vel.U + two.vel.Vu # assume axial speed constant thr.vel.Vx = thr.vel.Wx thr.vel.V = f.mag(thr.vel.Vx, thr.vel.Vu) # = np.sqrt(thr.vel.Vx**2 + thr.vel.Vu**2) thr.alpha = np.arctan(thr.vel.Vu / thr.vel.Vx)
U2 = np.sqrt(DeltaH_prod/phi) # velocity triangle (pithagoras) W2u = V2u - U2 W2x = V2x W2 = f.mag(W2u, W2x) # relative inlet angle and relative Mach number beta2 = np.arctan(W2u/V2x) Mach2r = W2/a2 # relative total quantities at rotor inlet # (add relative speed to static conditions) # T02r = T2*(1 + Mach2r**2*(gamma-1)/2) # total temperature is conserved # P02r = P2*(1 + (gamma-1)/2*Mach2r**2)**(gamma/(gamma-1)) T02r, P02r = f.relative_temperature_pressure(T2, P2, Mach2r, gamma) ############ ROTOR ############# # in the rotor, the relative total temperature is constant (se conservan rotalpías) T03r = T02r # ideal outlet temperature, real outlet temperature # assuming the expanse to P3, calculated with the assumed M3 T3s = f.P2T(T03r, P3, P02r, gamma) # = T03r*(P3/P02r)**((gamma-1)/gamma) T3 = f.stage_efficiency(eta_rotor, T03r, T3s) # = T03r - eta_rotor*(T03r - T3s) # velocities W3 = f.isen_velocity(cp, T03r, T3) # = np.sqrt(2*cp*(T03r - T3)) W3s = f.isen_velocity(cp, T03r, T3s) # = np.sqrt(2*cp*(T03r - T3s)) # density
U2 = np.sqrt(DeltaH_prod / phi) # velocity triangle (pithagoras) W2u = V2u - U2 W2x = V2x W2 = f.mag(W2u, W2x) # relative inlet angle and relative Mach number beta2 = np.arctan(W2u / V2x) Mach2r = W2 / a2 # relative total quantities at rotor inlet # (add relative speed to static conditions) # T02r = T2*(1 + Mach2r**2*(gamma-1)/2) # total temperature is conserved # P02r = P2*(1 + (gamma-1)/2*Mach2r**2)**(gamma/(gamma-1)) T02r, P02r = f.relative_temperature_pressure(T2, P2, Mach2r, gamma) ############ ROTOR ############# # in the rotor, the relative total temperature is constant (se conservan rotalpías) T03r = T02r # ideal outlet temperature, real outlet temperature # assuming the expanse to P3, calculated with the assumed M3 T3s = f.P2T(T03r, P3, P02r, gamma) # = T03r*(P3/P02r)**((gamma-1)/gamma) T3 = f.stage_efficiency(eta_rotor, T03r, T3s) # = T03r - eta_rotor*(T03r - T3s) # velocities W3 = f.isen_velocity(cp, T03r, T3) # = np.sqrt(2*cp*(T03r - T3)) W3s = f.isen_velocity(cp, T03r, T3s) # = np.sqrt(2*cp*(T03r - T3s))