Skip to content

Conversation

@WJinger
Copy link
Contributor

@WJinger WJinger commented Dec 21, 2025

嗨,闫老师!这个pr修改了opstool/anlys/_smart_analyze.py中的static_split(...)opstool/pre/section/sec_mesh.py中的plot_response(...)具体如下:

  1. static_split(...)函数添加了可自定义起点(start=)的选项。在拟静力试验时,结构的一些构件会在某一位移下破坏并退出工作,使用openseespy进行复现时可以通过删除单元再继续分析来复现这一现象。通过添加自定义起点的选项可使复现的滞回曲线更加贴近实际(以往都是将控制位移归零再删除单元,最后得到的滞回曲线虽然已经比较好了,但总感觉缺了点什么)。另外,当自定义起点不为零时,我添加了一个警告(警告的样式我做了修改放在_smart_analyze.py的开头部分,您觉得不合适可以删除),用于提醒注意必要的前置分析。

相关的脚本还是之前删除和添加单元的脚本,对应的部分已做修改。
Example-Remove&AddElement.ipynb

以下这些代码您可以检查修改后static_split(...)的可用性

import numpy as np
import matplotlib.pyplot as plt
import opstool as opst

tar = [-1.5, 1.5]
start_point = 0.5

analysis = opst.anlys.SmartAnalyze('Static')
segs = analysis.static_split(
    targets=tar,
    maxStep=0.1,
    start=start_point
    )

result = np.insert(
    np.cumsum(segs) + start_point
    , 0, start_point)

plt.close('all')
plt.plot(result, '-o')
plt.ylim(-2, 2)
plt.xlabel('Step')
plt.ylabel('Disp')
plt.grid()
plt.show()
  1. plot_response(...)对传入的points参数做了过滤nan的处理。points参数依赖于odb内的纤维截面坐标,但这些坐标有时会包含的nan(猜测是为了将不同维度的数据放在一个odb内而做的妥协),这些坐标点不加处理直接传入plot_response(...)会引起如下报错。这个脚本Example-Remove&AddElement.ipynb生成的数据库中,纤维截面(zeroLengthSection)的纤维点坐标就包含nan。
屏幕截图 2025-12-21 214517

@yexiang92
Copy link
Owner

@WJinger 谢谢推送,我最近对代码重构比较大,我会在下一个版本发布时合并,祝好~

@yexiang92
Copy link
Owner

@WJinger Hi, I recently made a major update. Could you please resend the pull request? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants