


{"id":161612,"date":"2021-08-25T17:57:33","date_gmt":"2021-08-25T17:57:33","guid":{"rendered":"\/forum\/forums\/topic\/interface-tracking-between-2-phases-in-vof\/"},"modified":"2021-08-26T11:46:47","modified_gmt":"2021-08-26T11:46:47","slug":"interface-tracking-between-2-phases-in-vof","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/interface-tracking-between-2-phases-in-vof\/","title":{"rendered":"Interface tracking between 2 phases in VOF"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>I am modeling laser melting in FLUENT using solidification\/melting and VOF. There are a number of particles over a solid substrate and there is an inert gas atmosphere above them. Now, the laser energy is a surface heat source. I need to convert it into volumetric heat source and then apply it into the interfacial cells between the metal particles and the gas. I need 2 things for this:<\/p>\n<ol>\n<li>Gradient of volume fraction of a phase in a cell(C_VOF_G) to convert the surface source to volumetric source. I understand that FLUENT does not have a macro for gradient of volume fraction. How to get the gradient of volume fraction?<\/li>\n<li>When the laser will melt the particle, volume fraction in the cells will change and hence the interface. How to track this interface using a UDF so that laser is applied on the interfacial cells?<\/li>\n<\/ol>\n<p>Till now I have been using the following code and it compiles without any error, When I give an inlet velocity for the gas domain and an outlet, the simulation runs although the results are not correct. When I make the gas domain stationary , the simulation completes without anything happening. Any help is much appreciated. <\/p>\n<p>Thank you<\/p>\n<p>DEFINE_ADJUST(adjust_gradient_heat, domain)<\/p>\n<p>{<\/p>\n<p> Thread *t;<\/p>\n<p> Thread **pt;<\/p>\n<p> cell_t c;<\/p>\n<p> int phase_domain_index = 1.0;<\/p>\n<p> Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,phase_domain_index);<\/p>\n<p> {<\/p>\n<p> Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);<\/p>\n<p> Scalar_Reconstruction(pDomain, SV_VOF,-1,SV_VOF_RG,NULL);<\/p>\n<p> Scalar_Derivatives(pDomain,SV_VOF,-1,SV_VOF_G,SV_VOF_RG, Vof_Deriv_Accumulate);<\/p>\n<p> }<\/p>\n<p><\/p>\n<\/p>\n<p> mp_thread_loop_c(t,domain,pt)<\/p>\n<p> if (FLUID_THREAD_P(t))<\/p>\n<p> {<\/p>\n<p> Thread *ppt = pt[phase_domain_index];<\/p>\n<p><\/p>\n<\/p>\n<p> begin_c_loop (c,t)<\/p>\n<p> {<\/p>\n<p> C_UDMI(c,t,0) = C_VOF_G(c,ppt)[0];<\/p>\n<p> C_UDMI(c,t,1) = C_VOF_G(c,ppt)[1];<\/p>\n<p> C_UDMI(c,t,2) = C_VOF_G(c,ppt)[2];<\/p>\n<p> C_UDMI(c,t,3) = sqrt(C_UDMI(c,t,0)*C_UDMI(c,t,0) + C_UDMI(c,t,1)*C_UDMI(c,t,1) + C_UDMI(c,t,2)*C_UDMI(c,t,2));&nbsp;&nbsp;&nbsp;&nbsp;\/\/ magnitude of gradient of volume fraction&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p> C_UDMI(c,t,4) = C_UDMI(c,t,0)\/C_UDMI(c,t,3);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ nx -&gt; x gradient of volume fraction divided by magnitude of gradient of volume fraction<\/p>\n<p> C_UDMI(c,t,5) = C_UDMI(c,t,1)\/C_UDMI(c,t,3);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ ny -&gt; y gradient of volume fraction divided by magnitude of gradient of volume fraction&nbsp;<\/p>\n<p> C_UDMI(c,t,6) = C_UDMI(c,t,2)\/C_UDMI(c,t,3);\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ nz -&gt; z gradient of volume fraction divided by magnitude of gradient of volume fraction\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p> }<\/p>\n<p> end_c_loop (c,t)<\/p>\n<p> }<\/p>\n<p> Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);<\/p>\n<p>}<\/p>\n<p>DEFINE_SOURCE(heat_source, c, t, dS, eqn)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/\/ The name of the UDF is heat_source<\/p>\n<p>{<\/p>\n<p> Thread *pri_th;<\/p>\n<p> Thread *sec_th;<\/p>\n<\/p>\n<p> real source;<\/p>\n<p> real x[ND_ND], time;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;\/\/ Define face centroid vector, time<\/p>\n<p> time = RP_Get_Real(&quot;flow-time&quot;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ Acquire time from Fluent solver<\/p>\n<p> C_CENTROID(x, c, t);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;\/\/ Acquire the cell centroid location<\/p>\n<p> real T = C_T(c,t);<\/p>\n<\/p>\n<p> pri_th = THREAD_SUB_THREAD(t, 0);<\/p>\n<p> sec_th = THREAD_SUB_THREAD(t, 1);<\/p>\n<\/p>\n<p> real alpha = C_VOF(c,sec_th);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ cell volume fraction<\/p>\n<p> real gamma;<\/p>\n<\/p>\n<p> if (T&gt;293.0 &amp;&amp; T&lt;1658.0)<\/p>\n<p> {<\/p>\n<p> gamma = 0;<\/p>\n<p> }<\/p>\n<p> else if (T&gt;=1658.0 &amp;&amp; T&lt;=1723.0)<\/p>\n<p> {<\/p>\n<p> gamma = (T-Ts)\/(Tl-Ts);<\/p>\n<p> }<\/p>\n<p> else if (T&gt;1723.0)<\/p>\n<p> {<\/p>\n<p> gamma = 1;<\/p>\n<p> }<\/p>\n<\/p>\n<p> real Pv = 0.54*Pa*exp((Lv*M*(T-Tv))\/(Rg*T*Tv));<\/p>\n<p> real mv = (0.82*M*Pv)\/(sqrt(2*Pi*M*Rg*T));<\/p>\n<\/p>\n<p> real rhos = 7900;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ density of solid SS316<\/p>\n<p> real rhol = 7433 + 0.0393*T &#8211; 0.00018*pow(T,2);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ density of liquid SS316<\/p>\n<p> real rhom = rhol*gamma + rhos*(1-gamma);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ density of SS316<\/p>\n<p> real rho = alpha*rhom + rhog*(1-alpha);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ density of cell containing metal and gas<\/p>\n<p> real Cps = 462 + 0.134*T;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ specific heat of solid SS316<\/p>\n<p> real Cpl = 775;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ specific heat of liquid SS316<\/p>\n<p> real Cpm = Cpl*gamma + Cps*(1-gamma);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ specific heat of SS316<\/p>\n<p> real Cp = alpha*Cpm + Cpg*(1-alpha);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ specific heat of cell containing metal and gas<\/p>\n<\/p>\n<p> real factor = (2*rho*Cp)\/(rhom*Cpm + rhog*Cpg);<\/p>\n<\/p>\n<p> real r = sqrt(pow(x[0]-x0-v*time,2.0) + pow(x[1]-y0,2.0));<\/p>\n<p><\/p>\n<\/p>\n<p> if(C_VOF(c,sec_th)&gt;0.05 &amp;&amp; C_VOF(c,sec_th)&lt;1)<\/p>\n<p> {<\/p>\n<p> if(C_T(c,t) &lt; 3090)<\/p>\n<p> {<\/p>\n<p> source = (((2*A*P)\/(Pi*R*R))*exp((-2*(r*r))\/(R*R)) &#8211; h*(T-Ta) &#8211; s*e*(pow(T,4) &#8211; pow(Ta,4)))*C_UDMI(c,t,3)*factor;<\/p>\n<p> dS[eqn] = 0.0;<\/p>\n<p> }<\/p>\n<p> else if(C_T(c,t) &gt;= 3090)<\/p>\n<p> {<\/p>\n<p> source = (((2*A*P)\/(Pi*R*R))*exp((-2*(r*r))\/(R*R)) &#8211; h*(T-Ta) &#8211; s*e*(pow(T,4) &#8211; pow(Ta,4)) &#8211; Lv*mv)*C_UDMI(c,t,3)*factor;<\/p>\n<p> dS[eqn] = 0.0;<\/p>\n<p> }<\/p>\n<p> }<\/p>\n<p> else\t<\/p>\n<p> {<\/p>\n<p> source = 0.0;<\/p>\n<p> dS[eqn] = 0.0;<\/p>\n<p> }<\/p>\n<p> return source;<\/p>\n<p>}<\/p>\n","protected":false},"template":"","class_list":["post-161612","topic","type-topic","status-closed","hentry","topic-tag-interface","topic-tag-laser-welding-1","topic-tag-melting-solidification-2","topic-tag-SelectiveLaserMelting-1","topic-tag-vof-model"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_author_ip":[""],"_bbp_old_reply_author_name_id":["Anonymous"],"_bbp_old_is_reply_anonymous_id":["false"],"_btv_view_count":["1591"],"_bbp_likes_count":["0"],"_bbp_subscription":["242319"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["161612"],"_bbp_forum_id":["27792"],"_bbp_engagement":["22555","167859"],"_bbp_voice_count":["2"],"_bbp_reply_count":["3"],"_bbp_last_reply_id":["189998"],"_bbp_last_active_id":["189998"],"_bbp_last_active_time":["2021-08-26 11:46:47"]},"test":"pawan"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/161612","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\/161612\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=161612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}