6.3.5. Viscoelastic flow: the log-conformation approach

A polymer solution does not respond to deformation instantaneously: the dissolved chains stretch, store elastic energy and relax back over a characteristic time \(\lambda\). The state of the chains is described by the conformation tensor \(\mathbf{C}\), a symmetric positive definite tensor that equals the identity when the polymer is unstretched. It is carried by the flow and pulled back towards equilibrium,

(6.6)\[\stackrel{\triangledown}{\mathbf{C}}\;=\;\partial_t\mathbf{C}+\left(\vec{u}\cdot\nabla\right)\mathbf{C}-\nabla\vec{u}\cdot\mathbf{C}-\mathbf{C}\cdot\left(\nabla\vec{u}\right)^\mathrm{T}\;=\;-\frac{1}{\lambda}g(\mathbf{C})\]

where the left hand side is the upper-convected derivative and the constitutive model supplies \(g\). For the Oldroyd-B model [49] it is simply \(g(\mathbf{C})=\mathbf{C}-\mathbf{I}\). The polymer then contributes an extra stress

\[\boldsymbol{\tau}_\mathrm{p}=\frac{\eta_\mathrm{p}}{\lambda}\left(\mathbf{C}-\mathbf{I}\right)\]

which is added to the momentum equation alongside the usual solvent stress. Note that pyoomph’s upper_convected_derivative() implements exactly the left hand side above, so the conformation equation can be written down almost verbatim.

Solving that equation as it stands works at low elasticity and then fails, usually well before the flow becomes physically interesting. The problem is that \(\mathbf{C}\) grows exponentially in extensional regions, and a polynomial finite element basis approximates an exponential badly. Once the discrete \(\mathbf{C}\) loses positive definiteness the computation diverges, and no amount of mesh refinement postpones it for long. This is the classical high Weissenberg number problem.

Fattal and Kupferman [26] observed that one should not discretise \(\mathbf{C}\) but its matrix logarithm \(\boldsymbol{\Psi}=\log\mathbf{C}\). That variable grows only linearly where \(\mathbf{C}\) grows exponentially, so a polynomial basis is well suited to it, and \(\mathbf{C}=\exp\boldsymbol{\Psi}\) is positive definite by construction whatever the discrete \(\boldsymbol{\Psi}\) does. Rewriting the equation in terms of \(\boldsymbol{\Psi}\) gives

\[\partial_t\boldsymbol{\Psi}+\left(\vec{u}\cdot\nabla\right)\boldsymbol{\Psi}-\left(\boldsymbol{\Omega}\boldsymbol{\Psi}-\boldsymbol{\Psi}\boldsymbol{\Omega}\right)-2\mathbf{B}+\frac{1}{\lambda}\mathbf{C}^{-1}g(\mathbf{C})=0\]

where \(\boldsymbol{\Omega}\) and \(\mathbf{B}\) are the rotational and extensional parts of \(\nabla\vec{u}\) in the eigenframe of \(\mathbf{C}\). All of that is done for you by ViscoelasticEquations, which is added alongside the ordinary flow equations. The viscosity handed to the latter is then the solvent viscosity \(\eta_\mathrm{s}\):

from pyoomph.equations.viscoelastic import ViscoelasticEquations, OldroydB

eqs = NavierStokesEquations(dynamic_viscosity=eta_s, mass_density=rho)
eqs += ViscoelasticEquations(model=OldroydB(), relaxation_time=lam, polymer_viscosity=eta_p)

Besides OldroydB, the models Giesekus [32], PTT, FENE_CR and FENE_P are available, and both 2d Cartesian and axisymmetric coordinate systems are supported.

The standard benchmark for viscoelastic flow solvers is creeping flow past a cylinder placed on the centreline of a channel whose half-height is twice the cylinder radius [2, 9, 38]. Everything is nondimensionalised with the total viscosity \(\eta_0=\eta_\mathrm{s}+\eta_\mathrm{p}\), the cylinder radius and the mean inlet velocity, leaving the solvent fraction \(\beta=\eta_\mathrm{s}/\eta_0=0.59\) and the Weissenberg number \(\mathrm{Wi}=\lambda\langle u\rangle/R\). Only the upper half is solved, with a symmetry condition on the centreline:

