Beispiel #1
0
def fluid_flow_long_numerical():
    nz = 8
    ntheta = 32
    nradius = 8
    omega = 100.0 * 2 * np.pi / 60
    p_in = 0.0
    p_out = 0.0
    radius_rotor = 1
    h = 0.000194564
    radius_stator = radius_rotor + h
    length = 8 * 2 * radius_stator
    visc = 0.015
    rho = 860.0
    eccentricity = 0.0001
    return flow.FluidFlow(
        nz,
        ntheta,
        nradius,
        length,
        omega,
        p_in,
        p_out,
        radius_rotor,
        radius_stator,
        visc,
        rho,
        eccentricity=eccentricity,
        immediately_calculate_pressure_matrix_numerically=False,
    )
Beispiel #2
0
def fluid_flow_short_eccentricity():
    nz = 8
    ntheta = 32
    nradius = 8
    omega = 100.0 * 2 * np.pi / 60
    p_in = 0.0
    p_out = 0.0
    radius_rotor = 0.1999996
    radius_stator = 0.1999996 + 0.000194564
    length = (1 / 10) * (2 * radius_stator)
    eccentricity = 0.0001
    visc = 0.015
    rho = 860.0
    return flow.FluidFlow(
        nz,
        ntheta,
        nradius,
        length,
        omega,
        p_in,
        p_out,
        radius_rotor,
        radius_stator,
        visc,
        rho,
        eccentricity=eccentricity,
        immediately_calculate_pressure_matrix_numerically=False,
    )
Beispiel #3
0
def fluid_flow_long_numerical():
    nz = 8
    ntheta = 132
    nradius = 11
    omega = 100. * 2 * np.pi / 60
    p_in = 0.
    p_out = 0.
    radius_rotor = 1
    h = 0.000194564
    radius_stator = radius_rotor + h
    length = 8 * 2 * radius_stator
    visc = 0.015
    rho = 860.
    eccentricity = 0.0001
    return flow.FluidFlow(nz,
                          ntheta,
                          nradius,
                          length,
                          omega,
                          p_in,
                          p_out,
                          radius_rotor,
                          radius_stator,
                          visc,
                          rho,
                          eccentricity=eccentricity)
Beispiel #4
0
def fluid_flow_short_numerical():
    nz = 8
    ntheta = 32
    nradius = 8
    length = 0.01
    omega = 100.0 * 2 * np.pi / 60
    p_in = 0.0
    p_out = 0.0
    radius_rotor = 0.08
    radius_stator = 0.1
    visc = 0.015
    rho = 860.0
    attitude_angle = None
    eccentricity = 0.001
    return flow.FluidFlow(
        nz,
        ntheta,
        nradius,
        length,
        omega,
        p_in,
        p_out,
        radius_rotor,
        radius_stator,
        visc,
        rho,
        attitude_angle=attitude_angle,
        eccentricity=eccentricity,
        immediately_calculate_pressure_matrix_numerically=False,
    )
Beispiel #5
0
def fluid_flow_short_numerical():
    nz = 8
    ntheta = 132
    nradius = 11
    length = 0.01
    omega = 100. * 2 * np.pi / 60
    p_in = 0.
    p_out = 0.
    radius_rotor = 0.08
    radius_stator = 0.1
    visc = 0.015
    rho = 860.
    attitude_angle = None
    eccentricity = 0.001
    return flow.FluidFlow(nz,
                          ntheta,
                          nradius,
                          length,
                          omega,
                          p_in,
                          p_out,
                          radius_rotor,
                          radius_stator,
                          visc,
                          rho,
                          attitude_angle=attitude_angle,
                          eccentricity=eccentricity)
Beispiel #6
0
def fluid_flow_short_eccentricity():
    nz = 16
    ntheta = 528
    nradius = 11
    omega = 100. * 2 * np.pi / 60
    p_in = 0.
    p_out = 0.
    radius_rotor = 0.1999996
    radius_stator = 0.1999996 + 0.000194564
    length = (1 / 10) * (2 * radius_stator)
    eccentricity = 0.0001
    visc = 0.015
    rho = 860.
    return flow.FluidFlow(nz,
                          ntheta,
                          nradius,
                          length,
                          omega,
                          p_in,
                          p_out,
                          radius_rotor,
                          radius_stator,
                          visc,
                          rho,
                          eccentricity=eccentricity)
