Ejemplo n.º 1
0
 def _get_inlet_velocity(self, c11, k_av):
     self.a_cr11 = gd.a_cr(self.T0_stag, k_av, self.work_fluid.R)
     self.lam11 = c11 / self.a_cr11
     self.eps11 = gd.eps_lam(self.lam11, self.k_av)
     self.sigma_inlet = self._get_sigma_inlet(self.k_av, self.eps11,
                                              self.lam11)
     self._stages[0].p1_stag = self.p0_stag * self.sigma_inlet
     self._stages[0].T1_stag = self.T0_stag
     self._stages[0].geom.d1_in_rel = self.d1_in_rel1
     self.rho11 = self.p0_stag * self.sigma_inlet / (
         self.work_fluid.R * self.T0_stag) * self.eps11
     self.u1_out1 = (np.pi * self.G * self.n**2 /
                     (900 * self.c1_a_rel_arr[0] * self.rho11 *
                      (1 - self.d1_in_rel1**2)))**(1 / 3)
     self._stages[0].u1_out = self.u1_out1
     for n, stage in enumerate(self._stages):
         stage.k_av = self.k_av
         logging.info('Computing stage %s' % (n + 1))
         if n < self.stage_num - 1:
             stage.compute()
             self._stages[n + 1].u1_out = stage.u3_out
             self._stages[n + 1].geom.d1_in_rel = stage.geom.d3_in_rel
             self._stages[n + 1].T1_stag = stage.T3_stag
             self._stages[n + 1].p1_stag = stage.p3_stag
         else:
             stage.compute()
     self.work_fluid.T2 = self.last.T3_stag
     return self._stages[
         0].c1, self.work_fluid.k_av_int, self.work_fluid.c_p_av_int
Ejemplo n.º 2
0
 def test_outlet(self):
     for T_stag_in in self.T_stag_in_outlet:
         for G_in in self.G_in_outlet:
             for dif in self.dif_outlet:
                 print('T_stag_in = %.1f, G_in = %.3f, dif = %.3f' %
                       (T_stag_in, G_in, dif))
                 p_stag_in = 1.2e5
                 work_fluid = NaturalGasCombustionProducts()
                 G_fuel = 0.1
                 alpha = 1 / (work_fluid.l0 * G_fuel / (G_in - G_fuel))
                 c_p = work_fluid.c_p_real_func(T_stag_in, alpha=alpha)
                 k = work_fluid.k_func(c_p)
                 F_in = 0.25
                 q = G_in * np.sqrt(work_fluid.R * T_stag_in) / (
                     F_in * p_stag_in * gd.m(k))
                 lam = gd.lam(k, q=q)
                 a_cr = gd.a_cr(T_stag_in, k, work_fluid.R)
                 c_in = a_cr * lam
                 outlet = OutletModel(T_stag_in=T_stag_in,
                                      p_stag_in=1.2e5,
                                      G_in=G_in,
                                      G_fuel_in=G_fuel,
                                      c_in=c_in,
                                      F_in=F_in,
                                      F_out=F_in * dif,
                                      sigma=0.99)
                 outlet.compute()
                 G_in = outlet.rho_in * outlet.F_in * outlet.c_in
                 G_out = outlet.rho_out * outlet.F_out * outlet.c_out
                 G_res = abs(G_out - G_in) / G_in
                 self.assertAlmostEqual(G_res, 0, places=3)
Ejemplo n.º 3
0
 def get_static(cls, c, T_stag, p_stag, k, R):
     a_cr = gd.a_cr(T_stag, k, R)
     lam = c / a_cr
     tau = gd.tau_lam(lam, k)
     pi = gd.pi_lam(lam, k)
     T = T_stag * tau
     p = p_stag * pi
     rho = p / (R * T)
     return T, p, rho, lam, a_cr, tau, pi
Ejemplo n.º 4
0
 def compute(self):
     super(OutletTurbineModel, self).compute()
     self.c_p_out = self.work_fluid.c_p_real_func(self.T_stag_out,
                                                  alpha=self.alpha)
     self.k_out = self.work_fluid.k_func(self.c_p_out)
     self.q_out = self.G_out * np.sqrt(
         self.work_fluid.R * self.T_stag_out) / (
             gd.m(self.k_out) * self.F_out * self.p_stag_out)
     self.lam_out = gd.lam(self.k_out, q=self.q_out)
     self.a_cr_out = gd.a_cr(self.T_stag_out, self.k_out, self.work_fluid.R)
     self.c_out = self.lam_out * self.a_cr_out
