Fluids

Fluids

Initialization and Initialization with UDF

    • liliana_augusto
      Subscriber

      Hello all,


      I am simulating a flow between two paralell plates, of a non-newtonian fluid (Herschel Bulkley). For the calculation of the viscosity I have used a UDF.


      I have two problems: if I compiled the UDF and initialize the simulation, I got this error:


      Divergence detected in AMG solver: x-momentum 
      Divergence detected in AMG solver: y-momentum 
      Divergence detected in AMG solver: pressure correction 
      Error at host: floating point exception 
      # Divergence detected in AMG solver: x-momentum -> Increasing relaxation sweeps!
      Error at Node 0: floating point exception
      # You may try the enhanced divergence recovery with (rpsetvar 'amg/protective-enhanced? #t)


      I have tried to decrease the relaxation factor, but it did not solve it...


      So I have tried to start the simulation with a newtonian fluid (using "k" of HB equation) and then continue the simulation with the UDF. Although, depending on the initial state I used, I got a different result. Is this normal? Has anyone have any suggestion to start the simulation with the UDF.


      The weird thing is: if I set tau0 to zero (like a power law viscosity), the results are in very good agreement with the analytical solution. If I use a fluid with a non-zero tau0, I have this issue.


      Here are the UDF:


      #include "udf.h"


      FILE *fp;


      DEFINE_PROPERTY(hb_viscosity, c, t)


      {


      real vis;


      real shear;


      real ys;


      real n; 


      real m;


      real k;


      real Max, Min;


      n = 0.797; /* Power Law Index */


      ys = 189; /* Initial Yield Stress */


      k = 4.1; /* Fluid Consistency */


      m = 100000000;


      Max = 100000000;


      Min = 0.00000000001;


      shear = C_STRAIN_RATE_MAG(c,t);


      vis = ys*(1-exp(-m*shear))/shear + k*pow(shear,n-1);


      return vis;


      }


      Thanks!

    • Karthik R
      Administrator

      Hello,


      Couple of question:



      • Did you get any compilation errors? It seems like you were able to run the simulation without the UDF.

      • What are your initial velocities (are they being computed from inlet or are you using 0 m/s)?

      • Are you solving a steady model? Did you let the model converge before turning on the UDF? If you are, depending on where you start using the UDF, it is not uncommon that you are getting a different steady state solution. Your UDF is computing a viscosity based on the shear rate (at a certain iteration) and this makes the momentum equation non-linear (shear stress terms). Therefore, each time you have a different shear rate, you might get a different value. 

      • Please plot vis vs. shear rate curve for your model and make sure your starting conditions are physical. I am suspecting that your initial viscosity is not physical and therefore, you are seeing a divergence. The fact that you are seeing different solution based for different number of iterations might be complimenting this. Could you please plot this and share the plot here?

      • I do not understand your tau0 question. Right now, you do not have a tau0 term in your model. Are you talking about initial yield stress?


      I hope this helps.


      Best Regards,


      Karthik

    • liliana_augusto
      Subscriber

      Hi!


       


      Not, the UDF is compiled ok. I got no errors. The simulation runs fine without UDF. It also runs with the UDF, but if I use for example a previous result I got with Newtonian fluid, I also runs, but did not converge to a good solution (very bad agreement with analytical solution).


      I used Hybrid Initialization and the run the simulation. If I do this with UDF, I got that erros that I sent previosly. Even if I decrease relaxation factors.


      Yes, it is steady model.


      I will try to plot what you said.


      The problem with tau0: If I simulate a fluid with a yield stress, the results are not good. But if I simulate a fluid with no yield stress (tau0), using same UDF just setting tau0=0, the results are in very good agreement with analytical solution.


      Thanks!


       

    • liliana_augusto
      Subscriber

      Some details of the simulation:


      Inlet: Pressure-inlet 30kPa


      Outlet: Pressure-outlet 0

    • liliana_augusto
      Subscriber

      Here it goes: I am using the regularized model (dashed line).


    • Rob
      Ansys Employee

      I'd suggest dropping the maximum down to around 10: if it's too viscous it'll mess with the numerics and much above 0.1 and it'll not move much anyway!  Also, try using a velocity inlet to get the model started.  What does the solution look like if you plot viscosity contour across the channel (node values off)? 

    • liliana_augusto
      Subscriber

      Hi!


      You mean drop the maximum down of the shear rate? How do I do this in Fluent? The graph is generic, just a plot of HB equation with the parameters I am using in the simulation.


      The problem is that I got the pressure difference from experimental data, not the velocity... That is why I was using pressure inlet and outlet. It should be a problem using pressure at inlet AND outlet?


      The contour of the molecular viscosity is quite messy...

    • liliana_augusto
      Subscriber

      Even with velocity inlet I got the divergence problem at the beggining.

    • Karthik R
      Administrator

      Hello,


      The reason you are seeing divergence in your model is because your starting viscosity is unnatural for a fluid and Fluent is having tough time handling this viscosity. Please make sure your viscosity and shear-stress are reasonable. One thing you could try is to use only a small portion of your viscosity - shear rate curve (where the material still behaves similar to a fluid). A viscosity of 10^6 for a fluid is unrealistic and it is essentially a solid. 


      Please let us know what you find.


      Thank you.


      Best Regards,


      Karthik

    • liliana_augusto
      Subscriber

      The curve is just generic... I plotted the HB equation for a big interval of shear rate and viscosity.


       


      FOR THE SIMULATION, I am using k as 4.1. So at the beggining I set the viscosity of the fluid as 4.1 and then turn on the UDF, with k also as 4.1.


      The viscosity does not reach a value of 10^6 at all.

    • liliana_augusto
      Subscriber

      I check the results (although I am not sure if it is correct...) and the strain rate is reaching 280 1/s and molecular viscosity is reaching 4200 Pa at the center.

    • Rob
      Ansys Employee

      That's pretty much plug flow in the middle and (probably) a low viscosity at the wall. Check the mesh resolution near the wall. 

Viewing 11 reply threads
  • You must be logged in to reply to this topic.