Beispiel #7
0
def fluid_flow_short_friswell(set_load=True):
    nz = 8
    ntheta = 32
    nradius = 8
    length = 0.03
    omega = 157.1
    p_in = 0.0
    p_out = 0.0
    radius_rotor = 0.0499
    radius_stator = 0.05
    load = 525
    visc = 0.1
    rho = 860.0
    eccentricity = (radius_stator - radius_rotor) * 0.2663
    if set_load:
        return flow.FluidFlow(
            nz,
            ntheta,
            nradius,
            length,
            omega,
            p_in,
            p_out,
            radius_rotor,
            radius_stator,
            visc,
            rho,
            load=load,
            immediately_calculate_pressure_matrix_numerically=False,
        )
    else:
        return flow.FluidFlow(
            nz,
            ntheta,
            nradius,
            length,
            omega,
            p_in,
            p_out,
            radius_rotor,
            radius_stator,
            visc,
            rho,
            eccentricity=eccentricity,
            immediately_calculate_pressure_matrix_numerically=False,
        )
Beispiel #8
0
def fluid_flow_short_friswell(set_load=True):
    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
    load = 525
    visc = 0.1
    rho = 860.
    eccentricity = (radius_stator - radius_rotor) * 0.2663
    if set_load:
        return flow.FluidFlow(nz,
                              ntheta,
                              nradius,
                              length,
                              omega,
                              p_in,
                              p_out,
                              radius_rotor,
                              radius_stator,
                              visc,
                              rho,
                              load=load)
    else:
        return flow.FluidFlow(nz,
                              ntheta,
                              nradius,
                              length,
                              omega,
                              p_in,
                              p_out,
                              radius_rotor,
                              radius_stator,
                              visc,
                              rho,
                              eccentricity=eccentricity)
Beispiel #9
0
def fluid_flow_example3():
    """This function returns a different instance of a simple fluid flow.
    The purpose is to make available a simple model
    so that doctest can be written using it.

    Parameters
    ----------

    Returns
    -------
    An instance of a fluid flow object.

    Examples
    --------
    >>> my_fluid_flow = fluid_flow_example3()
    >>> my_fluid_flow.eccentricity
    0.0001
    """
    from ross.fluid_flow import fluid_flow as flow

    nz = 8
    ntheta = 32 * 4
    omega = 100.0 * 2 * np.pi / 60
    p_in = 0.0
    p_out = 0.0
    radius_rotor = 1
    h = 0.000194564
    radius_stator = radius_rotor + h
    length = 8 * 2 * radius_stator
    visc = 0.015
    rho = 860.0
    eccentricity = 1e-4
    attitude_angle = np.pi / 4
    return flow.FluidFlow(
        nz,
        ntheta,
        length,
        omega,
        p_in,
        p_out,
        radius_rotor,
        radius_stator,
        visc,
        rho,
        eccentricity=eccentricity,
        attitude_angle=attitude_angle,
        immediately_calculate_pressure_matrix_numerically=False,
    )
def instantiate_fluid_flow_object(number_of_theta_nodes, number_of_z_nodes,
                                  length_type):
    """Instantiates a FluidFlow object, either short or long, using the same parameters in ROSS tests.

    Parameters
    ----------
    number_of_theta_nodes: int
    number_of_z_nodes: int
    length_type: bool
        Defines if short (True) or long (False) bearing.

    Returns
    -------
    A FluidFlow object
    """
    nradius = 11
    omega = 100.0 * 2 * np.pi / 60
    p_in = 0.0
    p_out = 0.0
    eccentricity = 0.0001
    visc = 0.015
    rho = 860.0
    if length_type:
        radius_rotor = 0.1999996
        radius_stator = 0.1999996 + 0.000194564
        length = (1 / 10) * (2 * radius_stator)
    else:
        p_in = 1
        p_out = 0
        radius_rotor = 1
        h = 0.000194564
        radius_stator = radius_rotor + h
        length = 8 * 2 * radius_stator

    return flow.FluidFlow(
        number_of_z_nodes,
        number_of_theta_nodes,
        nradius,
        length,
        omega,
        p_in,
        p_out,
        radius_rotor,
        radius_stator,
        visc,
        rho,
        eccentricity=eccentricity,
        immediately_calculate_pressure_matrix_numerically=False)
