


{"id":162002,"date":"2021-09-07T02:38:01","date_gmt":"2021-09-07T02:38:01","guid":{"rendered":"\/forum\/forums\/topic\/how-to-change-material-for-elements-between-load-steps-and-continue-the-simulation\/"},"modified":"2021-11-12T07:45:28","modified_gmt":"2021-11-12T07:45:28","slug":"how-to-change-material-for-elements-between-load-steps-and-continue-the-simulation","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-change-material-for-elements-between-load-steps-and-continue-the-simulation\/","title":{"rendered":"how to change material for elements between load steps and continue the simulation?"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>Hi ALL,<\/p>\n<p>I&#039;m trying to use MPCHG to change material for some elements between load steps if the elements&#039; EPELX is negative, and then go back to the solution processor and continue for a next load step.&nbsp;<\/p>\n<p>I found this APDL script from SimuTech website, but don&#039;t know how to use it correctly. Any suggestions?<\/p>\n<p><\/p>\n<\/p>\n<p><strong>*GET,current_loadstep,ACTIVE,,SET,LSTP ! current load step number<\/strong><\/p>\n<p><strong>*IF,current_loadstep,EQ,0,then ! before first load step SOLVE<\/strong><\/p>\n<p><strong>! Location of macros in user_files<\/strong><\/p>\n<p><strong>FINISH<\/strong><\/p>\n<p><strong>\/PSEARCH,_wb_userfiles_dir(1) ! provides location of &ldquo;user_files&rdquo;<\/strong><\/p>\n<p><strong>\/SOLU<\/strong><\/p>\n<p><strong>*GET,my,ACTIVE,,JOBNAM ! jobname, &lt;= 8 characters<\/strong><\/p>\n<p><strong>\/DELETE,my,rdb ! if exists, req&rsquo;d for single frame restart<\/strong><\/p>\n<p><strong>RESCONTROL,DEFINE,NONE ! no files for multiframe restart<\/strong><\/p>\n<p><strong>*ENDIF<\/strong><\/p>\n<p><\/p>\n<\/p>\n<p><strong>*GET,current_loadstep,ACTIVE,,SET,LSTP ! current load step number<\/strong><\/p>\n<p><strong>*IF,current_loadstep,GT,0,then ! after a load step SOLVE<\/strong><\/p>\n<p><strong>FINISH<\/strong><\/p>\n<p><strong>\/POST1<\/strong><\/p>\n<p><strong>SET,LAST ! just in case not loaded<\/strong><\/p>\n<p><strong>*GET,num_elem,elem,,COUNT ! how many elements<\/strong><\/p>\n<p><strong>*GET,num_elem_max,elem,,NUM,MAX ! highest element number<\/strong><\/p>\n<p><strong>! example examination of results<\/strong><\/p>\n<p><strong>ETABLE,my_epeq,NL,EPELX ! Example<\/strong><\/p>\n<p><strong>*DEL,my_epeq,,NOPR ! delete array without warning<\/strong><\/p>\n<p><strong>*DIM,my_epeq,ARRAY,num_elem_max ! array to hold strain<\/strong><\/p>\n<p><strong>*VGET,my_epeq(1),ELEM,1,ETAB,my_epeq ! element table column to array<\/strong><\/p>\n<p><strong>FINISH<\/strong><\/p>\n<p><strong>!<\/strong><\/p>\n<p><strong>\/SOLU<\/strong><\/p>\n<p><strong>ANTYPE,,REST ! single frame restart<\/strong><\/p>\n<p><strong>! Example: make changes according to my_epeq array contents<\/strong><\/p>\n<p><strong>current_elem=0<\/strong><\/p>\n<p><strong>*DO,ii,1,num_elem ! step through elements<\/strong><\/p>\n<p><strong>current_elem=ELNEXT(current_elem) ! next element<\/strong><\/p>\n<p><strong>! create changes for this element per my_epeq(current_elem) value<\/strong><\/p>\n<p><strong>! &hellip;<\/strong><\/p>\n<p><strong>*ENDDO<\/strong><\/p>\n<p><strong>ALLSEL<\/strong><\/p>\n<p><strong>*ENDIF<\/strong><\/p>\n<p><strong>! At this point, WB follows with the next SOLVE using the above settings&hellip;<\/strong><\/p>\n<p><\/p>\n<\/p>\n<p>Thanks,<\/p>\n<p>JL<\/p>\n","protected":false},"template":"","class_list":["post-162002","topic","type-topic","status-closed","hentry","topic-tag-ansys-workbench","topic-tag-apdl","topic-tag-MPCHG-1"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_author_ip":[""],"_bbp_old_reply_author_name_id":["Anonymous"],"_bbp_old_is_reply_anonymous_id":["false"],"_btv_view_count":["2918"],"_bbp_likes_count":["0"],"_bbp_subscription":["238200"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["162002"],"_bbp_forum_id":["27791"],"_bbp_engagement":["58821","161270","240204"],"_bbp_voice_count":["3"],"_bbp_reply_count":["3"],"_bbp_last_reply_id":["191198"],"_bbp_last_active_id":["191198"],"_bbp_last_active_time":["2021-11-12 07:45:28"]},"test":"jirong"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/162002","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\/162002\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=162002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}