A multi-scale method for complex flows of non-Newtonian fluids

We introduce a new heterogeneous multi-scale method for the simulation of flows of non-Newtonian fluids in general geometries and present its application to paradigmatic two-dimensional flows of polymeric fluids. Our method combines micro-scale data from non-equilibrium molecular dynamics (NEMD) with macro-scale continuum equations to achieve a data-driven prediction of complex flows. At the continuum level, the method is model-free, since the Cauchy stress tensor is determined locally in space and time from NEMD data. The modelling effort is thus limited to the identification of suitable interaction potentials at the micro-scale. Compared to previous proposals, our approach takes into account the fact that the material response can depend strongly on the local flow type and we show that this is a necessary feature to correctly capture the macroscopic dynamics. In particular, we highlight the importance of extensional rheology in simulating generic flows of polymeric fluids.


Introduction
Modelling and computational simulation of non-Newtonian fluids is a challenging problem, since these fluids exhibit complex effects, such as shear thinning or thickening, viscoelasticity or flow-induced phase separation. A detailed analysis of the rheology of complex fluids can be obtained by particle-based simulations. Clearly, such micro-scale description is accurate but computationally very expensive and cannot be applied to engineering-scale problems. Consequently, new mathematical algorithms and hybrid multi-scale approaches have been proposed in recent years.
In the literature, we can find several hybrid models combining particle dynamics with a macroscopic continuum model, such as the heterogeneous multi-scale methods [7,10,9,12,16,34], the triple-decker atomistic-mesoscopic-continuum method [14,15], the seamless multi-scale methods [8,11,13], the equationfree multi-scale methods [22,21,20] or the internal-flow multi-scale method [1,2]. In [28] software requirements and design principles are presented and illustrated for a prototype coupling between molecular dynamics and Lattice Boltzmann methods. Note that, in general, hybrid multi-scale approaches are successful when processes occurring on a small scale are only loosely coupled with the large-scale behavior, that is, in the presence of an effective scale separation. In keeping with this, our method is applicable when the local flow conditions experienced by a fluid element change on a much larger timescale than the microscopic relaxation time necessary to achieve a statistically steady state of the molecular conformation and interactions.
The aim of this paper is to illustrate a new heterogeneous multi-scale method for the simulation of flows of complex fluids in generic geometries and different conditions of motion. We extend and generalize the idea presented in [32], where a heterogeneous multi-scale method is developed for polymeric solutions subjected to simple shear flows. Simple shear is very well investigated for it is more easily realized in experiments than other flows. It provides fundamental information that is often sufficient to characterize simple fluids. However, complex fluids show a molecular structure that is able to change with respect to different conditions of motion, geometries, but also time scales and deformation rates. Therefore, to retrieve important rheological information about the stress response of such fluids, their behavior is studied under conditions of flow different from steady simple shear, for example extensional motions, startup flows and oscillating shear [27]. Moreover, it is also fundamental, for these types of materials, to consider flows in complex geometries that contain holes, barriers, contractions or other irregular features, because in close proximity of these structures the fluid is subject to local motions that are not equivalent to simple shear and can manifest some unexpected behavior.
We focus our efforts on the development of a method to link the micro-scale rheological information, available from simulations in different local flow types, to macro-scale flows in complex geometries. The main aim of this work is to show that it is necessary to correctly take into account the local flow type, which plays an important role in modifying the stress response in non-viscometric flows of non-Newtonian fluids featuring a flow-type dependent rheology, such as polymeric fluids. While simulations based on constitutive assumptions do take into account, by construction, the possible flow type dependence incorporated at the level of constitutive laws, multi-scale methods for fluid mechanics application has so far considered simple shear flows as the only source of information for the micro-to-macro coupling. With our approach, we overcome this severe limitation. The method is applied to planar flows, but it can be extended to more general three-dimensional flows. The most challenging task for such an extension will be to implement MD simulations under arbitrary local flow conditions. The paper is organized in the following way. Section 2 discusses the essential question that arises in building a heterogeneous multi-scale method. Namely, how micro-and macroscopic models are linked together. Section 3 is devoted to the description of micro-scale simulations with an emphasis on the decomposition of the average stress tensor and the reconstruction of data-driven material functions. For the macroscopic simulation of incompressible flows we use, as described in Section 4, a numerical method based on a semi-implicit time evolution scheme and mixed P 2 -P 0 finite elements for the approximation of the velocity-pressure pair under the incompressibility constraint. Results of numerical simulations obtained by our heterogeneous multi-scale method in different geometries are presented in Section 5. The paper is closed by Section 6 with an outlook on future research.

