DOI: 10.5061/dryad.9p8cz8wqs
title: Code from: Effect of fluid elasticity on the emergence of oscillations in an active elastic filament

description: Many microorganisms propel through complex media by deformations of their
 flagella. The beat is thought to emerge from interactions between forces
 of the surrounding fluid, passive elastic response from deformations of
 the flagellum, and active forces from internal molecular motors. The beat
 varies in response to changes in the fluid rheology, including elasticity,
 but there is limited data on how systematic changes in elasticity alter
 the beat. This work analyzes a related problem with fixed-strength driving
 force: the emergence of the beating of an elastic planar filament driven
 by a follower force at the tip in a viscoelastic fluid. This analysis
 examines how the onset of oscillations depends on the strength of the
 force and viscoelastic parameters. Compared to a Newtonian fluid, it takes
 more force to induce instability in viscoelastic fluids, and the frequency
 of the oscillation is higher. The linear analysis predicts that the
 frequency increases with the fluid relaxation time. Using numerical
 simulations, the model predictions are compared with experimental data on
 frequency changes in bi-flagellated alga Chlamydomonas reinhardtii. The
 model shows the same trends in response to changes in both fluid viscosity
 and Deborah number and thus provides a possible mechanistic understanding
 of the experimental observations.
description: # Code from: Effect of fluid elasticity on the emergence of oscillations
 in an active elastic filament
 [https://doi.org/10.5061/dryad.9p8cz8wqs](https://doi.org/10.5061/dryad.9p8cz8wqs) ## Code/Software MATLAB programs related to the paper. There are three main routines: two for computing eigenvalues and one for performing the dynamic simulation of a filament subject to a follower force at the tip in a linear viscoelastic fluid. Supporting routines, including those that set parameters for the simulation, are in the src/ directory. #### make\_viscous\_evals.m Compute the eigenvalues of the operator L*y=-y''''-sigma *y'' subject to the boundary conditions y(0)=y'(0)=y''(1)=y'''(1)=0 for a range of values of sigma. The output is saved in the file viscous_eigenvalues.mat. The output will contain two arrays: * sigma: values of the follower force strength * vis_eigs: eigenvalues of L #### compute\_VE\_evals.m Compute the corresponding eigenvalues in a linear viscoelastic fluid for a range of relaxation times (lambda) and viscosity ratios (beta). For each viscous eigenvalue etaV, the viscoelastic eigenvalue is found by solving the equation etaV = (1-beta).etaVE/(lambda.etaVE+1) + beta*etaVE There are two values of etaVE for each etaV. This code returns the value of etaVE with the largest real part. The output is saved in the file VE_eigenvalues.mat. The output file will contain: * sigma: values of follower force strength * w0: angular frequency at the bifurcation point in viscous fluid * Lambda_vec: array of relaxation times * De: array of corresponding Deborah numbers assuming frequency w0. i.e. De = w0*Lambda_vec * beta_vec: array of viscosity ratios * vis_eigs: eigenvalues in a viscous fluid for the corresponding value of sigma * etaVE: 3D array etaVE(i,j,k) is the eigenvalue if a viscoelastic fluid corresponding to sigma(i), Lambda_vec(j), and beta(k) #### Follower\_Force\_Simulation.m Simulation of filament subject to a follower force in a linear viscoelastic fluid. This code produces a numerical solution to equations (8) and (9) in the paper. This code will create a directory Output_data and place the output of the simulation in the directory. The output file will contain: * grid: data structure with numerical parameters * params: data structure will physical parameters * T: array of values where the output is stored * Xt: 3D array of the filament configuration at each time Xt(i,j,k): location of ith point, jth component (j=1 is x, j=2 is y) at time T(k) ### Experimental Data in Figure 8 experimental_viscous_data.csv and experimental_viscoelastic_data.csv contain the experimental data used to make the inset plots for Fig. 8. Data was originally published in Qin, B., Gopinath, A., Yang, J., Gollub, J. P. & Arratia, P. E. 2015 Flagellar kinematics and swimming of algal cells in viscoelastic fluids. Scientific reports, 5, 1–7. Viscosity is in units of cP, the frequency is in Hz. The columns in the viscous data set are the viscosity (cP) and the beat frequency (Hz). The columns in the viscoelastic data set are the total viscosity (cP), beat frequency (Hz), Deborah number (nondimensional), and the ratio of viscoelastic to Newtonian frequency (nondimensional).