コード例 #1
0
ファイル: meteor.py プロジェクト: sesquideus/asmodeus
    def evaluate(self, state, diff, dt):
        new_state = State(
            state.position + diff.drdt * dt,
            state.velocity + diff.dvdt * dt,
            state.log_mass + diff.dmdt * dt,
        )
        if new_state.log_mass < -100:
            raise OverflowError

        coordinates = new_state.position.to_WGS84()
        air_density = atmosphere.air_density(coordinates.alt)
        speed = new_state.velocity.norm()
        reynolds = atmosphere.Reynolds_number(self.radius, new_state.velocity.norm(), air_density / constants.AIR_VISCOSITY)
        gamma = 1 #atmosphere.drag_coefficient_smooth_sphere(reynolds)

        drag_vector = -(gamma * self.shape_factor * air_density * speed / (np.exp(new_state.log_mass / 3) * self.density**(2 / 3))) * new_state.velocity
        gravity_vector = -constants.GRAVITATIONAL_CONSTANT * constants.EARTH_MASS / new_state.position.norm()**3 * new_state.position
        coriolis_vector = -2 * EARTH_ROTATION ^ new_state.velocity
        huygens_vector = -EARTH_ROTATION ^ (EARTH_ROTATION ^ new_state.position)
        log_mass_change = -(self.heat_transfer * self.shape_factor * air_density * speed**3 * np.exp(-new_state.log_mass / 3) * self.density**(-2 / 3) / (2 * self.ablation_heat))

        return Diff(
            new_state.velocity,
            drag_vector + gravity_vector + coriolis_vector + huygens_vector,
            log_mass_change,
        )
コード例 #2
0
ファイル: meteor.py プロジェクト: sesquideus/asmodeus
    def save_snapshot(self, state, *, wgs84):
        coordinates = self.position.to_WGS84() if wgs84 else self.position.to_spherical()

        speed = self.velocity.norm()
        self.air_density = atmosphere.air_density(coordinates.alt)
        self.velocity_altaz = self.velocity.dxdydz_to_altaz_at(self.position)
        self.mass = np.exp(self.log_mass)
        self.radius = ((3 * self.mass) / (4 * np.pi * self.density))**(1 / 3)

        self.reynolds_number = atmosphere.Reynolds_number(2 * self.radius, speed, self.air_density)
        self.gamma = atmosphere.drag_coefficient_smooth_sphere(self.reynolds_number)
        self.dynamic_pressure = self.air_density * speed**2
        self.acceleration = state.dvdt.norm()
        self.mass_change = self.mass * state.dmdt

        self.luminous_power = -(radiometry.luminous_efficiency(speed) * self.mass_change * speed**2 / 2.0)
        self.absolute_magnitude = radiometry.absolute_magnitude(self.luminous_power)

        self.frames.append(models.frame.Frame(self))
コード例 #3
0
ファイル: test.py プロジェクト: sesquideus/asmodeus
 def testDensity10km(self):
     self.assertAlmostEqual(atmosphere.air_density(10000), 0.42, delta=0.01)
コード例 #4
0
ファイル: test.py プロジェクト: sesquideus/asmodeus
 def testDensityTooHigh(self):
     self.assertEqual(atmosphere.air_density(600000), 0)