Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

UDS_FLUX incorrectly computing advective sink term

    • Anthony Bowers
      Subscriber

      Hello 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? 



    • Mark O
      Ansys Employee
      Hi Anthony,
       
      You can test if the y or z components of the gradient are having an effect by setting them to zero to see if it makes a difference. Based on your picture for the volume fraction gradient, the x component of the gradient looks to be the same at every face. You could check for any vertical variation by changing the range for the plot. If there is no significant vertical variation and you still see the same result after setting the y and z components to zero it must be coming from somewhere else. 
       
      Other things to check:
      What are your boundary conditions inlets/outlets/pressure etc for the volume fraction and UDS? 
      Is it steady state or transient? Has it run for long enough for any flow to pass through?
      Is it converged? To check convergence switch on and report locally scaled residuals.
       
      Regards
       
      Mark
Viewing 1 reply thread
  • You must be logged in to reply to this topic.