Ejemplo n.º 5
0
 def test_outlet_turbine(self):
     self.turb_model.compute()
     q_out = gd.q(self.turb_model.lam_out, self.turb_model.k_out)
     G_out = q_out * gd.m(
         self.turb_model.k_out
     ) * self.turb_model.F_out * self.turb_model.p_stag_out / np.sqrt(
         self.turb_model.work_fluid.R * self.turb_model.T_stag_out)
     G_res = abs(self.turb_model.G_out - G_out) / self.turb_model.G_out
     self.assertAlmostEqual(G_res, 0, places=3)
     c_out_res = abs(self.turbine.last.c2_a -
                     self.turb_model.c_out) / self.turbine.last.c2_a
     self.assertAlmostEqual(c_out_res, 0, places=1)
     L_res = abs(self.turbine.L_t_sum -
                 abs(self.turb_model.L)) / self.turbine.L_t_sum
     self.assertAlmostEqual(L_res, 0, places=2)
     H_res = abs(self.turbine.H_t_stag -
                 abs(self.turb_model.H_stag)) / self.turbine.H_t_stag
     self.assertAlmostEqual(H_res, 0, places=2)
Ejemplo n.º 6
0
 def compute(self):
     self.delta_L_p_interp, self.frequency_interp = self._get_delta_L_p_and_frequency()
     self.pi1 = gd.pi_lam(self.lam1, self.k)
     self.p1 = self.p1_stag * self.pi1
     self.rho1 = self.p1 / (self.R * self.T1)
     self.P = (0.5 * ((1 - self.eta_ad_stag) / self.eta_ad_stag)**2 * self.G**2 * self.H_ad**2 /
               (self.rho1 * self.a1**3 * self.D1_out**2))
     self._L_p_sum = 10 * np.log10(self.P / self.P0)
     self.delta_L_p = interp1d(np.log10(self.frequency_interp), self.delta_L_p_interp,
                               bounds_error=False, fill_value='extrapolate')(np.log10(self.octaves.octave_centers))
     self._L_p = self.L_p_sum - self.delta_L_p
Ejemplo n.º 7
0
 def _compute_integrate_parameters(self):
     self.work_fluid.__init__()
     self.work_fluid.T1 = self.first.T1_stag
     self.work_fluid.T2 = self.last.T3_stag
     self.k_av = self.work_fluid.k_av_int
     self.c_p_av = self.work_fluid.c_p_av_int
     self.pi_la_stag = self.last.p3_stag / self.first.p1_stag
     self.eta_la_stag = self.T0_stag * (self.pi_la_stag ** ((self.k_av - 1) / self.k_av) - 1) / \
                        (self.last.T3_stag - self.first.T1_stag)
     self.sigma_outlet = self._get_sigma_outlet(
         self.last.k_av, gd.eps_lam(self.last.lam3, self.last.k_av),
         self.last.lam3)
     self.pi_c_stag = self.pi_la_stag * self.sigma_inlet * self.sigma_outlet
     self.eta_c_stag = self.T0_stag * (self.pi_c_stag ** ((self.k_av - 1) / self.k_av) - 1) / \
                       (self.last.T3_stag - self.first.T1_stag)
     self.eta_c_stag_p = eta_comp_stag_p(self.pi_c_stag, self.k_av,
                                         self.eta_c_stag)
     self.length = sum([i.geom.length for i in self])
Ejemplo n.º 8
0
 def _get_outlet_section_params(self, alpha3, u3_out):
     self.c3_a = u3_out * self.c3_a_rel
     self.lam3 = self.c3_a / (np.sin(alpha3) * self.a_cr3)
     self.q3 = gd.q(self.lam3, self.k_av)
     self.geom.F3 = self.geom.F1 * (self.q1 * self.p1_stag * np.sin(self.alpha1)) / \
                    (self.q3 * self.p3_stag * np.sin(alpha3)) * np.sqrt(self.T3_stag / self.T1_stag)
     self.geom.d3_in_rel = self.geom.get_d_in_rel(self.geom.F3,
                                                  self.geom.const_diam_par,
                                                  self.geom.D_const)
     self.geom.r3_av_rel = ((1 + self.geom.d3_in_rel**2) / 2)**0.5
     self.c3_u_rel = self.geom.r3_av_rel * (
         1 - self.R_av_next) - self.H_t_rel_next / (2 * self.geom.r3_av_rel)
     if self.c3_u_rel != 0:
         alpha3_new = np.arctan(self.c3_a_rel / self.c3_u_rel)
     else:
         alpha3_new = np.arctan(np.inf)
     self.geom.D3_out = self.geom.get_D_out(self.geom.F3,
                                            self.geom.d3_in_rel)
     self.geom.D3_in = self.geom.D3_out * self.geom.d3_in_rel
     u3_out_new = np.pi * self.geom.D3_out * self.n / 60
     res = max(
         abs(alpha3 - alpha3_new) / alpha3,
         abs(u3_out - u3_out_new) / u3_out)
     return alpha3_new, u3_out_new, res
