


{"id":275737,"date":"2023-03-21T15:44:53","date_gmt":"2023-03-21T15:44:53","guid":{"rendered":"\/forum\/forums\/topic\/udf-using-rp-variable-for-dynamic-mesh\/"},"modified":"2023-03-21T15:44:53","modified_gmt":"2023-03-21T15:44:53","slug":"udf-using-rp-variable-for-dynamic-mesh","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-using-rp-variable-for-dynamic-mesh\/","title":{"rendered":"UDF using RP variable for dynamic mesh"},"content":{"rendered":"<p>Hello,<\/p>\n<p>I found a UDF to calculate pressure on a face to move the mesh (dynamic mesh) based on this. The following is an exerpt from the UDF:<\/p>\n<p>\/* Get the value of the thread ID from a user-defined Scheme variable *\/<br \/>#if !RP_NODE \/* SERIAL or HOST *\/<br \/>&nbsp;surface_thread_id = RP_Get_Integer(&#8220;pres_av\/thread-id&#8221;);<br \/>&nbsp;Message(&#8220;\\nCalculating on Thread # %d\\n&#8221;,surface_thread_id);<br \/>#endif \/* !RP_NODE *\/<\/p>\n<p>&nbsp;\/* &nbsp;To set up this user Scheme variable in cortex type *\/<br \/>&nbsp;\/* (rp-var-define &#8216;pres_av\/thread-id 6 &#8216;integer #f) *\/<br \/>&nbsp;\/* After set up you can change it to another thread&#8217;s ID using : *\/<br \/>&nbsp;\/* (rpsetvar &#8216;pres_av\/thread-id 6) *\/<\/p>\n<p>&nbsp;\/* Send the ID value to all the nodes *\/<br \/>&nbsp;host_to_node_int_1(surface_thread_id); \/* Does nothing in serial *\/<\/p>\n<p>&nbsp;<\/p>\n<p>I have set my rp-var using a scheme file to the thread ID of the face I am looking to calculate on. When I run the simulation I only get the output &#8216;&nbsp;Message(&#8220;\\nCalculating on Thread # %d\\n&#8221;,surface_thread_id);&#8217; and then error received sigsev. I am guessing after this line the UDF has an error, but I am lost on what to fix next.&nbsp;<\/p>\n<p>Here is my scheme file if that helps:&nbsp;<\/p>\n<p>(define (make-new-rpvar name default type)<br \/>&nbsp; (if (not (rp-var-object name))<br \/>&nbsp; &nbsp; (rp-var-define name default type #f)))<\/p>\n<p>(rp-var-define &#8216;pres_av\/thread-id 6 &#8216;integer #f)<\/p>\n<p>(rpsetvar &#8216;pres_av\/thread-id 6)<\/p>\n<p>&nbsp;<\/p>\n<p>Thanks,<br \/>Breanna&nbsp;<\/p>\n","protected":false},"template":"","class_list":["post-275737","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["258905","199"],"_bbp_author_ip":["23.192.164.18"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["1704"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["275737"],"_bbp_forum_id":["27792"],"_bbp_engagement":["199","258905"],"_bbp_voice_count":["2"],"_bbp_reply_count":["5"],"_bbp_last_reply_id":["277421"],"_bbp_last_active_id":["277421"],"_bbp_last_active_time":["2023-03-31 15:40:46"]},"test":"bv169nova-edu"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/275737","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\/275737\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=275737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}