Esempio n. 1
0
def PositionWRT(xyz, cid, cid_new, model, is_cid_int=None):
    """
    Gets the location of the GRID which started in some arbitrary system and
    returns it in the desired coordinate system

    Parameters
    ----------
    xyz : (3, ) float ndarray
        the position of the GRID in an arbitrary coordinate system
    cid : int
        the coordinate ID for xyz
    cid_new : int
        the desired coordinate ID
    model : BDF()
        the BDF model object
    is_cid_int : bool
        is cid/cid_new an integer or a Coord object (deprecated)

    Returns
    -------
    xyz_local : (3, ) float ndarray
        the position of the GRID in an arbitrary coordinate system

    """
    if is_cid_int is not None:  # pragma: no cover
        deprecated('PositionWRT(xyz, cid, cid_new, model, is_cid_int=%s)' % is_cid_int,
                   'PositionWRT(xyz, cid, cid_new, model)', '1.2',
                   levels=[-1])

    if cid == cid_new: # same coordinate system
        return xyz

    cp_ref = _coord(model, cid)
    coord_to_ref = _coord(model, cid_new)

    if 0:  # pragma: no cover
        # pGlobal = pLocal1 * beta1 + porigin1
        # pGlobal = pLocal2 * beta2 + porigin2
        # pLocal1 * beta1 + porigin1 = pLocal2 * beta2 + porigin2
        # plocal1 * beta1 + porigin1 - porigin2 = plocal2 * beta2
        # (plocal1 * beta1 + porigin1 - porigin2) * beta2.T = plocal2

        # convert R-Theta-Z_1 to xyz_1
        p1_local = cp_ref.coord_to_xyz(xyz)

        # transform xyz_1 to xyz_2
        p2_local = dot(
            dot(p1_local, cp_ref.beta()) + cp_ref.origin - coord_to_ref.origin,
            coord_to_ref.beta().T)

        # convert xyz_2 to R-Theta-Z_2
        xyz_local = coord_to_ref.xyz_to_coord(p2_local)
    else:
        # converting the xyz point arbitrary->global
        xyz_global = cp_ref.transform_node_to_global(xyz)

        # now converting it to the output coordinate system
        xyz_local = coord_to_ref.transform_node_to_local(xyz_global)

    return xyz_local
Esempio n. 2
0
def Position(xyz, cid, model, is_cid_int=None):
    """
    Gets the point in the global XYZ coordinate system.

    Parameters
    ----------
    xyz : (3,) ndarray
        the position of the GRID in an arbitrary coordinate system
    cid : int
        the coordinate ID for xyz
    model : BDF()
        the BDF model object
    is_cid_int : bool
        is cid/cid_new an integer or a Coord object (deprecated)

    Returns
    -------
    xyz2 : (3,) ndarray
        the position of the GRID in an arbitrary coordinate system

    """
    if is_cid_int is not None:  # pragma: no cover
        deprecated('Position(xyz, cid, model, is_cid_int=%s)' % is_cid_int,
                   'Position(xyz, cid, model)', '1.2',
                   levels=[-1])

    cp_ref = _coord(model, cid)
    xyz2 = cp_ref.transform_node_to_global(xyz)
    return xyz2
Esempio n. 3
0
def make_symmetric_model(bdf_filename,
                         plane: str = 'xz',
                         zero_tol: float = 1e-12,
                         log=None,
                         debug: bool = True):
    log = get_logger2(log=log, debug=debug, encoding='utf-8')
    deprecated('make_symmetric_model',
               'make_half_model',
               '1.3',
               levels=[0, 1, 2])
    return make_half_model(bdf_filename,
                           plane=plane,
                           zero_tol=zero_tol,
                           log=log,
                           debug=debug)
Esempio n. 4
0
 def deprecated(self, old_name, new_name, deprecated_version):
     # type: (str, str, str) -> None
     """deprecates methods"""
     return deprecated(old_name,
                       new_name,
                       deprecated_version,
                       levels=[0, 1, 2])
Esempio n. 5
0
def TransformLoadWRT(F, M, cid, cid_new, model, is_cid_int=None):
    """
    Transforms a force/moment from an arbitrary coordinate system to another
    coordinate system.

    Parameters
    ----------
    Fxyz : (3, ) float ndarray
        the force in an arbitrary coordinate system
    Mxyz : (3, ) float ndarray
        the moment in an arbitrary coordinate system
    cid : int
        the coordinate ID for xyz
    cid_new : int
        the desired coordinate ID
    model : BDF()
        the BDF model object
    is_cid_int : bool
        is cid/cid_new an integer or a Coord object (deprecated)

    Returns
    -------
    Fxyz_local : (3, ) float ndarray
        the force in an arbitrary coordinate system
    Mxyz_local : (3, ) float ndarray
        the force in an arbitrary coordinate system

    """
    if is_cid_int is not None:  # pragma: no cover
        deprecated('TransformLoadWRT(F, M, cid, cid_new, model, is_cid_int=%s)' % is_cid_int,
                   'TransformLoadWRT(F, M, cid, cid_new, model)', '1.2',
                   levels=[-1])

    if cid == cid_new: # same coordinate system
        return F, M

    # find the vector r for doing:
    #     M = r x F
    cp_ref = _coord(model, cid)
    coord_to_ref = _coord(model, cid_new)
    r = cp_ref.origin - coord_to_ref.origin

    # change R-theta-z to xyz
    Fxyz_local_1 = cp_ref.coord_to_xyz(F)
    Mxyz_local_1 = cp_ref.coord_to_xyz(M)

    # pGlobal = pLocal1 * beta1 + porigin1
    # pGlobal = pLocal2 * beta2 + porigin2
    # pLocal1 * beta1 + porigin1 = pLocal2 * beta2 + porigin2
    # plocal1 * beta1 + porigin1 - porigin2 = plocal2 * beta2
    # (plocal1 * beta1 + porigin1 - porigin2) * beta2.T = plocal2
    #
    # origin transforms only apply to nodes, so...
    # Fglobal = Flocal1 * beta1
    # Flocal2 = (Flocal1 * beta1) * beta2.T

    Fxyz_global = dot(Fxyz_local_1, cp_ref.beta())
    Fxyz_local_2 = dot(dot(Fxyz_local_1, cp_ref.beta()), coord_to_ref.beta().T)

    # find the moment about the new origin due to the force
    Mxyz_global = cross(r, Fxyz_global)
    dMxyz_local_2 = cross(r, Fxyz_local_2)
    Mxyz_local_2 = Mxyz_local_1 + dMxyz_local_2

    # rotate the delta moment into the local frame
    M_local = coord_to_ref.xyz_to_coord(Mxyz_local_2)

    return Fxyz_local_2, Mxyz_local_2
Esempio n. 6
0
 def deprecated(self, old_name: str, new_name: str,
                deprecated_version: str) -> None:
     """deprecates methods"""
     deprecated(old_name, new_name, deprecated_version, levels=[0, 1, 2])