Exemplo n.º 1
0
class Mass(Chainable):
    def __init__(self, **kwargs):
        super(Mass, self).__init__(**kwargs)

        self.set_guard('mass', ureg.kg)
        self.link_attr('mass', core.mul, density='density', volume='volume')

        self.set_guard('density', ureg.kg / ureg.m**3)
        self.link_attr('density', core.reciprocal, value='specific_volume')
        self.link_attr('density',
                       density.from_specific_weight,
                       specific_weight='specific_weight')

        self.set_guard('specific_volume', ureg.m**3 / ureg.kg)
        self.link_attr('specific_volume', core.reciprocal, value='density')

        self.set_guard('specific_weight', ureg.N / ureg.m**3)

    mass = Guarded()

    density = Guarded()

    specific_volume = Guarded()

    specific_weight = Guarded()
Exemplo n.º 2
0
class Viscosity(Chainable):
    def __init__(self, **kwargs):
        super(Viscosity, self).__init__(**kwargs)

        self.set_guard('viscosity_dynamic', ureg.Pa * ureg.s)
        self.link_attr('viscosity_dynamic', core.mul, viscosity_kinematic='viscosity_kinematic', density='density')

        self.set_guard('viscosity_kinematic', ureg.m ** 2 / ureg.s)
        self.link_attr('viscosity_kinematic', core.div, viscosity_dynamic='viscosity_dynamic', density='density')

    viscosity_dynamic = Guarded()

    viscosity_kinematic = Guarded()
Exemplo n.º 3
0
class Surface(Chainable):
    def __init__(self, **kwargs):
        super(Surface, self).__init__(**kwargs)

        self.set_guard('cross_section', ureg.m**2)

    cross_section = Guarded()
Exemplo n.º 4
0
class Shearing(Chainable):
    def __init__(self, **kwargs):
        super(Shearing, self).__init__(**kwargs)

        self.set_guard('shear_rate', ureg.s**-1)

    shear_rate = Guarded()
Exemplo n.º 5
0
class Vector(Chainable):
    def __init__(self, **kwargs):
        super(Vector, self).__init__(**kwargs)

        self.set_guard('coordinate', ureg.m)

    coordinate = Guarded()
Exemplo n.º 6
0
class Segment(Chainable):
    def __init__(self, **kwargs):
        super(Segment, self).__init__(**kwargs)

        self.set_guard('point_1', ureg.m)
        self.set_guard('point_2', ureg.m)
        self.set_guard('distance', ureg.m)
        self.link_attr('distance',
                       geometry.distance,
                       point_1='point_1',
                       point_2='point_2')

    point_1 = Guarded()

    point_2 = Guarded()

    distance = Guarded()
Exemplo n.º 7
0
class Pressure(Chainable):
    r"""
    Pressure
    """
    def __init__(self, **kwargs):
        super(Pressure, self).__init__(**kwargs)

        self.set_guard('pressure', ureg.Pa, [0., inf])

    pressure = Guarded()
Exemplo n.º 8
0
class ThermalConductivity(Chainable):
    def __init__(self, **kwargs):
        super(ThermalConductivity, self).__init__(**kwargs)

        self.set_guard('thermal_conductivity', ureg.W / (ureg.m * ureg.K))
        self.link_attr('thermal_conductivity', core.reciprocal, value='thermal_conductivity')

        self.set_guard('thermal_resistivity', ureg.m * ureg.K / ureg.W)
        self.link_attr('thermal_resistivity', core.reciprocal, value='thermal_conductivity')

        self.set_guard('thermal_conductance', ureg.W / ureg.K)
        self.link_attr('thermal_conductance', core.reciprocal, value='thermal_resistance')

        self.set_guard('thermal_resistance', ureg.K / ureg.W)
        self.link_attr('thermal_resistance', core.reciprocal, value='thermal_conductance')

        self.set_guard('heat_transfer_coeff', ureg.W / (ureg.K * ureg.m ** -2))
        self.link_attr('heat_transfer_coeff', core.reciprocal, value='thermal_insulance')

        self.set_guard('thermal_insulance', ureg.K * ureg.m ** 2 / ureg.W)
        self.link_attr('thermal_insulance', core.reciprocal, value='heat_transfer_coeff')

        self.set_guard('thermal_diffusivity', ureg.m ** 2 / ureg.s)
        self.link_attr('thermal_diffusivity', thermal.thermal_diffusivity, thermal_conductivity='thermal_conductivity',
                       density='density', specific_heat_capacity='specific_heat_capacity')

        self.set_guard('thermal_transmittance_convection', ureg.K * ureg.m ** 2 / ureg.W)

        self.set_guard('thermal_transmittance_radiation', ureg.K * ureg.m ** 2 / ureg.W)

    thermal_conductivity = Guarded()

    thermal_resistivity = Guarded()

    thermal_conductance = Guarded()

    thermal_resistance = Guarded()

    heat_transfer_coeff = Guarded()

    thermal_insulance = Guarded()

    thermal_diffusivity = Guarded()

    thermal_transmittance_convection = Guarded()

    thermal_transmittance_radiation = Guarded()
