处理 ANSYS 单元矩阵文件 (.emat)#
ANSYS 单元矩阵文件是 FORTRAN 格式的二进制文件,每个单元都包含以下内容:
Stiffness matrix 刚度矩阵
Mass matrix 质量矩阵
Damping matrix 阻尼矩阵
Stress stiffening matrix 应力硬化矩阵
Complex stiffness matrix 复刚度矩阵
Element force vectors 单元集中力向量
Example#
加载单元矩阵文件
from ansys.mapdl import reader as pymapdl_reader
emat_file = pymapdl_reader.read_binary('file.emat')
从结果文件中读取单个单元:
dof_ref, element_data = emat_file.read_element(0)
字典 element_data
包含用于构建刚度、质量和阻尼矩阵的条目。如果有记录,字典还将应用于集中力向量。
作用力#
读取所有节点的累计作用力:
applied_force = emat_file.global_applied_force()
请参阅 emat_file.nnum
,了解此作用力对应的排序节点。
DOF Reference#
来自 read_element
的每个自由度索引对应一个物理自由度。对应表如下:
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