1 Introduction

Consider a persistent random walk in a bounded domain. The motion is described by two parameters: the finite speed v and the inverse of persistent time \(\alpha \), also known as tumbling rate in run-and-tumble models [1,2,3,4,5,6,7,8]. Suppose there is a small aperture in the boundary allowing the walker to exit. We wonder about the existence of an optimal exit time with respect to system parameters. While a trivial decrease of exit times for faster walkers is evident, the role of \(\alpha \) is quite more difficult to evaluate. We expect that the peculiar property of active matter to accumulate at boundaries plays a crucial role in determining the behavior of the system [9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]. In general, we expect a competition between two characteristic times, the one spent by the walker in the bulk \(\tau _{_{bulk}}\), expected to grow with \(\alpha \) (the more you tumble, the more you wander around), and the one spent on boundary \(\tau _{_{boundary}}\), expected to decrease with \(\alpha \) (tumbling promotes moving away from boundaries), giving rise to the possible existence of optimal tumbling rate values corresponding to minimum exit times. We can give semi-quantitative arguments supporting this picture. We suppose that the time spent in the bulk by a persistent random walker before reaching the boundary is a growing function of \(\alpha \) (assuming, on first approximation, linear dependence, in agreement with first-passage expressions [24, 25]),

$$\begin{aligned} \tau _{_{bulk}} = a + b \ \alpha , \end{aligned}$$
(1)

with a and b generic constants depending on v and geometrical parameters. The time spent on boundary can be instead represented by a inverse proportionality:

$$\begin{aligned} \tau _{_{boundary}} = \frac{c}{\alpha } , \end{aligned}$$
(2)

where we have assumed that the time spent on the boundary could diverge in the limit of null tumbling rate (infinite persistent time), corresponding to a blocking situation on the walls (sticky boundaries). Before exit, the particle spends part of the time in the bulk and part in the boundary, so we can write the particle’s lifetime as the sum of the two times, \(\tau = \tau _{_{bulk}} + \tau _{_{boundary}}\), getting the expression

$$\begin{aligned} \tau = a + b \ \alpha + \frac{c}{\alpha } . \end{aligned}$$
(3)

Therefore, we expect the existence of a minimum value \( \tau ^* = a + 2 \sqrt{bc}\), obtained at a finite value of the tumbling rate \(\alpha ^* = \sqrt{c/b}\). Generalizing the argument to more complicated situations we can relax the hypothesis of complete blocking of particles at walls, and write the exit time as

$$\begin{aligned} \tau = \frac{f(\alpha )}{\alpha +\alpha _0} , \end{aligned}$$
(4)