Ejemplo n.º 9
0
 def _compute_gas_dynamics(self):
     self.c_p_av = self.k_av * self.R_gas / (self.k_av - 1)
     self.c1_a = self.u1_out * self.c1_a_rel
     self.H_t = self.H_t_rel * self.u1_out**2
     self.L_z = self.k_h * self.H_t
     self.H_ad = self.L_z * self.eta_ad_stag
     self.delta_T_stag = self.L_z / self.c_p_av
     self.T3_stag = self.T1_stag + self.delta_T_stag
     self.pi_stag = (1 + self.H_ad /
                     (self.c_p_av * self.T1_stag))**(self.k_av /
                                                     (self.k_av - 1))
     self.p3_stag = self.p1_stag * self.pi_stag
     self.a_cr1 = gd.a_cr(self.T1_stag, self.k_av, self.R_gas)
     self.a_cr3 = gd.a_cr(self.T3_stag, self.k_av, self.R_gas)
     self.geom.r1_av_rel = ((1 + self.geom.d1_in_rel**2) / 2)**0.5
     self.c1_u_rel = self.geom.r1_av_rel * (
         1 - self.R_av) - self.H_t_rel / (2 * self.geom.r1_av_rel)
     self.c1_u = self.c1_u_rel * self.u1_out
     self.c1 = np.sqrt(self.c1_u**2 + self.c1_a**2)
     self.alpha1 = np.arctan(self.c1_a_rel / self.c1_u_rel)
     self.lam1 = self.c1_a / (np.sin(self.alpha1) * self.a_cr1)
     self.q1 = gd.q(self.lam1, self.k_av)
     self.geom.F1 = self.G * (self.R_gas * self.T1_stag)**0.5 / (
         gd.m(self.k_av) * self.p1_stag * self.q1 * np.sin(self.alpha1))
     self.geom.D1_out = self.geom.get_D_out(self.geom.F1,
                                            self.geom.d1_in_rel)
     self.geom.D1_in = self.geom.d1_in_rel * self.geom.D1_out
     self.geom.D_const = self.geom.get_D_const(self.geom.d1_in_rel,
                                               self.geom.const_diam_par,
                                               self.geom.D1_out)
     self.alpha3 = self.alpha1
     self.u3_out = self.u1_out
     self.outlet_geom_res = 1
     while self.outlet_geom_res >= self.precision:
         self.alpha3_old = self.alpha3
         self.u3_out_old = self.u3_out
         self.alpha3, self.u3_out, self.outlet_geom_res = self._get_outlet_section_params(
             self.alpha3_old, self.u3_out_old)
     self.c3_u = self.c3_u_rel * self.u3_out
     self.c3 = np.sqrt(self.c3_a + self.c3_u)
     self.geom.r2_av_rel = 0.5 * (self.geom.r1_av_rel + self.geom.r3_av_rel)
     self.c2_u_rel = (self.H_t_rel + self.c1_u_rel *
                      self.geom.r1_av_rel) / self.geom.r2_av_rel
     self.c2_a = 0.5 * (self.c1_a + self.c3_a)
     self.u2_out = 0.5 * (self.u1_out + self.u3_out)
     self.c2_a_rel = self.c2_a / self.u2_out
     self.beta1 = np.arctan(self.c1_a_rel /
                            (self.geom.r1_av_rel - self.c1_u_rel))
     self.beta2 = np.arctan(self.c2_a_rel /
                            (self.geom.r2_av_rel - self.c2_u_rel))
     self.alpha2 = np.arctan(self.c2_a_rel / self.c2_u_rel)
     self.epsilon_rk = self.beta2 - self.beta1
     self.epsilon_na = self.alpha3 - self.alpha2
     self.w1 = self.c1_a / np.sin(self.beta1)
     self.w2 = self.c2_a / np.sin(self.beta2)
     self.w1_u = self.w1 * np.cos(self.beta1)
     self.w2_u = self.w2 * np.cos(self.beta2)
     self.c2 = self.c2_a / np.sin(self.alpha2)
     self.c2_u = self.c2_u_rel * self.u2_out
     self.tau1 = gd.tau_lam(self.lam1, self.k_av)
     self.T1 = self.T1_stag * self.tau1
     self.a1 = np.sqrt(self.k_av * self.R_gas * self.T1)
     self.M_w1_av = self.w1 / self.a1
     self.a_cr2 = self.a_cr3
     self.lam2 = self.c2 / self.a_cr2
     self.tau2 = gd.tau_lam(self.lam2, self.k_av)
     self.T2 = self.T3_stag * self.tau2
     self.a2 = np.sqrt(self.k_av * self.R_gas * self.T2)
     self.M_c2_av = self.c2 / self.a2
Ejemplo n.º 10
0
 def p2_stag(self, r):
     return self.p2(r) / GasDynamicFunctions.pi_lam(
         self.c2(r) /
         GasDynamicFunctions.a_cr(self.T2_stag(r), self.k, self.R), self.k)
Ejemplo n.º 11
0
 def p2_w_stag(self, r):
     return self.p2(r) / GasDynamicFunctions.pi_lam(self.lam_w2(r), self.k)