Working with a ANSYS Element Matrix File (.emat)#
The ANSYS element matrix file is a FORTRAN formatted binary file containing the following for each element:
Stiffness matrix
Mass matrix
Damping matrix
Stress stiffening matrix
Complex stiffness matrix
Element force vectors
Example#
Load the element matrix file:
from ansys.mapdl import reader as pymapdl_reader
emat_file = pymapdl_reader.read_binary('file.emat')
Read a single element from the result file:
dof_ref, element_data = emat_file.read_element(0)
The dictionary element_data
contains the entries used to construct
stiffness, mass, and damping matrices. If recorded, the dictionary
will also applied force vectors.
Applied Force#
Read accumulated applied force for all nodes:
applied_force = emat_file.global_applied_force()
See emat_file.nnum
for the sorted nodes this applied force corresponds to.
DOF Reference#
Each degree of freedom index from read_element
corresponds to a
physical degree of freedom. The table of this correspondence is
below:
Index |
DOF |
1 |
UX |
2 |
UY |
3 |
UZ |
4 |
ROTX |
5 |
ROTY |
6 |
ROTZ |
7 |
AX |
8 |
AY |
9 |
AZ |
10 |
VX |
11 |
VY |
12 |
VZ |
16 |
WARP |
17 |
CONC |
18 |
HDSP |
19 |
PRES |
20 |
TEMP |
21 |
VOLT |
22 |
MAG |
23 |
ENKE |
24 |
ENDS |
25 |
EMF |
26 |
CURR |
27 - 32 |
Spares |
EmatFile Object Methods#
- class ansys.mapdl.reader.emat.EmatFile(filename)#
Enables pythonic access to an ANSYS element matrix file.
- Parameters:
filename (str, pathlib.Path) – File to open. Generally ends in
*.emat
.
Examples
>>> from ansys.mapdl import reader as pymapdl_reader >>> emat_file = pymapdl_reader.read_binary('file.emat')
- property eeqv#
Element equivalence table. This table equates the number used for storage to the actual element number.
Notes
The ANSYS program stores all element data in the numerical order that the SOLUTION processor solves the elements. This table equates the order number used to the actual element.
- property element_matrices_index_table#
Return element matrices index table
- property enum#
Sorted ANSYS element numbers
- property filename#
String form of the filename. This property is read-only.
- global_applied_force()#
Returns the applied force for each node.
- Returns:
applied_force – Applied force with size (n_nodes, n_dof). Result is sorted to correspond with the sorted global nodes array.
- Return type:
np.ndarray
- property n_dof#
Number of dofs per node
- property n_elements#
Number of elements in the file
- property n_nodes#
Number of nodes in the file
- property neqv#
Nodal equivalence table. This table equates the number used for storage to the actual node number.
- property nnum#
Sorted ANSYS node numbers
- property pathlib_filename#
Return the
pathlib.Path
version of the filename. This property can not be set.
- read_element(index, stress=True, mass=True, damping=True, stress_stiff=True, applied_force=True, newton_raphson=True, imaginary_load=True)#
Read element by index
- Parameters:
index (int) – Element index. This is not the element number. Reference the element equivalency table for the actual element number.
stress (bool, optional) – Return the stress matrix entries if available.
mass (bool, optional) – Return the mass matrix entries if available.
damping (bool, optional) – Return the damping matrix entries if available.
stress_stiff (bool, optional) – Return the stress stiffening entries if available.
newton_raphson (bool, optional) – Return the newton raphson load entries if available.
applied_force (bool, optional) – Return the applied load vector if available.
imaginary_load (bool, optional) – Return the imaginary load vector if available.
- Returns:
dof_idx (np.ndarray) – DOF index table. This record specifies the DOF locations of this element matrix in relation to the global matrix. The index is calculated as (N-1)*NUMDOF+DOF, where N is the position number of the node in the nodal equivalence table and DOF is the DOF reference number given above
element_data (dict) – Dictionary containing the following entries for each of the corresponding inputs when the item is True. - ‘stress’ : stress matrix entries - ‘mass’ : mass matrix entries - ‘damping’ : damping matrix entries - ‘stress_stiff’ : stress stiffening matrix entries - ‘newton_raphson’ : newton rapson load vector - ‘applied_force’ : applied force vector - ‘imaginary_load’ : imaginary load vector
Notes
If the matrix is diagonal, the length of the records will be nmrow. If the matrix is unsymmetric, the length of the records will be nmrow*nmrow. If the matrix is symmetric, only the lower triangular terms are written and the length of the records will be
(nmrow)*(nmrow+1)/2
Records are written relative to the dof_idx. The index is calculated as (N-1)*NUMDOF+DOF, where N is the position number of the node in the nodal equivalence table and DOF is the DOF reference number given by
dof_idx
.
- read_element_matrix_header(f_index)#
Read element matrix header
- Parameters:
f_indes (int) – Fortran index to the start of the element matrix header.
Notes
- stkey - stiffness matrix key
0 - matrix not present 1 - matrix present
- mkey - mass matrix key
0 - matrix not present 1 - matrix present
- dkey - damping matrix key
0 - matrix not present 1 - matrix present
- sskey - stress stiffening matrix key
0 - matrix not present 1 - matrix present
- akey - applied load vector key
0 - vector not used 1 - vector used
- nrkey - newton-raphson(restoring) load
0 - vector not used 1 - vector used
- ikey - imaginary load vector key (for complex analyses)
0 - vector not used 1 - vector used
- nmrow - numbers/columns in matrices.
If the number is negative, the matrices will be written in lower triangular form.
- read_header()#
Read standard emat file header