# Path: ht/core.py
# def wall_factor(mu=None, mu_wall=None, Pr=None, Pr_wall=None, T=None,
#                 T_wall=None, mu_heating_coeff=0.11, mu_cooling_coeff=0.25,
#                 Pr_heating_coeff=0.11, Pr_cooling_coeff=0.25,
#                 T_heating_coeff=0.11, T_cooling_coeff=0.25,
#                 property_option=WALL_FACTOR_PRANDTL):
#     r'''Computes the wall correction factor for heat transfer, mass transfer,
#     or momentum transfer between a fluid and a wall. Utility function; the
#     coefficients for the phenomenon must be provided to this method. The
#     default coefficients are for heat transfer of a turbulent liquid.
# 
#     The general formula is as follows; substitute the property desired and
#     the phenomenon desired into the equation for things other than heat
#     transfer.
# 
#     .. math::
#         \frac{Nu}{Nu_{\text{constant properties}}}
#         = \left(\frac{\mu}{\mu_{wall}}\right)^n
# 
#     Parameters
#     ----------
#     mu : float, optional
#         Viscosity of flowing fluid away from the surface, [Pa*s]
#     mu_wall : float, optional
#         Viscosity of the fluid at the wall, [Pa*s]
#     Pr : float, optional
#         Prandtl number of flowing fluid away from the surface, [-]
#     Pr_wall : float, optional
#         Prandtl number of the fluid at the wall, [-]
#     T : float, optional
#         Temperature of flowing fluid away from the surface, [K]
#     T_wall : float, optional
#         Temperature of the fluid at the wall, [K]
#     mu_heating_coeff : float, optional
#         Coefficient for viscosity - surface providing heating, [-]
#     mu_cooling_coeff : float, optional
#         Coefficient for viscosity - surface providing cooling, [-]
#     Pr_heating_coeff : float, optional
#         Coefficient for Prandtl number - surface providing heating, [-]
#     Pr_cooling_coeff : float, optional
#         Coefficient for Prandtl number - surface providing cooling, [-]
#     T_heating_coeff : float, optional
#         Coefficient for temperature - surface providing heating, [-]
#     T_cooling_coeff : float, optional
#         Coefficient for temperature - surface providing cooling, [-]
#     property_option : str, optional
#         Which property to use for computing the correction factor; one of
#         'Viscosity', 'Prandtl', or 'Temperature'.
# 
#     Returns
#     -------
#     factor : float
#         Correction factor for heat transfer; to be multiplied by the Nusselt
#         number or heat transfer coefficient or friction factor or pressure drop
#         to obtain the actual result, [-]
# 
#     Examples
#     --------
#     >>> wall_factor(mu=8E-4, mu_wall=3E-4, Pr=1.2, Pr_wall=1.1, T=300,
#     ... T_wall=350, property_option='Prandtl')
#     1.0096172023817749
#     '''
#     if property_option == WALL_FACTOR_DEFAULT:
#         property_option = WALL_FACTOR_PRANDTL
#     if property_option == WALL_FACTOR_VISCOSITY:
#         if mu is None or mu_wall is None:
#             raise TypeError('Viscosity wall correction specified but both '
#                             'viscosity values are not available.')
#         heating = is_heating_property(mu, mu_wall)
#         if heating:
#             return (mu/mu_wall)**mu_heating_coeff
#         else:
#             return (mu/mu_wall)**mu_cooling_coeff
#     elif property_option == WALL_FACTOR_TEMPERATURE:
#         if T is None or T_wall is None:
#             raise TypeError('Temperature wall correction specified but both '
#                             'temperature values are not available.')
#         heating = is_heating_temperature(T, T_wall)
#         if heating:
#             return (T/T_wall)**T_heating_coeff
#         else:
#             return (T/T_wall)**T_cooling_coeff
#     elif property_option == WALL_FACTOR_PRANDTL:
#         if Pr is None or Pr_wall is None:
#             raise TypeError('Prandtl number wall correction specified but both'
#                             ' Prandtl number values are not available.')
#         heating = is_heating_property(Pr, Pr_wall)
#         if heating:
#             return (Pr/Pr_wall)**Pr_heating_coeff
#         else:
#             return (Pr/Pr_wall)**Pr_cooling_coeff
#     else:
#         raise ValueError(wall_factor_bad_option_msg)
# 
# WALL_FACTOR_PRANDTL = 'Prandtl'


