Viscoelastic fluid in a pipe (Maxwell model)#
We are going to consider the problem of transient flow of viscoelastic flow in a pipe.
The transient equation for laminar flow, with velocity only in axial direction (\(u_y(t,r) = u(t,r))\) is
where we denote \(P = -\frac{\partial p}{\partial z}\), where \(z\) is the axis of the pipe.
For a Newtonian flow, stress tensor is computed with
and the solution is the well known Hagen-Poiseuille flow. However, if a viscoelastic fluid is considered, with the Maxwell model the stress is computed with
where \(\lambda\) is the relaxation time.
We can write this equations with dimensionless variables, by defining
With these variables, the dimensionless equations are (we drop the “*” for the sake of simplicity):
The boundary conditions are:
and the initial conditions are
This is a system of PDE that cannot be solved analytically (at least, not easily).
The easiest (for me, at least…) method is to use the Finite Difference Method (FD) Method
Translating the previous equations to FD language, with explicit scheme, with central difference in space and forward in time, we get
and, in terms of previous time step,
For Newtonian:
def uNew(u,tau,tauS,tauN,r):
return (u + deltat*(4+(tauN-tauS)/(2*deltar)+tau/r))
def tauNew(tau,uS,uN):
#return (xi/(xi+deltat)*tau+deltat/(2*deltar*(deltat+xi))*(uN-uS))
return (tau + deltat/xi*((uN-uS)/(2*deltar)-tau))
def tauNewNew(uS,uN):
return (1/(2*deltar)*(uN-uS))
import numpy as np
N = 21
deltar = 1/(N-1)
sigma = 0.001 # parameter for stability
deltat = sigma*deltar
T = 1 #dimensionless
K = int(T/deltat) + 1
uVE = np.zeros((N,K))
uNewtonian = uVE.copy()
tauVE = uVE.copy()
tauNewtonian = uVE.copy()
xi = 0.2
for k in range(1,K-1):
for i in range(1,N-1):
tauVE[i,k] = tauNew(tauVE[i,k-1],uVE[i-1,k-1],uVE[i+1,k-1])
tauNewtonian[i,k] = tauNewNew(uNewtonian[i-1,k-1],uNewtonian[i+1,k-1])
for i in range(1,N-1):
uVE[i,k] = uNew(uVE[i,k-1],tauVE[i,k-1],tauVE[i-1,k-1],tauVE[i+1,k-1],i*deltar)
uNewtonian[i,k] = uNew(uNewtonian[i,k-1],tauNewtonian[i,k-1],tauNewtonian[i-1,k-1],tauNewtonian[i+1,k-1],i*deltar)
uVE[0,k] = uVE[1,k]
uNewtonian[0,k] = uNewtonian[1,k]
uVE[N-1,k] = 0
uNewtonian[N-1,k] = 0
tauVE[N-1,k] = tauNew(tauVE[N-1,k-1],uVE[N-2,k-1],2*uVE[N-1,k-1]-uVE[N-2,k-1])
tauNewtonian[N-1,k] = tauNewNew(uNewtonian[N-2,k-1],2*uNewtonian[N-1,k-1]-uNewtonian[N-2,k-1])
%matplotlib widget
import matplotlib.pyplot as plt
t = np.arange(0,T,deltat)
plt.figure(figsize=(10,8))
plt.plot(t,uVE[0,:-1],label=r'Viscoelastic with $\xi$ = {}'.format(xi))
plt.plot(t,uNewtonian[0,:-1],label='Newtonian')
plt.xlabel(r'$t^*$')
plt.ylabel(r'$u^*$')
plt.legend();
Exercise#
Change the Maxwell model by the Voigth-Kelvin model and discuss the result