Importing Abaqus results#
This section explains how to import results from Abaqus simulations into HelloTriangle.
It covers running the provided Abaqus Python script to extract data from an ODB file, converting it to JSON,
and loading the results as Mesh objects for visualization and analysis.
Running the Abaqus Python extraction script#
To extract results from an Abaqus ODB file, use the included Python script
odb_to_json_v2.py. This script reads your ODB, exports selected fields, and writes them to a JSON file
that can be read by HelloTriangle.
Note
You can download the script here (right-click to download): odb_to_json_v2.py.
Before running the script, you need to specify:
ODB file path (odb_path) – path to your Abaqus ODB file. You can just provide the file name if you run the script from the same directory where the ODB file is located.
Output JSON file (output_json) – filename for the extracted data.
Field requests (field_requests) – a list of field names to extract. Both native and derived fields are supported (e.g.,
U,LE_MAX_PRINC,S_VON_MISES).Extrapolation mode (extrapolation_mode) – only
element_nodal(element fields are extrapolated to element nodes) is available for now.Step and frame selection (steps_selection) – specify which steps and frames to extract. This is a dictionary where the keys are step names and the values can be either:
'all'→ export all frames in that steplist of frame indices → export only the selected frames, for example
[0, 5, -1]--1always refers to the last frame of the step
# Example user input in odb_to_json.py
odb_path = "mysimulation.odb"
output_json = "mysimulation.json"
field_requests = ["U", "COORD", "LE_MAX_PRINC", "S_VON_MISES"]
extrapolation_mode = "element_nodal"
steps_selection = {
"mystep1": 'all', # export all frames
"mystep2": [0, 5, -1], # export frames 0, 5, and last frame
}
Once configured, run the script with Abaqus Python:
abaqus python odb_to_json_v2.py
The resulting JSON file can now be imported into HelloTriangle.
Important
HelloTriangle is a cloud-based platform. Large JSON files from Abaqus simulations can slow down uploads and processing. To ensure a smooth user experience, export only the fields, steps and frames you need, especially when dealing with large meshes.
Loading Abaqus results in HelloTriangle#
To import the JSON file and convert it to Mesh objects, use
import_abaqus_results() from the abaqus_import module.
from hellotriangle.io.abaqus_import import import_abaqus_results
# Load JSON as a Python dictionary
abq_data = load("mysimulation.json")
# Convert to HelloTriangle Mesh objects
meshes = import_abaqus_results(
abq_data,
step_name="mystep1", # Optional, default: last step
frame_number=-1, # Optional, default: last frame
elemn_to_node=True, # Optional, convert element-nodal fields to node-based
compact=True # Optional, compact resulting meshes
)
Note
If elemn_to_node is enabled, the field values are averaged at nodes.
Node-based fields are not affected.
Warning
The function assumes that the JSON was generated using the provided Abaqus Python script. Any modifications to the script that change the JSON structure may cause this function to fail or import data incorrectly.
Accessing meshes and fields#
Once imported, each instance in the Abaqus model is available as a Mesh object
keyed by instance name:
part1 = meshes["PART1-1_C3D8R"]
part2 = meshes["PART2-1_S4"]
Note
If the displacement field U was included in the extracted JSON, the node coordinates
in the meshes are automatically deformed according to the selected step and frame.
Listing available fields:
print(part1.field_report())
This prints all fields attached to the mesh, including:
Node fields (type
node)Element-nodal fields (type
elemn)Element fields (type
elem)
Using fields for visualization#
Fields can be used directly when rendering meshes. For example, to draw the part colored by von Mises stress:
draw(part1, field="S_VON_MISES")