class ConfinedCylinderProblem(Problem):
    def __init__(self):
        super().__init__()
        self.channel_length = 20 # upstream and downstream length
        self.channel_height = 2 # half-height of the channel
        self.R, self.Ro = 1, 1.6 # cylinder radius and outer radius of the O-grid
        # Resolution is set by hand rather than by an error estimator. 
        self.far_resolution, self.near_resolution = 1.5, 0.09
        # The O-grid: the polymer stress forms a thin boundary layer on the cylinder
        self.n_circumferential, self.n_radial, self.layer_growth = 80, 20, 1.25
        # Wi enters as a global parameter so that we can continue in it later on
        self.Wi = self.define_global_parameter(Wi=0.1)
        # solvent fraction of the viscosity        
        self.beta = 0.59
        # Viscoelastic model 
        self.model=OldroydB()

    def define_problem(self):
        self += ConfinedCylinderMesh()
        # Creeping flow, so Stokes rather than Navier-Stokes. Its viscosity is the SOLVENT one
        stokes = StokesEquations(dynamic_viscosity=self.beta, mode="TH")
        
        
        # SUPG is not decoration here. The constitutive equation has no diffusion at all - its only
        # spatial operator is the advection u.grad(Psi) - and the polymer stress grows exponentially
        # just behind the rear stagnation point. Plain Galerkin answers that with a node-to-node
        # sawtooth all along the wake, which leaves the drag almost untouched (it is an integral over
        # the cylinder) but ruins any profile plotted through the wake. The reference stabilises too,
        # with DEVSS-G/DG
        viscoelastic = ViscoelasticEquations(model=self.model, relaxation_time=self.Wi,
                                             polymer_viscosity=1 - self.beta, stabilization="SUPG")

        
        eqs = MeshFileOutput() + stokes + viscoelastic
        # Fully developed inflow: a parabola with mean velocity 1 and the matching Oldroyd-B stress.
        # ViscoelasticInflowBC differentiates the profile itself to get the local shear rate and
        # pins the log-conformation tensor to the viscometric solution of the model in use. On the
        # symmetry line that shear rate vanishes and the conformation tensor becomes isotropic,
        # which is the degenerate case of the matrix logarithm the condition goes through; it is
        # handled there
        inflow = vector(1.5 * (1 - (var("coordinate_y")/self.channel_height) ** 2 ), 0)
        eqs += DirichletBC(velocity=inflow) @ ["inlet","outlet"]
        eqs += ViscoelasticInflowBC(inflow) @ "inlet"
                        
        eqs += DirichletBC(velocity_y=0,log_conformation_xy=0) @ "symmetry"  # no penetration, free tangentially                
        eqs += NoSlipBC() @ ["cylinder","top"]
        
        # The velocity is prescribed on the entire boundary, so the pressure needs a datum
        eqs += AverageConstraint(pressure=0) 
        
        # Output quantities
        
        # Get the stress on the cylinder and integrate its x-component to get the drag coefficient.
        # The factor 2 restores the full cylinder, domain=".." makes sure bulk gradients are taken
        u=var("velocity",domain="..")
        p=var("pressure")
        stress = -p * identity_matrix() + 2 * stokes.dynamic_viscosity * sym(grad(u)) + var("polymer_stress",domain="..")
        eqs += IntegralObservables(drag=-2 * dot(var("normal"),stress@vector(1,0)) ) @ "cylinder"
        eqs += IntegralObservableOutput("cylinder_drag") @ "cylinder"
        
        # These are what Claus & Phillips contour in their Fig. 12: the Cauchy stress is made traceless,
        # T0 = sigma - 1/2*tr(sigma)*I, and then projected onto the streamline direction and its normal.
        # The pressure drops out of T0 identically - in an incompressible plane flow tr(sigma) is
        # -2p + tr(tau_p) - so only the solvent rate of strain and the polymer stress survive.
        u=var("velocity")
        T0 = 2 * stokes.dynamic_viscosity * sym(grad(u)) + var("polymer_stress")
        T0 = T0 - trace(T0) / 2 * identity_matrix(3)        
        u_mag = subexpression(square_root(dot(u, u)))
        par = u/u_mag
        perp = vector(-par[1], par[0])
        # The projection itself is solved on another residual so that we we do not have to solve for S1 and S2 while the flow is being solved. 
        # They are only needed for plotting, see solve_auxiliary_residual("output_projection") below
        eqs+=ProjectExpression(S1=dot(perp, matproduct(T0, par)), S2=dot(par, matproduct(T0, par)),destination="output_projection")
                        
        self += eqs @ "fluid"

Four details are worth pointing out.

The inflow condition has to prescribe not only the velocity but also the stress the polymer has in fully developed channel flow, otherwise the solution spends the entire upstream length relaxing towards it. That is what ViscoelasticInflowBC is for: given the same profile that the velocity condition uses, it differentiates it to obtain the local shear rate and pins the log-conformation tensor to the viscometric solution of whatever constitutive model the bulk equations were given. On the symmetry line the shear rate vanishes and \(\mathbf{C}\) becomes isotropic, which is a degenerate case for the matrix logarithm it goes through; that case is handled. For the models whose viscometric solution is not an elementary expression – the exponential PTT is the one here – the same class instead enforces the constitutive equation itself on the inflow boundary, by Lagrange multipliers, which says the same thing without needing a formula for the answer.

The Weissenberg number enters as a define_global_parameter(), because the solution has to be continued in it. Starting a stationary solve directly at a larger \(\mathrm{Wi}\) overshoots into a conformation tensor so stretched that \(\exp\boldsymbol{\Psi}\) overflows on the very first Newton step. Stepping up from a converged solution at a smaller \(\mathrm{Wi}\) costs nothing and works.

