# Path: proptools/solid.py
# def chamber_pressure(K, a, n, rho_solid, c_star):
# def burn_area_ratio(p_c, a, n, rho_solid, c_star):
# def burn_and_throat_area(F, p_c, p_e, a, n, rho_solid, c_star, gamma):
# def thrust_curve(A_b, x, A_t, A_e, p_a, a, n, rho_solid, c_star, gamma):
#     C_F = nozzle.thrust_coef(p_c, p_e, gamma)
#     F = nozzle.thrust(A_t, p_c, p_e, gamma, p_a, A_e / A_t)


import unittest
import numpy as np
from proptools import solid
"""Unit tests for solid rocket motor equations."""


class TestBurnAreaRatio(unittest.TestCase):
    """Unit tests for solid.burn_area_ratio."""

    def test_ex_12_3(self):
        """Test against example problem 12-3 from Rocket Propulsion Elements."""
        gamma = 1.26    # Given ratio of specific heats [units: dimensionless].
        rho_solid = 1510.    # Given solid propellant density [units: kilogram meter**-3].
        p_c = 6.895e6    # Given chamber pressure [units: pascal].
        n = 0.5    # Burn rate exponent, guess
        a = 2.54e-3 * (p_c)**(-n)    # Burn rate coefficient, from given burn rate of
        # 0.1 inch second**-1 at 1000 psi [units: meter second**-1 pascal**-n].
        c_star = 1209.    # Given characteristic velocity [units: meter second**-1].
        K_RPE = 1933. / 1.30    # Given burn area ratio [units: dimensionless].


# Path: proptools/solid.py
# def chamber_pressure(K, a, n, rho_solid, c_star):
# def burn_area_ratio(p_c, a, n, rho_solid, c_star):
# def burn_and_throat_area(F, p_c, p_e, a, n, rho_solid, c_star, gamma):
# def thrust_curve(A_b, x, A_t, A_e, p_a, a, n, rho_solid, c_star, gamma):
#     C_F = nozzle.thrust_coef(p_c, p_e, gamma)
#     F = nozzle.thrust(A_t, p_c, p_e, gamma, p_a, A_e / A_t)


# Path: proptools/solid_test.py
import unittest
import numpy as np
from proptools import solid

"""Unit tests for solid rocket motor equations."""


class TestBurnAreaRatio(unittest.TestCase):
    """Unit tests for solid.burn_area_ratio."""

    def test_ex_12_3(self):
        """Test against example problem 12-3 from Rocket Propulsion Elements."""
        gamma = 1.26    # Given ratio of specific heats [units: dimensionless].
        rho_solid = 1510.    # Given solid propellant density [units: kilogram meter**-3].
        p_c = 6.895e6    # Given chamber pressure [units: pascal].
        n = 0.5    # Burn rate exponent, guess
        a = 2.54e-3 * (p_c)**(-n)    # Burn rate coefficient, from given burn rate of
        # 0.1 inch second**-1 at 1000 psi [units: meter second**-1 pascal**-n].
        c_star = 1209.    # Given characteristic velocity [units: meter second**-1].
        K_RPE = 1933. / 1.30    # Given burn area ratio [units: dimensionless].


        K = solid.burn_area_ratio(p_c, a, n, rho_solid, c_star)