ModelMass

class opstool.pre.ModelMass[source]

Bases: object

A class used to generate node masses. Element mass is distributed equally to each connected node.

Methods

add_mass_from_brick

Add mass from tetrahedral or hexahedral elements.

add_mass_from_line

Add mass from two-node line elements.

add_mass_from_solid

Add mass from tetrahedral or hexahedral elements.

add_mass_from_surf

Add mass from a planar element, including shell.

add_node_mass

Add mass to the existing node mass.

generate_ops_gravity_load

Call the OpenSeesPy load command to generate a nodal gravity load.

generate_ops_node_mass

Call the OpenSeesPy node mass command to generate all node masses.

get_node_mass

Get nodal mass.

get_total_mass

Get the total mass of the model.

reset

Attributes

nodal_mass

Returns: nodal_mass: dict[int, float] The nodal mass dict, the key is nodeTag, value is nodal mass.

total_mass

Returns: total_mass: float The total mass.

add_node_mass(node_tag, mass)[source]

Add mass to the existing node mass.

Parameters

node_tag: int, node tag. mass: float, mass value.

Returns

None

add_mass_from_line(ele_tags, rho, area)[source]

Add mass from two-node line elements.

Parameters

ele_tags: Union[list, int]

Element tag or list.

rho: Union[list, float]

Mass density or list, if list length shoud same as ele_tags.

area: Union[list, float]

Cross-sectional area or list, if list length shoud same as ele_tags.

add_mass_from_surf(ele_tags, rho, d)[source]

Add mass from a planar element, including shell.

Parameters

ele_tags: Union[list, int]

Element tag or list.

rho: Union[list, float]

Mass density or list, if list length shoud same as ele_tags.

d: Union[list, float]

Element thickness or list, if list length shoud same as ele_tags.

add_mass_from_brick(ele_tags, rho)[source]

Add mass from tetrahedral or hexahedral elements.

Parameters

ele_tags: Union[list, int]

Element tag or list.

rho: Union[list, float]

Mass density or list, if list length shoud same as ele_tags.

add_mass_from_solid(ele_tags, rho)[source]

Add mass from tetrahedral or hexahedral elements.

Parameters

ele_tags: Union[list, int]

Element tag or list.

rho: Union[list, float]

Mass density or list, if list length shoud same as ele_tags.

get_total_mass()[source]

Get the total mass of the model.

Returns

total_mass: float

property total_mass

Returns:

total_mass: float

The total mass.

property nodal_mass

Returns:

nodal_mass: dict[int, float]

The nodal mass dict, the key is nodeTag, value is nodal mass.

generate_ops_node_mass()[source]

Call the OpenSeesPy node mass command to generate all node masses. The inertia moment of the rotational dof will be ignored.

Note

This function will use the mass command to generate a lumped mass matrix, and does not apply it repeatedly with the mass parameters when the element is defined. This means that if you use this function, please ignore the mass parameter in the element definition, such as the '-mass' option of some beam--column elements, and the density parameter in nDMaterial.

Returns

None

generate_ops_gravity_load(direction, factor=-9.81, exclude_nodes=None)[source]

Call the OpenSeesPy load command to generate a nodal gravity load.

Parameters

direction: str,

The gravity load direction.

factor: float, default=-9.81

The factor applied to the mass values, it should be the multiplication of gravitational acceleration and directional indicators, e.g., -9.81, where 9.81 is the gravitational acceleration and -1 indicates along the negative Z axis. Of course, it can be multiplied by an additional factor to account for additional constant loads, e.g., 1.05 * (-9.81).

exclude_nodes: list, default=None

Excluded node tags, whose masses will not be used to generate gravity loads.

Returns

None

get_node_mass(node_tags=None)[source]

Get nodal mass.

Parameters

node_tags: list, optional, default=None

If None, return all node masses, else return node mass in node_tags.

Returns

node_mass: dict

A dict obj whose keys are node tags and whose values are masses.