


{"id":290957,"date":"2023-06-29T16:25:24","date_gmt":"2023-06-29T16:25:24","guid":{"rendered":"\/forum\/?post_type=topic&#038;p=290957"},"modified":"2023-06-29T16:25:24","modified_gmt":"2023-06-29T16:25:24","slug":"udf-for-surface-reaction-rateplease-help-a-beginner","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/","title":{"rendered":"UDF for surface reaction rate\u3008Please help a beginner\u3009"},"content":{"rendered":"<p>Hello there.<br \/>I am a newbie who recently started simulating membrane reactors for CO2 methanation(CO2 + 4H2 &rarr; CH4 + 2H2O) in Fluent.<br \/>I would like to apply the chemical reaction rate to a 3D porous media surface. Below is the actual code I wrote by looking and copying from the UDF guide and the information I found online. This reaction rate equation requires using partial pressures of chemical species, but how to express partial pressures is unclear to me.<\/p>\n<p>#include &#8220;udf.h&#8221;<\/p>\n<p>#define R 8.314 &nbsp; &nbsp; &nbsp; \/* Gas constant *\/<br \/>#define E_a 56000 &nbsp; &nbsp; \/* Activation Energy of each constant &nbsp;*\/<br \/>#define E_eq 158.7 &nbsp; &nbsp;<br \/>#define E_OH 89000 &nbsp; &nbsp;<br \/>#define k_a0 21.7 &nbsp; &nbsp; \/* Pre-exponential of each constant &nbsp;*\/<br \/>#define k_OH0 6.8e+7<br \/>#define k_eq0 137 &nbsp; &nbsp;<\/p>\n<p>DEFINE_SR_RATE(methanation,f,t,r,mw,yi,rr)<br \/>{<br \/>Thread *t0 = THREAD_T0(t);<\/p>\n<p>cell_t c0 = F_C0(f,t);<\/p>\n<p>real y_h2o = yi[0];<br \/>real y_ch4 = yi[1]; &nbsp; &nbsp;\/* Species numbers that match order in ANSYS FLUENT dialog box *\/<br \/>real y_h2 = yi[2];<br \/>real y_co2 = yi[3];<\/p>\n<p>y_h2o *= 1\/mw[0];<br \/>y_ch4 *= 1\/mw[1];<br \/>y_h2 *= 1\/mw[2];<br \/>y_co2 *= 1\/mw[3];<\/p>\n<p>real Nsum = y_h2o + y_ch4 + y_h2 + y_co2 ;<\/p>\n<p>y_h2o *= 1\/Nsum;<br \/>y_ch4 *= 1\/Nsum;<br \/>y_h2 *= 1\/Nsum;<br \/>y_co2 *= 1\/Nsum;<\/p>\n<p>real T_w = F_T(f,t);<\/p>\n<p>real K_a = k_a0*exp(-E_a\/(R*T_w));<br \/>real K_OH = k_OH0*exp(-E_OH\/(R*T_w));<br \/>real K_eq = k_eq0*pow(R*T_w, -3.998)*exp(E_eq\/(R*T_w));<\/p>\n<p>real TP = C_P(c0,t0); &nbsp;\/*Mabe this is one of the causes. I want partial pressures of species *\/<\/p>\n<p>&nbsp; &nbsp;if (FLUID_THREAD_P(t) &amp;&amp; THREAD_VAR(t).fluid.porous)<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp;*rr = (K_a* pow(TP*y_h2, 0.49) * pow(TP*y_co2, 0.42) \/ (1 + K_OH * TP*y_h2o * pow(TP*y_h2, -0.5))) * (1 &#8211; (TP*ch4 * pow(TP*y_h2o, 2) \/ (pow(TP*y_h2, 4) * TP*y_co2 * K_eq)));<\/p>\n<p>&nbsp;&nbsp;<br \/>}<\/p>\n<p>It compiles successfully, but when I start the calculation after initialization, it crashes immediately after displaying the following error.&nbsp;<\/p>\n<p>===============================================<br \/>= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES<br \/>= RANK 0 PID 2500 RUNNING AT desktop-<br \/>= EXIT STATUS: -1 (ffffffff)<br \/>===============================================<\/p>\n<p>===============================================<br \/>= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES<br \/>= RANK 2 PID 1764 RUNNING AT desktop<br \/>= EXIT STATUS: -1 (ffffffff)<br \/>===============================================<\/p>\n<p>===============================================<br \/>= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES<br \/>= RANK 3 PID 11488 RUNNING AT desktop<br \/>= EXIT STATUS: -1 (ffffffff)<br \/>===============================================<\/p>\n<p>I believe it is caused by the UDF, as this error disappears when I unhook the UDF. Can someone please help me? Thank you.<\/p>\n","protected":false},"template":"","class_list":["post-290957","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 there.I am a newbie who recently started simulating membrane reactors for CO2 methanation(CO2 + 4H2 \u2192 CH4 + 2H2O) in Fluent.I would like to apply the chemical reaction rate to a 3D porous media surface. Below is the actual code I wrote by looking and copying from the UDF guide and the information I\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/\" \/>\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=\"UDF for surface reaction rate\u3008Please help a beginner\u3009 | Ansys Learning Forum\" \/>\n\t\t<meta property=\"og:description\" content=\"Hello there.I am a newbie who recently started simulating membrane reactors for CO2 methanation(CO2 + 4H2 \u2192 CH4 + 2H2O) in Fluent.I would like to apply the chemical reaction rate to a 3D porous media surface. Below is the actual code I wrote by looking and copying from the UDF guide and the information I\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2023-06-29T16:25:24+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2023-06-29T16:25:24+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"UDF for surface reaction rate\u3008Please help a beginner\u3009 | Ansys Learning Forum\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Hello there.I am a newbie who recently started simulating membrane reactors for CO2 methanation(CO2 + 4H2 \u2192 CH4 + 2H2O) in Fluent.I would like to apply the chemical reaction rate to a 3D porous media surface. Below is the actual code I wrote by looking and copying from the UDF guide and the information I\" \/>\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\\\/udf-for-surface-reaction-rateplease-help-a-beginner\\\/#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\\\/udf-for-surface-reaction-rateplease-help-a-beginner\\\/#listItem\",\"name\":\"UDF for surface reaction rate\\u3008Please help a beginner\\u3009\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/udf-for-surface-reaction-rateplease-help-a-beginner\\\/#listItem\",\"position\":3,\"name\":\"UDF for surface reaction rate\\u3008Please help a beginner\\u3009\",\"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\\\/udf-for-surface-reaction-rateplease-help-a-beginner\\\/#webpage\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/udf-for-surface-reaction-rateplease-help-a-beginner\\\/\",\"name\":\"UDF for surface reaction rate\\u3008Please help a beginner\\u3009 | Ansys Learning Forum\",\"description\":\"Hello there.I am a newbie who recently started simulating membrane reactors for CO2 methanation(CO2 + 4H2 \\u2192 CH4 + 2H2O) in Fluent.I would like to apply the chemical reaction rate to a 3D porous media surface. Below is the actual code I wrote by looking and copying from the UDF guide and the information I\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/topic\\\/udf-for-surface-reaction-rateplease-help-a-beginner\\\/#breadcrumblist\"},\"datePublished\":\"2023-06-29T16:25:24+00:00\",\"dateModified\":\"2023-06-29T16:25:24+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":"UDF for surface reaction rate\u3008Please help a beginner\u3009 | Ansys Learning Forum","description":"Hello there.I am a newbie who recently started simulating membrane reactors for CO2 methanation(CO2 + 4H2 \u2192 CH4 + 2H2O) in Fluent.I would like to apply the chemical reaction rate to a 3D porous media surface. Below is the actual code I wrote by looking and copying from the UDF guide and the information I","canonical_url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/#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\/udf-for-surface-reaction-rateplease-help-a-beginner\/#listItem","name":"UDF for surface reaction rate\u3008Please help a beginner\u3009"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/#listItem","position":3,"name":"UDF for surface reaction rate\u3008Please help a beginner\u3009","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\/udf-for-surface-reaction-rateplease-help-a-beginner\/#webpage","url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/","name":"UDF for surface reaction rate\u3008Please help a beginner\u3009 | Ansys Learning Forum","description":"Hello there.I am a newbie who recently started simulating membrane reactors for CO2 methanation(CO2 + 4H2 \u2192 CH4 + 2H2O) in Fluent.I would like to apply the chemical reaction rate to a 3D porous media surface. Below is the actual code I wrote by looking and copying from the UDF guide and the information I","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#website"},"breadcrumb":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/#breadcrumblist"},"datePublished":"2023-06-29T16:25:24+00:00","dateModified":"2023-06-29T16:25:24+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":"UDF for surface reaction rate\u3008Please help a beginner\u3009 | Ansys Learning Forum","og:description":"Hello there.I am a newbie who recently started simulating membrane reactors for CO2 methanation(CO2 + 4H2 \u2192 CH4 + 2H2O) in Fluent.I would like to apply the chemical reaction rate to a 3D porous media surface. Below is the actual code I wrote by looking and copying from the UDF guide and the information I","og:url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/","article:published_time":"2023-06-29T16:25:24+00:00","article:modified_time":"2023-06-29T16:25:24+00:00","twitter:card":"summary_large_image","twitter:title":"UDF for surface reaction rate\u3008Please help a beginner\u3009 | Ansys Learning Forum","twitter:description":"Hello there.I am a newbie who recently started simulating membrane reactors for CO2 methanation(CO2 + 4H2 \u2192 CH4 + 2H2O) in Fluent.I would like to apply the chemical reaction rate to a 3D porous media surface. Below is the actual code I wrote by looking and copying from the UDF guide and the information I"},"aioseo_meta_data":{"post_id":"290957","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 18:01:25","updated":"2024-10-28 18:01:25","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\tUDF for surface reaction rate\u3008Please help a beginner\u3009\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":"UDF for surface reaction rate\u3008Please help a beginner\u3009","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/udf-for-surface-reaction-rateplease-help-a-beginner\/"}],"acf":[],"custom_fields":[{"0":{"_bbp_author_ip":["96.7.218.215"],"_bbp_subscription":["29936","14311","336769"],"_btv_view_count":["1864"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["290957"],"_bbp_forum_id":["27792"],"_bbp_engagement":["14311","29936","336769"],"_bbp_voice_count":["3"],"_bbp_reply_count":["5"],"_bbp_last_reply_id":["344235"],"_bbp_last_active_id":["344235"],"_bbp_last_active_time":["2024-01-11 11:56:40"]},"test":"satostudent-agh-edu-pl"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/290957","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\/290957\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=290957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}