uncscode / particula

a simple, fast, and powerful particle simulator
https://uncscode.github.io/particula
MIT License
6 stars 9 forks source link

Edge case test of aerodynamic convert #481

Open Gorkowski opened 1 month ago

Gorkowski commented 1 month ago

suggestion (testing): Add test cases for extreme values in aerodynamic_to_physical_radius conversion

Consider adding test cases for extreme values (very small and very large) to ensure the conversion function handles these cases correctly. This would improve the robustness of the test.

def test_convert_aerodynamic_to_physical_radius(): """Test the conversion from aerodynamic to physical radius.""" aerodynamic_radii = np.array([1e-9, 1e-6, 1e-3]) # m pressure = 101325.0 temperature = 298.0 particle_density = 2000.0 aerodynamic_shape_factor = 1.3 reference_density = 1000.0

physical_radii = convert_aerodynamic_to_physical_radius(
    aerodynamic_radii, pressure, temperature, particle_density,
    aerodynamic_shape_factor, reference_density
)

expected_physical_radii = np.array([7.98497748e-10, 7.98497748e-07, 7.98497748e-04])
assert np.allclose(physical_radii, expected_physical_radii, rtol=1e-6)