Beispiel #11
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,
    ):
        """Instantiate a bearing using inputs from its fluid flow.

        Parameters
        ----------
        n : int
            The node in which the bearing will be located in the rotor.

        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
            Length in the Z direction (m).

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

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

        Fluid characteristics
        ^^^^^^^^^^^^^^^^^^^^^
        Describes the fluid characteristics.
        visc: float
            Viscosity (Pa.s).
        rho: float
            Fluid density(Kg/m^3).

        Returns
        -------
        bearing: rs.BearingElement
            A bearing object.

        Examples
        --------
        >>> 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 = 0.1
        >>> rho = 860.
        >>> BearingElement.from_fluid_flow(0, nz, ntheta, nradius, length, omega, p_in,
        ...                                p_out, radius_rotor, radius_stator,
        ...                                visc, rho, eccentricity=eccentricity) # doctest: +ELLIPSIS
        BearingElement(n=0, n_link=None,
         kxx=[...
        """
        fluid_flow = flow.FluidFlow(
            nz,
            ntheta,
            nradius,
            length,
            omega,
            p_in,
            p_out,
            radius_rotor,
            radius_stator,
            visc,
            rho,
            eccentricity=eccentricity,
            load=load,
        )
        c = calculate_damping_matrix(fluid_flow, force_type="short")
        k = calculate_stiffness_matrix(fluid_flow, force_type="short")
        return cls(
            n,
            kxx=k[0],
            cxx=c[0],
            kyy=k[3],
            kxy=k[1],
            kyx=k[2],
            cyy=c[3],
            cxy=c[1],
            cyx=c[2],
            frequency=fluid_flow.omega,
        )
    def from_fluid_flow(
        cls,
        n,
        nz,
        ntheta,
        length,
        omega,
        p_in,
        p_out,
        radius_rotor,
        radius_stator,
        viscosity,
        density,
        attitude_angle=None,
        eccentricity=None,
        load=None,
        omegap=None,
        immediately_calculate_pressure_matrix_numerically=True,
        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", "viscosity", "density", "attitude_angle",
                 "eccentricity", "load", "omegap"]
        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.
        viscosity: float, list
            Viscosity (Pa.s).
            Input a list to make it random.
        density: 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 = 8
        >>> ntheta = 64
        >>> length = 1.5 * 0.0254
        >>> omega = [157.1, 300]
        >>> p_in = 0.
        >>> p_out = 0.
        >>> radius_rotor = 3 * 0.0254
        >>> radius_stator = 3.003 * 0.0254
        >>> viscosity = np.random.uniform(2.4e-03, 2.8e-03, 5)
        >>> density = 860
        >>> load = 1244.1
        >>> elms = srs.ST_BearingElement.from_fluid_flow(
        ...     0, nz=nz, ntheta=ntheta, length=length,
        ...     omega=omega, p_in=p_in, p_out=p_out, radius_rotor=radius_rotor,
        ...     radius_stator=radius_stator, viscosity=viscosity, density=density,
        ...     load=load, is_random=["viscosity"]
        ... )
        >>> len(list(iter(elms)))
        5
        """
        attribute_dict = locals()
        attribute_dict.pop("cls")
        attribute_dict.pop("omega")
        attribute_dict.pop("is_random")
        size = len(attribute_dict[is_random[0]])
        args_dict = {
            "kxx": np.zeros((len(omega), size)),
            "kxy": np.zeros((len(omega), size)),
            "kyx": np.zeros((len(omega), size)),
            "kyy": np.zeros((len(omega), size)),
            "cxx": np.zeros((len(omega), size)),
            "cxy": np.zeros((len(omega), size)),
            "cyx": np.zeros((len(omega), size)),
            "cyy": np.zeros((len(omega), size)),
        }

        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 j, frequency in enumerate(omega):
            for i in range(size):
                fluid_flow = flow.FluidFlow(
                    attribute_dict["nz"][i],
                    attribute_dict["ntheta"][i],
                    attribute_dict["length"][i],
                    frequency,
                    attribute_dict["p_in"][i],
                    attribute_dict["p_out"][i],
                    attribute_dict["radius_rotor"][i],
                    attribute_dict["radius_stator"][i],
                    attribute_dict["viscosity"][i],
                    attribute_dict["density"][i],
                    attribute_dict["attitude_angle"][i],
                    attribute_dict["eccentricity"][i],
                    attribute_dict["load"][i],
                    attribute_dict["omegap"][i],
                )
                k, c = calculate_stiffness_and_damping_coefficients(fluid_flow)

                args_dict["kxx"][j, i] = k[0]
                args_dict["kxy"][j, i] = k[1]
                args_dict["kyx"][j, i] = k[2]
                args_dict["kyy"][j, i] = k[3]
                args_dict["cxx"][j, i] = c[0]
                args_dict["cxy"][j, i] = c[1]
                args_dict["cyx"][j, i] = c[2]
                args_dict["cyy"][j, i] = 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=omega,
            tag=tag,
            n_link=n_link,
            scale_factor=scale_factor,
            is_random=list(args_dict.keys()),
        )
Beispiel #13
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()),
        )