Link between micro-scale data and macro-scale simulations
At the heart of our proposal there is the understanding that the local kinematics of a generic planar flow must be identified by at least two parameters, one measuring the speed of the deformation and the other measuring the local flow type (see [25,Chapter 1.4] for a discussion of this point). We introduce the symmetrized gradient D ≡ 1 2 (∇u + ∇u T ) of the velocity field u and, for the case of planar flows in which e 3 is normal to the flow plane, we can define the kinematic parameters |ε| ≡ tr D 2 2 and While there is ample agreement about measuring the deformation rate in generic situations by means ofε, different choices can be made for the flow-type parameter, depending on the type of material response that we envision (see [18], Sec. III). Here we choose β 3 for its simplicity and we stress that, to make it a frame-indifferent parameter, we consider it as measured relative to the vanishing spin of a fixed inertial frame of reference. In other contexts, different choices may be appropriate (such as the relative rotation rate proposed by Schunk and Scriven [31]), but the structure of the scheme that we are going to present remains the same.
The local kinematic parametersε and β 3 are the macro-scale input of micro-scale simulations that will in turn give an ensemble-averaged stress tensor σ. To be able to use the micro-scale information encoded in σ we must express it in a form that is independent of the coordinates, because coordinates that are chosen for computational convenience cannot always be coherent when we pass from the micro-to the macro-scale simulation. We can achieve this independence by decomposing the stress on an orthogonal tensorial basis built upon D (see [18] for details and significance of this decomposition). For the case of planar incompressible flows, we have where I is the identity tensor and The coefficients of the linear decomposition (1) represent a pressure, a generalized viscosity and a reorientation factor related to normal stress differences and can be retrieved from the computational data in any coordinates by computing Here the double scalar product and the tensorial norm are defined by For the sake of clarity, we indicate withη andλ 3 the two material functions of the kinematic parameters (ε, β 3 ), reconstructed by sampling the two-dimensional parameter space. In this way, we obtain from computational rheological measurements the constitutive expression for the stress tensor, that can be used in performing the macro-scale continuum simulations. There is no need to define a pressure function because it is determined, at the macro-scale, as the Lagrange multiplier of the incompressibility constraint.

Micro-scale simulation
The NEMD simulation at the micro-scale is performed using LAMMPS [30, lammps.sandia.gov]. We consider both monomeric and polymeric aggregates in a three-dimensional computational domain with periodic boundary conditions and undergoing two different planar flows: simple shear and extensional flow. The average velocity field is imposed by suitably deforming the computational box and the canonical ensemble statistics of the velocity fluctuations is achieved via the classical Nosé-Hoover thermostat [17]. For the case of simple shear we use the LAMMPS command fix deform in conjunction with the SLLOD algorithm [5], while the extensional flow is treated by means of the UEF package [29]. The latter implements boundary conditions developed by Dobson [6] and Hunt [19], that are an extension of the boundary conditions of Kraynik and Reinelt [23]. We will discuss results for monomers, N pol = 1, and polymers, N pol = 20, where N pol is the number of monomers per molecule.

Interaction potentials
We model polymers as bead-spring systems with two types of interaction potential. The first one is active between each pair of monomers and is the Weeks-Chandler-Andersen (WCA) potential, the repulsive part of a Lennard-Jones potential with minimum energy − when the centers of the beads are at distance r = 6 √ 2σ: The second one, only active between successive monomers in a polymeric chain, is the Finitely Extensible Nonlinear Elastic (FENE) potential with K the elastic constant and R 0 the maximum extent of the bonds. Figure 1: The monomeric fluid displays almost no rate dependence and very little flow-type dependence of the stress coefficients, while the polymeric fluid features rate dependence and a strong flow-type dependence. We compare the NEMD data for the stress coefficients η (top) and λ 3 (bottom) againstε obtained for the monomeric case with N pol = 1 (left) and the polymeric case N pol = 20 (right) under simple shear (circles and black dashed curves) and planar extension (diamonds and red solid curves). In the latter case, λ 3 fluctuates around zero, that is the expected value based on symmetry considerations. The presence of a strong flow-type dependence for the polymeric fluid is a key feature, originated by the different conformations of the long molecules. Fitting curves are obtained as described in the text.

