Generalized Newtonian Fluid in Basilisk C

434 views
Skip to first unread message

srivastava...@gmail.com

unread,
Oct 12, 2018, 12:57:11 AM10/12/18
to basilisk-fr
Dear Basilisk C users, 

I want to implement the equations for generalized Newtonian fluids in Basilisk C. 

Something similar to from its Gerris counterpart:

  SourceViscosity {} {
    double mu, ty, N, mumax = 1000.;
    double m;

    switch (MODEL) {
    case 0: /* Newtonian */
      mu = 1.; ty = 0.; N = 1.; break;
    case 1: /* Power-law (shear-thinning) */
      mu = 0.08; ty = 0.; N = 0.5; break;
    case 2: /* Herschel-Bulkley */
      mu = 0.0672; ty = 0.12; N = 0.5; break;
    case 3: /* Bingham */
      mu = 1.; ty = 10.; N = 1.; break;
    }
    if (D2 > 0.)
      m = ty/(2.*D2) + mu*exp ((N - 1.)*log (D2));
    else {
      if (ty > 0. || N < 1.) m = mumax;
      else m = N == 1. ? mu : 0.;
    }
    return MIN (m, mumax);
  } {
    # Crank-Nicholson does not converge for these cases, we need backward Euler
    # (beta = 0.5 -> Crank-Nicholson, beta = 1 -> backward Euler)
    beta = 1
  }

Can you please tell me what would be the best way to access (/calculate) the second principal invariant of the shear strain rate tensor

I realize that one way to do this would be to use the velocity field and calculate its gradient and then find the invariant inside the code. I was just wondering if there exists a variable (or an inbuilt Basilisk function) which does this for us? I can use anything which is closest to this as a starting point. 


Regards, 
Nihal
 

Stephane Popinet

unread,
Oct 12, 2018, 2:11:14 AM10/12/18
to basil...@googlegroups.com
Hi Nihal,

See Pierre-Yves Lagrée's sandbox:

http://basilisk.fr/sandbox/M1EMN/README#examples-of-granular-flows
http://basilisk.fr/sandbox/M1EMN/Exemples/granular_column.c

cheers,

Stephane

PS: note that you could have found this yourself by typing "D2" in the
search box on the website...

Vatsal Sanjay

unread,
Oct 31, 2018, 12:24:41 PM10/31/18
to basilisk-fr

Hi Nihal and Prof. Popinet,