Exemplo n.º 9
0
class VolumeFlow(Surface, Segment):
    def __init__(self, **kwargs):
        super(VolumeFlow, self).__init__(**kwargs)

        self.set_guard('volumeflow', ureg.m**3 / ureg.s)
        self.link_attr('volumeflow',
                       core.mul,
                       segment='distance',
                       surface='cross_section',
                       dt=1. * ureg.s)

    volumeflow = Guarded()
Exemplo n.º 10
0
class ThermalPolymer(Chainable):
    def __init__(self, **kwargs):
        super(ThermalPolymer, self).__init__(**kwargs)

        self.set_guard('temperature_glass', ureg.degC, [-273.15, inf])
        self.link_attr('temperature_glass',
                       thermal_polymer.temperature_glass,
                       temperature_melt='temperature_melt')

        self.link_attr('temperature_melt',
                       thermal_polymer.temperature_melt,
                       temperature_glass='temperature_glass')

    temperature_glass = Guarded()
Exemplo n.º 11
0
class Thermal(Chainable):
    def __init__(self, **kwargs):
        super(Thermal, self).__init__(**kwargs)

        self.set_guard('temperature', ureg.degC, [-273.15, inf],
                       'Temperature of the material')
        self.set_guard('temperature_melt', ureg.degC, [-273.15, inf],
                       'Melting temperature of the material')
        self.set_guard('temperature_vapor', ureg.degC, [-273.15, inf])

        self.set_guard('specific_heat_capacity', ureg.J / (ureg.kg * ureg.K))
        self.link_attr('specific_heat_capacity',
                       thermal.specific_heat_capacity,
                       thermal_conductivity='thermal_conductivity',
                       density='density',
                       thermal_diffusivity='thermal_diffusivity')

        self.set_guard('thermal_diffusivity', ureg.m**2 / ureg.s)
        self.link_attr('thermal_diffusivity',
                       thermal.thermal_diffusivity,
                       thermal_conductivity='thermal_conductivity',
                       specific_heat_capacity='specific_heat_capacity',
                       density='density')

        self.set_guard('thermal_conductivity', ureg.W / (ureg.m * ureg.K))
        self.link_attr('thermal_conductivity',
                       thermal.thermal_conductivity,
                       thermal_diffusivity='thermal_diffusivity',
                       specific_heat_capacity='specific_heat_capacity',
                       density='density')

        self.set_guard('thermal_expansion_coeff', ureg.um / (ureg.m * ureg.K))

    temperature = Guarded()
    r"""Temperature of a material """

    temperature_melt = Guarded()

    temperature_vapor = Guarded()

    specific_heat_capacity = Guarded()

    thermal_diffusivity = Guarded()

    thermal_conductivity = Guarded()

    thermal_expansion_coeff = Guarded()
