CreateODB

class opstool.post.CreateODB(odb_tag=1, model_update=False, save_every=None, dtype=None, zlib=False, **kwargs)[source]

Bases: object

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. This tag can be used to identify the load case and is used in post-processing and visualization to identify which results are processed.

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_every: Optional[int], default: None

Save response data at a fixed interval of analysis steps.

Added since version 1.0.25.

Note

If set to an integer value, response data will be written to disk every save_every steps. This is particularly useful for large models with many analysis steps, as it allows responses to be flushed periodically into multiple ODB files, significantly reducing peak memory usage.

If set to None, all response data are accumulated in memory and written to a single ODB file at the end of the analysis. This option provides the best runtime performance due to minimal I/O overhead, but may require substantial memory for large-scale models.

In practice, this parameter should be chosen based on the model size and available system memory. If sufficient memory is available, it is recommended to keep save_every=None. Smaller values of save_every increase the frequency of disk writes, leading to higher disk usage and potentially slower data loading in subsequent post-processing stages.

dtype: dict, default: dict(int=np.int32, float=np.float32)

Set integer and floating point precision types.

zlib: bool, default: False

Whether to compress the response data file. Only works when odb_format is set to “nc” in opstool.post.set_odb_format(). Added since version 1.0.25.

kwargs: Other post-processing parameters, optional:
  • elastic_frame_sec_points: int, default: 7

    The number of elastic frame elements section points. A larger number may result in a larger file size.

  • interpolate_beam_disp: Union[bool, int], default: False, added since version 1.0.25

    Whether to interpolate beam displacements for nodal response of beam elements. If True, shape functions will be used to interpolate the displacements of beam elements for a smoother visualization. If an integer n is provided, it specifies the number of interpolation points along each beam element. If you have a large number of beam elements, enabling this option may slow down the plotting process, and it is recommended to disable it. Interpolation will not have a significant effect when applied to sufficiently subdivided beam elements; instead, it will increase the data size and slow down the speed.

  • section_response_dof: Optional[dict], default: None

    A dictionary to specify the section response type for different section types. The keys are the section types, and the values are the response types. For example, to specify the response type for “SectionAggregator”, you can set:

    {
        "SectionAggregator": ["P", "MZ", "MY", "T", "VY", "VZ"]  # means you use the section "P", "MZ", "MY", "T" and addtional "VY", "VZ" dof.
    }
    

    This is because for some section types, such as Aggregator, the number and order of the degrees of freedom are specified by the user. For other sections, the program can determine them automatically.

  • compute_mechanical_measures: Union[bool, str, dict], default: “All”

    Whether to compute mechanical measures for solid and planar elements, including principal stresses, principal strains, von Mises stresses, etc. If False, no mechanical measures will be computed. If True or “All”, all mechanical measures will be computed.

    Otherwise, you can specify a dictionary to indicate which measures to compute. Dictionary keys are the names of mechanical measures, and values are parameters needed for computation. Only the measures specified in the dictionary will be computed. For example, the default setting is:

    {
        "principal": None,  # principal stresses
        "von-mises": None,  # von Mises stress
        "octahedral": None,  # octahedral stresses (sigma_oct, tau_oct)
        "tau_max": None,  # maximum shear stress (Tresca)
    }
    

    where the keys are the names of mechanical measures to be computed, and the values are None because no additional parameters are needed for these measures. If you want to compute the Mohr-Coulomb or Drucker-Prager equivalent stress with specific parameters, you can set:

    {
        "principal": None,  # principal stresses
        "von-mises": None,  # von Mises stress
        "octahedral": None,  # octahedral stresses (sigma_oct, tau_oct)
        "tau_max": None,  # maximum shear stress (Tresca)
        # Mohr-Coulomb  with Tension-Compression Form
        "mohr_coulomb_sy": {"syc": <compressive strength>, "syt": <tensile strength>},
        # Mohr-Coulomb with Cohesion-Friction Form
        "mohr_coulomb_c_phi": {"c": <cohesion>, "phi": <friction angle in degrees>},
        # Drucker-Prager with Tension-Compression Form
        "drucker_prager_sy": {"syc": <compressive strength>, "syt": <tensile strength>},
        # Drucker-Prager with Cohesion-Friction Form
        "drucker_prager_c_phi": {"c": <cohesion>, "phi": <friction angle in degrees>, "kind": <circumscribed/middle/inscribed>},
    }
    

    For detailed information, see Stress and Strength Criteria.

  • project_gauss_to_nodes: Optional[str], default: “copy”

    Method to project Gauss point responses to nodes. Options are:

    • "copy": Copy Gauss point responses to nodes, that is, the node’s response comes from the nearest Gaussian point.

    • "average": Average Gauss point responses to nodes by integrate weight.

    • "extrapolate": Extrapolate Gauss point responses to nodes by element shape function.

    • None or False: Do not project Gauss point responses to nodes.

  • Whether to save the responses:
    • 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.

    • save_sensitivity_resp: bool, default: False

      Whether to save sensitivity analysis responses.

  • Nodes or elements that need to be saved:
    • 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.

    • fiber_ele_tags: Union[list, str], default: None

      Element tags that contain fiber sections to be saved. If “all”, save all fiber section elements responses. If None, save nothing.

    • 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.

    • sensitivity_para_tags: Union[list, tuple, int], default: None

      Sensitivity parameter 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.

Methods

combine_response_spectrum

Combine modal responses data, only for response spectrum analysis.

fetch_response_step

Extract response data for the current analysis step.

reset

Reset the ODB model.

save_eigen_data

Save modal analysis data.

save_model_data

Save the model data from the current domain.

save_response

Save all response data.

reset()[source]

Reset the ODB model.

fetch_response_step(print_info=False)[source]

Extract response data for the current analysis step.

Parameters

print_info: bool, optional

print information, by default, False

combine_response_spectrum(method='srss', lambdas=None, damping=0.05, scale=1.0)[source]

Combine modal responses data, only for response spectrum analysis.

Note

This method only works when save_every=None in opstool.post.CreateODB().

Parameters

method{“srss”, “cqc”}

Combination method.

lambdasarray-like, optional

Modal frequencies. Required for CQC.

dampingfloat or array-like

Modal damping ratios. Optional for CQC.

scalearray-like or None

Modal scaling factors. Optional for CQC.

save_response(zlib=None)[source]

Save all response data.

save_eigen_data(mode_tag=1, solver='-genBandArpack')[source]

Save modal analysis data.

Parameters

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”.

save_model_data()[source]

Save the model data from the current domain.