Average stress coefficients
We considered values of the deformation rateε ranging from 0.001 s −1 to 1 s −1 . For each value ofε we performed 21 simulations with different initial configurations of the particles. At each time, the average stress given as output by LAMMPS is projected onto the basis tensors through the formulae (3) and these projections are averaged over time. Finally, a mean over all initial configurations is taken. Figure 1 presents the data obtained for the generalized viscosity η and the reorientation factor λ 3 . By fitting those data with Carreau and power functions we obtain, for the monomeric case with N pol = 1, the curves For the polymeric case with N pol = 20, the Gaussian Process Regression method (see Appendix A) was used to obtain the fitting curves. By comparing the results obtained under simple shear and planar extension for N pol = 1 and N pol = 20, we find that the former fluid displays almost no rate dependence and very little flow-type dependence of the stress coefficients, while the latter features rate dependence and a strong flow-type dependence ( Figure 1). The statistics of interaction between monomers in the two types of flow does not differ significantly, leading to a quasi-Newtonian rheology. On the contrary, the fact that polymer chains are kept in an elongated state by extensional flows, while they tend to tumble and keep a spherical shape in simple shear, generates a richer phenomenology. In fact, the shear-thinning trend displayed in simple shear is qualitatively similar to that of monomeric fluids, while we find an opposite trend-a shear-thickening behavior-in extensional flows at small deformation rates, followed by a non-monotonic behavior of the viscosity. The elastic effects generated by the bonds are crucial in this case and give rise, in simple shear, to the normal stress differences associated with the coefficient λ 3 , also featuring a non-monotonic curve.
The direct connection between the statistics of chain conformation in the polymeric case and the observed rheology can be evinced from the probability distribution, presented in Figure 2, of the normalized radius of gyration R g and asphericity α defined as follows. Let the components of the 3 × 3 gyration tensor be with m i the mass of the i-th monomer, r i its position, M = i m i , and r cm the center of mass of the polymeric chain. With R 0 the effective monomer radius, we set Moreover, the asphericity is given by where a 1 ≤ a 2 ≤ a 3 are the eigenvalues of the gyration tensor R. At low deformation rate, the distributions obtained in simple shear and extensional flows are almost identical (blue curves in Figure 2) because the chains are equally and mildly stretched by the imposed flow. Asε grows larger, the extensional flow distributions feature a single peak that is progressively shifted rightward, toward more stretched configurations. On the other hand, in simple shear we notice a broadening of the distribution eventually leading to a doubly peaked shape (red curves in Figure 2). This indicates that chains spend roughly half of the time in a stretched configuration while frequently going back to a coiled configuration. In this very different microscopic behavior we find the origin of the strong flow-type dependence of the viscosity at largerε.

Data-driven material functions
Ideally, we would like to perform micro-scale simulations with many values ofε and β 3 , since flows in generic geometries can easily feature variations of the flow type with β 3 ranging from minus to plus infinity and values ofε that cover many orders of magnitude. The implementation of simulation algorithms for mixed flows different from simple shear and planar extension is a nontrivial task that will be addressed in future works, but we still need, for our macro-scale simulations, a suitable definition of material functions that covers the whole range of kinematic parameters. We thus apply simple extrapolation strategies to build material functions out of the available computational data.

