Fluids

Fluids

Is the UDF for Herschel-Bulkley viscosity model right? I am receving AMG solver error.

    • uditkumar007
      Subscriber
      Hello,nI have written a UDF code for the Herschel-Bulkley viscosity model. nCODE:n#include udf.hnFILE *fp;nDEFINE_PROPERTY(hb_viscosity, c, t)n{nreal viscosity;nreal stress;nreal ys;nreal n, m;nreal k;nreal Max, Min;nn = 0.94; nys = 4.022; nk = 0.04; nm = 1000;nMax = 100000;nMin = 0.00000000001;nstress = C_STRAIN_RATE_MAG(c,t);nnviscosity = ys*(1-exp(-m*stress))/stress + k*pow(stress,n-1);nnreturn viscosity;n}nnI am receiving an AMG solver error when I try to run the solution. Which equation does ANSYS use to calculate the viscosity?nWhen I try to use the in-built Herschel-Bulkley model, I don't get a stable value from the Grid sensitivity analysis. Any kind of help will be very kind.nThanks.n
    • Rob
      Ansys Employee
      Other than defining the variables as REAL and then giving an INTEGER value it looks OK. Check the maths of the viscosity, and where are Min and Max used? Is the UDF returning a positive value?.If you're not getting a stable result with a refined mesh have a very careful look at the results. You may be finding new details in the flow (ie it's not yet mesh dependent) or your monitors may be picking up some transients in the flow. Hard to say without seeing pictures of the flow field. n
    • uditkumar007
      Subscriber
      Sir, I was receiving a floating-point error too. Maybe the stress was tending to 0 or equal to 0. So the UDF wasn't returning a positive value. So I tried it with an if loop. n{nif (stress<= 0)nstress = 10;n}nnThe solution was running. But I wasn't getting the desired values with this modificationnBut when I changed the Boundary conditions it's running fine. I guess I need to tweak this a little bit to get the desired values. nSir, I am not sure what the max and min value does. I saw this in a reference and also in ANSYS FLUENT 2020R2 there are Max Min And Count values in the strain rate section. Not sure what it does. Thank You Sir for your precious suggestions. n
    • Rob
      Ansys Employee
      Most viscosity models have a limit to prevent the fluid value exceeding a sensible range, maybe it relates to that (I've not looked). n
    • uditkumar007
      Subscriber
      Thank You Sir for your kind suggestions.n
Viewing 4 reply threads
  • You must be logged in to reply to this topic.