I have been working on a similar problem (implementation of Generalized Newtonian Viscosity in Basilisk C). Pierre-Yves Lagrée's sandbox has been helpful for this. I have a few comments and then a doubt:


  1. I extended the method described at http://basilisk.fr/sandbox/M1EMN/Exemples/bingham_simple.c for generalized Newtonian fluids, and it works well. (the code can be accessed at https://github.com/VatsalSy/PlanarCouetteFlow_PowerLaw.

  2. I changed the way D2 is calculated in the above code (and in Pierre-Yves Lagrée's sandbox) to do the calculations at the face centers instead of the cell-centers. The part of the code that changed is:


double muTemp = mu_0;
 foreach_face() {
   double D11 = (u.x[] - u.x[-1,0]);
   double D22 = ((u.y[0,1]-u.y[0,-1])+(u.y[-1,1]-u.y[-1,-1]))/4.0;
   double D12 = 0.5*(((u.x[0,1]-u.x[0,-1])+(u.x[-1,1]-u.x[-1,-1]))/4.0 + (u.y[] - u.y[-1,0]));
   double D2 = sqrt(sq(D11)+sq(D22)+2.0*sq(D12))/(Delta);
   if (D2 > 0.0) {
     double temp = tauy/(sqrt(2.0)*D2) + mu_0*exp((n-1.0)*log(D2/sqrt(2.0)));
     muTemp = min(temp, mumax);
   } else {
     if (tauy > 0.0 || n < 1.0){
       muTemp = mumax;
     } else {
       muTemp = (n == 1.0 ? mu_0 : 0.0);
     }
   }
   muv.x[] = fm.x[]*(muTemp);
 }
 boundary ((scalar *){muv});

The only difference that I found was that using the above code, I was able to predict the plug region accurately, but the difference is not that high.

The code is available at https://github.com/VatsalSy/PlanarCouetteFlow_PowerLawV2


  1. I was also able to reproduce Popinet’s sandbox results from http://basilisk.fr/sandbox/popinet/lid-bingham.c, where he uses the Augmented Lagrangian Method to solve for Bingham fluids. The code is available at:

https://github.com/VatsalSy/LidDrivenFlowVP


So, with these tests, I am reasonably confident that the implementation of regularization is ok. As a final test, I wanted to simulate the test case used in Gerris (http://gerris.dalembert.upmc.fr/gerris/tests/tests/couette.html) in Basilisk. For this, I use the recently added embedded boundary method to have a rotating inner cylinder (http://basilisk.fr/src/embed.h). The code I use is available at https://github.com/VatsalSy/RotatingCouette


The technique works well for Bingham fluids, but I could not reproduce the Gerris (and theoretical) results for power law / Shear-thinning fluids (with n = 0.5).


Can you please suggest me why that would be so? Or, maybe some other (better?) test case for verifying that the method works fine. I have changed the values of mu_0, mumax, refinement level, and time-step but the result attached is the best I could get. I also tried doing the same case with Pierre-Yves Lagrée's method of calculating D2 at the cell-center instead of the face center with no improvement.


I have attached the final results from each of the four simulations that I have mentioned here with this post.


P.S. Another thing which is strange is that if I reduce the value of n from 0.5 to 0.38-0.42, it matches the Gerris (and theoretical) results quite well.


Cheers,
Vatsal

-- 
Vatsal Sanjay

Ph.D. Student
Physics of Fluids Group
University of Twente
Enschede, the Netherlands
https://pof.tnw.utwente.nl

Past:
Two-Phase Flow & Instability Lab
Department of Mechanical Engineering
Indian Institute of Technology Roorkee
https://twophaseiitr.weebly.com


NonNewtonian.png
NonNewtonian_FACE.png
LidDriven.png
Couette.png

"Pierre-Yves Lagrée (PYL)"

unread,
Nov 2, 2018, 7:42:32 AM11/2/18
to basilisk-fr
Hi Vatsal 



 

  1. I extended the method described at http://basilisk.fr/sandbox/M1EMN/Exemples/bingham_simple.c for generalized Newtonian fluids, and it works well. (the code can be accessed at https://github.com/VatsalSy/PlanarCouetteFlow_PowerLaw.

It would be nice to open your own sandbox on basilisk page and put all these codes there! 


 So, with these tests, I am reasonably confident that the implementation of regularization is ok.

very good news. 


As a final test, I wanted to simulate the test case used in Gerris (http://gerris.dalembert.upmc.fr/gerris/tests/tests/couette.html) in Basilisk. For this, I use the recently added embedded boundary method to have a rotating inner cylinder (http://basilisk.fr/src/embed.h). The code I use is available at https://github.com/VatsalSy/RotatingCouette

The technique works well for Bingham fluids, but I could not reproduce the Gerris (and theoretical) results for power law / Shear-thinning fluids (with n = 0.5).

 

P.S. Another thing which is strange is that if I reduce the value of n from 0.5 to 0.38-0.42, it matches the Gerris (and theoretical) results quite well.


Sorry no idea


Sincerely

 



----> ----> ----> ----> ---->  
---> Pierre-Yves Lagrée (PYL)
_____________________________
///////////////////////////// 

Vatsal Sanjay

unread,
Nov 2, 2018, 9:13:08 AM11/2/18
to basilisk-fr
Hi Pierre,

Thank you for your quick response. 



It would be nice to open your own sandbox on basilisk page and put all these codes there! 


Sure. I would love to do that. Can you please tell me how? Is there a guide for that? I tried searching on Basilisk page and found this: http://basilisk.fr/Help#editing-the-wiki-with-darcs


Cheers, 
Vatsal

Alexis Berny

unread,
Nov 2, 2018, 9:16:37 AM11/2/18
to basilisk-fr
Hi,
if you want to Edit the Wiki (and create your own sandbox), you can use darcs (wich is describe in the page you found). You can also follow the instruction on this page:


Best

--
Alexis Berny

Vatsal Sanjay

unread,
Nov 2, 2018, 10:31:44 AM11/2/18
to basilisk-fr
Hi Alexis, 

Thank you for the reply. I will do that. 

Cheers, 
Vatsal
Reply all
Reply to author
Forward
0 new messages