from math import pi, sin, acos, radians, exp
from fluids.constants import g
from fluids.numerics import horner, splev, bisplev, implementation_optimize_tck, tck_interp2d_linear, numpy as np
from ht.core import wall_factor, WALL_FACTOR_PRANDTL
    from scipy.interpolate import RectBivariateSpline
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.'''

from __future__ import division

__all__ = ['dP_Kern', 'dP_Zukauskas',
           'Nu_ESDU_73031', 'Nu_Zukauskas_Bejan','Nu_HEDH_tube_bank',
           'Nu_Grimison_tube_bank',
           'Zukauskas_tube_row_correction',
           'ESDU_tube_row_correction',
           'ESDU_tube_angle_correction',
	   'baffle_correction_Bell', 'baffle_leakage_Bell',
           'bundle_bypassing_Bell', 'unequal_baffle_spacing_Bell',
           'laminar_correction_Bell']

__numba_additional_funcs__ = ['Grimison_C1_aligned_interp', 'Grimison_m_aligned_interp',
                              'Grimson_C1_staggered_interp', 'Grimson_m_staggered_interp',
                              'Kern_f_Re', 'Bell_baffle_configuration_obj', 'Bell_baffle_leakage_obj',
                              'Bell_bundle_bypass_low_obj', 'Bell_bundle_bypass_high_obj']

try:
    IS_NUMBA
except:
    IS_NUMBA = False
# Applies for row 1-9.
Grimson_Nl_aligned = [0.64, 0.8, 0.87, 0.9, 0.92, 0.94, 0.96, 0.98, 0.99]
Grimson_Nl_staggered = [0.68, 0.75, 0.83, 0.89, 0.92, 0.95, 0.97, 0.98, 0.99]



# Path: ht/core.py
# def wall_factor(mu=None, mu_wall=None, Pr=None, Pr_wall=None, T=None,
#                 T_wall=None, mu_heating_coeff=0.11, mu_cooling_coeff=0.25,
#                 Pr_heating_coeff=0.11, Pr_cooling_coeff=0.25,
#                 T_heating_coeff=0.11, T_cooling_coeff=0.25,
#                 property_option=WALL_FACTOR_PRANDTL):
#     r'''Computes the wall correction factor for heat transfer, mass transfer,
#     or momentum transfer between a fluid and a wall. Utility function; the
#     coefficients for the phenomenon must be provided to this method. The
#     default coefficients are for heat transfer of a turbulent liquid.
# 
#     The general formula is as follows; substitute the property desired and
#     the phenomenon desired into the equation for things other than heat
#     transfer.
# 
#     .. math::
#         \frac{Nu}{Nu_{\text{constant properties}}}
#         = \left(\frac{\mu}{\mu_{wall}}\right)^n
# 
#     Parameters
#     ----------
#     mu : float, optional
#         Viscosity of flowing fluid away from the surface, [Pa*s]
#     mu_wall : float, optional
#         Viscosity of the fluid at the wall, [Pa*s]
#     Pr : float, optional
#         Prandtl number of flowing fluid away from the surface, [-]
#     Pr_wall : float, optional
#         Prandtl number of the fluid at the wall, [-]
#     T : float, optional
#         Temperature of flowing fluid away from the surface, [K]
#     T_wall : float, optional
#         Temperature of the fluid at the wall, [K]
#     mu_heating_coeff : float, optional
#         Coefficient for viscosity - surface providing heating, [-]
#     mu_cooling_coeff : float, optional
#         Coefficient for viscosity - surface providing cooling, [-]
#     Pr_heating_coeff : float, optional
#         Coefficient for Prandtl number - surface providing heating, [-]
#     Pr_cooling_coeff : float, optional
#         Coefficient for Prandtl number - surface providing cooling, [-]
#     T_heating_coeff : float, optional
#         Coefficient for temperature - surface providing heating, [-]
#     T_cooling_coeff : float, optional
#         Coefficient for temperature - surface providing cooling, [-]
#     property_option : str, optional
#         Which property to use for computing the correction factor; one of
#         'Viscosity', 'Prandtl', or 'Temperature'.
# 
#     Returns
#     -------
#     factor : float
#         Correction factor for heat transfer; to be multiplied by the Nusselt
#         number or heat transfer coefficient or friction factor or pressure drop
#         to obtain the actual result, [-]
# 
#     Examples
#     --------
#     >>> wall_factor(mu=8E-4, mu_wall=3E-4, Pr=1.2, Pr_wall=1.1, T=300,
#     ... T_wall=350, property_option='Prandtl')
#     1.0096172023817749
#     '''
#     if property_option == WALL_FACTOR_DEFAULT:
#         property_option = WALL_FACTOR_PRANDTL
#     if property_option == WALL_FACTOR_VISCOSITY:
#         if mu is None or mu_wall is None:
#             raise TypeError('Viscosity wall correction specified but both '
#                             'viscosity values are not available.')
#         heating = is_heating_property(mu, mu_wall)
#         if heating:
#             return (mu/mu_wall)**mu_heating_coeff
#         else:
#             return (mu/mu_wall)**mu_cooling_coeff
#     elif property_option == WALL_FACTOR_TEMPERATURE:
#         if T is None or T_wall is None:
#             raise TypeError('Temperature wall correction specified but both '
#                             'temperature values are not available.')
#         heating = is_heating_temperature(T, T_wall)
#         if heating:
#             return (T/T_wall)**T_heating_coeff
#         else:
#             return (T/T_wall)**T_cooling_coeff
#     elif property_option == WALL_FACTOR_PRANDTL:
#         if Pr is None or Pr_wall is None:
#             raise TypeError('Prandtl number wall correction specified but both'
#                             ' Prandtl number values are not available.')
#         heating = is_heating_property(Pr, Pr_wall)
#         if heating:
#             return (Pr/Pr_wall)**Pr_heating_coeff
#         else:
#             return (Pr/Pr_wall)**Pr_cooling_coeff
#     else:
#         raise ValueError(wall_factor_bad_option_msg)
# 
# WALL_FACTOR_PRANDTL = 'Prandtl'


