


{"id":369456,"date":"2024-06-01T03:27:37","date_gmt":"2024-06-01T03:27:37","guid":{"rendered":"\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/"},"modified":"2024-06-01T03:27:37","modified_gmt":"2024-06-01T03:27:37","slug":"storing-and-plotting-values-in-udm","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/","title":{"rendered":"Storing and plotting values in UDM"},"content":{"rendered":"<p>I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?<\/p>\n<div>#include &#8220;udf.h&#8221;<\/div>\n<div>#include &lt;math.h&gt;<\/div>\n<div>&nbsp;<\/div>\n<div>#define rho 950 \/\/ kg\/m^3<\/div>\n<div>#define Hg 2033631 \/\/ J\/Kg<\/div>\n<div>#define Hf -310000 \/\/ J\/Kg<\/div>\n<div>#define T_ref 298 \/\/ K<\/div>\n<div>#define A1 0.01104 \/\/ m\/s<\/div>\n<div>#define A2 3.9648 \/\/ m\/s<\/div>\n<div>#define Cp 1500 \/\/ J\/(Kg*K)<\/div>\n<div>#define E1 20557.188 \/\/ J\/mol<\/div>\n<div>#define E2 55893.78 \/\/ J\/mol<\/div>\n<div>#define R_u 8.314 \/\/ J\/(mol*K)<\/div>\n<div>#define alpha 0.3<\/div>\n<div>&nbsp;<\/div>\n<div>DEFINE_PROFILE(surface_temperature_profile, t, position)<\/div>\n<div>{<\/div>\n<div>&nbsp; &nbsp; face_t f;<\/div>\n<div>&nbsp; &nbsp; real Ts, heat_flux, heat, a_face, Hv, r, Ts_old, Ts_new, error, Ts_new_prime, Area[ND_ND];<\/div>\n<div>&nbsp; &nbsp; real radial_position;<\/div>\n<div>&nbsp; &nbsp; real centroid[ND_ND];<\/div>\n<div>&nbsp; &nbsp; int iter;<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; begin_f_loop(f, t)<\/div>\n<div>&nbsp; &nbsp; {<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; Ts = F_T(f, t);&nbsp; \/\/ Current temperature at the face<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; heat = BOUNDARY_HEAT_FLUX(f, t);&nbsp; \/\/ Heat transfer at face f in watts<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; F_AREA(Area, f, t);&nbsp; \/\/ Get the area vector of the face<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; a_face = NV_MAG(Area);&nbsp; \/\/ Magnitude of the face area<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; \/\/ Calculate the radial position of the face centroid<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; F_CENTROID(centroid, f, t);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; radial_position = centroid[1]; \/\/ Assuming the radial position is the y-coordinate in 2D axisymmetric<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; \/\/ Heat flux for the circumferential area<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; heat_flux = (heat*2*M_PI*radial_position) \/ a_face; \/\/ Heat flux in W\/m^2<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;Heat flux on face %d: %g W\/m^2\\n&#8221;, f, heat_flux);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; Ts_old = Ts;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; iter = 0;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; error = 1;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; while (error &gt; 1e-6 &amp;&amp; iter &lt; 100)<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; {<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hv = Hg &#8211; Hf + Cp * (Ts &#8211; T_ref);&nbsp; \/\/ Calculation heat of formation<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r = (fabs(heat_flux)) \/ (Hv * rho);&nbsp; \/\/ Regression rate<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Ts_old &gt; 722)<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ts_new = E1 \/ (R_u * (log(A1) &#8211; log(r)));&nbsp; \/\/ New surface temperature for high temperature<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ts_new = E2 \/ (R_u * (log(A2) &#8211; log(r)));&nbsp; \/\/ New surface temperature for low temperature<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error = fabs(Ts_new &#8211; Ts_old);&nbsp; \/\/ Error calculation<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ts_old = Ts_new;&nbsp; \/\/ Update Ts_old for next iteration<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iter++;&nbsp; \/\/ Increment iteration count<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; }<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; Ts_new_prime = Ts + (alpha * (Ts_new &#8211; Ts));&nbsp;<\/div>\n<div>r = (fabs(heat_flux)) \/ (Hv * rho);<\/div>\n<div>\/\/ Store r in UDM<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; F_UDMI(f, t, 0) = r;&nbsp; \/\/ Assuming the UDM index is 0<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;New Temp %d: %g K\\n&#8221;, f, Ts_new_prime);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; printf(&#8220;r_dot %d: %g mm\/s\\n&#8221;, f, r*1000);<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; F_PROFILE(f, t, position) = Ts_new_prime;&nbsp; \/\/ Update the face temperature profile<\/div>\n<div>&nbsp; &nbsp; }<\/div>\n<div>&nbsp; &nbsp; end_f_loop(f, t)<\/div>\n<div>}<\/div>\n","protected":false},"template":"","class_list":["post-369456","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=\"I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?#include &quot;udf.h&quot;#include #define rho 950 \/\/ kg\/m^3#define Hg\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/\" \/>\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=\"Storing and plotting values in UDM | Ansys Learning Forum\" \/>\n\t\t<meta property=\"og:description\" content=\"I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?#include &quot;udf.h&quot;#include #define rho 950 \/\/ kg\/m^3#define Hg\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2024-06-01T03:27:37+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-06-01T03:27:37+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Storing and plotting values in UDM | Ansys Learning Forum\" \/>\n\t\t<meta name=\"twitter:description\" content=\"I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?#include &quot;udf.h&quot;#include #define rho 950 \/\/ kg\/m^3#define Hg\" \/>\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\\\/storing-and-plotting-values-in-udm\\\/#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\\\/storing-and-plotting-values-in-udm\\\/#listItem\",\"name\":\"Storing and plotting values in UDM\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/storing-and-plotting-values-in-udm\\\/#listItem\",\"position\":3,\"name\":\"Storing and plotting values in UDM\",\"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\\\/storing-and-plotting-values-in-udm\\\/#webpage\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/storing-and-plotting-values-in-udm\\\/\",\"name\":\"Storing and plotting values in UDM | Ansys Learning Forum\",\"description\":\"I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?#include \\\"udf.h\\\"#include #define rho 950 \\\/\\\/ kg\\\/m^3#define Hg\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/storing-and-plotting-values-in-udm\\\/#breadcrumblist\"},\"datePublished\":\"2024-06-01T03:27:37+00:00\",\"dateModified\":\"2024-06-01T03:27:37+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":"Storing and plotting values in UDM | Ansys Learning Forum","description":"I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?#include \"udf.h\"#include #define rho 950 \/\/ kg\/m^3#define Hg","canonical_url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/#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\/storing-and-plotting-values-in-udm\/#listItem","name":"Storing and plotting values in UDM"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/#listItem","position":3,"name":"Storing and plotting values in UDM","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\/storing-and-plotting-values-in-udm\/#webpage","url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/","name":"Storing and plotting values in UDM | Ansys Learning Forum","description":"I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?#include \"udf.h\"#include #define rho 950 \/\/ kg\/m^3#define Hg","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#website"},"breadcrumb":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/#breadcrumblist"},"datePublished":"2024-06-01T03:27:37+00:00","dateModified":"2024-06-01T03:27:37+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":"Storing and plotting values in UDM | Ansys Learning Forum","og:description":"I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?#include &quot;udf.h&quot;#include #define rho 950 \/\/ kg\/m^3#define Hg","og:url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/","article:published_time":"2024-06-01T03:27:37+00:00","article:modified_time":"2024-06-01T03:27:37+00:00","twitter:card":"summary_large_image","twitter:title":"Storing and plotting values in UDM | Ansys Learning Forum","twitter:description":"I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?#include &quot;udf.h&quot;#include #define rho 950 \/\/ kg\/m^3#define Hg"},"aioseo_meta_data":{"post_id":"369456","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 16:39:53","updated":"2024-10-28 16:39:53","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\tStoring and plotting values in UDM\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":"Storing and plotting values in UDM","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/storing-and-plotting-values-in-udm\/"}],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["343144","199"],"_bbp_author_ip":["23.216.133.166"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["730"],"_bbp_topic_status":["unanswered"],"_bbp_topic_id":["369456"],"_bbp_forum_id":["27792"],"_bbp_engagement":["199","343144"],"_bbp_voice_count":["2"],"_bbp_reply_count":["1"],"_bbp_last_reply_id":["369563"],"_bbp_last_active_id":["369563"],"_bbp_last_active_time":["2024-06-03 11:10:43"]},"test":"zwernjaydengmail-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/369456","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\/369456\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=369456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}