Extract Mass given a list of elements or properties

33 views
Skip to first unread message

Fabio Cunha

unread,
Oct 9, 2015, 2:33:40 PM10/9/15
to pyNastran Discuss
Hi folks,

I am able to extract the mass of the whole model mesh through:

mesh.mass() or mesh.mass_properties()

Is it possible in a simple manner to extract the mass/mass_properties given a list of elements or properties?

Br,

Fábio.


Steven Doyle

unread,
Oct 9, 2015, 2:40:33 PM10/9/15
to pyNastran Discuss
The mass() method will be removed in the next version (to be released soon), so I recommend switching everything to mass_properties.

The calling signature & docstring for mass_properties is:

    def mass_properties(self, element_ids=None, reference_point=None,
                        sym_axis=None, num_cpus=1, scale=None):
        """
        Caclulates mass properties in the global system about the
        reference point.

        Parameters
        ---------------
        self : BDF
            The BDF object.
        element_ids : ndarray, optional
            An array of element ids.
        reference_point : ndarray, optional
            An array that defines the origin of the frame.
            default = <0,0,0>.
        sym_axis : str, optional
            The axis to which the model is symmetric. If AERO cards are used, this can be left blank
            allowed_values = 'x', 'y', 'z', 'xy', 'yz', 'xz', 'xyz'
        scale : float, optional
            The WTMASS scaling value.
            default=None -> PARAM, WTMASS is used
            float > 0.0

        Returns
        ----------
        mass : float
            The mass of the model.
        cg : ndarray
            The cg of the model as an array.
        I : ndarray
            Moment of inertia array([Ixx, Iyy, Izz, Ixy, Ixz, Iyz]).


Just call it with element_ids as a list/ndarray of the element ids.  You cannot explicitly get mass by property id.


--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Fabio Cunha

unread,
Oct 9, 2015, 2:59:06 PM10/9/15
to pyNastran Discuss
Hi Steve,

Thanks for the very quick reply. I am still using version 0.6. I definitely need to update the code in the next few days...

In version 0.60 the signature is quite different:

mass_properties(self, reference_point=None) method of pyNastran.bdf.bdf.BDF instance

    Caclulates mass properties in the global system about the reference point.
    :param self: the BDF object
    :param reference_point: an array that defines the origin of the frame.
        default = <0,0,0>.
    :returns mass: the mass of the model
    :returns cg: the cg of the model as an array.
    :returns I: moment of inertia array([Ixx, Iyy, Izz, Ixy, Ixz, Iyz])
   
    I = mass * centroid * centroid
   
    .. math:: I_{xx} = m (dy^2 + dz^2)
   
    .. math:: I_{yz} = -m * dy * dz
   
    where:
    .. math:: dx = x_{element} - x_{ref}


Br,

Fábio,

Steven Doyle

unread,
Oct 9, 2015, 3:08:58 PM10/9/15
to pyNastran Discuss
v0.6 was released a longgg time ago.  That was pre-OP2 vectorization (which I'm now considering removing).

Fabio Cunha

unread,
Oct 9, 2015, 3:50:46 PM10/9/15
to pyNastran Discuss
Yes, I know... Sometime I am lazy to update packages.

I just updated and  tested the function. It worked perfectly!

Thanks a lot!
Reply all
Reply to author
Forward
0 new messages