src/test/lid-oldroydb.c

Oldroyd-B lid-driven cavity

The viscoelastic fluid is confined in a unit-square cavity. A time-dependent tangential velocity is imposed on the top boundary. utop=8[1+tanh(t12)]x2(1x)2 This test case has been proposed by Fattal & Kupferman (2005).

We assume that the solvent and polymer viscosities are equal (β=0.5) and the Weissenberg number Wi is equal to 1.

#define DT_MAX 5e-4
// Total viscoelastic viscosity 
#define MU0 1.
// Ratio of the solvent viscosity to the total viscosity
#define BETA 0.5
// Polymer viscosity
#define MUP ((1. - BETA)*MU0)
// Solvent viscosity 
#define MUS (BETA*MU0)
// Weissberger number
#define WI 1.
#define uwall(x,t) (8.*(1. + tanh(8.*(t - 0.5)))*sq(x)*sq(1. - x))

#include "grid/multigrid.h"
#include "navier-stokes/centered.h"
#include "log-conform.h"

int main()
{
  DT = DT_MAX;
  N = 64;
  init_grid (N);
  const scalar lamb[] = WI;
  λ = lamb;
  const scalar mupc[] = MUP;
  mup = mupc;
  const face vector mus[] = {MUS,MUS};
  μ = mus;
  stokes = true ;
  run();
}

u.t[top]    = dirichlet(uwall(x,t));
u.t[bottom] = dirichlet(0);
u.t[left]   = dirichlet(0);
u.t[right]  = dirichlet(0);

event init (i = 0) 
{
  scalar s = tau_p.x.x;
  s[left] = dirichlet (0.);
  s[right] = dirichlet (0.);
  s = tau_p.y.y;
  s[bottom] = dirichlet (0.);	
  foreach()
    u.x[] = 0.;
  boundary ((scalar *){u});
}

static double energy()
{
  double se = 0.;
  if (u.x.face)
    foreach(reduction(+:se))
      se += (sq(u.x[] + u.x[1,0]) + sq(u.y[] + u.y[0,1]))/8.*sq(Δ);
  else // centered
    foreach(reduction(+:se))
      se += (sq(u.x[]) + sq(u.y[]))/2.*sq(Δ);
  return se;
}

event kinetic_energy (i += 50)
{
  fprintf (stderr, "%g %g\n", t, energy());
}

event profile (t = 8.)
{
  FILE * fp = fopen("yprof", "w");
  for (double y = 0; y <= 1.; y += 0.01)
    fprintf (fp, "%g %g \n", y, interpolate (u.x, 0.5, y));
  fclose (fp);
  
  fp = fopen("xprof", "w");
  for (double x = 0; x <= 1; x += 0.01)
    fprintf (fp, "%g %g\n", x, interpolate (u.y, x, 0.75));
  fclose (fp);
}
Time evolution of the total kinetic energy

Time evolution of the total kinetic energy

Velocity profile u_x for x=0.5

Velocity profile u_x for x=0.5

Velocity profile u_y for y=0.75

Velocity profile u_y for y=0.75

References

[fattal2005]

Raanan Fattal and Raz Kupferman. Time-dependent simulation of viscoelastic flows at high Weissenberg number using the log-conformation representation. Journal of Non-Newtonian Fluid Mechanics, 126(1):23-37, 2005.

See also