# Path: ht/conv_tube_bank.py
from math import pi, sin, acos, radians, exp
from fluids.constants import g
from fluids.numerics import horner, splev, bisplev, implementation_optimize_tck, tck_interp2d_linear, numpy as np
from ht.core import wall_factor, WALL_FACTOR_PRANDTL
    from scipy.interpolate import RectBivariateSpline

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.'''

from __future__ import division

__all__ = ['dP_Kern', 'dP_Zukauskas',
           'Nu_ESDU_73031', 'Nu_Zukauskas_Bejan','Nu_HEDH_tube_bank',
           'Nu_Grimison_tube_bank',
           'Zukauskas_tube_row_correction',
           'ESDU_tube_row_correction',
           'ESDU_tube_angle_correction',
	   'baffle_correction_Bell', 'baffle_leakage_Bell',
           'bundle_bypassing_Bell', 'unequal_baffle_spacing_Bell',
           'laminar_correction_Bell']

__numba_additional_funcs__ = ['Grimison_C1_aligned_interp', 'Grimison_m_aligned_interp',
                              'Grimson_C1_staggered_interp', 'Grimson_m_staggered_interp',
                              'Kern_f_Re', 'Bell_baffle_configuration_obj', 'Bell_baffle_leakage_obj',
                              'Bell_bundle_bypass_low_obj', 'Bell_bundle_bypass_high_obj']

try:
    IS_NUMBA
except:
    IS_NUMBA = False
# Applies for row 1-9.
Grimson_Nl_aligned = [0.64, 0.8, 0.87, 0.9, 0.92, 0.94, 0.96, 0.98, 0.99]
Grimson_Nl_staggered = [0.68, 0.75, 0.83, 0.89, 0.92, 0.95, 0.97, 0.98, 0.99]



Grimison_SL_aligned = [1.25, 1.5, 2, 3]