Macro-scale simulation
We consider the flow of an incompressible fluid with constant density ρ and velocity vector u. From the macroscopic point of view the continuum description leads to the conservation of mass and the balance of linear momentum. In the incompressible case, they translate into the following partial differential equations on the domain Ω: Here σ denotes the Cauchy stress tensor and p the pressure field. Equation (7) expresses the incompressibility constraint. We partition the boundary of the domain as disjoint union of inlet Γ in , outlet Γ out , and solid walls Γ w , so that ∂Ω = Γ in ∪ Γ out ∪ Γ w . As usual, n is the outward unit normal to ∂Ω.
A weak formulation of the problem is retrieved by multiplying equation (8) and integrating over Ω. By applying Green's formula, we obtain the integral equation Moreover, (7) can be multiplied by a scalar test function q ∈ L 2 0 (Ω) = g ∈ L 2 (Ω) : Ω g = 0 and integrated over Ω to give We decompose the Cauchy stress tensor in spherical and deviatoric parts by introducing the traceless extra stress τ such that σ = −(p +p)I + τ, wherep ∈ L 2 0 (Ω) is a given pressure field used to impose a chosen pressure gradient from inlet to outlet. On top of the Dirichlet boundary conditions for u on Γ w we assume a form of periodicity for u and p, requiring that they take the same values on Γ in and Γ out . Thanks to the independence of the test functions v and q, we can take the sum of (9) and (10) and substitute the expression for σ to obtain the complete weak formulation of the problem: Find u ∈ L 2 (R + ; H 1 Γ w (Ω)) and p ∈ L 2 (R + ; L 2 0 (Ω)), such that for any suitable test functions v and q we have Equation (11) must be completed with suitable initial conditions for the velocity field, that we will assume to vanish identically at time t = 0. To exploit the reflection symmetry of some domains, we will consider a fictitious boundary Γ c corresponding to the symmetry axis. On this boundary we will assume that the normal component of the velocity field and the tangential component of the traction τn vanish. For the time integration of (11) we apply a semi-implicit Euler scheme. In particular, the nonlinear convective term is approximated explicitly, the rest is approximated implicitly. This approximation is suitable to simulate flows at sufficiently low Reynolds number. Consequently, we have with bilinear forms b(u, q) := − Ω q∇·u and a(u, v) := Ω τ(u) : ∇v. Note that the latter is already linearized since the (nonlinear) material functions in (4) are computed using u n . For each time step, Equation (12) is discretized in space and solved, in a standard way, by means of mixed finite elements P 2 -P 0 for the approximation of the velocity-pressure pair, which are known to satisfy the Ladyzhenskaya-Babuška-Brezzi inf-sup condition for a stable solution of the associated saddle-point problem [3]. The numerical method is implemented within the Python library FEniCS [26] and some details pertaining the micro-to-macro coupling through the dynamic reconstruction of the extra stress are given in Appendix B.

Numerical results for different geometries
The aim of this section is to demonstrate the robustness and effectiveness of our heterogeneous multi-scale method by presenting the results of simulations in three different planar geometries: flows in a straight Figure 3: Comparison of the horizontal velocity profile u x , local deformation rateε, and viscosity η for the flow in a straight channel computed by our multi-scale method with a reference Newtonian solution. In the case N pol = 1, the non-Newtonian solution is extremely close to the Newtonian one, as expected from the mild rate dependence of the viscosity and the small values of λ 3 . In the case N pol = 20, we observe a much larger deviation with a shear-thinning character expected from the rate dependence of the viscosity. channel, through a 4:1 contraction, and past a deep hole. These are paradigmatic geometries frequently used to test the non-Newtonian behavior of fluid models [4].

