-
-
July 4, 2025 at 1:44 pm
Anthony Bowers
SubscriberHello all,
I am trying to implement a custom advection-like term that occurs at a gas-liquid interface using User-Defined Scalara functions. See equation (1)Â
To accomplish this term I am manipulating the DEFINE_UDS_FLUX term. See image below :
To implement this term using DEFINE_UDS_FLUX, the volume fraction gradient is obtained from a specific adjustment function where it is read by the DEFINE_UDS_FLUX. To make this term a flux, I linearly interpolate the volume fraction gradient values at neighboring cells to get a face value. See code below:ÂDEFINE_UDS_FLUX(VolumFracGrad_Sink, f, t, i){  cell_t c0, c1 = -1;  Thread *t0, *t1 = NULL;  real NV_VEC(A), flux = 0.0;  // Cell pointers  c0 = F_C0(f, t);  t0 = F_C0_THREAD(f, t);  c1 = F_C1(f, t);  t1 = F_C1_THREAD(f, t);  real grad_alpha[3];  // Compute face area vector  F_AREA(A, f, t);  if (BOUNDARY_FACE_THREAD_P(t))   {      flux = 0;   }  else  {   // -------------------------------  // 5. Gradient of alpha  // -------------------------------  grad_alpha[0] =(C_UDMI(c0, t0, 0)+C_UDMI(c1, t1, 0))*0.5;  grad_alpha[1] =(C_UDMI(c0, t0, 1)+C_UDMI(c1, t1, 1))*0.5;  grad_alpha[2] =(C_UDMI(c0, t0, 2)+C_UDMI(c1, t1, 2))*0.5;  flux = -NV_DOT(grad_alpha,A);  }  return flux;}
However, when I run this code using a volume of fluid approach with a sharp interface and a highly refined domain, I obtain this result.
Has anyone came across a similar problem? I'd expect a uniform result, not a skewed result. If I just take the x-direction gradient with no face area attachted, I get this result :
It is very strange because If I plot the volume fraction gradient obtained in the defined adjust function (which is saved as C_UDMI(c,t,0 to 2) this is the results:Â
However, it does seem that ansys is predicting a y-direction volume fraction gradient.. could this be the issue?Â
-
- You must be logged in to reply to this topic.
-
3407
-
1057
-
1051
-
896
-
887
© 2025 Copyright ANSYS, Inc. All rights reserved.