Beispiel #1
0
def test_stiffness_matrix():
    """
    This function instantiate a bearing using the fluid flow class and test if it matches the
    expected results for the stiffness matrix, given the eccentricity ratio.
    Taken from example 5.5.1, page 181 (Dynamics of rotating machine, FRISSWELL)
    """
    bearing = fluid_flow_short_friswell()
    kxx, kxy, kyx, kyy = calculate_short_stiffness_matrix(bearing)
    assert math.isclose(kxx / 10**6, 12.81, rel_tol=0.01)
    assert math.isclose(kxy / 10**6, 16.39, rel_tol=0.01)
    assert math.isclose(kyx / 10**6, -25.06, rel_tol=0.01)
    assert math.isclose(kyy / 10**6, 8.815, rel_tol=0.01)
Beispiel #2
0
def test_stiffness_matrix_numerical(fluid_flow_short_eccentricity):
    """
    This function instantiate a bearing using the fluid flow class and test if it matches the
    expected results for the stiffness matrix based on Friswell's book formulas, given the
    eccentricity ratio.
    Taken from chapter 5, page 179 (Dynamics of rotating machine, FRISSWELL)
    """
    bearing = fluid_flow_short_eccentricity
    bearing.calculate_pressure_matrix_numerical()
    K, C = calculate_stiffness_and_damping_coefficients(bearing)
    kxx, kxy, kyx, kyy = K[0], K[1], K[2], K[3]
    k_xx, k_xy, k_yx, k_yy = calculate_short_stiffness_matrix(bearing)
    assert_allclose(kxx, k_xx, rtol=0.29)
    assert_allclose(kxy, k_xy, rtol=0.22)
    assert_allclose(kyx, k_yx, rtol=0.15)
    assert_allclose(kyy, k_yy, rtol=0.22)
Beispiel #3
0
    def from_fluid_flow(
        cls,
        n,
        nz,
        ntheta,
        nradius,
        length,
        omega,
        p_in,
        p_out,
        radius_rotor,
        radius_stator,
        visc,
        rho,
        eccentricity=None,
        load=None,
        tag=None,
        n_link=None,
        scale_factor=1,
        is_random=None,
    ):
        """Instantiate a bearing using inputs from its fluid flow.

        Parameters
        ----------
        n : int
            The node in which the bearing will be located in the rotor.
        is_random : list
            List of the object attributes to become random.
            Possibilities:
                ["length", "omega", "p_in", "p_out", "radius_rotor",
                 "radius_stator", "visc", "rho", "eccentricity", "load"]
        tag: str, optional
            A tag to name the element
            Default is None.
        n_link: int, optional
            Node to which the bearing will connect. If None the bearing is
            connected to ground.
            Default is None.
        scale_factor: float, optional
            The scale factor is used to scale the bearing drawing.
            Default is 1.

        Grid related
        ^^^^^^^^^^^^
        Describes the discretization of the problem
        nz: int
            Number of points along the Z direction (direction of flow).
        ntheta: int
            Number of points along the direction theta. NOTE: ntheta must be odd.
        nradius: int
            Number of points along the direction r.
        length: float, list
            Length in the Z direction (m).
            Input a list to make it random.

        Operation conditions
        ^^^^^^^^^^^^^^^^^^^^
        Describes the operation conditions.
        omega: float, list
            Rotation of the rotor (rad/s).
            Input a list to make it random.
        p_in: float, list
            Input Pressure (Pa).
            Input a list to make it random.
        p_out: float, list
            Output Pressure (Pa).
            Input a list to make it random.
        load: float, list
            Load applied to the rotor (N).
            Input a list to make it random.

        Geometric data of the problem
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        Describes the geometric data of the problem.
        radius_rotor: float, list
            Rotor radius (m).
            Input a list to make it random.
        radius_stator: float, list
            Stator Radius (m).
            Input a list to make it random.
        eccentricity: float, list
            Eccentricity (m) is the euclidean distance between rotor and stator
            centers.
            The center of the stator is in position (0,0).
            Input a list to make it random.

        Fluid characteristics
        ^^^^^^^^^^^^^^^^^^^^^
        Describes the fluid characteristics.
        visc: float, list
            Viscosity (Pa.s).
            Input a list to make it random.
        rho: float, list
            Fluid density(Kg/m^3).
            Input a list to make it random.

        Returns
        -------
        random bearing: srs.ST_BearingElement
            A random bearing object.

        Examples
        --------
        >>> import numpy as np
        >>> import ross.stochastic as srs
        >>> nz = 30
        >>> ntheta = 20
        >>> nradius = 11
        >>> length = 0.03
        >>> omega = 157.1
        >>> p_in = 0.
        >>> p_out = 0.
        >>> radius_rotor = 0.0499
        >>> radius_stator = 0.05
        >>> eccentricity = (radius_stator - radius_rotor)*0.2663
        >>> visc = np.random.uniform(0.1, 0.2, 5)
        >>> rho = 860.0
        >>> elms = srs.ST_BearingElement.from_fluid_flow(
        ...     0, nz, ntheta, nradius, length,
        ...     omega, p_in, p_out, radius_rotor,
        ...     radius_stator, visc, rho,
        ...     eccentricity=eccentricity, is_random=["visc"]
        ... )
        >>> len(list(iter(elms)))
        5
        """
        attribute_dict = locals()
        size = len(attribute_dict[is_random[0]])
        args_dict = {
            "kxx": [],
            "kxy": [],
            "kyx": [],
            "kyy": [],
            "cxx": [],
            "cxy": [],
            "cyx": [],
            "cyy": [],
        }

        for k, v in attribute_dict.items():
            if k not in is_random:
                attribute_dict[k] = np.full(size, v)
            else:
                attribute_dict[k] = np.asarray(v)

        for i in range(size):
            fluid_flow = flow.FluidFlow(
                attribute_dict["nz"][i],
                attribute_dict["ntheta"][i],
                attribute_dict["nradius"][i],
                attribute_dict["length"][i],
                attribute_dict["omega"][i],
                attribute_dict["p_in"][i],
                attribute_dict["p_out"][i],
                attribute_dict["radius_rotor"][i],
                attribute_dict["radius_stator"][i],
                attribute_dict["visc"][i],
                attribute_dict["rho"][i],
                eccentricity=attribute_dict["eccentricity"][i],
                load=attribute_dict["load"][i],
            )
            c = calculate_short_damping_matrix(fluid_flow)
            k = calculate_short_stiffness_matrix(fluid_flow)
            args_dict["kxx"].append(k[0])
            args_dict["kxy"].append(k[1])
            args_dict["kyx"].append(k[2])
            args_dict["kyy"].append(k[3])
            args_dict["cxx"].append(c[0])
            args_dict["cxy"].append(c[1])
            args_dict["cyx"].append(c[2])
            args_dict["cyy"].append(c[3])

        return cls(
            n,
            kxx=args_dict["kxx"],
            cxx=args_dict["cxx"],
            kyy=args_dict["kyy"],
            kxy=args_dict["kxy"],
            kyx=args_dict["kyx"],
            cyy=args_dict["cyy"],
            cxy=args_dict["cxy"],
            cyx=args_dict["cyx"],
            frequency=[fluid_flow.omega],
            tag=tag,
            n_link=n_link,
            scale_factor=scale_factor,
            is_random=list(args_dict.keys()),
        )