


{"id":430473,"date":"2025-04-30T16:28:37","date_gmt":"2025-04-30T16:28:37","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/modeling-the-marangoni-effect-in-a-multiphase-problem-using-udf-in-fluent\/"},"modified":"2025-04-30T16:56:49","modified_gmt":"2025-04-30T16:56:49","slug":"modeling-the-marangoni-effect-in-a-multiphase-problem-using-udf-in-fluent","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/modeling-the-marangoni-effect-in-a-multiphase-problem-using-udf-in-fluent\/","title":{"rendered":"Modeling the Marangoni effect in a multiphase problem using UDF in Fluent"},"content":{"rendered":"<p>&lt;p&gt;&lt;p&gt;&lt;p&gt;&lt;p&gt;I am trying to model the Marangoni effect on a free surface where heating occurs. In my problem using two materials, but implicitly the third is air. So I want to use the Marangoni condition on the surface:&lt;br&gt;<img decoding=\"async\" src=\"https:\/\/innovationspace.ansys.com\/forum\/wp-content\/uploads\/sites\/2\/2025\/04\/30-04-2025-1746029487-mceclip0.png\" \/>&lt;\/p&gt;&lt;p&gt;Hovewer in Ansys 2023R1 Fluent does not support non-&#8220;single-valued&#8221; expressions to account for the distribution of different phases on the surface, that is, the coefficient must be geometrically the same on the edge. The most interesting thing is that the assignment of conditions on the shear stress vector is supported by expressions, but for some reason I get an error about &#8220;unsuccessful interpolation in the nodes of the face&#8221;, therefore there is simply zero by default, as can be seen in the solution in the form of a wall shear stress equal to 0.&lt;br&gt;So I took a stab at creating a UDF that works, but the problem is that I also use internal sources via DEFINE_SOURCE that regulates the speed in cells that have not yet melted .And here is the strangest thing, that only the Marangoni stress condition built into Fluent gives correct results, and the velocities are also &#8220;suppressed&#8221; by the sources. In the case DEFINE_PROFILE is basically applie boundary conditions on the velocity, without taking into account the sources included in the momentum equation (my guess), unlike the built-in method. In this regard, I provide my code and ask for help with how exactly you implement your conditions so that, as you write, &#8220;This shear stress is then applied to the momentum equation&#8221; (apparently directly).&lt;\/p&gt;&lt;div&gt;#include &#8220;vars_opt_conv_rad.h&#8221;&lt;\/div&gt;&lt;div&gt;#include &#8220;udf.h&#8221;&lt;\/div&gt;&lt;div&gt;#include &#8220;sg.h&#8221;&lt;\/div&gt;&lt;div&gt;#include &#8220;sg_mphase.h&#8221;&lt;\/div&gt;&lt;div&gt;#include &#8220;mem.h&#8221;&lt;\/div&gt;&lt;div&gt;#include &#8220;metric.h&#8221;&lt;\/div&gt;&lt;div&gt;#include &#8220;math.h&#8221;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;#define dTdx 0&lt;\/div&gt;&lt;div&gt;#define dTdz 1&lt;\/div&gt;&lt;div&gt;#define VOF1 2&lt;\/div&gt;&lt;div&gt;#define LVOF1 3&lt;\/div&gt;&lt;div&gt;#define LVOF2 4&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;DEFINE_EXECUTE_ON_LOADING(on_loading, libudf)&lt;\/div&gt;&lt;div&gt;{&lt;\/div&gt;&lt;div&gt;Set_User_Memory_Name(dTdx, &#8220;dTdx&#8221;);&lt;\/div&gt;&lt;div&gt;Set_User_Memory_Name(dTdz, &#8220;dTdz&#8221;);&lt;\/div&gt;&lt;div&gt;Set_User_Memory_Name(VOF1, &#8220;VOF1&#8221;);&lt;\/div&gt;&lt;div&gt;Set_User_Memory_Name(LVOF1, &#8220;LVOF1&#8221;);&lt;\/div&gt;&lt;div&gt;Set_User_Memory_Name(LVOF2, &#8220;LVOF2&#8221;);&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;div&gt;&lt;div&gt;void compute_temperature_derivatives(Domain *domain)&lt;\/div&gt;&lt;div&gt;{&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; MD_Alloc_Storage_Vars(domain, SV_T_RG, SV_T_G, SV_NULL);&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; Scalar_Reconstruction(domain, SV_T, -1, SV_T_RG, NULL);&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; Scalar_Derivatives(domain, SV_T, -1, SV_T_G, SV_T_RG, NULL);&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;DEFINE_ADJUST(compute_grad_and_phase, domain)&lt;\/div&gt;&lt;div&gt;{&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; Thread *ct, *phase_thread;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; cell_t c;&lt;\/div&gt;&lt;div&gt;real *Tgr;&lt;\/div&gt;&lt;div&gt;real T;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; compute_temperature_derivatives(domain);&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; thread_loop_c(ct, domain)&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; {&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; begin_c_loop(c, ct)&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; {&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tgr = C_T_RG(c, ct);&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; C_UDMI(c, ct, dTdx) = Tgr[0];&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; C_UDMI(c, ct, dTdz) = Tgr[2];&nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; phase_thread = THREAD_SUB_THREAD(ct, 0);&nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (phase_thread)&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; C_UDMI(c, ct, VOF1) = C_VOF(c, phase_thread);&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;real Tm = C_UDMI(c, ct, VOF1) * Tm_phase1 + (1.0 &#8211; C_UDMI(c, ct, VOF1)) * Tm_phase2;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;T = C_T(c, ct);&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;if (T &lt;= Ts1) {&lt;\/div&gt;&lt;div&gt;C_UDMI(c, ct, LVOF1) = 0.0;&nbsp;&lt;\/div&gt;&lt;div&gt;} else if (T &gt;= Tl1) {&lt;\/div&gt;&lt;div&gt;C_UDMI(c, ct, LVOF1) = 1.0;&nbsp;&lt;\/div&gt;&lt;div&gt;} else {&lt;\/div&gt;&lt;div&gt;C_UDMI(c, ct, LVOF1) = (T &#8211; Ts1) \/ (Tl1 &#8211; Ts1);&nbsp;&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;if (T &lt;= Ts2) {&lt;\/div&gt;&lt;div&gt;C_UDMI(c, ct, LVOF2) = 0.0;&lt;\/div&gt;&lt;div&gt;} else if (T &gt;= Tl2) {&lt;\/div&gt;&lt;div&gt;C_UDMI(c, ct, LVOF2) = 1.0;&lt;\/div&gt;&lt;div&gt;} else {&lt;\/div&gt;&lt;div&gt;C_UDMI(c, ct, LVOF2) = (T &#8211; Ts2) \/ (Tl2 &#8211; Ts2);&nbsp;&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; }&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; end_c_loop(c, ct)&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; }&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;DEFINE_PROFILE(marangoni_shear_x, t, i)&lt;\/div&gt;&lt;div&gt;{&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; face_t f;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; cell_t c;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; Thread *ct;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; begin_f_loop(f, t)&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; {&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; c = F_C0(f, t);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; ct = F_C0_THREAD(f, t);&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real vof1 = C_UDMI(c, ct, VOF1);&nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;real f1 = C_UDMI(c, ct, LVOF1);&lt;\/div&gt;&lt;div&gt;real f2 = C_UDMI(c, ct, LVOF2);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real gradTx = C_UDMI(c, ct, dTdx);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real T = C_T(c, ct);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real Tm = vof1 * Tm_phase1 + (1.0 &#8211; vof1) * Tm_phase2;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real dSigma_dT = D_SIGMA_DT_1 * vof1 + D_SIGMA_DT_2 * (1.0 &#8211; vof1);&lt;\/div&gt;&lt;div&gt;real f_liquid = vof1 * f1 + (1.0 &#8211; vof1) * f2;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real sigmoid = f_liquid \/ (1.0 + exp((Tm &#8211; T) \/ 10));&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; F_PROFILE(f, t, i) = &#8211; dSigma_dT * gradTx * sigmoid;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; }&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; end_f_loop(f, t)&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;DEFINE_PROFILE(marangoni_shear_z, t, i)&lt;\/div&gt;&lt;div&gt;{&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; face_t f;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; cell_t c;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; Thread *ct;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; begin_f_loop(f, t)&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; {&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; c = F_C0(f, t);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; ct = F_C0_THREAD(f, t);&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real vof1 = C_UDMI(c, ct, VOF1);&nbsp; &nbsp;&lt;\/div&gt;&lt;div&gt;real f1 = C_UDMI(c, ct, LVOF1);&lt;\/div&gt;&lt;div&gt;real f2 = C_UDMI(c, ct, LVOF2);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real gradTz = C_UDMI(c, ct, dTdz);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real T = C_T(c, ct);&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real Tm = vof1 * Tm_phase1 + (1.0 &#8211; vof1) * Tm_phase2;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real dSigma_dT = D_SIGMA_DT_1 * vof1 + D_SIGMA_DT_2 * (1.0 &#8211; vof1);&lt;\/div&gt;&lt;div&gt;real f_liquid = vof1 * f1 + (1.0 &#8211; vof1) * f2;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; real sigmoid = f_liquid \/ (1.0 + exp((Tm &#8211; T) \/ 10));&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; F_PROFILE(f, t, i) = &#8211; dSigma_dT * gradTz * sigmoid;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; }&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; end_f_loop(f, t)&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;\/* Brake force X *\/&lt;\/div&gt;&lt;div&gt;DEFINE_SOURCE(s_bfx, c, t, dS, eqn)&lt;\/div&gt;&lt;div&gt;{&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real src, T, vx0;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real velocity_multiplier, brake_factor;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real f1, f2;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; Thread *primary_thread;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; primary_thread = THREAD_SUB_THREAD(t, 0);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real phase1_frac = C_VOF(c, primary_thread);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; T = C_T(c, t);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real Tm = phase1_frac * Tm_phase1 + (1.0 &#8211; phase1_frac) * Tm_phase2;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; f1 = C_UDMI(c, t, LVOF1);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; f2 = C_UDMI(c, t, LVOF2);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; brake_factor = brakeForceFactor * (&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; phase1_frac * (1.0 &#8211; f1) +&nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; (1.0 &#8211; phase1_frac) * (1.0 &#8211; f2)&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; );&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; vx0 = 0;&nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; velocity_multiplier = -C_R(c, t) * brake_factor \/ (1.0 + exp((T &#8211; Tm) \/ 3.0));&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; src = velocity_multiplier * (C_U(c, t) &#8211; vx0);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; dS[eqn] = velocity_multiplier;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; return src;&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;\/* Brake force Y *\/&lt;\/div&gt;&lt;div&gt;DEFINE_SOURCE(s_bfy, c, t, dS, eqn)&lt;\/div&gt;&lt;div&gt;{&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real src, T, vy0;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real velocity_multiplier, brake_factor;&lt;\/div&gt;&lt;div&gt;real f1, f2;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; Thread *primary_thread;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;primary_thread = THREAD_SUB_THREAD(t, 0);&lt;\/div&gt;&lt;div&gt;real phase1_frac = C_VOF(c, primary_thread);&lt;\/div&gt;&lt;div&gt;T = C_T(c, t);&lt;\/div&gt;&lt;div&gt;real Tm = phase1_frac * Tm_phase1 + (1.0 &#8211; phase1_frac) * Tm_phase2;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;f1 = C_UDMI(c, t, LVOF1);&lt;\/div&gt;&lt;div&gt;f2 = C_UDMI(c, t, LVOF2);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; brake_factor = brakeForceFactor * (&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; phase1_frac * (1.0 &#8211; f1) +&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; (1.0 &#8211; phase1_frac) * (1.0 &#8211; f2)&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; );&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; vy0 = 0;&nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; velocity_multiplier = -1.0 * C_R(c, t) * brake_factor \/ (1.0 + exp((T &#8211; Tm) \/ 3.0));&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; src = velocity_multiplier * (C_V(c, t) &#8211; vy0);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; dS[eqn] = velocity_multiplier;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; return src;&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;\/* Brake force Z *\/&lt;\/div&gt;&lt;div&gt;DEFINE_SOURCE(s_bfz, c, t, dS, eqn)&lt;\/div&gt;&lt;div&gt;{&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real src, T, vz0;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real velocity_multiplier, brake_factor;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real f1, f2;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; Thread *primary_thread;&lt;\/div&gt;&lt;div&gt;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; primary_thread = THREAD_SUB_THREAD(t, 0);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real phase1_frac = C_VOF(c, primary_thread);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; T = C_T(c, t);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; real Tm = phase1_frac * Tm_phase1 + (1.0 &#8211; phase1_frac) * Tm_phase2;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; f1 = C_UDMI(c, t, LVOF1);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; f2 = C_UDMI(c, t, LVOF2);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; brake_factor = brakeForceFactor * (&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; phase1_frac * (1.0 &#8211; f1) +&nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; &nbsp; &nbsp; (1.0 &#8211; phase1_frac) * (1.0 &#8211; f2)&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; );&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; vz0 = 0;&nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; velocity_multiplier = -C_R(c, t) * brake_factor \/ (1.0 + exp((T &#8211; Tm) \/ 3.0));&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; src = velocity_multiplier * (C_W(c, t) &#8211; vz0);&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; dS[eqn] = velocity_multiplier;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp;&nbsp;&lt;\/div&gt;&lt;div&gt;&nbsp; &nbsp; return src;&lt;\/div&gt;&lt;div&gt;}&lt;\/div&gt;&lt;\/div&gt;<\/p>\n","protected":false},"template":"","class_list":["post-430473","topic","type-topic","status-publish","hentry","topic-tag-fluent-ansys-1","topic-tag-boundary-conditions","topic-tag-Marangoniforce-1","topic-tag-udf"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_forum_id":["27792"],"_bbp_topic_id":["430473"],"_bbp_subscription":["546897","199"],"_bbp_author_ip":["95.141.32.101"],"_bbp_last_reply_id":["430584"],"_bbp_last_active_id":["430584"],"_bbp_last_active_time":["2025-05-01 16:23:30"],"_bbp_reply_count":["8"],"_bbp_reply_count_hidden":["0"],"_bbp_voice_count":["2"],"_bbp_engagement":["546897","199"],"_btv_view_count":["364"],"_bbp_topic_status":["unanswered"],"_edit_last":["546897"],"_bbp_revision_log":["a:3:{i:430477;a:2:{s:6:\"author\";i:546897;s:6:\"reason\";s:0:\"\";}i:430478;a:2:{s:6:\"author\";i:546897;s:6:\"reason\";s:0:\"\";}i:430479;a:2:{s:6:\"author\";i:546897;s:6:\"reason\";s:0:\"\";}}"]},"test":"ilya-nearakcheevgmail-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/430473","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":3,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/430473\/revisions"}],"predecessor-version":[{"id":430479,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/430473\/revisions\/430479"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=430473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}