where \(f(\alpha )\) is a smooth function of \(\alpha \)Footnote 1 and \(\alpha _0\) is a parameter that depends on the properties of the boundary and the interactions between particle and wall. We note that for \(\alpha _0=0\) the exit time (4) can be put in the form (3), retrieving the perfect sticky boundary situation. In the general case we have that the optimal exit time is obtained at finite \(\alpha ^*\) satisfying \(f(\alpha ^*)=(\alpha ^*+\alpha _0) f'(\alpha ^*)\), but, in certain range of values of parameter \(\alpha _0\), it is reached at \(\alpha ^*=0\). In other words, there is a critical value of the parameter \(\alpha _0\), discriminating a region where the optimal escape corresponds to a finite tumbling rate from a region where the fastest escapees are non-tumbling walkers.

These semi-quantitative arguments suggest that active random walks can exhibit very rich behaviors in escape processes, depending on the nature of the interaction with the boundary. Recent experimental studies have shown the importance of boundary interactions for the escape of microalgae from circular pools [27]. Evidences of optimal escapes or optimal search strategies have been previously observed in numerical investigation of active particles in circular domains [28,29,30,31,32]. In this work we analyze in detail the role played by particle-boundary interactions for the occurrence of optimal exit times of run-and-tumble particles in bounded domains. In particular, we will focus on one-dimensional and two-dimensional systems, studying different boundary conditions. For the one-dimensional case we will exploit recent analytical results obtained for the run-and-tumble equations in the presence of partially absorption [33, 34], sticky boundaries [22, 23] and generic boundary conditions [35]. In Ref. [35] a very general expression of the mean exit time was obtained, valid for a variety of different types and combinations of boundaries, from reflecting to partially absorbing and sticky-like, resulting in non trivial behaviors as a function of physical parameters, with the possible existence of non-monotonic trends in certain case studies. Starting from these preliminary observations and results we conduct a detailed analysis and discuss in depth the conditions under which such a non-monotonic behaviors are present, evidencing the role of accumulation at boundaries by using tunable parameters to modulate its relevance. The two-dimensional case will be studied considering circular domains with the presence of a narrow aperture on the boundary, that allows particles to escape. By numerically investigating the particle dynamics for different particle-boundary interactions (cases of complete, partial or absent alignment of the self-propelled orientation of the particle on the boundary) we will be able to scrutinize the exit processes, elucidating the role of boundaries in determining optimal escapes.

2 1D exact results

We consider a run-and-tumble particle, with speed v and tumbling rate \(\alpha \), confined in a 1D segment \((-R,R)\) [1,2,3,4,5,6,7,8, 22, 34]. We assume that the particle starts its motion at the origin \(x=0\). Boundary conditions are as follows. There is an hard wall at \(x=-R\), allowing particle accumulation, i.e., the particle gets stuck to the wall until a tumble event reverses its direction of motion [22, 23]. An absorbing barrier is present at the exit point \(x=R\). A schematic representation of the system is shown in Fig. 1 (case 1). Following similar analysis of Ref. [22], where only symmetric cases were taken into account, it is possible to obtain the exact expression of the mean exit time, i.e. the mean first passage time for the particle to reach the exit point \(x=R\) – see the Appendix A and [35], in which a general treatment is given for generic boundaries – obtaining (Fig. 2, blue full line)

$$\begin{aligned} \tau _1 = 3\ \frac{R}{v} + \frac{3}{2} \frac{R^2}{v^2} \ \alpha + \frac{1}{\alpha } . \end{aligned}$$
(5)

This expression is exactly what expected by qualitative arguments considering the exit time as a sum of bulk-time (1) and boundary-time (2), with \(a=3R/v\), \(b=3R^2/2v^2\) and \(c=1\). The mean exit time diverges as \(\alpha ^{-1}\) and \(\alpha \) at small and high tumbling rates, respectively (see Fig. 2). Therefore, there exists a minimum value \(~{\tau _1^*=(3+\sqrt{6}) R/v}\) obtained for the optimal tumbling rate \(~{\alpha ^*=\sqrt{2/3}\ v/R}\).

Fig. 1
figure 1

Schematic representation of the analyzed cases corresponding to a 1D run-and-tumble particle – moving with velocity \({\textbf{v}} = {\hat{\textbf{e}}} v\) (\(\hat{\textbf{e}} = \pm {\hat{\textbf{x}}}\)) and tumbling rate \(\alpha \) – in a finite domain with an absorbing boundary on the right side of the interval and different boundary conditions on the left side. (1) Sticky boundary: the particle remains stuck at the boundary until it reverses its direction of motion with rate \(\alpha /2\) (the factor 1/2 comes from the fact that, after a tumble, the particle can, with equal probability, maintain its direction of motion or reverse it). (2) Reflecting boundary: when the particle hits the wall it instantaneously reverses its direction of motion (corresponding to an infinite tumbling rate at the wall). (3) Sticky-reflecting boundary: the particle remains stuck at the boundary until it reverses its direction of motion with rate \((\alpha +\gamma )/2\). (4) Sticky-absorbing boundary: the particle at the boundary can reverse its direction of motion (with rate \(\alpha /2\)) or be absorbed (with rate \(\lambda \))

In order to study the role of particle-boundary interaction in determining the presence of an optimal exit time at finite \(\alpha \) we now consider different kinds of boundaries. Let us first assume a totally reflecting boundary at \(x=-R\). In this case, arriving at the boundary, the particle, is no more stuck at wall, but it reverses instantaneously its direction of motion (Fig. 1, case 2). Now there is no more accumulation at boundaries and the exit time has the following form – see the Appendix A and Refs. [34, 35] –

$$\begin{aligned} \tau _2 = 2 \frac{R}{v} + \frac{3}{2} \frac{R^2}{v^2}\ \alpha . \end{aligned}$$
(6)

In other words the boundary-time vanishes (\(c=0\)), the exit time becomes a simple growing function of \(\alpha \) and its minimum value \(\tau ^*_2=2R/v\) is reached at \(\alpha ^*=0\) (see Fig. 2, black dashed curve), with only the presence of a crossover when the run length \(v/\alpha \) is comparable with the system size R.

Fig. 2
figure 2

Mean exit times \(\tau \) as a function of the tumbling rate \(\alpha \) for a 1D run-and-tumble particle in a finite interval \([-R,R]\) with absorbing boundary at \(x=R\). Different boundary conditions are considered at \(x=-R\). \(\tau _1\) corresponds to sticky boundary (see expression (5) in the text), \(\tau _2\) to reflecting boundary (6), \(\tau _3\) to sticky-repelling boundary with enhanced tumbling rate at wall \(\alpha +\gamma \) (7). Inset. Exit times for the case of sticky-permeable wall at \(x=-R\), with exit rate \(\lambda \) (12); the reported cases correspond to (from up to bottom) \(\lambda =0, 10^{-3},10^{-2},10^{-1},0.4,+\infty \). We set \(v=R=1\) (\(\gamma _c \simeq 0.549\), \(\lambda _c \simeq 0.366\))

We now analyze an intermediate situation between the previous two. We generalize the first analyzed case, by considering that a particle stuck at the \(x=-R\) boundary reorients its self-propelling direction at a rate \(\alpha +\gamma \) instead of \(\alpha \), i.e., the tumbling rate at the wall is higher than that on the bulk, reducing the stickiness of the wall (Fig. 1, case 3). Therefore we introduced a new parameter \(\gamma \) governing the behavior of the boundary. For \(\gamma =0\) we recover the first case of sticky boundary, while for \(\gamma \rightarrow \infty \) we get the reflecting case. The parameter \(\gamma \), as we will see, allows us to switch between different behaviors, suppressing the presence of optimal exit times at finite \(\alpha \) for certain parameter values. In this case we can show that the mean exit time is – see the Appendix A and Ref.s [22, 35] –

$$\begin{aligned} \tau _3 = 2 \frac{R}{v} + \frac{3}{2} \frac{R^2}{v^2}\ \alpha + \frac{1+\alpha R/v}{\alpha + \gamma } . \end{aligned}$$
(7)

It is evident here a more complex form of the exit time, due to the non trivial particle-boundary interaction at wall. The above expression interpolates the previous two: for \(\gamma =0\) we get (5), while for \(\gamma \rightarrow \infty \) we recover (6). We also note that (7) can be cast in the form (4), with \(\alpha _0=\gamma \). Analyzing the behavior of \(\tau _3\) as a function of the tumbling rate, we find that the condition for the existence of an optimal exit time at finite \(\alpha ^*\) is

$$\begin{aligned} \gamma < \gamma _c =\frac{v}{R} \frac{\sqrt{7}-1}{3} , \end{aligned}$$
(8)

determined by studying the solutions of \(\partial \tau _3/\partial \alpha = 0\). We obtain the expressions

$$\begin{aligned} \alpha ^*=-\gamma +\frac{v}{R} \sqrt{\frac{2 (1-R\gamma /v)}{3}} , \end{aligned}$$
(9)

and

$$\begin{aligned} \tau _3^* = \frac{3R}{v}[1+(\alpha ^*+\gamma /2)R/v] . \end{aligned}$$
(10)

For \(\gamma > \gamma _c\), instead, the minimum exit time is reached by non-tumbling particles (\(\alpha ^*=0\)), due to the less relevance of the time spent at wall:

$$\begin{aligned} \tau _3^* = \frac{2R}{v} + \frac{1}{\gamma } . \end{aligned}$$
(11)

In Fig. 2 we report some examples of exit times for different values of the parameter \(\gamma \), above and below the critical value \(\gamma _c\) (red dot-dashed curves).

Fig. 3
figure 3

Minimum mean exit time \(\tau _3^*\) and corresponding optimal tumbling rate \(\alpha ^*\) as a function of the parameter \(\gamma \) in the third model analyzed in this work – sticky-repelling boundary, see Fig. 1 case 3 and Fig. 2, red dot-dashed lines. For \(\gamma < \gamma _c\) the optimal value of the tumbling rate is finite, see equation (9), and the corresponding minimum exit time is given by (10). For \(\gamma >\gamma _c\) the minimum value of the exit time is given by (11), corresponding to vanishing tumbling rate \(\alpha ^*=0\). We set \(v=R=1\), for which \(\gamma _c \simeq 0.549\)

In Fig. 3 we show the behavior of the optimal exit time \(\tau _3^*\) and tumbling rate \(\alpha ^*\) as a function of the parameter \(\gamma \), evidencing the crossover at the critical value \(\gamma _c\), where the optimal tumbling rate goes to zero and the minimum exit time changes from (10) to (11).

The last non trivial situation we consider is that of a partially permeable wall at \(x=-R\), allowing particles to exit with rate \(\lambda \). Now the particle can exit, as before, reaching the exit point \(x=R\), but also with rate \(\lambda \) when it is stuck at \(x=-R\) (Fig. 1, case 4), then reducing the sticky property of the wall. In this case the exit time reads – see the Appendix A and Ref.s [22, 35] –

$$\begin{aligned} \tau _4 = \frac{R}{v} + \frac{1}{2} \frac{R^2}{v^2}\ \alpha + \frac{(1+\alpha R/v)^2}{\alpha + 2 \lambda (1+\alpha R/v)} . \end{aligned}$$
(12)

We note that for \(\lambda =0\) we retrieve the expression of impermeable wall (5), while, for \(\lambda \rightarrow \infty \), we obtain the first-passage time in the presence of two absorbing boundaries, \(\tau _4 = R/v + R^2\alpha /2v^2\) [25, 34, 35]. Also in this case the expression (12) can be cast in the form (4), with \(\alpha _0=(1/2\lambda + R/v)^{-1}\). We have that the condition for the existence of an optimal exit time \(\tau ^*\) at finite \(\alpha ^*\), is

$$\begin{aligned} \lambda < \lambda _c =\frac{v}{R} \frac{\sqrt{3}-1}{2} . \end{aligned}$$
(13)

For \(\lambda > \lambda _c\) the minimum exit time is at \(\alpha ^*=0\). In Fig. 2 (inset) we report the exit times (12) for different values of the parameter \(\lambda \).

Summarizing, we can conclude that the accumulation at the wall is responsible for the increase in the time that particles spend on the boundary as the tumbling rate decreases, in contrast to the opposite trend of the time spent by particles in the bulk. This results in the existence of optimal escape times at a finite value of the tumbling rate \(\alpha ^*\). When boundary accumulation is progressively inhibited, for example increasing the tumbling rate on the boundary or allowing particle absorption at wall, the optimal \(\alpha ^*\) begins to decrease and finally reaches zero at a certain value of the additional parameters (\(\gamma \) or \(\lambda \) in the previous models) that describe the inefficiency of the wall in allowing particles accumulation.

3 2D numerical results

We now turn to analyze the case of planar motions. We consider a 2D run-and-tumble particle in a circular domain of radius R. The particle moves at constant speed v (in the bulk) and reorients its direction of motion at rate \(\alpha \), with the tumbling angle chosen from a uniform distribution.

Fig. 4
figure 4

Schematic representation of the different boundary-particle interactions considered for a 2D run-and-tumble particle inside a circular domain. The upper case corresponds to the not-alignment situation (NA), in which the particle, hitting the edge, does not change its self-propelling orientation \({\hat{\textbf{e}}}\) and continues to move (with decreasing speed) along the border until its orientation is parallel to the boundary normal (unless it has tumbled or encountered the exit in the mean- time). The second case corresponds to an (instantaneous) complete-alignment (CA) of the self-propelling orientation with the boundary wall. The particle continues its motion along the boundary at speed v. The last case refers to the partial-alignment (PA) of \({\hat{\textbf{e}}}\) along the boundary, with a finite value of the angle \(\varphi \) between it and the tangent to the boundary. The particle proceeds at speed \(v \cos \varphi \)

The equation of motion of the particle in the bulk is

$$\begin{aligned} \partial _t \textbf{r} = v {\hat{\textbf{e}}}, \end{aligned}$$
(14)

where \(\textbf{r}\) is the position of the particle and \({\hat{\textbf{e}}}\) the unit vector indicating its direction of motion, which is changed with rate \(\alpha \) and extracted from a uniform distribution. When the particle arrives on the boundary it moves along it in a way that depends on the particular particle-boundary interaction we consider (see below and the Fig. 4 for a schematic representation of the different cases analyzed). A narrow aperture on the boundary allows the particle to exit. We will examine three case studies, corresponding to different particle-boundary interactions. The first case is that of a particle that does not change its orientation when arriving at the border. This is the case, for example, of spherical active particles, where torques are absent [9, 36]. We refer to this case as not-alignment case (NA). The second case is that of a complete alignment (CA) of particle orientation along the boundary. When colliding to the border the particle changes instantaneously its self-propelling direction of motion parallel to the wall. This is the case, for example, of elongated particles, such as E.coli bacteria [37] (we are neglecting the transient time for the complete alignment of the particle orientation to the boundary). The last case analyzed is that of partial alignment (PA), corresponding to a particle that maintains a fixed angle \(\varphi \) between its orientation and the tangent vector to the boundary. This happens, for example, in the case of sperm cells, where the extension of flagellum prevent a complete alignment of the cell along the boundary [38, 39]. Summarizing, we are considering a particle that, when arriving at the boundary, proceeds its motion along it with: decreasing speed in the NA case, with speed v in the CA case, and with speed \(v \cos {\varphi }\) in the PA case. The particle motion ends when it encounters the aperture and exits from the domain (we consider point-like particles that exit as soon as they cross the exit zone, if they come from the bulk, or touch its edge, if they come from the circular boundary). A schematic representation of the analyzed cases is shown in Fig. 4. We use numerical simulation to investigate such active random walks in 2D circular geometry, proceeding as follow. We start with a particle at the center of the circular domain. We then sequentially extract directions of motion with uniform angular distribution and rum times from an exponential distribution \(\alpha \exp {(-\alpha t)}\). The particle moves at constant speed v along straight lines in the bulk and, when it hits the boundary, it proceeds along the border for the rest of the run time, proceeding with a speed which depends on the case analyzed (as described before). The motion of the particle ends when it reaches the small aperture and exits the domain. Average over \(10^4\) up to \(10^5\) runs are considered.

Fig. 5
figure 5

Mean exit times \(\tau \) as a function of the tumbling rate \(\alpha \) for a 2D run-and-tumble particle inside a disk of radius R with a small aperture on the boundary of size \(\delta \), with \(\delta /R=\pi /180\) (angular aperture of \(1^{\text {o}}\)). The reported cases correspond to not-alignment of particle velocity along the boundary (NA, blue full circles), complete alignment (CA, black full squares), finite angle \(\varphi \) between the particle orientation and the tangent to the boundary (PA, red open diamonds) – see the schematic pictures in Fig. 4. The lines are guides to the eye. The asymptotic limit \(\alpha \rightarrow 0\) of PA curves is \(\tau (0) = R/v [1+(2\pi -\delta /R)^2/(4\pi \cos \varphi )]\) (dashed lines, see Appendix B). We set \(v=R=1\)

Fig. 6
figure 6

Mean exit times \(\tau \) decomposed as a sum of the time spent in the bulk \(\tau _{bulk}\) and on the boundary \(\tau _{boundary}\) as a function of the tumbling rate \(\alpha \) in the partial-alignment model (PA). The four panels refer to different values of the angle \(\varphi \) (see the text and Fig. 5). We set \(v=R=1\)

In Fig. 5 we show the mean exit times as a function of the tumbling rate \(\alpha \) for the different cases analyzed. It is evident the presence of a minimum at finite values of \(\alpha \) in the NA case and PA case for sufficiently high values of the alignment angles \(\varphi \) (close to \(\pi /2\)). We note that the PA case with \(\varphi =\pi /2\) shows a divergent exit time at small \(\alpha \), similarly to the NA case, because of the perfect sticky condition that occurs at the boundary in these cases. For smaller angles, down to the case of complete alignment (PA with \(\varphi = 0\), corresponding to CA), the minimum exit time is reached by non-tumbling particles (\(\alpha =0\)). The reported trends are very similar to the cases analyzed in 1D, highlighting the ability of the simplified one-dimensional models to effectively capture the essential aspects of the physics of the problem. However, we note that the specific functional dependencies in 1D and 2D can be different, and, for example, the \(\tau (\alpha )\) trends (see the PA curves in the figure) cannot always be captured by a simplified expression like Eq.(4), requiring, instead, more involved functional forms (see the footnote at page 1). A deeper analysis reveals the role played by boundaries at different tumbling rates. We can decompose the exit time as the sum of the time spent by the particle in the bulk and on the boundary before exiting the domain, \(\tau =\tau _{bulk}+\tau _{boundary}\). In Fig. 6 we report these times for the case of PA model with different values of the angle \(\varphi \). It is evident the dominant role of the bulk and boundary times, respectively at high and low tumbling rate values. Moreover, their behavior as a function of \(\alpha \) influences the whole behavior of the exit times, with the possible existence of non-monotonic trends and optimal values. Summarizing, we can then say that, even in the two-dimensional case, the accumulation at boundaries determines the existence of optimal exit times at finite values of the tumbling rate, which eventually becomes zero when the sticky properties of boundaries are reduced.

4 Conclusions

We have investigated the escape processes of confined active particles. In particular, we focused on the possible existence of optimal escape times. We found that the peculiar property of active matter to accumulate at walls gives rise to the existence of optimal tumbling rates corresponding to fast escapes. By introducing four different kinds of boundary conditions in 1D run-and-tumble models, we were able to obtain analytical expressions of escape times, which allow us to discuss the relevance of accumulation processes at boundaries for the existence of optimal finite values of tumbling rates. These findings are corroborated by the analysis of 2D run-and-tumble particles confined in a circular domain. By numerically studying the escape dynamics for different kinds of particle-boundary interactions (not/complete/partial - alignment of particle’s self-propulsion with the boundary wall) we find again the existence of optimal tumbling rate values for fast escapes, which tend to zero (the particles that come out the fastest are the ones that do not tumbling) by inhibiting the sticky properties of the walls. We expect this is a very general behavior of active matter, occurring whenever particles accumulation is present. Optimal escapes are, in fact, present also in physical situations where the escape (absorbing) regions are in the bulk and not along the boundary [31], or in the case in which the confinement of particles is due to external fields (potential barriers or confining potentials) instead of geometrical constraints [40,41,42]. Indeed, also in these cases, we have particles accumulation and the presence of competition between times spent on the bulk and on the boundary, which we have demonstrated are essential ingredients to have optimal escapes. Possible directions for future investigations could be to explore different geometries of the confining box, with the possible presence of curvature-dependent accumulation [43], to analyze the differences with respect to other active particles models, such as the active Brownian particle model [44], or to extend the investigation to three-dimensional domains and including particle-particle interactions. Finally, it would be interesting to investigate optimal escapes in experiments, for example, by devising genetically modified bacteria, with tunable tumbling rate controlled by external fields, in analogy to light-controlled speed in photokinetic bacteria [45]. The challenge here, in addition to synthesize these new kind of bacteria, is to develop an experimental set-up to study microswimmers in confined environments with the presence of narrow apertures enabling escape, with all the difficulties associated with the presence of effects not easily controlled at these microscales, such as hydrodynamic interactions with bourdaries. Alternatively, one could use non-living particles, such as shaped active Brownian colloids with controlled rotational dynamics [46] or the recently employed commercially toy robots Hexbugs [47]. We finally note that the possible existence of optimal escapes by varying particles tumbling rate should correspond to different trends of exit times of particles with fixed tumbling rate by changing the size of the confining domain [28]. This might be an alternative way to experimentally validate the reported findings, although varying the size of the system by orders of magnitude might not be such an easy task to accomplish.