Channel flow
The multi-scale method is firstly tested on the classical case of a planar channel flow. The total length of the channel is L = 5 m along the x-axis and the system width is W = 2 m along the y-axis. Exploiting the reflection symmetry of the problem, we discretized only the upper half of the channel on a mesh with 100 triangular elements along the x-axis and 20 elements along the y-axis, for a total of 4000 triangles in the entire computational domain. On the fictitious boundary that corresponds to the center of the channel we impose a vanishing vertical velocity and a vanishing normal traction to respect the reflection symmetry of the problem. We consider a fluid with unit density and drive the flow by imposing a constant horizontal pressure gradient C = 1 Pa/m. As for the velocity field u, we assume periodic boundary conditions so that the velocity at inlet and outlet is the same. The time step is ∆t = 1 × 10 −3 s. We let the system evolve up to the time T = 2 s to reach a steady state.
The flow type is everywhere equivalent to that of a simple shear. Indeed, this is a viscometric flow with β 3 = 1 in the top half of the domain and β 3 = −1 in the other half. A discontinuity would appear at the midline of the channel consistent with the fact that β 3 is not defined forε = 0. The homogeneity of the flow type makes the flow-type dependence of the stress tensor irrelevant. To assess the importance of non-Newtonian effects, we compare the solution obtained from the multi-scale approach with the analytical solution of a reference Newtonian model, represented by the classical stress-strain relation withη constant. We takeη = 1.7 Pa s for N pol = 1 andη = 10 Pa s for N pol = 20, corresponding to the zero-rate limit of the interpolated shear viscosity from our NEMD simulations. The comparison of velocity, deformation rate, and viscosity profiles is reported in Figure 3. In the case N pol = 1 the non-Newtonian solution is extremely close to the Newtonian one, as expected from the mild rate dependence of the viscosity and the small values of λ 3 . In the case N pol = 20, we observe a much larger deviation that is small only around the center of the channel, where the shear rate vanishes and the viscosity approaches that of the reference Newtonian model.
Due to the non-uniformity of the viscosity in the development of the flow and in its steady state, the characterization of the flow by means of dimensionless quantities such as the Reynolds number is not straightforward. Nevertheless, we can identify the range of local parameter values as follows. We take the channel width W as reference length and P = CW as reference pressure drop. The local Reynolds number is then given by Another important dimensionless quantity is the reorientation angle ϕ, such that which measures the rotation of the stress eigenvectors with respect to the eigenvectors of D. This geometric information is precisely the meaning of the first normal stress difference in simple shear flows, extended to generic local flows by the definition of λ 3 and η [18].
In the monomeric case, we have η min = 1.6 Pa s and η max = 1.    mixed rotational flow near the corners of the domain. The spatial non-uniformity of the flow type must be taken into account to obtain a precise macro-scale description of the fluid motion. To show this, we compare the prediction of the full non-Newtonian model with that of a modified non-Newtonian model, wherein the flow-type dependence is artificially suppressed. Specifically, β 3 is replaced by the function sign(β 3 ). In this way, only the micro-scale data obtained in simple shear (i.e., β 3 = ±1) are used, but the results cannot properly reflect the fluid behavior.

Flow through a contraction
We discuss results obtained with a channel of length L = 5 m and maximum width W = 2 m, only in the polymeric case N pol = 20, with time step ∆t = 10 −3 , letting the system evolve to reach a steady state for T = 0.2 s. We can appreciate the time convergence to the steady solution by looking at the evolution of the flow rate Q through vertical sections of the domain, reported in Figure 4, left panel. The discretization employs an unstructured triangular mesh with average diameter of the triangles h ≈ 0.03 m. The mesh convergence of the multi-scale method is assessed by considering the L 2 norm of the difference between solutions obtained with mesh parameter h and 2h. From the data reported in Figure 4, right panel, we see that the incremental correction scales linearly in h, thus showing convergence of our simulation.
The pressure gradient that drives the flow is C = 0.3 Pa/m. The velocity field u is assumed periodic so that it is matched at inlet and outlet and, to exploit symmetry and compute the numerical solution only in the upper half of the domain, we use the same conditions as in the straight channel simulation, namely, vanishing vertical velocity and vertical traction at the center of the channel. The flow is laminar with the characteristic increase of horizontal velocity u x in correspondence of the contraction. The pressure gradient is concentrated along the narrower portion of the domain and features oblique isolines due to the presence of normal stress differences in that region ( Figure 5). The non-uniformity of the deformation rateε and of the flow-type parameter β 3 has a strong influence on the local values of η, that range from 3.8 Pa s to 13 Pa s in the contracting region, and λ 3 , that range from −4 Pa s to 4 Pa s, considering also the lower half of the domain (see Figure 6). From these values and taking now W/4 as reference length, we can estimate Re ∈ [0.015, 0.05] and ϕ ∈ [−23.5, 23.5] degrees.
In this complex flow, the flow type measured by the parameter β 3 varies significantly through the domain (Figure 6b), ranging from pure extension (β 3 = 0) to simple shear (|β 3 | = 1) to more rotational flows (|β 3 | > 1). Regions of mixed and extensional motion cover a major part of the domain, going well within the contraction. Since the viscosity in the full non-Newtonian model is a function ofε and β 3 , the effect of the flow type is clearly dominant in determining its value. The importance of correctly embedding the flow-type dependence in the multi-scale model can be highlighted by comparing the prediction of the full non-Newtonian model with that obtained from the modified non-Newtonian model (Figure 7). The viscosity in the modified model presents a very different profile in the extensional and mixed flow regions, where it happens to decrease instead of increasing, as predicted by the correct method and in line with the extensional rheology of the polymeric case. This has an immediate effect on the velocity profile, that features a more rapid flow and a clear asymmetry, due to the overemphasized role of the normal stress differences related to λ 3 in the modified model.

