


{"id":436164,"date":"2025-07-07T00:18:58","date_gmt":"2025-07-07T00:18:58","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/commands-apdl\/"},"modified":"2025-07-07T00:44:38","modified_gmt":"2025-07-07T00:44:38","slug":"commands-apdl","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/commands-apdl\/","title":{"rendered":"Commands (APDL)"},"content":{"rendered":"<p>&lt;p&gt;&lt;p&gt;&lt;p&gt;&lt;p&gt;&lt;p&gt;&lt;p&gt;Hi,&lt;br&gt;&lt;br&gt;I am running a steady state thermal simulation in Ansys. I have run the simulation once and I have the temperature profile. Now I want to select a part of the model and give heat generation value to it which, for example, depends on the temperature profile of that part. I am new to using Commands (APDL). I wrote a few lines of code and inserted it in Solution branch and cleared the generated data and resolved it. Below is my code:&lt;\/p&gt;&lt;p&gt; &lt;\/p&gt;&lt;p&gt;<strong>allsel,all&lt;br&gt;cmsel,s,named_selection&lt;br&gt;nsle,s&lt;br&gt;*get,numnodes,node,,count&lt;br&gt;*dim,nlist,array,numnodes&lt;br&gt;*do,i,1,numnodes&lt;br&gt;&nbsp; &nbsp; nlist(i)=ndnext(i-1)&lt;br&gt;*enddo&lt;br&gt;*dim,templ,array,numnodes&lt;br&gt;*vget,templ(1),node,nlist(1),temp,numnodes&lt;br&gt;*dim,qgen,array,numnodes&lt;br&gt;cmsel,s,named_selection&lt;br&gt;nsle,s&lt;br&gt;bfdele,all,HGEN&lt;br&gt;*do,i,1,numnodes&lt;br&gt;&nbsp; &nbsp; nodeid = nlist(i)&lt;br&gt;&nbsp; &nbsp; xval = NX(nodeid)&lt;br&gt;&nbsp; &nbsp; yval = NY(nodeid)&lt;br&gt;&nbsp; &nbsp; r = sqrt(xval**2 + yval**2)&lt;br&gt;&nbsp; &nbsp; t = templ(i)&lt;br&gt;&nbsp; &nbsp; qgen(i) = t\/2&lt;br&gt;&nbsp; &nbsp; bf,nodeid,HGEN,qgen(i)&lt;br&gt;*enddo&lt;br&gt;allsel,all&lt;\/p&gt;&lt;p&gt;<\/strong>I am not getting a new temperature profile at all. I would really appreciate if someone could review my code and let me know if any modification is needed in the code.&lt;\/p&gt;&lt;\/p&gt;&lt;\/p&gt;&lt;\/p&gt;&lt;\/p&gt;&lt;\/p&gt;<\/p>\n","protected":false},"template":"","class_list":["post-436164","topic","type-topic","status-publish","hentry","topic-tag-ansys-mechanical-apdl","topic-tag-apdl-code-in-workbench","topic-tag-apdl-coding","topic-tag-apdl-commands"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_forum_id":["27791"],"_bbp_topic_id":["436164"],"_bbp_author_ip":["2603:7080:a3f0:7920:bd55:4257:31a6:c5f4"],"_bbp_last_reply_id":["436527"],"_bbp_last_active_id":["436527"],"_bbp_last_active_time":["2025-07-10 14:25:27"],"_bbp_reply_count":["8"],"_bbp_reply_count_hidden":["0"],"_bbp_voice_count":["2"],"_bbp_engagement":["342539","20905"],"_btv_view_count":["799"],"_bbp_topic_status":["unanswered"],"_edit_last":["342539"],"_bbp_revision_log":["a:2:{i:436165;a:2:{s:6:\"author\";i:342539;s:6:\"reason\";s:0:\"\";}i:436166;a:2:{s:6:\"author\";i:342539;s:6:\"reason\";s:0:\"\";}}"],"_bbp_subscription":["20905","342539"]},"test":"fbcf96b56862920588590ba8357b4c0ae05bc92b"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/436164","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":2,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/436164\/revisions"}],"predecessor-version":[{"id":436166,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/436164\/revisions\/436166"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=436164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}