


{"id":459228,"date":"2026-06-03T06:57:11","date_gmt":"2026-06-03T06:57:11","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/transient-structural-ansys-apdl-looping-code-problem\/"},"modified":"2026-06-03T06:57:11","modified_gmt":"2026-06-03T06:57:11","slug":"transient-structural-ansys-apdl-looping-code-problem","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/transient-structural-ansys-apdl-looping-code-problem\/","title":{"rendered":"Transient Structural ANSYS APDL Looping Code Problem"},"content":{"rendered":"<p>&lt;p&gt;Dear all. I am having a little bit of trouble with setting up a looping transient structural analysis code. For the sake of brevity, I have put only the relevant block of code below.&nbsp;&lt;\/p&gt;&lt;p&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Flutter Analysis Loop&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;U_fin = 19 !m\/s&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;init_time = 5 !s&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;final_time = 20 !s&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;dt = 2.5E-02 !time step in seconds&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;total_steps = (final_time-init_time)\/dt&lt;\/span&gt;&lt;\/p&gt;&lt;p&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;*DO,i,1, total_steps, 1&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp;&nbsp;&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; \/PREP7 &nbsp; &nbsp;&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; [Element Modification Code Here]&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; ALLSEL, ALL&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; \/SOLU&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; time_val = init_time + i*dt&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; ANTYPE,,RESTART&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; AUTOTS, OFF&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; DELTIM, dt&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; TIMINT, ON&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; OUTRES,ALL,20&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; TIME, time_val&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; SOLVE&lt;\/span&gt;&lt;br&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;&nbsp; &nbsp; FINISH&lt;\/span&gt;&lt;\/p&gt;&lt;p&gt;&lt;span style=&#8221;font-size: 10pt;&#8221;&gt;*ENDDO&lt;\/span&gt;&lt;\/p&gt;&lt;p&gt;&lt;span style=&#8221;font-size: 14pt;&#8221;&gt;The general idea behind this looping section is to have ANSYS modify the properties of a structural element in every load step (as shown with the \/PREP7 section) then solve the resulting new structural setup (as shown in \/SOLU section). The problem I faced was that the DELTIM and TIME commands seem to not receive the values from the parameters &#8220;dt&#8221; and &#8220;time_val&#8221; respectively, regardless of how those parameters have been defined beforehand. This resulted in ANSYS returning to the default values for the time step sizes and time at the end of a load step.&nbsp;&lt;\/span&gt;&lt;\/p&gt;&lt;p&gt;&lt;span style=&#8221;font-size: 14pt;&#8221;&gt;Anyone&#8217;s help on this problem is very welcome. &lt;\/span&gt;&lt;\/p&gt;<\/p>\n","protected":false},"template":"","class_list":["post-459228","topic","type-topic","status-publish","hentry","topic-tag-ansys-apdl","topic-tag-ansys-mechanical-apdl","topic-tag-transient-structural"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_forum_id":["27791"],"_bbp_topic_id":["459228"],"_bbp_subscription":["261660","18229","20905"],"_bbp_author_ip":["167.205.0.229"],"_bbp_last_reply_id":["459395"],"_bbp_last_active_id":["459395"],"_bbp_last_active_time":["2026-06-05 13:29:01"],"_bbp_reply_count":["6"],"_bbp_reply_count_hidden":["0"],"_bbp_voice_count":["3"],"_bbp_engagement":["261660","18229","20905"],"_btv_view_count":["41"],"_bbp_topic_status":["unanswered"]},"test":"35020306mahasiswa-itb-ac-id"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/459228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/459228\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=459228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}