Exemplo n.º 12
0
class TwoDomainTaitpvT(Chainable):
    r"""
    The modified 2-domain Tait pvT model is used to determine the density of the material as a function of the temperature and pressure. This variation impacts on many aspects of the flow simulation.

    The 2-domain Tait pvT model is given by the following equations:

    .. math::

       v(T, p)=v_{0}(T)\left[1-C \ln \left(1+\frac{p}{B(T)}\right)\right]+v_{t}(T, p)

    where:
        * :math:`v(T, p)` is the specific geometry at temperature and pressure
        * :math:`v_0` is the specific geometry at zero gauge pressure
        * :math:`T` is the temperature
        * :math:`p` is the pressure
        * :math:`C` is a constant
        * :math:`B` accounts for the pressure sensitivity of the material

    The input for fully specified state:
        * b_1s
        * b_1m
        * b_2s
        * b_2m
        * b_3s
        * b_3m
        * b_4s
        * b_4m
        * b_5
        * b_6
        * b_7
        * b_8
        * b_9
        * temperature
        * pressure
    """
    @cite('osswald_polymer_2006')
    def __init__(self, **kwargs):
        super(TwoDomainTaitpvT, self).__init__(**kwargs)
        self.temperature_transition = self.temperature_transition  # need for initialization of material state

        self.set_guard('_B', ureg.Pa)
        self.link_attr('_B',
                       twodomaintaitpvt.get_B,
                       T='temperature',
                       b_3='_b_3',
                       b_4='_b_4',
                       b_5='b_5')

        self.set_guard('b_1s', ureg.m**3 / ureg.kg)
        self.set_guard('b_1m', ureg.m**3 / ureg.kg)
        self.set_guard('_b_1', ureg.m**3 / ureg.kg)
        self.link_attr('_b_1',
                       twodomaintaitpvt.switch_m_s,
                       T='temperature',
                       T_t='temperature_transition',
                       s='b_1s',
                       m='b_1m')

        self.set_guard('b_2s', ureg.m**3 / (ureg.kg * ureg.K))
        self.set_guard('b_2m', ureg.m**3 / (ureg.kg * ureg.K))
        self.set_guard('_b_2', ureg.m**3 / (ureg.kg * ureg.K))
        self.link_attr('_b_2',
                       twodomaintaitpvt.switch_m_s,
                       T='temperature',
                       T_t='temperature_transition',
                       s='b_2s',
                       m='b_2m')

        self.set_guard('b_3s', ureg.Pa)
        self.set_guard('b_3m', ureg.Pa)
        self.set_guard('_b_3', ureg.Pa)
        self.link_attr('_b_3',
                       twodomaintaitpvt.switch_m_s,
                       T='temperature',
                       T_t='temperature_transition',
                       s='b_3s',
                       m='b_3m')

        self.set_guard('b_4s', ureg.K**-1)
        self.set_guard('b_4m', ureg.K**-1)
        self.set_guard('_b_4', ureg.K**-1)
        self.link_attr('_b_4',
                       twodomaintaitpvt.switch_m_s,
                       T='temperature',
                       T_t='temperature_transition',
                       s='b_4s',
                       m='b_4m')

        self.set_guard('b_5', ureg.K)
        self.set_guard('b_6', ureg.K / ureg.Pa)
        self.set_guard('b_7', ureg.m**3 / ureg.kg)
        self.set_guard('b_8', ureg.K**-1)
        self.set_guard('b_9', ureg.Pa**-1)

        self.set_guard('specific_volume_zero_gauge_pressure',
                       ureg.m**3 / ureg.kg)
        self.link_attr('specific_volume_zero_gauge_pressure',
                       twodomaintaitpvt.get_v_0,
                       T='temperature',
                       b_1='_b_1',
                       b_2='_b_2',
                       b_5='b_5')

        self.set_guard('specific_volume_transition_temperature',
                       ureg.m**3 / ureg.kg)
        self.link_attr('specific_volume_transition_temperature',
                       twodomaintaitpvt.get_v_t,
                       p='pressure',
                       T='temperature',
                       T_t='temperature_transition',
                       b_5='b_5',
                       b_7='b_7',
                       b_8='b_8',
                       b_9='b_9')

        self.link_attr('specific_volume',
                       twodomaintaitpvt.get_specific_volume,
                       p='pressure',
                       v_0='specific_volume_zero_gauge_pressure',
                       v_t='specific_volume_transition_temperature',
                       B='_B')

        self.set_guard('temperature_transition', ureg.degC)
        self.link_attr('temperature_transition',
                       twodomaintaitpvt.get_T_t,
                       p='pressure',
                       b_5='b_5',
                       b_6='b_6')

    _B = Guarded()

    b_1s = Guarded()

    b_1m = Guarded()

    _b_1 = Guarded()

    b_2s = Guarded()

    b_2m = Guarded()

    _b_2 = Guarded()

    b_3m = Guarded()

    b_3s = Guarded()

    _b_3 = Guarded()

    b_4m = Guarded()

    b_4s = Guarded()

    _b_4 = Guarded()

    b_5 = Guarded()

    b_6 = Guarded()

    b_7 = Guarded()

    b_8 = Guarded()

    b_9 = Guarded()

    specific_volume_zero_gauge_pressure = Guarded()

    specific_volume_transition_temperature = Guarded()

    temperature_transition = Guarded()
