如何使用 pyansys 库解释带有 python 的 .rst 结果文件?
How do I interpret .rst results file with python using pyansys library?
我正在使用 ansys.mapdl 库 reader 读取二进制文件“.rst”,我想了解这些结果。我在 ansys mechanical 上模拟了一个梁,我正在评估总变形、等效弹性应变和等效应力。
哪些节点与哪些值关联?这三个结果如何分开?另外,我尝试打印随机数据只是为了尝试理解它,但有些数据是 NAN,所以我想知道为什么会这样。
这是模拟和一些代码
编辑:
这是从 ansys mechanical 导出到 .txt 文件的前 10 个节点的总变形
Node Number Total Deformation (m)
1 3,4011e-002
2 3,1337e-002
3 2,8684e-002
4 2,6064e-002
5 2,3489e-002
6 2,097e-002
7 1,8522e-002
8 1,6157e-002
9 1,389e-002
10 1,1736e-002
这是我在 运行 这个小脚本
之后的结果
rst_results = path + "file.rst"
model = pymapdl_reader.read_binary(rst_results)
nnum, data = model.nodal_solution(0, nodes=range(1, 10))
print(data)
输出:
[[-1.30837114e-03 -5.18717535e-07 -3.39862333e-02]
[-1.19035991e-03 -6.35982671e-07 -3.13144870e-02]
[-1.07379301e-03 -8.05693695e-07 -2.86642968e-02]
[-9.59576794e-04 -1.01205615e-06 -2.60467228e-02]
[-8.48646606e-04 -1.24353973e-06 -2.34735376e-02]
[-7.41942455e-04 -1.49284317e-06 -2.09571697e-02]
[-6.40385662e-04 -1.75494961e-06 -1.85106729e-02]
[-5.44855004e-04 -2.02586199e-06 -1.61477097e-02]
[-4.56160962e-04 -2.30167900e-06 -1.38825364e-02]]
来自docs:
def principal_nodal_stress(self, rnum, nodes=None):
"""Computes the principal component stresses for each node in
the solution.
Parameters
----------
rnum : int or list
Cumulative result number with zero based indexing, or a
list containing (step, substep) of the requested result.
Returns
-------
nodenum : numpy.ndarray
Node numbers of the result.
pstress : numpy.ndarray
Principal stresses, stress intensity, and equivalent stress.
[sigma1, sigma2, sigma3, sint, seqv]
Examples
--------
Load the principal nodal stress for the first solution.
>>> from ansys.mapdl import reader as pymapdl_reader
>>> rst = pymapdl_reader.read_binary('file.rst')
>>> nnum, stress = rst.principal_nodal_stress(0)
所以节点数数组 nnum
中的每个数字对应于 stress
中的应力。
你能检查哪些节点号对应于中间节点吗?用于打印输出和后处理的节点应力数据仅适用于角节点。所以我猜这就是 nan
.
的原因
对于节点位移:
>>> from ansys.mapdl import reader as pymapdl_reader
>>> rst = pymapdl_reader.read_binary('file.rst')
>>> nnum, data = rst.nodal_solution(0)
对于弹性应变,您需要一个单元结果:
>>> enum, edata, enode = rst.element_solution_data(0, datatype='EEL')
>>> enum[0] # first element number
>>> enode[0] # nodes belonging to element 1
>>> edata[0] # data belonging to element 1
可用的结果是:
EMS: misc. data
ENF: nodal forces
ENS: nodal stresses
ENG: volume and energies
EGR: nodal gradients
EEL: elastic strains
EPL: plastic strains
ECR: creep strains
ETH: thermal strains
EUL: euler angles
EFX: nodal fluxes
ELF: local forces
EMN: misc. non-sum values
ECD: element current densities
ENL: nodal nonlinear data
EHC: calculated heat
EPT: element temperatures
ESF: element surface stresses
EDI: diffusion strains
ETB: ETABLE items (post1 only)
ECT: contact data
EXY: integration point locations
EBA: back stresses
ESV: state variables
MNL: material nonlinear record
我正在使用 ansys.mapdl 库 reader 读取二进制文件“.rst”,我想了解这些结果。我在 ansys mechanical 上模拟了一个梁,我正在评估总变形、等效弹性应变和等效应力。
哪些节点与哪些值关联?这三个结果如何分开?另外,我尝试打印随机数据只是为了尝试理解它,但有些数据是 NAN,所以我想知道为什么会这样。
这是模拟和一些代码
编辑: 这是从 ansys mechanical 导出到 .txt 文件的前 10 个节点的总变形
Node Number Total Deformation (m)
1 3,4011e-002
2 3,1337e-002
3 2,8684e-002
4 2,6064e-002
5 2,3489e-002
6 2,097e-002
7 1,8522e-002
8 1,6157e-002
9 1,389e-002
10 1,1736e-002
这是我在 运行 这个小脚本
之后的结果rst_results = path + "file.rst"
model = pymapdl_reader.read_binary(rst_results)
nnum, data = model.nodal_solution(0, nodes=range(1, 10))
print(data)
输出:
[[-1.30837114e-03 -5.18717535e-07 -3.39862333e-02]
[-1.19035991e-03 -6.35982671e-07 -3.13144870e-02]
[-1.07379301e-03 -8.05693695e-07 -2.86642968e-02]
[-9.59576794e-04 -1.01205615e-06 -2.60467228e-02]
[-8.48646606e-04 -1.24353973e-06 -2.34735376e-02]
[-7.41942455e-04 -1.49284317e-06 -2.09571697e-02]
[-6.40385662e-04 -1.75494961e-06 -1.85106729e-02]
[-5.44855004e-04 -2.02586199e-06 -1.61477097e-02]
[-4.56160962e-04 -2.30167900e-06 -1.38825364e-02]]
来自docs:
def principal_nodal_stress(self, rnum, nodes=None):
"""Computes the principal component stresses for each node in
the solution.
Parameters
----------
rnum : int or list
Cumulative result number with zero based indexing, or a
list containing (step, substep) of the requested result.
Returns
-------
nodenum : numpy.ndarray
Node numbers of the result.
pstress : numpy.ndarray
Principal stresses, stress intensity, and equivalent stress.
[sigma1, sigma2, sigma3, sint, seqv]
Examples
--------
Load the principal nodal stress for the first solution.
>>> from ansys.mapdl import reader as pymapdl_reader
>>> rst = pymapdl_reader.read_binary('file.rst')
>>> nnum, stress = rst.principal_nodal_stress(0)
所以节点数数组 nnum
中的每个数字对应于 stress
中的应力。
你能检查哪些节点号对应于中间节点吗?用于打印输出和后处理的节点应力数据仅适用于角节点。所以我猜这就是 nan
.
对于节点位移:
>>> from ansys.mapdl import reader as pymapdl_reader
>>> rst = pymapdl_reader.read_binary('file.rst')
>>> nnum, data = rst.nodal_solution(0)
对于弹性应变,您需要一个单元结果:
>>> enum, edata, enode = rst.element_solution_data(0, datatype='EEL')
>>> enum[0] # first element number
>>> enode[0] # nodes belonging to element 1
>>> edata[0] # data belonging to element 1
可用的结果是:
EMS: misc. data
ENF: nodal forces
ENS: nodal stresses
ENG: volume and energies
EGR: nodal gradients
EEL: elastic strains
EPL: plastic strains
ECR: creep strains
ETH: thermal strains
EUL: euler angles
EFX: nodal fluxes
ELF: local forces
EMN: misc. non-sum values
ECD: element current densities
ENL: nodal nonlinear data
EHC: calculated heat
EPT: element temperatures
ESF: element surface stresses
EDI: diffusion strains
ETB: ETABLE items (post1 only)
ECT: contact data
EXY: integration point locations
EBA: back stresses
ESV: state variables
MNL: material nonlinear record