mass_properties Module
- Defines:
- mass_poperties
get the mass & moment of inertia of the model
- pyNastran.bdf.mesh_utils.mass_properties.get_sub_eids(all_eids: ndarray, eids: list[int], etype: str) ndarray[source]
supports limiting the element/mass ids
- pyNastran.bdf.mesh_utils.mass_properties.hstack_dict_values(adict: dict[Any, list[int]]) ndarray[source]
- pyNastran.bdf.mesh_utils.mass_properties.increment_inertia(centroidi: ndarray, reference_xyz: ndarray, massi: float, mass: float, mass_cg: ndarray, inertia: ndarray, mass_list: list[float], cg_list: list[ndarray], inertia_list: list[ndarray]) float[source]
helper method
- centroidi: (3,) float np.ndarray
delta value
- reference_xyz(3,) float np.ndarray
origin
- massifloat
delta value
- massfloat
total value
- mass_cg: (3,) float np.ndarray
total value
- inertia: (6,) float np.ndarray
total value; [Ixx, Iyy, Izz, Ixy, Ixz, Iyz]
- pyNastran.bdf.mesh_utils.mass_properties.mass_properties(model: BDF, element_ids: list[int] | None = None, mass_ids: list[int] | None = None, reference_point: np.ndarray | None = None, sym_axis: str = '', scale: float | None = None, inertia_reference: str = 'cg')[source]
Calculates mass properties in the global system about the reference point, while considering WTMASS.
- Parameters:
- modelBDF()
a BDF object
- element_idslist[int]; ndarray
the element ids to consider
- mass_idslist[int]; ndarray
the mass ids to consider
- reference_point(3, ) ndarray; default = <0,0,0>.
an array that defines the origin of the frame.
- inertia_referencestr; default=’cg’
‘cg’ : inertia is taken about the cg ‘ref’ : inertia is about the reference point
- sym_axisstr; default=’’
‘yz’, ‘xz’, ‘xy’
- scalefloat; default=WTMASS
scales weight to mass (1/g) overwrites PARAM,WTMASS
- Returns:
- massfloat
the mass of the model; wtmass is considered
- cg(3, ) float ndarray
the cg of the model as an array.
- I(6, ) float ndarray
moment of inertia array([Ixx, Iyy, Izz, Ixy, Ixz, Iyz]); wtmass is considered
See also
model.mass_properties ..
- pyNastran.bdf.mesh_utils.mass_properties.mass_properties_breakdown(model: BDF, element_ids=None, mass_ids=None, nsm_id=None, reference_point=None, sym_axis: str | None = None, scale: float | None = None, inertia_reference: str = 'cg', debug: bool = False)[source]
Gets an incomplete breakdown the mass properties on a per element basis
- pyNastran.bdf.mesh_utils.mass_properties.mass_properties_no_xref(model, element_ids=None, mass_ids=None, reference_point=None, sym_axis: str = '', scale=None, inertia_reference='cg')[source]
Calculates mass properties without cross-referencing the model.
- pyNastran.bdf.mesh_utils.mass_properties.mass_properties_nsm(model: BDF, element_ids: list[int] | None = None, mass_ids: list[int] | None = None, nsm_id: int | None = None, reference_point: np.ndarray | None = None, sym_axis: str = '', scale: float | None = None, inertia_reference: str = 'cg', xyz_cid0_dict=None, debug: bool = False) tuple[float, np.ndarray, np.ndarray][source]
Calculates mass properties in the global system about the reference point. Considers NSM, NSM1, NSML, NSML1, and WTMASS.
- Parameters:
- modelBDF()
a BDF object
- element_idslist[int]; (n, ) ndarray, optional
An array of element ids.
- mass_idslist[int]; (n, ) ndarray, optional
An array of mass ids.
- nsm_idint
the NSM id to consider
- reference_pointndarray/int, optional
- typendarray
An array that defines the origin of the frame. default = <0,0,0>.
- typeint
the node id
- sym_axisstr; default=’’
The axis to which the model is symmetric. If AERO cards are used, this can be left blank. allowed_values = ‘no’, x’, ‘y’, ‘z’, ‘xy’, ‘yz’, ‘xz’, ‘xyz’
- scalefloat; default=wtmass
The WTMASS scaling value. default=None -> PARAM, WTMASS is used float > 0.0
- inertia_referencestr; default=’cg’
‘cg’ : inertia is taken about the cg ‘ref’ : inertia is about the reference point
- xyz_cid0_dictdict[nid]xyz; default=None -> auto-calculate
mapping of the node id to the global position
- debugbool; default=False
developer debug; may be removed in the future
- Returns:
- massfloat
The mass of the model; wtmass is considered
- cg(3,) float ndarray
The cg of the model
- inertia(6,) float ndarray
Moment of inertia array([Ixx, Iyy, Izz, Ixy, Ixz, Iyz]); wtmass is considered
- inertia = mass * centroid * centroid
\[I_{xx} = m (dy^2 + dz^2) ..\]\[I_{yz} = -m * dy * dz ..\]- where:
\[dx = x_{element} - x_{ref} ..\]Note
This doesn’t use the mass matrix formulation like Nastran. It assumes m*r^2 is the dominant term. If you’re trying to get the mass of a single element, it will be wrong, but for real models will be correct.
Warning
If eids are requested, but don’t exist, no warning is thrown. Decide if this is the desired behavior.
If the NSMx ALL option is used, the mass from all elements will be considered, even if not included in the element set
Examples
mass properties of entire structure
>>> mass, cg, inertia = mass_properties(model) >>> Ixx, Iyy, Izz, Ixy, Ixz, Iyz = inertia
mass properties of model based on Property ID >>> pids = list(model.properties.keys()) >>> pid_eids = model.get_element_ids_dict_with_pids(pids) >>> for pid, eids in sorted(pid_eids.items()): >>> mass, cg, inertia = mass_properties(model, element_ids=eids)
- pyNastran.bdf.mesh_utils.mass_properties.plot_inertia(total_mass: ndarray, cg: ndarray, inertia: ndarray) None[source]
- pyNastran.bdf.mesh_utils.mass_properties.transform_inertia(mass: float, xyz_cg: np.ndarray, xyz_ref1: np.ndarray, xyz_ref2: np.ndarray, inertia_ref1: np.ndarray, coord_cg=None, coord_ref1=None, coord_ref2=None, coord1: CORD2R | None = None, coord2: CORD2R | None = None, debug: bool = False) np.ndarray[source]
Transforms mass moment of inertia using parallel-axis theorem.
- Parameters:
- massfloat
the mass
- xyz_cg(3, ) float ndarray
the CG location in coord1
- xyz_ref1(3, ) float ndarray
the original reference location in coord1
- xyz_ref2(3, ) float ndarray
the new reference location in coord2
- coord_cg: CORD2R | None; default=None -> cid=0
the coordinate system for xyz_cg
- coord_ref1: CORD2R | None; default=None -> cid=0
the coordinate system for xyz_ref1
- coord_ref2: CORD2R | None; default=None -> cid=0
the coordinate system for xyz_ref2
- inertia_ref1(6, ) float ndarray
the mass moment of inertias about the original reference point [Ixx, Iyy, Izz, Ixy, Ixz, Iyz] in coord1
- coord1: CORD2R | None
the coordinate system for inertia_ref1 None: cid=0 (basic frame) not supported yet
- coord2: CORD2R | None
the coordinate system for inertia_ref2 None: cid=0 (basic frame) not validated yet
- Returns:
- inertia_new(6, ) float ndarray
the mass moment of inertias about the new reference point [Ixx, Iyy, Izz, Ixy, Ixz, Iyz]