Esempio n. 1
0
    def test_sweep(self):
        """tests FLFACT sweeps"""
        mach = 0.8
        alts = np.linspace(-10000, 80000.)
        rho, mach, vel = make_flfacts_alt_sweep(mach,
                                                alts,
                                                eas_limit=300.,
                                                alt_units='m',
                                                velocity_units='m/s',
                                                density_units='kg/m^3',
                                                eas_units='m/s')
        del rho, mach, vel, alts

        alt = 10000.
        machs = np.linspace(0., 0.8)
        rho, mach, vel = make_flfacts_mach_sweep(alt,
                                                 machs,
                                                 eas_limit=300.,
                                                 alt_units='m',
                                                 velocity_units='m/s',
                                                 density_units='kg/m^3',
                                                 eas_units='m/s')
        del rho, mach, vel, alt

        alt = 0.
        machs = np.linspace(0.6, 0.8)
        with self.assertRaises(RuntimeError):
            rho, mach, vel = make_flfacts_mach_sweep(alt,
                                                     machs,
                                                     eas_limit=100.,
                                                     alt_units='m',
                                                     velocity_units='m/s',
                                                     density_units='kg/m^3',
                                                     eas_units='m/s')
        del alt

        alt = 10000.
        eass = np.linspace(0., 300.)
        rho, mach, vel = make_flfacts_eas_sweep(alt,
                                                eass,
                                                alt_units='m',
                                                velocity_units='m/s',
                                                density_units='kg/m^3',
                                                eas_units='m/s')
        del rho, mach, vel, alt
Esempio n. 2
0
    def make_flfacts_mach_sweep(self,
                                model,
                                alt,
                                machs,
                                eas_limit=1000.,
                                alt_units='m',
                                velocity_units='m/s',
                                density_units='kg/m^3',
                                eas_units='m/s'):
        """makes a mach sweep"""
        machs.sort()
        machs = machs[::-1]
        rho, mach, velocity = make_flfacts_mach_sweep(
            alt,
            machs,
            eas_limit=eas_limit,
            alt_units=alt_units,
            velocity_units=velocity_units,
            density_units=density_units,
            eas_units=eas_units)

        machs2 = machs[:len(rho)]
        assert len(rho) == len(machs2)

        flfact_rho = self.sid + 1
        flfact_mach = self.sid + 2
        flfact_velocity = self.sid + 3
        flfact_eas = self.sid + 4

        comment = ' density: min=%.3e max=%.3e %s; alt %.0f %s' % (
            rho.min(),
            rho.max(),
            density_units,
            alt,
            alt_units,
        )
        model.add_flfact(flfact_rho, rho, comment=comment)
        comment = ' Mach: min=%s max=%s' % (mach.min(), mach.max())
        model.add_flfact(flfact_mach, mach, comment=comment)
        comment = ' velocity: min=%.3f max=%.3f %s' % (
            velocity.min(), velocity.max(), velocity_units)
        model.add_flfact(flfact_velocity, velocity, comment=comment)

        # eas in velocity units
        rho0 = atm_density(0.,
                           alt_units=alt_units,
                           density_units=density_units)
        eas = velocity * np.sqrt(rho / rho0)
        kvel = _velocity_factor(velocity_units, eas_units)

        eas_in_eas_units = eas * kvel
        comment = ' EAS: min=%.3f max=%.3f %s' % (
            eas_in_eas_units.min(), eas_in_eas_units.max(), eas_units)
        model.add_flfact(flfact_eas, eas_in_eas_units, comment=comment)
Esempio n. 3
0
    def test_sweep(self):
        """tests FLFACT sweeps"""
        mach = 0.8
        alts = np.linspace(-10000, 80000.)
        rho, mach, vel = make_flfacts_alt_sweep(
            mach, alts, eas_limit=300., alt_units='m',
            velocity_units='m/s',
            density_units='kg/m^3',
            eas_units='m/s')
        del rho, mach, vel, alts

        alt = 10000.
        machs = np.linspace(0., 0.8)
        rho, mach, vel = make_flfacts_mach_sweep(
            alt, machs, eas_limit=300.,
            alt_units='m',
            velocity_units='m/s',
            density_units='kg/m^3',
            eas_units='m/s')
        del rho, mach, vel, alt