


{"id":425713,"date":"2025-03-14T15:15:24","date_gmt":"2025-03-14T15:15:24","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/setting-bubble-diameter-under-dispersed-turbulence-model\/"},"modified":"2025-03-14T21:49:39","modified_gmt":"2025-03-14T21:49:39","slug":"setting-bubble-diameter-under-dispersed-turbulence-model","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/setting-bubble-diameter-under-dispersed-turbulence-model\/","title":{"rendered":"Setting bubble diameter under Dispersed turbulence model"},"content":{"rendered":"<p>&lt;p&gt;&lt;p&gt;&lt;p&gt;Hi all, &lt;\/p&gt;&lt;p&gt;I&#8217;m trying to set a UDF to set the bubble diameter for an Eulerian simulation while simulating the turbulence under the Dispersed model (as the density ratio is way beyond 1). While a similar UDF works perfectly for the Mixture model (for turbulence), it does not work with the modifications I&#8217;ve deemed necessary (i.e., pointing to the liquid &#8211; primary phase thread using the super_thread macro). Has anyone managed to define a similar UDF successfully? Any input is appreciated as the current formulation results in SIGSEV error.&nbsp;&lt;\/p&gt;&lt;p&gt;<code><\/code><code>&lt;\/p&gt;&lt;pre&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;#include &quot;udf.h&quot;&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;#include &quot;math.h&quot;&lt;\/span&gt;&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;DEFINE_PROPERTY(calderbank_db, c, t)&lt;\/span&gt;&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;{&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp; \/* Accessing the liquid domain *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  Thread liq = THREAD_SUPER_THREAD(0); \/* Pointing to liquid phase *\/&lt;\/span&gt;&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  \/* Define the variables *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  real db; \/* Bubble diamter placeholder *\/&lt;\/span&gt;&lt;br&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp; \/* Get local conditions from the dispersed (gas) phase *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  real eps = C_D(c, liq); \/* Obtain turbulence dissipation from liquid phase *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  real eG = C_VOF(c, t); \/* Volume fraction of the gas phase *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br&gt;  \/* Liquid properties *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  double density_liq = 998.2; \/* Density of liquid phase (kg\/m&amp;sup3;) *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  \/* Ensure epsilon is positive to avoid division errors *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  if (eps &lt;= 0.0)&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  {&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  &amp;nbsp; eps = 0.0000000001; \/* Small value to prevent singularity *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  }&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  if (eG &gt; 0.3)&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  {&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  &amp;nbsp; db = 0.0000001; \/* almost zero db *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  }&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  \/* Calderbank&#039;s model (1958) for pure liquid *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  \/* db = C1 + C2 * ((surf_tension \/ rhoL)^0.6 \/ eps^0.4) * eG^0.5 *\/&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  db = 0.0009 + 4.15 * pow(0.072 \/ density_liq, 0.6) * 1 \/ (pow(eps, 0.4)) * pow(eG, 0.5);&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;  return db;&lt;\/span&gt;&lt;br&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;}&lt;\/span&gt;&lt;\/pre&gt;&lt;div&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;<\/code><code><\/code>&lt;\/span&gt;&lt;\/div&gt;<\/p>\n","protected":false},"template":"","class_list":["post-425713","topic","type-topic","status-publish","hentry","topic-tag-fluent-ansys-1","topic-tag-bubble-diamter-1","topic-tag-udf"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_forum_id":["27792"],"_bbp_topic_id":["425713"],"_bbp_subscription":["27395","199"],"_bbp_author_ip":["131.180.10.131"],"_bbp_last_reply_id":["425876"],"_bbp_last_active_id":["425876"],"_bbp_last_active_time":["2025-03-17 11:20:59"],"_bbp_reply_count":["4"],"_bbp_reply_count_hidden":["0"],"_bbp_voice_count":["2"],"_bbp_engagement":["27395","199"],"_btv_view_count":["282"],"_bbp_topic_status":["unanswered"],"_edit_last":["27395"],"_bbp_revision_log":["a:2:{i:425714;a:2:{s:6:\"author\";i:27395;s:6:\"reason\";s:0:\"\";}i:425745;a:2:{s:6:\"author\";i:27395;s:6:\"reason\";s:0:\"\";}}"]},"test":"h-a-maldonadodeleontudelft-nl"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/425713","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":2,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/425713\/revisions"}],"predecessor-version":[{"id":425745,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/425713\/revisions\/425745"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=425713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}