The conformation tensor needs a symmetry condition of its own. Its shear component is odd under \(y\to-y\), so \(\Psi_{xy}=0\) on the centreline, and imposing that is not optional: the constitutive equation contains no diffusion, so nothing else damps an odd mode in that component.

We introduce two numbers to steer the local mesh size: a coarse far_resolution for the channel, and a much finer near_resolution attached to a single extra point on the top wall directly above the cylinder, from which gmsh grades outwards. This is combined with a O-grid, which resolves the thin polymer stress boundary layer on the cylinder.

Another catch is in \(eqviscoelastic\) itself, since it has no diffusion whatsoever – its only spatial operator is \(\left(\vec{u}\cdot\nabla\right)\boldsymbol{\Psi}\) – and just behind the rear stagnation point the polymer stress grows exponentially. Plain Galerkin answers that with a node-to-node sawtooth running the length of the wake. It barely touches the drag, which is an integral over the cylinder, but it destroys any profile taken through the wake. Passing stabilization="SUPG" to ViscoelasticEquations removes it; the reference stabilises as well, with a DEVSS-G/DG scheme.

Fig. 6.10 reproduces Fig. 6 of [9]: the polymer stress \(\tau_{xx}\) along a path that runs up the centreline, over the cylinder surface and away down the wake, one curve per Weissenberg number. The axes are theirs, so the two can be laid side by side.

Polymer stress along the centreline and cylinder surface.

Fig. 6.10 \(\tau_{xx}\) along the centreline and around the cylinder, for \(\mathrm{Wi}=0.1\) to \(0.9\); compare Fig. 6 of Claus and Phillips. The large peak at \(X=0\) is the top of the cylinder, where the fluid is sheared hardest, and it grows from about 18 to about 127 over this range, matching theirs closely. The second peak just downstream of \(X=1\) is the birefringent strand in the wake; it comes out higher and less resolved here than in their figure. Decreasing the mesh size factors would yield better agreement, but also longer simulation time.

Their Fig. 12 shows a different decomposition: the Cauchy stress is made traceless and then projected onto the streamline direction and its normal, giving a flow-directed shear stress \(S_1\) and normal stress \(S_2\). Note that the pressure drops out of the traceless part identically, so only the solvent rate of strain and the polymer stress contribute.

Both are obtained with ProjectExpression, which solves an \(L^2\) projection onto a real finite element field, rather than with add_local_function(). The projection is one-way – nothing else reads \(S_1\) or \(S_2\) – therefore, we define the projection of these quantities on another residual "output_projection". During the continuation of \(\mathrm{Wi}\), \(S_1\) or \(S_2\) won’t be solved. Only before output, we have to call solve_auxiliary_residual() to solve the projection alone, so that both quantities are updated and end up in the written output.

Flow-directed shear and normal stress around the cylinder.

Fig. 6.11 The flow-directed stresses \(S_1\) and \(S_2\); compare Fig. 12 of Claus and Phillips.

The quantity everyone reports is the dimensionless drag on the cylinder, \(K=F_x/(\eta_0\langle u\rangle)\), obtained here by integrating the total traction over the cylinder surface. The script walks up in \(\mathrm{Wi}\) with go_to_param(), which halves its step whenever Newton fails, and prints the drag next to the values of Claus and Phillips [9]:

Wi      K (pyoomph)   K (Claus & Phillips)
0.1      130.3631         130.364
0.2      126.6261         126.626
0.3      123.1928         123.192
0.4      120.5937         120.593
0.5      118.8298         118.826
0.6      117.7808         117.776
0.7      117.3213         117.316
0.8      117.3396               -
0.9      117.7332               -

The agreement is within \(0.005\,\%\) over the whole range for which the reference has mesh-converged values, which is comfortably inside the spread between the published values themselves – the three independent codes they compare disagree with each other by about \(0.02\,\%\). The drag falls with elasticity, reaches a minimum near \(\mathrm{Wi}\approx0.8\) and rises again, which is the behaviour the literature reports. The last two rows have no entry to compare against: at \(\mathrm{Wi}=0.8\) and above, every column of their table is marked as diverging.

Note

This benchmark is where the log-conformation approach earns its keep. Formulations that discretise \(\mathbf{C}\) directly typically lose convergence somewhere around \(\mathrm{Wi}\approx0.7\), and at \(\mathrm{Wi}=1\) every column of the comparison table in [9] is marked as diverging.

Do not read the last two rows as evidence that this formulation is immune, though. Whether the continuation gets that far depends on the mesh, and it depends on it the wrong way round: a finer mesh loses convergence earlier, which is exactly what [9] report for every scheme they compare. The drag is also the least sensitive thing one could monitor – it is an integral over the cylinder, and it stays smooth long after the wake has stopped converging.

Full code available in the

pyoomph example bundle

SpatioTemporal_PDEs/viscoelastic_cylinder.py