Flow past a deep hole
In this section we analyze a second example of flow in a complex geometry. We consider a channel of length L = 5 m and width W = 1 m. At a distance of 1.75 m from the inlet we find the hole of width W hole = 1.5 m and depth H = 5 m. The discretization employs an unstructured triangular mesh with average diameter of the triangles h ≈ 0.06 m. The time step is ∆t = 10 −3 and we let the system evolve to reach a steady state for T = 0.4 s (see Figure 4, left panel). We present simulation results for the polymeric case N pol = 20, driving the flow with an outlet-to-inlet pressure gradient C = 0.3 Pa/m. The velocity field is again assumed to be periodic, and hence equal at inlet an outlet.
The flow past a deep hole features a complex distribution of local flow types with a consequent variation Figure 7: The dependence of the stress on the local flow type must be taken into account to correctly predict the fluid behavior. We compare the steady-state viscosity η and horizontal velocity u x nearby the contraction, computed with (a,c) the full non-Newtonian model and (b,d) the modified one. The viscosity in the modified model presents a very different profile in the extensional and mixed flow regions, nearby entrance and exit of the restriction. This influences the velocity field, which features a clear asymmetry due to the overemphasized role of normal stress differences in the modified model. of the material response. Also in this case, a comparison of the viscosity and the horizontal velocity obtained with the full and the modified non-Newtonian models (Figure 8) confirms the need for a correct treatment of flow-type-dependent rheologies. The viscosity appears to be significantly different right above the deep hole. This has a mild but noticeable influence on the flow. The velocity depression is shifted rightward and, since the viscosity is lower, the flow is globally faster with the modified model, as seen also from the values of the flow rate reported in Figure 4.