Exemplo n.º 13
0
class CrossWLF(Chainable):
    r"""
    This 6-parameter model considers the effects of shear rate and temperature on the viscosity. Similar to the Bird-Carreau model,
    this model describes both Newtonian and shear thinning behavior. The shear thinning part is modeled by the general Cross equation,\
    which is a popular and earlier alternative to the Bird-Carreau-Yasuda model:


    """
    @cite('osswald_polymer_2015')
    def __init__(self, **kwargs):
        super(CrossWLF, self).__init__(**kwargs)

        self.set_guard('A_1', ureg.dimensionless)

        self.set_guard('A_2', ureg.K, [0., inf])

        self.set_guard('D_1', ureg.Pa * ureg.s)

        self.set_guard('D_2', ureg.K)

        self.set_guard('D_3', ureg.K / ureg.Pa)

        self.set_guard('n', ureg.dimensionless)

        self.set_guard('tau_star', ureg.Pa)
        self.link_attr('tau_star', crosswlf.critical_shear_stress, n='n')

        self.link_attr('temperature_glass',
                       crosswlf.glass_transition_temperature,
                       D_2='D_2',
                       D_3='D_3',
                       p='pressure')

        self.link_attr('viscosity_zero_shear_rate',
                       crosswlf.zero_shear_viscosity,
                       temperature='temperature',
                       D_1='D_1',
                       temperature_glass_transition='temperature_glass',
                       A_1='A_1',
                       A_2='A_2')

        self.link_attr('viscosity_dynamic',
                       crosswlf.viscosity_dynamic,
                       shear_rate='shear_rate',
                       tau_star='tau_star',
                       zero_shear_viscosity='viscosity_zero_shear_rate',
                       n='n')

    A_1 = Guarded()

    A_2 = Guarded()

    D_1 = Guarded()

    D_2 = Guarded()

    D_3 = Guarded()

    n = Guarded()

    tau_star = Guarded()

    viscosity_zero_shear_rate = Guarded()
Exemplo n.º 14
0
class Volume(Chainable):
    def __init__(self, **kwargs):
        super(Volume, self).__init__(**kwargs)
        self.set_guard('volume', ureg.m**3)

    volume = Guarded()
Exemplo n.º 15
0
class CrossArrhenius(Chainable):
    r"""
    The model is based on the assumption that the fluid flow obeys the Arrhenius equation for molecular kinetics.

    .. math::

       \eta(T, \dot{\gamma})=\frac{\eta_{0}(T)}{1+(\lambda(T) \dot{\gamma})^{a}}

    where:
        * :math:`\eta_{0}\left(T_{\mathrm{ref}}\right)` zero shear rate viscosity at reference temperature
        * :math:`\lambda\left(T_{\text { ref }}\right)` “relaxation time” at reference temperature
        * :math:`a` “shear-thinning”constant
        * :math:`E_{\mathrm{a}}` Arrhenius activation energy
        * :math:`R` gas constant
        * :math:`T` temperature
        * :math:`T_{ref}` reference temperature

    The input for fully specified state:
        * temperature
        * temperature_cross_arrhenius_ref
        * arrhenius_activation_energy
        * relaxation_time_ref
        * shear_rate
        * shear_thinning_const
        * viscosity_zero_shear_rate_ref
    """
    @cite('osswald_polymer_2006')
    def __init__(self, **kwargs):
        super(CrossArrhenius, self).__init__(**kwargs)

        self.set_guard('arrhenius_activation_energy', ureg.J / ureg.mol)

        self.set_guard('_arrhenius', ureg.dimensionless)
        self.link_attr(
            '_arrhenius',
            crossarrhenius.arrhenius_shift,
            temperature='temperature',
            arrhenius_activation_energy='arrhenius_activation_energy',
            temperature_ref='temperature_cross_arrhenius_ref')

        self.set_guard('relaxation_time', ureg.s)
        self.link_attr(
            'relaxation_time',
            crossarrhenius.relaxation_time,
            relaxation_time_ref='relaxation_time_ref',
            zero_shear_viscosity_ref='viscosity_zero_shear_rate_ref')

        self.set_guard('relaxation_time_ref', ureg.s)
        self.link_attr('viscosity_dynamic',
                       crossarrhenius.viscosity_dynamic,
                       shear_rate='shear_rate',
                       zero_shear_viscosity='viscosity_zero_shear_rate',
                       relaxation_time='relaxation_time',
                       shear_thinning_const='shear_thinning_const')

        self.set_guard('viscosity_zero_shear_rate', ureg.Pa * ureg.s)
        self.link_attr(
            'viscosity_zero_shear_rate',
            crossarrhenius.zero_shear_viscosity,
            arrhenius='_arrhenius',
            zero_shear_viscosity_ref='viscosity_zero_shear_rate_ref')

        self.set_guard('viscosity_zero_shear_rate_ref', ureg.Pa * ureg.s)

        self.set_guard('shear_thinning_const', ureg.dimensionless)

        self.set_guard('temperature_cross_arrhenius_ref', ureg.degC)

    arrhenius_activation_energy = Guarded()

    _arrhenius = Guarded()

    relaxation_time = Guarded()

    relaxation_time_ref = Guarded()

    viscosity_zero_shear_rate = Guarded()

    viscosity_zero_shear_rate_ref = Guarded()

    shear_thinning_const = Guarded()

    temperature_cross_arrhenius_ref = Guarded()