


{"id":28826,"date":"2018-03-05T22:02:21","date_gmt":"2018-03-05T22:02:21","guid":{"rendered":"\/forum\/forums\/topic\/hooking-uds-to-the-model\/"},"modified":"2018-03-05T22:02:21","modified_gmt":"2018-03-05T22:02:21","slug":"hooking-uds-to-the-model","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/","title":{"rendered":"Hooking UDS to the model"},"content":{"rendered":"<p>Hello everyone,<\/p>\n<p><\/p>\n<p>I have been interpreting some User-defined functions, and now I would like to use User defined scalars. Quite a lot of people use them, yet the documentation is not that clear about the steps to follow. Basically, after interpreting, when I launch the calculation, Fluent crashes and closes. I don&#8217;t have time to see what kind of error it is, but I think it is written: MPI error.<\/p>\n<p><\/p>\n<p>I will describe the steps I use, hoping it would help others.<\/p>\n<p><\/p>\n<p>Step 1: Writing the UDF in a .c file<\/p>\n<p><\/p>\n<p>\/* Defining the adsoprtion of the system *\/ \/********************************************\/<\/p>\n<p>#include &#8220;udf.h&#8221;<\/p>\n<p>int ads;<\/p>\n<p>DEFINE_ADJUST(adsorption,domain){<br \/>Thread*t; cell_t c; real E,A,P;<br \/>thread_loop_c(t,domain){<br \/>begin_c_loop (c,t){<br \/>real tem=C_T(c,t);<br \/>P=C_P(c,t)+RP_Get_Real(&#8220;operating-pressure&#8221;);<br \/>E=3080+18,9*tem;<br \/>A=8,31429*tem*log(1.47E9\/P);<br \/>C_UDSI(c,t,ads)=71.6*exp(-A*A\/(E*E));}<br \/>end_c_loop(c,t)}<br \/>}<\/p>\n<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DEFINE_SOURCE(energy_source,c,t,dS,eqn){<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; real e_source;<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; e_source=-C_UDSI_M1(c,t,ads)*0.496056352e3*3080*sqrt(log(71.6\/C_UDSI_M1(c,t,ads)));<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; dS[eqn]=0.0;<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return e_source;<br \/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<\/p>\n<p><\/p>\n<p>&nbsp;Step 2: Interpreting the UDF<\/p>\n<p><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/5981460a-ac9c-4b48-90ac-a89a0167c92e_interpreting-udf.jpg?width=690&amp;upscale=false\" alt=\"\" width=\"846\" height=\"476\"><\/p>\n<p><\/p>\n<p>Step 3: Adding a User Defined Scalar (UDS)<\/p>\n<p><\/p>\n<p>In Flux function, I chose Adsorption, corresponding to the UDF using the UDS<\/p>\n<p><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/eae382b9-5381-4f7f-b439-a89a016868f5_adding-uds.jpg?width=690&amp;upscale=false\" alt=\"\"><\/p>\n<p><\/p>\n<p>Step 4: Hooking the UDF<\/p>\n<p><\/p>\n<p>I hooked adsorption as an adjust function<\/p>\n<p><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/fd5d6a20-d636-40dc-bab1-a89a016a04c3_hooking-the-udf.jpg?width=690&amp;upscale=false\" alt=\"\"><\/p>\n<p><\/p>\n<p>Step 5: In Cell Zone condition&gt;cross Source&gt;Source&gt;Energy source&gt; Choose UDF energy_source.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/b3eb8885-356c-4fce-9915-a89a0169685f_adding-source-term.jpg?width=690&amp;upscale=false\" alt=\"\"><\/p>\n<p><\/p>\n<p>Step 6: Initializing. Everything ok (hybrid initialization)<\/p>\n<p><\/p>\n<p>Step 7: Running calculation. When it comes to the first iteration, Fluent crashes. Infortunately, I don&#8217;t have time to take a screenshot.<\/p>\n<p><\/p>\n<p>Where does it come from? Did I forget a step or something in the programme?<\/p>\n<p><\/p>\n<p>Regards,<\/p>\n","protected":false},"template":"","class_list":["post-28826","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Hello everyone, I have been interpreting some User-defined functions, and now I would like to use User defined scalars. Quite a lot of people use them, yet the documentation is not that clear about the steps to follow. Basically, after interpreting, when I launch the calculation, Fluent crashes and closes. I don&#039;t have time to\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Ansys Learning Forum | Ansys Innovation Space\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Hooking UDS to the model | Ansys Learning Forum\" \/>\n\t\t<meta property=\"og:description\" content=\"Hello everyone, I have been interpreting some User-defined functions, and now I would like to use User defined scalars. Quite a lot of people use them, yet the documentation is not that clear about the steps to follow. Basically, after interpreting, when I launch the calculation, Fluent crashes and closes. I don&#039;t have time to\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/5981460a-ac9c-4b48-90ac-a89a0167c92e_interpreting-udf.jpg?width=690&#038;upscale=false\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/5981460a-ac9c-4b48-90ac-a89a0167c92e_interpreting-udf.jpg?width=690&#038;upscale=false\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2018-03-05T22:02:21+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2018-03-05T22:02:21+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Hooking UDS to the model | Ansys Learning Forum\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Hello everyone, I have been interpreting some User-defined functions, and now I would like to use User defined scalars. Quite a lot of people use them, yet the documentation is not that clear about the steps to follow. Basically, after interpreting, when I launch the calculation, Fluent crashes and closes. I don&#039;t have time to\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/5981460a-ac9c-4b48-90ac-a89a0167c92e_interpreting-udf.jpg?width=690&amp;upscale=false\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/hooking-uds-to-the-model\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/topics\\\/#listItem\",\"name\":\"Topics\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/topics\\\/#listItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/topics\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/hooking-uds-to-the-model\\\/#listItem\",\"name\":\"Hooking UDS to the model\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/hooking-uds-to-the-model\\\/#listItem\",\"position\":3,\"name\":\"Hooking UDS to the model\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/topics\\\/#listItem\",\"name\":\"Topics\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#organization\",\"name\":\"Ansys Learning Forum\",\"description\":\"Ansys Innovation Space\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/hooking-uds-to-the-model\\\/#webpage\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/hooking-uds-to-the-model\\\/\",\"name\":\"Hooking UDS to the model | Ansys Learning Forum\",\"description\":\"Hello everyone, I have been interpreting some User-defined functions, and now I would like to use User defined scalars. Quite a lot of people use them, yet the documentation is not that clear about the steps to follow. Basically, after interpreting, when I launch the calculation, Fluent crashes and closes. I don't have time to\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/hooking-uds-to-the-model\\\/#breadcrumblist\"},\"datePublished\":\"2018-03-05T22:02:21+00:00\",\"dateModified\":\"2018-03-05T22:02:21+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/\",\"name\":\"Ansys Learning Forum\",\"description\":\"Ansys Innovation Space\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Hooking UDS to the model | Ansys Learning Forum","description":"Hello everyone, I have been interpreting some User-defined functions, and now I would like to use User defined scalars. Quite a lot of people use them, yet the documentation is not that clear about the steps to follow. Basically, after interpreting, when I launch the calculation, Fluent crashes and closes. I don't have time to","canonical_url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","position":1,"name":"Home","item":"https:\/\/innovationspace.ansys.com\/forum","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/topics\/#listItem","name":"Topics"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/topics\/#listItem","position":2,"name":"Topics","item":"https:\/\/innovationspace.ansys.com\/forum\/topics\/","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/#listItem","name":"Hooking UDS to the model"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/#listItem","position":3,"name":"Hooking UDS to the model","previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/topics\/#listItem","name":"Topics"}}]},{"@type":"Organization","@id":"https:\/\/innovationspace.ansys.com\/forum\/#organization","name":"Ansys Learning Forum","description":"Ansys Innovation Space","url":"https:\/\/innovationspace.ansys.com\/forum\/"},{"@type":"WebPage","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/#webpage","url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/","name":"Hooking UDS to the model | Ansys Learning Forum","description":"Hello everyone, I have been interpreting some User-defined functions, and now I would like to use User defined scalars. Quite a lot of people use them, yet the documentation is not that clear about the steps to follow. Basically, after interpreting, when I launch the calculation, Fluent crashes and closes. I don't have time to","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#website"},"breadcrumb":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/#breadcrumblist"},"datePublished":"2018-03-05T22:02:21+00:00","dateModified":"2018-03-05T22:02:21+00:00"},{"@type":"WebSite","@id":"https:\/\/innovationspace.ansys.com\/forum\/#website","url":"https:\/\/innovationspace.ansys.com\/forum\/","name":"Ansys Learning Forum","description":"Ansys Innovation Space","inLanguage":"en-US","publisher":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#organization"}}]},"og:locale":"en_US","og:site_name":"Ansys Learning Forum | Ansys Innovation Space","og:type":"article","og:title":"Hooking UDS to the model | Ansys Learning Forum","og:description":"Hello everyone, I have been interpreting some User-defined functions, and now I would like to use User defined scalars. Quite a lot of people use them, yet the documentation is not that clear about the steps to follow. Basically, after interpreting, when I launch the calculation, Fluent crashes and closes. I don't have time to","og:url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/","og:image":"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/5981460a-ac9c-4b48-90ac-a89a0167c92e_interpreting-udf.jpg?width=690&#038;upscale=false","og:image:secure_url":"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/5981460a-ac9c-4b48-90ac-a89a0167c92e_interpreting-udf.jpg?width=690&#038;upscale=false","article:published_time":"2018-03-05T22:02:21+00:00","article:modified_time":"2018-03-05T22:02:21+00:00","twitter:card":"summary_large_image","twitter:title":"Hooking UDS to the model | Ansys Learning Forum","twitter:description":"Hello everyone, I have been interpreting some User-defined functions, and now I would like to use User defined scalars. Quite a lot of people use them, yet the documentation is not that clear about the steps to follow. Basically, after interpreting, when I launch the calculation, Fluent crashes and closes. I don't have time to","twitter:image":"https:\/\/us.v-cdn.net\/6032193\/uploads\/attachments\/fd3884c4-81ba-4b5c-97c7-a88e00a49a41\/5981460a-ac9c-4b48-90ac-a89a0167c92e_interpreting-udf.jpg?width=690&amp;upscale=false"},"aioseo_meta_data":{"post_id":"28826","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"content","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":true,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2024-10-28 23:31:59","updated":"2024-10-28 23:31:59","ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/forum\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/forum\/topics\/\" title=\"Topics\">Topics<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHooking UDS to the model\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/innovationspace.ansys.com\/forum"},{"label":"Topics","link":"https:\/\/innovationspace.ansys.com\/forum\/topics\/"},{"label":"Hooking UDS to the model","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/hooking-uds-to-the-model\/"}],"acf":[],"custom_fields":[{"0":{"_bbp_old_topic_id":["993"],"_bbp_old_topic_author_name_id":["Anonymous"],"_bbp_old_is_topic_anonymous_id":["false"],"_bbp_old_closed_status_id":["publish"],"_bbp_author_ip":[null],"_bbp_old_sticky_status_id":["normal"],"_bbp_likes_count":["0","0","0","0","0"],"_btv_view_count":["914"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["28826"],"_bbp_forum_id":["27792"],"_bbp_engagement":["156032","156795"],"_bbp_voice_count":["2"],"_bbp_reply_count":["2"],"_bbp_last_reply_id":["58059"],"_bbp_last_active_id":["58059"],"_bbp_last_active_time":["2018-04-19 19:30:28"]},"test":"vassili-briodeau"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/28826","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\/28826\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=28826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}