pycufsm.helpers
Functions
|
generate the signature curve solution, part 1: find recommended lengths |
|
load Matlab CUFSM data from a MAT file |
|
Converts new format of inputs to old (original CUFSM) format |
|
Converts old (original CUFSM) format of inputs to new format |
Module Contents
- pycufsm.helpers.lengths_recommend(nodes: numpy.ndarray, elements: numpy.ndarray, length_append: float | None = None, n_lengths: int = 50) numpy.ndarray
generate the signature curve solution, part 1: find recommended lengths
- Args:
nodes (np.ndarray): standard parameter elements (np.ndarray): standard parameter length_append (Optional[float], optional): Any additional specific length to include
in the half-wavelengths. Defaults to None.
n_lengths (int, optional): number of half-wavelengths to include. Defaults to 50.
- Returns:
np.ndarray: recommended lengths
Z. Li, July 2010 (last modified) Function split by B Smith; this part only finds recommended lengths
- pycufsm.helpers.load_cufsm_mat(mat_file: str | None = None, mat_data: pycufsm._types.Cufsm_MAT_File | None = None) pycufsm._types.PyCufsm_Input
load Matlab CUFSM data from a MAT file
- Args:
- mat (Cufsm_MAT_File): dicionary of data read from a MAT file (as generated by
scipy.io.loadmat())
- Returns:
PyCufsm_Input: cleaned data ready for pyCUFSM input
- pycufsm.helpers.inputs_new_to_old(props: Dict[str, Dict[str, float]], nodes: pycufsm._types.ArrayLike, elements: Sequence[pycufsm._types.New_Element], lengths: pycufsm._types.ArrayLike | set | Dict[float, pycufsm._types.ArrayLike], node_props: Dict[Literal['all'] | int, pycufsm._types.New_Node_Props] | None = None, springs: Sequence[pycufsm._types.New_Spring] | None = None, constraints: Sequence[pycufsm._types.New_Constraint] | None = None, analysis_config: pycufsm._types.Analysis_Config | None = None, cfsm_config: pycufsm._types.Cfsm_Config | None = None) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, pycufsm._types.GBT_Con, pycufsm._types.BC, numpy.ndarray, int]
Converts new format of inputs to old (original CUFSM) format
- Args:
- props (Dict[str, Dict[str, float]]): Dictionary of named materials and their properties
{“mat_name”: {E_x: float, E_y: float, nu_x: float, nu_y: float, G_bulk: float}}
- nodes (ArrayLike): 2D array of nodal coordinates
[[x, y]] or [[x, y, stress]] Note that any node numbers used in later inputs refer to the index of the node in this ‘nodes’ array, with the first node being node 0. If array only has 2 columns, then stress is assumed to be 0.0 initially.
- elements (Sequence[New_Element]): Element connectivity and properties
- [{
nodes: “all”|List[int], # “all” or [node1, node2, node3, …] in sequence t: float, # thickness mat: str # “mat_name”
)]. nodes: “all” is a special indicator that all nodes should be connected sequentially If nodes is given as an array, any number of nodal indices may be listed in order
- lengths (Union[ArrayLike, set, Dict[float, ArrayLike]): Half-wavelengths for analysis
[length1, length2, …] # lengths only (assumes [m_a] = [1] for each length) {length: list[int]} # length: [m_a]
- node_props (Optional[Dict[Union[Literal[“all”, int], New_Node_Props]]): DOF restrictions
and stresses on nodes. {
- node_#|”all”: {
dof_x: bool, # defaults to True (included / not constrained) dof_y: bool, # defaults to True (included / not constrained) dof_z: bool, # defaults to True (included / not constrained) dof_q: bool, # defaults to True (included / not constrained)
}
} Defaults to None, and taken as all DOFs included and all 0.0 stresses if so
- springs (Optional[Sequence[New_Spring]]): Definition of any springs in cross-section
- [{
node: int, # node # k_x: float, # x stiffness k_y: float, # y stiffness k_z: float, # z stiffness k_q: float, # q stiffness k_type: str, # “foundation”|”node_pair”|”total” - stiffness type node_pair: int, # node # to which to pair (if relevant) discrete: bool, # whether spring is at a discrete location y: float, # location of discrete spring
}] Defaults to None.
- constraints (Optional[Sequence[New_Constraint]]): Definition of any constraints in section
- [{
elim_node: int, # node # elim_dof: str, # “x”|”y”|”z”|”q” - “q” is the twist dof coeff: float, # elim_dof = coeff * keep_dof keep_node: int, # node # keep_dof: str # “x”|”y”|”z”|”q” - “q” is the twist dof
}] Defaults to None.
- analysis_config (Optional[Analysis_Config]): Configuration options for any analysis
- {
B_C: str, # “S-S”|”C-C”|”S-C”|”C-F”|”C-G” - boundary condition type n_eigs: int # number of eigenvalues to consider
} Defaults to None, and taken as {B_C: “S-S”, n_eigs: 10} if so. Boundary condition types (at loaded edges):
‘S-S’ simple-simple ‘C-C’ clamped-clamped ‘S-C’ simple-clamped ‘C-F’ clamped-free ‘C-G’ clamped-guided
- cfsm_config (Optional[Cfsm_Config]): Configuration options for cFSM (constrained modes)
- {
- glob_modes: list(int), # list of 1’s (inclusion) and 0’s (exclusion) for
each mode from the analysis
- dist_modes: list(int), # list of 1’s (inclusion) and 0’s (exclusion) for
each mode from the analysis
- local_modes: list(int), # list of 1’s (inclusion) and 0’s (exclusion) for
each mode from the analysis
- other_modes: list(int), # list of 1’s (inclusion) and 0’s (exclusion) for
each mode from the analysis
null_space: str, # “ST”|”K_global”|”Kg_global”|”vector” normalization: str, # “none”|”vector”|”strain_energy”|”work” coupled: bool, # coupled basis vs uncoupled basis for general B.C. orthogonality: str # “natural”|”modal_axial”|”modal_load” - natural or
modal basis
} Defaults to None, in which case no cFSM analysis is performed null_space:
“ST”: ST basis “K_global”: null space of GDL with respect to K_global “Kg_global”: null space of GDL with respect to Kg_global “vector”: null space of GDL in vector sense
- coupled: basis for general B.C. especially for non-simply supported B.C.s
uncoupled basis = the basis will be block diagonal coupled basis = the basis is fully spanned
- orthogonality: natural basis vs modal basis
“natural”: natural basis “modal_axial”: modal basis, axial orthogonality “modal_load”: modal basis, load dependent orthogonality
- Returns:
props (np.ndarray): [mat_num stiff_x E_y nu_x nu_y G_bulk] 6 x n_mats nodes (np.ndarray): [node# x y dof_x dof_y dof_z dof_r stress] n_nodes x 8 elements (np.ndarray): [elem# node_i node_j thick mat_num] n_elements x 5 lengths (np.ndarray): [L1 L2 L3…] 1 x n_lengths lengths to be analyzed;
could be half-wavelengths for signature curve or physical lengths for general b.c.
- springs (np.ndarray): [node# d.o.f. k_spring k_flag] where 1=x dir 2= y dir 3 = z dir
4 = q dir (twist) flag says if k_stiff is a foundation stiffness or a total stiffness
- constraints (np.ndarray): [node# e dof_e coeff node# k dof_k] e=dof to be eliminated
k=kept dof dof_e_node = coeff*dof_k_node_k
- GBT_con (GBT_Con): GBT_con.glob,GBT_con.dist, GBT_con.local, GBT_con.other vectors of 1’s
and 0’s referring to the inclusion (1) or exclusion of a given mode from the analysis, GBT_con.o_space - choices of ST/O mode
1: ST basis 2: O space (null space of GDL) with respect to K_global 3: O space (null space of GDL) with respect to Kg_global 4: O space (null space of GDL) in vector sense
- GBT_con.norm - code for normalization (if normalization is done at all)
0: no normalization, 1: vector norm 2: strain energy norm 3: work norm
- GBT_con.couple - coupled basis vs uncoupled basis for general
B.C. especially for non-simply supported B.C.
1: uncoupled basis, the basis will be block diagonal 2: coupled basis, the basis is fully spanned
- GBT_con.orth - natural basis vs modal basis
1: natural basis 2: modal basis, axial orthogonality 3: modal basis, load dependent orthogonality
- B_C (str): [‘S-S’] a string specifying boundary conditions to be analyzed:
‘S-S’ simply-pimply supported boundary condition at loaded edges ‘C-C’ clamped-clamped boundary condition at loaded edges ‘S-C’ simply-clamped supported boundary condition at loaded edges ‘C-F’ clamped-free supported boundary condition at loaded edges ‘C-G’ clamped-guided supported boundary condition at loaded edges
- m_all (np.ndarray): m_all{length#}=[longitudinal_num# … longitudinal_num#],
longitudinal terms m for all the lengths in cell notation each cell has a vector including the longitudinal terms for this length
n_eigs (int): the number of eigenvalues to be determined at length (default=10) sect_props (Sect_Props): _description_
- pycufsm.helpers.inputs_old_to_new(props: pycufsm._types.ArrayLike, nodes: pycufsm._types.ArrayLike, elements: pycufsm._types.ArrayLike, lengths: pycufsm._types.ArrayLike, springs: pycufsm._types.ArrayLike, constraints: pycufsm._types.ArrayLike, GBT_con: pycufsm._types.GBT_Con, B_C: pycufsm._types.BC, m_all: pycufsm._types.ArrayLike, n_eigs: int) Tuple[Dict[str, pycufsm._types.New_Props], numpy.ndarray, List[pycufsm._types.New_Element], Dict[float, numpy.ndarray], Dict[Literal['all'] | int, pycufsm._types.New_Node_Props], List[pycufsm._types.New_Spring], List[pycufsm._types.New_Constraint], pycufsm._types.Analysis_Config, pycufsm._types.Cfsm_Config]
Converts old (original CUFSM) format of inputs to new format
- Args:
props (np.ndarray): [mat_num stiff_x E_y nu_x nu_y G_bulk] 6 x n_mats nodes (np.ndarray): [node# x y dof_x dof_y dof_z dof_r stress] n_nodes x 8 elements (np.ndarray): [elem# node_i node_j thick mat_num] n_elements x 5 lengths (np.ndarray): [L1 L2 L3…] 1 x n_lengths lengths to be analyzed;
could be half-wavelengths for signature curve or physical lengths for general b.c.
- springs (np.ndarray): [node# d.o.f. k_spring k_flag] where 1=x dir 2= y dir 3 = z dir
4 = q dir (twist) flag says if k_stiff is a foundation stiffness or a total stiffness
- constraints (np.ndarray): [node# e dof_e coeff node# k dof_k] e=dof to be eliminated
k=kept dof dof_e_node = coeff*dof_k_node_k
- GBT_con (GBT_Con): GBT_con.glob,GBT_con.dist, GBT_con.local, GBT_con.other vectors of 1’s
and 0’s referring to the inclusion (1) or exclusion of a given mode from the analysis, GBT_con.o_space - choices of ST/O mode
1: ST basis 2: O space (null space of GDL) with respect to K_global 3: O space (null space of GDL) with respect to Kg_global 4: O space (null space of GDL) in vector sense
- GBT_con.norm - code for normalization (if normalization is done at all)
0: no normalization, 1: vector norm 2: strain energy norm 3: work norm
- GBT_con.couple - coupled basis vs uncoupled basis for general
B.C. especially for non-simply supported B.C.
1: uncoupled basis, the basis will be block diagonal 2: coupled basis, the basis is fully spanned
- GBT_con.orth - natural basis vs modal basis
1: natural basis 2: modal basis, axial orthogonality 3: modal basis, load dependent orthogonality
- B_C (str): [‘S-S’] a string specifying boundary conditions to be analyzed:
‘S-S’ simply-pimply supported boundary condition at loaded edges ‘C-C’ clamped-clamped boundary condition at loaded edges ‘S-C’ simply-clamped supported boundary condition at loaded edges ‘C-F’ clamped-free supported boundary condition at loaded edges ‘C-G’ clamped-guided supported boundary condition at loaded edges
- m_all (np.ndarray): m_all{length#}=[longitudinal_num# … longitudinal_num#],
longitudinal terms m for all the lengths in cell notation each cell has a vector including the longitudinal terms for this length
n_eigs (int): the number of eigenvalues to be determined at length (default=10) sect_props (Sect_Props): _description_
- Returns:
- props (Dict[str, Dict[str, float]]): Dictionary of named materials and their properties
{“mat_name”: {E_x: float, E_y: float, nu_x: float, nu_y: float, G_bulk: float}}
- nodes (ArrayLike): 2D array of nodal coordinates
[[x, y]] Note that any node numbers used in later inputs refer to the index of the node in this ‘nodes’ array, with the first node being node 0.
- elements (Sequence[New_Element]): Element connectivity and properties
- [{
nodes: “all”|List[int], # “all” or [node1, node2, node3, …] in sequence t: float, # thickness mat: str # “mat_name”
)]. nodes: “all” is a special indicator that all nodes should be connected sequentially If nodes is given as an array, any number of nodal indices may be listed in order
- lengths (Union[ArrayLike, set, Dict[float, ArrayLike]): Half-wavelengths for analysis
[length1, length2, …] # lengths only (assumes [m_a] = [1] for each length) {length: list[int]} # length: [m_a]
- node_props (Optional[Dict[Union[Literal[“all”, int], New_Node_Props]]): DOF restrictions
and stresses on nodes. {
- node_#|”all”: {
dof_x: bool, # defaults to True (included / not constrained) dof_y: bool, # defaults to True (included / not constrained) dof_z: bool, # defaults to True (included / not constrained) dof_q: bool, # defaults to True (included / not constrained) stress: float # defaults to 0.0 (no stress)
}
} Defaults to None, and taken as all DOFs included and all 0.0 stresses if so
- springs (Optional[Sequence[New_Spring]]): Definition of any springs in cross-section
- [{
node: int, # node # k_x: float, # x stiffness k_y: float, # y stiffness k_z: float, # z stiffness k_q: float, # q stiffness k_type: str, # “foundation”|”node_pair”|”total” - stiffness type node_pair: int, # node # to which to pair (if relevant) discrete: bool, # whether spring is at a discrete location y: float, # location of discrete spring
}] Defaults to None.
- constraints (Optional[Sequence[New_Constraint]]): Definition of any constraints in section
- [{
elim_node: int, # node # elim_dof: str, # “x”|”y”|”z”|”q” - “q” is the twist dof coeff: float, # elim_dof = coeff * keep_dof keep_node: int, # node # keep_dof: str # “x”|”y”|”z”|”q” - “q” is the twist dof
}] Defaults to None.
- analysis_config (Optional[Analysis_Config]): Configuration options for any analysis
- {
B_C: str, # “S-S”|”C-C”|”S-C”|”C-F”|”C-G” - boundary condition type n_eigs: int # number of eigenvalues to consider
} Defaults to None, and taken as {B_C: “S-S”, n_eigs: 10} if so. Boundary condition types (at loaded edges):
‘S-S’ simple-simple ‘C-C’ clamped-clamped ‘S-C’ simple-clamped ‘C-F’ clamped-free ‘C-G’ clamped-guided
- cfsm_config (Optional[Cfsm_Config]): Configuration options for cFSM (constrained modes)
- {
- glob_modes: list(int), # list of 1’s (inclusion) and 0’s (exclusion) for
each mode from the analysis
- dist_modes: list(int), # list of 1’s (inclusion) and 0’s (exclusion) for
each mode from the analysis
- local_modes: list(int), # list of 1’s (inclusion) and 0’s (exclusion) for
each mode from the analysis
- other_modes: list(int), # list of 1’s (inclusion) and 0’s (exclusion) for
each mode from the analysis
null_space: str, # “ST”|”K_global”|”Kg_global”|”vector” normalization: str, # “none”|”vector”|”strain_energy”|”work” coupled: bool, # coupled basis vs uncoupled basis for general B.C. orthogonality: str # “natural”|”modal_axial”|”modal_load” - natural or
modal basis
} Defaults to None, in which case no cFSM analysis is performed null_space:
“ST”: ST basis “K_global”: null space of GDL with respect to K_global “Kg_global”: null space of GDL with respect to Kg_global “vector”: null space of GDL in vector sense
- coupled: basis for general B.C. especially for non-simply supported B.C.s
uncoupled basis = the basis will be block diagonal coupled basis = the basis is fully spanned
- orthogonality: natural basis vs modal basis
“natural”: natural basis “modal_axial”: modal basis, axial orthogonality “modal_load”: modal basis, load dependent orthogonality