


{"id":161700,"date":"2021-08-28T20:16:43","date_gmt":"2021-08-28T20:16:43","guid":{"rendered":"\/forum\/forums\/topic\/apdl-to-assign-material-parameter-based-on-x-coordinate-of-element\/"},"modified":"2021-09-21T11:56:17","modified_gmt":"2021-09-21T11:56:17","slug":"apdl-to-assign-material-parameter-based-on-x-coordinate-of-element","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/apdl-to-assign-material-parameter-based-on-x-coordinate-of-element\/","title":{"rendered":"APDL to assign material parameter based on x-coordinate of element"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>Hello,<\/p>\n<p>I am a novice with APDL, but have tried to implement APDL command into ANSYS workbench mechanical in order to assign material properties based on coordinate position. I have attempted this using the APDL script below. I recieve no errors, but the procedure is not working. Any help is appreciated! <\/p>\n<p><\/p>\n<\/p>\n<pre class=\"code codeBlock\" spellcheck=\"false\">!Define constants\n*SET,sig_max,500\n*SET,sig_min,200\n*SET,H_max,500\n*SET,H_min,200\n*SET,L_1,100 !width of geometry in mm\n\n\n!Get number of elements\n!GET, Par, Entity, ENTNUM, Item1, IT1NUM&nbsp;\n*GET,par_elemcount,ELEM,,COUNT&nbsp; &nbsp;\n\n\n!Create arrays for each centroid positions\n!DIM, Par, Type, IMAX, JMAX\n*DIM,centarray,ARRAY,par_elemcount,2&nbsp;&nbsp;\n\n\n!Assign element IDs and Centroid positions to centarray\n!VGET Retrieves values and stores them into an array parameter.\n*VGET,centarray(1,1),ELEM,,ELIST&nbsp; !Element IDs\n*VGET,centarray(1,2),ELEM,,CENT,X&nbsp;\n\n\n!Loop through each element\n!defines do loop !*DO, Par, IVAL, FVAL, INC\n*DO,i,1,par_elemcount,1&nbsp; &nbsp;\n\n\n!test i value\n*SET,par_testi,i\n\n\n!Get x-coordinate of element centroid\n*SET,x_pos,centarray(i,2)&nbsp;\n\n\n!calc material prop for element\nH=((H_max-H_min)\/L_1)*x_pos + H_min\nsig=((sig_max-sig_min)\/L_1)*x_pos + sig_min\n\n\n!Assign material prop to element\n!TB,lab,MAT,NTEMP,NPTS,TBLPT,EOSPT,FuncName\n!TB,bilinear isometric hardening, matid=1, no. of temp pts=1,\n!no. of pts=n\/a for biso, eq of state=n\/a, funcname=n\/a\nTB,BISO,1,1,,,\n\n\n!TBDATA,STLOC,C1,C2\n!TBDATA, starting location, 1st const, 2nd const.\nTBDATA,3,sig,H\n\n\nMPCHG,1,i !only updating 1 ele at a time. inefficient\n\n\n*ENDDO&nbsp;&nbsp;\n!end loop\n```\n<\/pre>\n<p>I have inserted this as a command into under geometry which should then run in \/prep7. Note: it would be a lot more efficient to assign all elements with same x-cord at same time, but couldn&#039;t figure out how to achieve this. But as a first step, getting the above working would be great! <\/p>\n<p>Many Thanks!<\/p>\n","protected":false},"template":"","class_list":["post-161700","topic","type-topic","status-closed","hentry","topic-tag-apdl-command","topic-tag-material","topic-tag-material-assignments","topic-tag-mechanical-apdl"],"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":["3521"],"_bbp_likes_count":["0"],"_bbp_subscription":["253998"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["161700"],"_bbp_forum_id":["27815"],"_bbp_engagement":["88","210232"],"_bbp_voice_count":["2"],"_bbp_reply_count":["5"],"_bbp_last_reply_id":["190223"],"_bbp_last_active_id":["190223"],"_bbp_last_active_time":["2021-09-21 11:56:17"]},"test":"rh11g20soton-ac-uk"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/161700","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\/161700\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=161700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}