Conclusions and outlook
We have developed and tested a heterogeneous multi-scale method for the simulation of flows in arbitrary geometries for complex fluids by means of a data-driven reconstruction of the stress tensor. This is based on employing the results of micro-scale simulations according to a general decomposition of the stress [18] that allows to correctly align its different components in flows that display a broad spectrum of local flow types. We have shown that a proper treatment of the flow-type dependence, that was missing in previous multi-scale methods exclusively focused on simple shear rheology, is essential to capture the macroscopic dynamics.
In our case, the micro-scale simulations are non-equilibrium molecular dynamics simulations of polymeric chains with internal FENE bonds and an effective Weeks-Chandler-Andersen interaction potential. Nevertheless, our coupling scheme does not rely on a specific simulation strategy neither at the micro-scale nor at the macro-scale. Indeed, we have chosen to implement the macroscopic continuum simulation with a well-established mixed finite element method based on P 2 -P 0 elements for the velocity-pressure pair to deal with the incompressibility constraint and a semi-implicit time integration scheme, but any other computational method to solve for the continuum evolution can in principle be employed.
Polymeric fluids are well known to display a significant degree of flow-type dependence in their rheo- We performed micro-scale simulations imposing simple shear and planar extension as average kinematic conditions under which we evaluate the stress response. From these, we constructed the rheological functions in mixed flows by means of a simple interpolation and extrapolation procedure. In view of the impact on macroscopic flows in non-viscometric geometries of the local flow conditions, we plan to expand the micro-scale simulations to obtain data under mixed and rotational flow conditions. This will require the implementation of a suitable generalization of the Kraynik-Reinelt boundary conditions.
In fluids composed by molecules with longer microscopic relaxation times, it may happen that the local flow type experienced by a fluid element changes fast along streamlines. The method that we presented can in principle be extended to take this into account by devising MD simulations for which the flow type of the imposed background motion is slowly varying. The macroscopic material functions would then depend also on the derivative along streamlines of the flow-type parameter. Other directions for future work are the testing of our method in parameter ranges where elastic instabilities may be observed, that may lead to the presence of highly oscillatory material coefficients in space and time, and the implementation of an on-the-fly coupling between macro-scale and micro-scale simulations, to be able to sample the space of kinematic conditions in a problem-driven fashion.  A Fitting procedure for the micro-scale NEMD data We report here the details about the fitting of micro-scale data that we performed using Gaussian Process Regression (GPR). Since some choices are involved in the procedure, it seems appropriate to give a brief account of ours. GPR is a Bayesian approach to regression based on machine learning techniques. The fitting is done through a Gaussian stochastic process f (x; w) that evolves along the variable x and depends on a list of hyper-parameters w. The observed data are a finite number N of pairs (x i , y i ) N i=1 . The functional form of the Gaussian process is specified by its mean and covariance functions, , where E denotes the expected value. A fundamental feature of GPR is that it does not produce a definite value of the fitting parameters w, but considers them random variables and seeks to determine suitable mean and variance for their distribution. This is achieved by an iterative optimization that takes into account the likelihood of the parameters distributions given the knowledge of the observed data [33].
What one needs to specify is the type of mean and covariance functions to be used for the GPR. Typical choices for the former are polynomial functions of x with coefficients given by w, while for the latter are Radial Basis Functions with a set of two hyper-parameters w = (σ, l), or the Matérn covariance of degree ν given by where Γ is the Euler gamma function and K ν is the modified Bessel function of the second kind. In our treatement, we took as x variable the quantityε or log 10 (ε), as y variable we took η, log 10 (η), or λ 3 . We tested regressions with mean function zero, constant, or polynomial up to degree four and, for the covariance function, RBF or Matérn kernel of degree up to 5 and picked the combinations that give the best results after optimization.

B Multi-scale coupling in the code
The purpose of this section is to present the portion of code that implements the multi-scale coupling in the context of an otherwise standard Finite Element simulation of the flow equations (see [24] for an introduction to the library FEniCS). The peculiarity of our method concerns the integration of NEMD data with the continuum solver and the construction of the stress tensor based on the general representation (4). In our code, numpy arrays contain the interpolated curves η sh , λ 3,sh and η ext , while λ 3,ext is simply zero. In particular, the first column of the array S contains the values ofε on which the Carreau function or GPR is sampled and the second column the corresponding expected values of η sh . For an efficient use of those data in the stress computation, we transform them in projections on a Finite Element space defined on a one-dimensional mesh, the nodes of which are given by the sampled values ofε. Considering, for instance, the curve η sh , it becomes the function etas in the space E of P 1 elements defined on the mesh mesh_etas. Its construction is performed with the following lines of code. Similar commands are used to define the functions etae and lambda3s that represent η ext and λ 3,sh .
1 # 1D mesh for eta_sh 2 3 import numpy as np 4 from mshr import * The second portion of code relevant to the multi-scale coupling is the local computation of the kinematic parametersε and β 3 and the reconstruction, at each time step, of the spatial profile of the stress coefficients η and λ 3 by means of the material functionsη(ε, β 3 ) andλ 3 (ε, β 3 ). This is accomplished through the following definitions, where mesh is the two-dimensional triangular mesh defined on the flow domain, and u is a three-component variable containing the velocity and pressure fields. 1 from fenics import * . dx (0)) **2+( u [1]. dx (1))**2) +0.25*( u [1]. dx (0)+u[0]. dx (1))**2) At each time step, we need to compute the new stress coefficients based on the velocity field u_n obtained in the previous step. These will be used to update the stress. To this end, we apply the interpolation between simple shear and extensional data according to (5)-(6).