The OdbClient class
- class odbclient.OdbClient(odb_file, abaqus_bin=None, python_env_path=None)[source]
The interface class to access data from odb files provided by the odbserver.
- Parameters:
odb_file (string) – The path to the odb file
abaqus_bin (string, optional) – The path to the abaqus binary (not a .bat or shell script). Guessed if not given.
python_env_path (string, optional) – The path to the python2 environmnent to be used by the odbserver. Guessed if not given.
Examples
Instantiating and querying instance names
>>> import odbclient as CL >>> client = CL.OdbClient("some_file.odb") >>> client.instance_names() ['PART-1-1']
Querying node coordinates
>>> client.node_coordinates('PART-1-1') x y z node_id 1 -30.0 15.0 10.0 2 -30.0 25.0 10.0 3 -30.0 15.0 0.0 ...
Querying step names
>>> client.step_names() ['Load']
Querying frames of a step
>>> client.frame_ids('Load') [0, 1]
Querying variable names of a frame and step
>>> client.variable_names('Load', 1) ['CF', 'COORD', 'E', 'EVOL', 'IVOL', 'RF', 'S', 'U']
Querying variable data of an instance, frame and step
>>> client.variable('S', 'PART-1-1', 'Load', 1) S11 S22 ... S13 S23 node_id element_id ... 5 1 -38.617779 2.705118 ... -3.578981 1.355571 7 1 -38.617779 2.705118 ... 3.578981 -1.355571 3 1 -50.749348 -21.749729 ... -7.597347 -0.000003 1 1 -50.749348 -21.749729 ... 7.597347 0.000003 6 1 38.643414 -2.588303 ... 3.522046 1.446851 ... ... ... ... ... ... 54 4 7.353698 -3.177251 ... 1.775653 -2.608372 56 4 -6.695759 -17.656754 ... 0.217049 -3.040078 55 4 -6.695759 -17.656754 ... -0.217049 3.040078 47 4 -0.226473 1.787100 ... 0.967435 -0.671089 48 4 -0.226473 1.787100 ... -0.967435 0.671089
Oftentimes it is desirable to have the node coordinates and multiple field variables in one dataframe. This can be easily achieved by
join()
operations.>>> node_coordinates = client.node_coordinates('PART-1-1') >>> stress = client.variable('S', 'PART-1-1', 'Load', 1) >>> strain = client.variable('E', 'PART-1-1', 'Load', 1) >>> node_coordinates.join(stress).join(strain) x y z ... E12 E13 E23 node_id element_id ... 5 1 -20.0 15.0 10.0 ... -2.741873e-11 -4.652675e-11 1.762242e-11 7 1 -20.0 15.0 0.0 ... -2.741873e-11 4.652675e-11 -1.762242e-11 3 1 -30.0 15.0 0.0 ... -2.599339e-11 -9.876550e-11 -3.946581e-17 1 1 -30.0 15.0 10.0 ... -2.599339e-11 9.876550e-11 3.946581e-17 6 1 -20.0 25.0 10.0 ... -2.689760e-11 4.578660e-11 1.880906e-11 ... ... ... ... ... ... ... ... 54 4 5.0 25.0 10.0 ... -6.076223e-11 2.308349e-11 -3.390884e-11 56 4 10.0 20.0 10.0 ... -5.091068e-11 2.821631e-12 -3.952102e-11 55 4 10.0 20.0 0.0 ... -5.091068e-11 -2.821631e-12 3.952102e-11 47 4 0.0 20.0 0.0 ... -5.129363e-11 1.257666e-11 -8.724152e-12 48 4 0.0 20.0 10.0 ... -5.129363e-11 -1.257666e-11 8.724152e-12
- element_connectivity(instance_name, elset_name='')[source]
Query the element connectivity of an instance.
- Parameters:
instance_name (string) – The name of the instance to be queried
elset_name (string, optional) – A name of an element set of the instance that the query is to be limited to.
- Returns:
connectivity – The connectivity as a
pandas.DataFrame
. For every element there is list of node ids that the element is connected to.- Return type:
- element_ids(elset_name, instance_name='')[source]
Query the element ids of a certain element set.
- Parameters:
elset_name (string) – The name of the element set
instance_name (string, optional) – The name of the instance the element set is to be taken from. If not given element sets from all instances are considered.
- Returns:
element_ids – The element ids as
pandas.Index
- Return type:
- elset_names(instance_name='')[source]
Query the available element set names.
- Parameters:
instance_name (string, optional) – The name of the instance the element sets are queried from. If not given the element sets of all instances are returned.
- Returns:
instance_names – The names of the instances
- Return type:
list of strings
- frame_ids(step_name)[source]
Query the frames of a given step.
- Parameters:
step_name (string) – The name of the step
- Returns:
step_name – The name of the step the frame ids are expected in.
- Return type:
list of ints
- instance_names()[source]
Query the instance names from the odbserver.
- Returns:
instance_names – The names of the instances.
- Return type:
list of string
- node_coordinates(instance_name, nset_name='')[source]
Query the node coordinates of an instance.
- Parameters:
instance_name (string) – The name of the instance to be queried
nset_name (string, optional) – A name of a node set of the instance that the query is to be limited to.
- Returns:
node_coords – The node list as a pandas data frame without connectivity. The columns are named
x
,y
andz
.- Return type:
- node_ids(nset_name, instance_name='')[source]
Query the node ids of a certain node set.
- Parameters:
nset_name (string) – The name of the node set
instance_name (string, optional) – The name of the instance the node set is to be taken from. If not given node sets from all instances are considered.
- Returns:
node_ids – The node ids as
pandas.Index
- Return type:
- nset_names(instance_name='')[source]
Query the available node set names.
- Parameters:
instance_name (string, optional) – The name of the instance the node sets are queried from. If not given the node sets of all instances are returned.
- Returns:
instance_names – The names of the instances
- Return type:
list of strings
- step_names()[source]
Query the step names from the odb file.
- Returns:
step_names – The names of all the steps stored in the odb file.
- Return type:
list of string
- variable(variable_name, instance_name, step_name, frame_id, nset_name='', elset_name='', position=None)[source]
Read field variable data.
- Parameters:
variable_name (string) – The name of the variable.
instance_name (string) – The name of the instance.
step_name (string) – The name of the step
frame_id (int) – The index of the frame
nset_name (string, optional) – The name of the node set to be queried. If not given, the whole instance
elnset_name (string, optional) – The name of the element set to be queried. If not given, the whole instance
position (string, optional) –
Position within element. Terminology as in Abaqus .inp file:
INTEGRATION POINTS
,CENTROIDAL
,WHOLE ELEMENT
,NODES
,FACES
,AVERAGED AT NODES
If not given the native position is taken, except for
INTEGRATION_POINTS
TheELEMENT_NODAL
position is used.