Postprocessing¶
Data Saving¶
- opstool.post.set_odb_path(path)[source]¶
Set the output directory for the results.
Parameters:¶
- path: str
The path to the output directory.
- opstool.post.save_model_data(odb_tag=1)[source]¶
Save the model data from the current domain.
Parameters¶
- odb_tag: Union[str, int], default = 1
Output database tag, the data will be saved in
ModelData-{odb_tag}.nc.
- opstool.post.save_eigen_data(odb_tag=1, mode_tag=1, solver='-genBandArpack')[source]¶
Save modal analysis data.
Parameters¶
- odb_tag: Union[str, int], default = 1
Output database tag, the data will be saved in
EigenData-{odb_tag}.nc.- mode_tagint, optional,
Modal tag, all modal data smaller than this modal tag will be saved, by default 1
- solverstr, optional,
OpenSees’ eigenvalue analysis solver, by default “-genBandArpack”. See eigen Command
- class opstool.post.CreateODB(odb_tag=1, model_update=False, save_nodal_resp=True, save_frame_resp=True, save_truss_resp=True, save_link_resp=True, save_shell_resp=True, save_fiber_sec_resp=True, save_plane_resp=True, save_brick_resp=True, save_contact_resp=True, node_tags=None, frame_tags=None, truss_tags=None, link_tags=None, shell_tags=None, plane_tags=None, brick_tags=None, contact_tags=None)[source]¶
Create an output database (ODB) to save response data.
Parameters¶
- odb_tag: Union[int, str], default: 1
Tag of output databases (ODB) to be saved.
- model_update: bool, default: False
Whether to update the model data.
Note
If True, the model data will be updated at each step. If no nodes and elements are added or removed during the analysis of your model, keep this parameter set to False. Enabling model updates unnecessarily can increase memory usage and slow down performance. If some nodes or elements are deleted during the analysis, you should set this parameter to True.
- save_nodal_resp: bool, default: True
Whether to save nodal responses.
- save_frame_resp: bool, default: True
Whether to save frame element responses.
- save_truss_resp: bool, default: True
Whether to save truss element responses.
- save_link_resp: bool, default: True
Whether to save link element responses.
- save_shell_resp: bool, default: True
Whether to save shell element responses.
- save_fiber_sec_resp: bool, default: True
Whether to save fiber section responses.
- save_plane_resp: bool, default: True
Whether to save plane element responses.
- save_brick_resp: bool, default: True
Whether to save brick element responses.
- save_contact_resp: bool, default: True
Whether to save contact element responses.
- node_tags: Union[list, tuple, int], default: None
Node tags to be saved. If None, save all nodes’ responses.
- frame_tags: Union[list, tuple, int], default: None
Frame element tags to be saved. If None, save all frame elements’ responses.
- truss_tags: Union[list, tuple, int], default: None
Truss element tags to be saved. If None, save all truss elements’ responses.
- link_tags: Union[list, tuple, int], default: None
Link element tags to be saved. If None, save all link elements’ responses.
- shell_tags: Union[list, tuple, int], default: None
Shell element tags to be saved. If None, save all shell elements’ responses.
- plane_tags: Union[list, tuple, int], default: None
Plane element tags to be saved. If None, save all plane elements’ responses.
- brick_tags: Union[list, tuple, int], default: None
Brick element tags to be saved. If None, save all brick elements’ responses.
- contact_tags: Union[list, tuple, int], default: None
Contact element tags to be saved.
Note
If you enter optional node and element tags to avoid saving all data, make sure these tags are not deleted during the analysis. Otherwise, unexpected behavior may occur.
- fetch_response_step(print_info=False)[source]¶
Extract response data for the current moment.
Parameters¶
- print_info: bool, optional
print information, by default, False
Result Reading¶
- opstool.post.get_model_data(odb_tag=None, data_type='Nodal', from_responses=False)[source]¶
Read model data from a file.
Parameters¶
- odb_tag: Union[int, str], default: one
Tag of output databases (ODB) to be read.
- data_type: str, default: Nodal
Type of data to be read. Optional: “Nodal”
- from_responses: bool, default: False
Whether to read data from response data. If True, the data will be read from the response data file. This is useful when the model data is updated in an analysis process.
Returns¶
ModelData: xarray.Dataset if model_update is True, otherwise xarray.DataArray
- opstool.post.get_eigen_data(odb_tag=None)[source]¶
Get the eigenvalue data from the saved file.
Parameters¶
- odb_tag: Union[int, str], default: None
Tag of output databases (ODB) have been saved.
Returns¶
- modal_props: xr.DataArray
Modal properties’ data.
- eigenvectors: xr.DataArray
Eigen vectors data.
- opstool.post.get_nodal_responses(odb_tag, resp_type=None, node_tags=None)[source]¶
Read nodal responses data from a file.
- Return type:
Dataset
Parameters¶
- odb_tag: Union[int, str], default: one
Tag of output databases (ODB) to be read.
- resp_type: str, default: disp
Type of response to be read. Optional:
“disp” - Displacement at the node.
“vel” - Velocity at the node.
“accel” - Acceleration at the node.
“reaction” - Reaction forces at the node.
“reactionIncInertia” - Reaction forces including inertial effects.
“rayleighForces” - Forces resulting from Rayleigh damping.
“pressure” - Pressure applied to the node.
If None, return all responses.
Note
If the nodes include fluid pressure dof, such as those used for …UP elements, the pore pressure should be extracted using
resp_type="vel", and the value is placed in the degree of freedomRZ.- node_tags: Union[list, tuple, int], default: None
Node tags to be read. Such as [1, 2, 3] or numpy.array([1, 2, 3]) or 1. If None, return all nodal responses.
Note
If some nodes are deleted during the analysis, their response data will be filled with numpy.nan.
Returns¶
- NodalResp: xarray.Dataset
Nodal responses’ data.
Note
The returned data can be viewed using .dims and .coords to view the dimension names and coordinates. You can further index or process the data.
- opstool.post.get_element_responses(odb_tag, ele_type, resp_type=None, ele_tags=None)[source]¶
Read nodal responses data from a file.
- Return type:
Dataset
Parameters¶
- odb_tag: Union[int, str], default: one
Tag of output databases (ODB) to be read.
- ele_type: str, default: Frame
Type of element to be read. Optional: “Frame”, “Truss”, “Link”, “Shell”, “Plane”, “Solid”, “Contact
- resp_type: str, default: disp
The response type, which depends on the parameter ele_type. If None, return all responses to that ele_type.
- For Frame:
“localForces”: Local forces in the element local coordinate system.
“basicForces”: Basic forces in the element basic coordinate system.
“basicDeformations”: Basic deformations in the element basic coordinate system.
“plasticDeformation”: Plastic deformations in the element basic coordinate system.
“sectionForces”: Section forces in the element coordinate system.
“sectionDeformations”: Section deformations in the element coordinate system.
“sectionLocs”: Section locations, 0.0 to 1.0.
- For Truss:
“axialForce”: Axial force.
“axialDefo”: Axial deformation.
“Stress”: Stress of material.
“Strain”: Strain of material.
- For Link:
“basicDeformation”: Basic deformation, i.e., pure deformation.
“basicForce”: Basic force.
- For Shell:
“sectionForces”: Sectional forces at Gauss points (per unit length).
“sectionDeformations”: Sectional deformation at Gauss points (per unit length).
- For Plane:
“stresses”: Stresses at Gauss points.
“strains”: Strains at Gauss points.
- For Brick or ‘Solid’:
“stresses”: Stresses at Gauss points.
“strains”: Strains at Gauss points.
- For Contact:
“localForces”: Local forces in the element local coordinate system (normal and tangential).
“localDisp”: Local displacements in the element local coordinate system (normal and tangential).
“slips”: Slips in the element local coordinate system (tangential).
- ele_tags: Union[list, tuple, int], default: None
Element tags to be read. Such as [1, 2, 3] or numpy.array([1, 2, 3]) or 1. If None, return all nodal responses.
Note
If some nodes are deleted during the analysis, their response data will be filled with numpy.nan.
Returns¶
- EleResp: xarray.Dataset
Element responses’ data.
Note
The returned data can be viewed using .dims、.coords and .attrs to view the dimension names and coordinates. You can further index or process the data.