Spatial heterogeneity of mortality and diffusion rates determines larval delivery to adult habitats for coastal marine populations

Many benthic animals begin life with a planktonic larval stage during which coastal currents may move individuals far from shore. This trait is believed to allow individuals to develop away from nearshore predators and sibling competition, based on the assumption that mortality rates are weaker offshore. However, larvae developing offshore often fail to locate suitable coastal habitats. This results in a trade-off between nearshore mortality and offshore wastage with consequences for larval delivery to adult habitats that have not been fully appreciated. We use a reaction-diffusion model to show that when the nearshore larval mortality rate is high, larval supply can vary more than 10-fold with the offshore mortality rate. If this offshore rate is weak, then larval supply is maximized by an intermediate diffusion rate or larval duration. While a low-diffusivity coastal boundary layer typically improves the larval supply by decreasing wastage, it can also reduce the larval supply by preventing individuals from exploiting low offshore mortality rates. Finally, the cross-shore structure of the mortality rate may influence the alongshore transport of larvae by determining how far offshore they reside prior to settling, and, consequently, the alongshore currents they experience. Our observations contrast with the prior argument that larval supply decreases with diffusivity and larval duration due to wastage, and challenge the widespread decision to omit cross-shore heterogeneity from studies of alongshore movement. Scenarios in which spatial variability in the mortality rate has a large effect on recruitment are important both for understanding the biological consequences of the larval stage and from a modeling perspective.


Introduction
Biphasic life cycles, featuring a planktonic larval stage and a sedentary adult stage separated by metamorphosis, are common among benthic invertebrates and reef fish (Gerber et al. 2014;Levin and Bridges 1995;Pechenik 1999). Although the exact details of the larval stage vary across species, a successful trajectory might progress as follows: spawning or hatching in the benthos or bottom waters; transport (by diffusion, advection, and in many cases, locomotion) away from the natal habitat; development in the water column until competent for metamorphosis; transport toward a suitable benthic habitat; and settling into this habitat for metamorphosis (Shanks 1995). However, very few spawned larvae actually settle, while the vast majority either succumb to predation and other hazards or fail to find a suitable habitat before senescence ("wastage") (Morgan 1995;Rumrill 1990;White et al. 2014).
It is often asserted that planktonic development did not arise as an adaptation for dispersal, but rather as an ontogenetic migration that removes vulnerable offspring from sibling competition and coastal predators (including the larvae's parents), with dispersal occurring as a consequence (Levin 2006;Morgan 1995;Pechenik 1999;Shanks 1995;Strathmann 1974). The claim rests on the belief that larvae experience greater mortality rates near the shore than elsewhere. However, this argument is confounded by the fact that larvae transported far from coastal habitats instead face an increased risk of wastage (Cowen et al. 2000;Morgan 1995;Rumrill 1990). The spatial segregation of these two sources of larval loss results in a trade-off between mortality and wastage with offshore travel, in which movement away from one hazard seemingly brings larvae closer to the other. In other words, dispersing larvae find themselves "between a rock and a hard place." Assuming that the commonness of dispersive larvae in nature indicates that this life history strategy is in some way adaptive, one or more of the following statements about larval dispersal should be true: 1. The risk of mortality near the shore is so great that the probability of returning from offshore to settle is greater than that of surviving near the coast. 2. There are mechanisms by which the trade-off of offshore movement can be managed, such that larvae can escape mortality near the shore without greatly increasing their risk of wastage, or vice versa. 3. Despite the risks, species with dispersive larva produce sufficiently many successful offspring to replenish the adult population. There are benefits to planktonic development and dispersal, described below, that are not adequately represented by the fraction of offspring that succeeds.
Theory and examples supporting statements (2) and (3) are common in the literature, while (1) is usually taken as axiomatic for the evolution of planktonic, rather than benthically reared, offspring.
Mechanisms for managing the trade-off between wastage and mortality can be biotic or abiotic. Biotic mechanisms include horizontal and vertical locomotion by larvae of some species to influence net changes to their advection and diffusion, but the ability to do so varies across taxa (Cowen et al. 2000;Largier 2003;Paris et al. 2007;Shanks 1986;Young 1995). Abiotic mechanisms, on the other hand, are relevant to individuals of all species in a given environment. Retention zones and coastal boundary layers (CBLs) in which movement is slow have long been recognized as common oceanographic phenomena that reduce wastage by keeping larvae close to shore (Largier 2003;Largier 2004;Morgan 1995;Nickols et al. 2013;Shanks 2009). These mechanisms may, in some cases, also act to mitigate trade-offs between wastage and mortality by allowing larvae to escape high nearshore mortality rates without being swept too far away. In other cases-particularly when the mortality rate is high over much of the CBL or the habitat into which larvae must settle-one would expect nearshore retention to exacerbate mortality. Further investigation is needed to determine how low-diffusivity coastal regions interact with the mortality-wastage trade-off.
Undoubtedly, there are benefits to planktonic development that extend beyond ensuring a sufficiently large reproductive yield. These include many of the usual benefits to dispersal and range expansion seen in both aquatic and terrestrial ecosystems, such as escaping crowding, inbreeding, and pathogens or parasites; the ability to colonize new and potentially better habitats; and increased resilience against local disturbances (Burgess et al. 2016;Hamilton and May 1977;Shaw et al. 2019;Strathmann 1974). Larval dispersal may also allow larvae to access and benefit from different or more abundant food sources in the offshore waters than would be accessible nearshore or in the benthos. Additionally, planktonic development may allow for multiple kinds of bet-hedging against environmental variability. By having larvae settle in several different habitats along the shore, individuals reduce the probability of having all of their offspring wiped out by a localized stochastic disturbance (Strathmann 1974). Organisms may also bet-hedge by exploiting the trade-off between wastage and mortality inherent in cross-shore dispersal. If nearshore mortality rates and offshore diffusivity vary annually, but independently, then exposing individual offspring to either (but not both) of these sources of loss reduces the probability that a bad year will extinguish all of an individual's progeny.
The present article investigates the conditions needed for the risk of nearshore mortality to outweigh that of offshore wastage (that is, statement (1)), and how these conditions are affected by a CBL (statement (2)), a mechanism usually held to improve recruitment. Despite the evolutionary significance ascribed to cross-shore heterogeneity in the larval mortality rate, there have been surprisingly few attempts to measure mortality rates in nature (but see Rumrill (1990) and White et al. (2014)). This is largely due to the many challenges researchers face tracking individual larvae in situ, as well as obstacles to direct measurement of the mortality rate itself. Yet, although mathematical models are commonly used to study larval dispersal and the connectivity of coastal metapopulations, even theoretical studies often assume the mortality rate to be uniform in space, or are agnostic about offshore mortality (or mortality in general) as an important source of loss compared to nearshore mortality and wastage (Cowen et al. 2000;Cowen et al. 2006;Cowen and Sponaugle 2008;Nickols et al. 2015;Paris et al. 2007;Roughgarden et al. 1988;Siegel et al. 2008). Excluding cross-shore structure in the mortality rate allows researchers to focus on other aspects of dispersal, but to our knowledge, no efforts have been made to determine what effect this structure has on other research foci, such as larval supply and alongshore dispersal distance (collectively, "larval delivery" to coastal post-larval habitats).
We believe that in some cases, neglecting the cross-shore structure of the environment will lead to erroneous predictions of larval delivery. Fitting a spatially uniform mortality rate to field measurements, or neglecting mortality altogether, can result in substantively different estimates of the fraction of spawned larvae that returns to shore, and may have consequences for local population dynamics. Furthermore, the spatial structure of the mortality rate determines how far offshore settling larvae tend to reside during development. Since alongshore currents are often structured in the cross-shore direction, a heterogeneous mortality rate could influence which alongshore currents larvae experience during development, and consequently, how far alongshore larvae disperse (Largier 2003;Largier et al. 1993;Nickols et al. 2012).
The trade-off created by near-and offshore hazards may also have evolutionary implications that have not previously been discussed. The diffusivity of an individual larva is the result of both coastal hydrodynamics, which vary on several time scales, and morphology and behavior, which can be shaped over generations by natural selection. Focusing strictly on a population's ability to sustain itself over time, we expect the most favorable phenotypes to be those that maximize the number of larvae that survive until reproduction while minimizing the risk of recruitment failure due to environmental stochasticity. If the mortality risk were equal everywhere, then there would seem to be little reason for larvae to travel long distances, and so evolution would favor phenotypes that reduce diffusivity. On the other hand, a greater risk of death near the shore than elsewhere would select for intermediate or high diffusivity, depending on how this risk compares with that of offshore loss.
Here, we model the passive diffusion of larvae to investigate when and how the cross-shore structure of the mortality rate impacts predictions of larval supply, as measured by the fraction of dispersing larvae that ultimately settles (or equivalently, an individual larva's probability of settling). We also explore how a CBL interacts with the heterogeneous mortality rate, and when a CBL mitigates or exacerbates the wastage-mortality trade-off of cross-shore travel. Finally, we address the implications of these findings for alongshore movement of larvae, as represented by the duration of time larvae spend offshore compared with nearshore.

Model and methods
We present two models of larval dispersal. The first model is a reaction-diffusion equation describing how the spatial distribution of a population of larvae synchronously spawned from a homogeneous habitat changes over the course of one larval duration. The second model is a stochastic process describing the movement of an individual larva from this population. Because our emphasis is on consequences of cross-shore structure in the mortality rate and diffusivity, we included the cross-shore spatial dimension only. This is equivalent to modeling dispersal from a long, straight, homogeneous coastline where all cross-sections perpendicular to the shore exhibit the same distribution of larvae. A schematic diagram of the modeled environment is shown in Fig. 1.
Both models are non-dimensionalized in order to group together analogous biological and biophysical scenarios while reducing the number of model parameters that must be considered and improving computational efficiency (see 2.2 Nondimensionalization of the population model).

Reaction-diffusion population model
Let X ≥ 0 denote cross-shore distance (km) from a coastline located at X = 0 . We assume that our species of interest has a post-larval habitat (from which larvae spawn and into which larvae settle) occupying a strip of width X h adjacent to the shore; that is, the habitat is the interval [0, X h ] . Typical habitat widths X h for coastal marine animals range from as narrow as 0.01 km (for animals inhabiting small rocky reefs) to as wide as 5 km or more (for animals that can thrive at a variety of depths, such as the dungeness crab) (Rasmuson 2013).
At time T = 0 (days), N 0 larvae are spawned with uniform density over [0, X h ] . The total lifespan of a larva is called the larval duration, which we denote by T LD . Larval durations tend to be nearly fixed for individuals of the same species in the same environment, and vary from as short as a few minutes, as in many tunicates, up to many months, as in the dungeness crab or the giant triton, with typical values in the range 5-100 days (Shanks et al. 2003;Shanks 2009). The larval duration consists of two phases: a pre-competence duration of length T PC during which larvae must become sufficiently developed to undergo metamorphosis, and a competence duration of length T LD − T PC during which larvae are ready for metamorphosis but must locate and settle into a suitable habitat. The competence duration is finite because larvae eventually senesce or become inviable for metamorphosis (Levin 2006;Morgan 1995;Shanks 1995). In our model, settling can only occur when T ∈ [T PC , T LD ] , and larvae that have not settled by T LD are considered wasted.
If N(T, X) denotes the density of larvae located X km from shore T days after spawning, then N satisfies the linear reaction-diffusion equation where K(X) denotes eddy diffusivity in the cross-shore direction, R s (T, X) denotes the rate at which larvae settle into location X at time T, and R m (X) denotes the rate at which larvae die at location X. The boundary conditions of this (1) model are discussed in the Boundary conditions of the reaction-diffusion model. To capture the cross-shore structure of the mortality rate with minimal assumptions, we choose R m (X) to be a time-constant step function that takes one value m > 0 over a high mortality zone (HMZ) near the shore, [0, X m ] , and a potentially smaller value n ∈ [0, m] beyond the HMZ: Because the HMZ may simply be the habitat range of a predator, X m has the same typical values as X h .
We similarly choose the settling rate to be a step function: if larvae settle with rate s into the habitat during the competence duration, but cannot settle at any other time or location, then The cross-shore eddy diffusivity K(X) combines a coastal boundary layer (CBL) of width X b ≥ 0 with a constant diffusion rate K > 0 attained beyond the CBL. The CBL usually extends as far offshore as the 30m isobath, resulting in typical CBL widths of 1-10 km (Nickols et al. 2015). Empirical results reported by Largier (2003), Okubo and Levin (2001), and Nickols et al. (2012) indicate that within the CBL, crossshore diffusivity increases as a power law with cross-shore distance, K(X) ∝ X . The exponent ranges from 0.5 to 2, with typical values slightly greater than 1 (Nickols et al. 2012). This produces the cross-shore diffusion rate.
Simulations ignoring the effects of the CBL are run with X b = 0 and a reflecting boundary at X = 0.
Model parameters and their typical ranges are summarized in Table 1.

Non-dimensionalization of the population model
Non-dimensionalization, or the rescaling of variables and parameters by units (or "scales") characteristic of larval development and dispersal, allows us represent mathematically analogous biological and biophysical scenarios using a single model while reducing the number of parameters we must consider in our analysis. Many rescalings of the model are possible. We choose the one with unitless time variable t = T∕T LD , length variable x = X∕X h , and population density p(t, x) = N(T, X)∕N 0 . The time rescaling allows Orange arrows indicate the strength of eddy diffusivity in the cross-shore and alongshore directions, K X (X) and K Y (X) , under the assumption that the environment is homogeneous in the alongshore direction. Our model explicitly considers only cross-shore movement, so K X is referred to as simply K in the text. The grey part of the larval trajectory takes place during pre-competence, [0, T PC ) , and the yellow part takes place during competence, [T PC , T LD ] all simulations to be performed over t ∈ [0, 1] . The length rescaling enables us to vary the spatial features of greatest relevance-CBL width, HMZ width, and diffusion-relative to a fixed reference width. Importantly, the rescaled population density p(t, x) can be interpreted as the probability density of an individual larva having dimensionless location x at dimensionless time t.
After non-dimensionalization, the model becomes with dimensionless diffusion rate and dimensionless settling rate In defining the dimensionless mortality rate, m (x) , it is useful to define the "offshore mortality ratio" so that we may separately vary near-and offshore mortality rates in our analysis without violating m ≥ n ≥ 0 . This gives us the dimensionless mortality rate Note that ∈ [0, 1] , with = 0 and = 1 corresponding to an offshore mortality rate of 0 and a spatially uniform mortality rate of , respectively. Parameters from the dimensionless model (5) are summarized in Table 2.

Associated individual stochastic process
It can be shown (see Equivalence of the reaction-diffusion and stochastic individual models) that the position, t , of an individual larva governed by model (5) satisfies a "killed" stochastic differential equation (Karlin and Taylor 1981) Table 2 Summary of parameters for the non-dimensionalized model (5). As in Table 1, ranges refer to typical ranges but do not include all possible cases a These are the values used in all simulations below, unless different values are specified for particular parameters. The default x b = 0 means that unless otherwise stated, simulations are run with constant diffusivity offshore and no CBL b Many species that travel far enough offshore to experience the extreme diffusivities listed in Table 1 also have long larval durations and large habitats. Therefore, we do not expect ̄ to be as large as is theoretically possible from the ranges in Table 1 Parameter In this context, "killing" means that this process terminates at a random time ≤ 1 if death or settling occurs. Over any short time-step [t, t + t) ⊂ [0, 1] , the process located at t = x terminates due to death or settling, respectively, with probabilities where o( t) represents terms that decay faster than t as t ↘ 0 (Karlin and Taylor 1981). If neither settling nor death occurs before t = 1 , then = 1 and wastage occurs. The probability density function of t on the event that neither form of killing has yet occurred is p (t, x), the solution to model (5).

Computing important quantities
The journey of every larva terminates in either settling, wastage, or mortality. The probability of each outcome can be computed from p(t, x) (see Appendix 5.3): Note that expressions (13) and (15) are proportional to the average values of the settling and mortality rates over space and time, respectively, weighted by the probability density of the larva's position over time. Also, by definition, Adult female benthic invertebrates can spawn anywhere from 10 2 to 10 9 eggs, depending on egg size and fertilization rates (Christiansen and Fenchel 1979;Levitan 1995;Rumrill 1990;Thorson 1950). Supposing that the number of fertilized eggs falls in the range 10 2 ≤ N 0 ≤ 10 7 per adult, and that each adult produces between 1 and 100 successful offspring (so that populations can replace themselves, even after post-larval mortality), we expect S to take very small values, on the order of 10 −7 ≤ S ≤ 10 −2 (Rumrill 1990). S should be regarded as a non-dimensional measurement of larval supply, or the total number of larvae returning to a coastal habitat that may recruit to the reproductive (postlarval) population.
Alongshore currents typically vary and increase in magnitude with offshore distance (Largier 2003;Largier et al. 1993;Nickols et al. 2012). Therefore, we shall use the amount of time (or, given the nondimensionalization, the fraction of the larval duration) that larvae spend farther offshore than x > 0 (km) prior to settling as a proxy for potential alongshore movement. This quantity is denoted by a random variable depending on x, Here, ̂t is the individual process (10) conditioned upon dispersal terminating in settling, rather than mortality or wastage. We shall approximate the distribution of (x) for x = 10 by repeatedly simulating the individual model and computing (x) only for trials in which settling occurs. While this distribution could be computed deterministically from equations resembling (5), finer resolution can be attained in far less computation time through stochastic simulations.

How is larval supply affected by a spatially heterogeneous mortality rate?
We explore the relationship between the probability of settling, S, and the offshore mortality ratio, , in Fig. 2 in two scenarios: fixed nearshore mortality, and fixed total (or average) mortality.

Fixed nearshore mortality rate
In this scenario, the dimensionless nearshore mortality rate, , is held constant while the offshore mortality ratio, , is varied from 0 to 1. This describes the effect of unknown offshore mortality when only a nearshore rate has been measured. The value of S obtained when = 1 represents an estimate of larval return obtained by assuming the nearshore mortality rate holds at all offshore locations. Varying alone is also useful for considering the effect of the offshore mortality rate in isolation. However, the following results should be interpreted with the caveat that varying also affects the average mortality rate.
The probability of settling, S, strictly decreases with the offshore mortality ratio, , when dimensionless nearshore Impact of the offshore mortality rate on estimated probability of settling. a Probability of survival, S, as a function of the offshore mortality ratio, , for fixed nearshore mortality rates = 2 (blue), 6 (red), 10 (green). b Probability of survival, S, as a function of the offshore mortality ratio, , with probability of mortality, M, fixed at values obtained using uniform mortality rates 0 = 2 (blue), 6 (red), 10 (green). c Nearshore mortality rates, , required to keep M constant as is varied in b. Recall that the estimate from a uniform mortality rate appears on the right of a and b, where = 1 . Note the logarithmic vertical axes used to display S in this figure mortality, , is fixed. This is because increasing increases the total mortality rate over the entire coastal environment, x ∈ [0, ∞) . The magnitude of this effect varies positively with the nearshore mortality rate: over the range = 0 to 1, S varies by a factor of ∼2.5 when = 2 , compared with ∼ 20 when = 10 . This increased sensitivity to the offshore mortality ratio as the nearshore mortality rate is increased suggests that when nearshore mortality is high, the risk of offshore wastage may be outweighed by the benefit of escaping nearshore predation.
This trend was not qualitatively changed by varying the width x m of the high mortality zone (HMZ), which lessens the effect of the offshore mortality rate by increasing exposure to the nearshore rate. It was also not qualitatively affected by varying dimensionless eddy diffusivity, ̄ , although increasing ̄ reduces the overall fraction of larvae that settles and steepens the relationship between S and . This results in a greater difference between the case = 1 and any case with < 1.

Fixed total mortality
In this scenario, the probability of mortality, M, (which is proportional to the total number of larvae that die) is held constant at the value obtained assuming a uniform mortality rate ( = 0 and = 1 ) while the offshore mortality ratio is varied between 0 and 1. To keep M constant, the nearshore mortality rate is decreased as is increased (Fig. 2c). This describes the effect of unknown offshore mortality when only the fraction of larvae that perish has been estimated. The value of S obtained when = 1 represents an estimate of larval return obtained by fitting a uniform mortality rate to measurements of a potentially heterogeneous one.
Generally, S increases slightly with the offshore mortality ratio , but is largely insensitive to this parameter while total mortality is constant. In all three mortality schemes considered, S varies by ∼4.1 fold or less over the range 0.053 < ≤ 1 . However, S is very sensitive to changes in when is small and total mortality is high. For instance, when 0 = 10 , S increases by nearly 50-fold over 0 ≤ ≤ 0.053 (Fig. 2b). This sharp increase is more likely driven by the decrease in possible when even a small amount of offshore mortality is permitted (e.g., the transition from = 0 to > 0 ), illustrated in Fig. 2c). These trends are qualitatively unchanged by varying HMZ width, x m , and eddy diffusivity, ̄.
The increasing relationship between the probability of settling, S, and the offshore mortality ratio, , when total mortality is fixed may be counter-intuitive, but is clear when considered alongside the relationship between and shown in Fig. 2c: increasing while decreasing redistributes the mortality risk from nearshore larvae, which are more likely to locate suitable habitats if they can survive for sufficiently long, to offshore larvae, which are more likely to be wasted.

How is the relationship between diffusivity and larval supply affected by a spatially heterogeneous mortality rate?
We varied ̄ and while holding constant to understand the relationship between dimensionless diffusivity, dimensionless mortality, and the probability of settling, S, when mortality risk is elevated nearshore. We did not hold total mortality constant, as was done in the previous section, because we are specifically interested in how a low-mortality region offshore interacts with the rate of movement of the larva.
When the mortality rate is spatially uniform ( = 1 ), the probability of settling strictly decreases with diffusivity (Fig. 3a). For instance, when = 10 , S decreases by a factor of ∼ 18 over the range 1 ≤̄≤ 1000 . This reflects an increased probability of wastage as movement over large distances relative to the size of the habitat becomes more likely. This result holds independently of . Qualitatively similar trends appear when the mortality rate is weaker offshore ( < 1 ) provided that the nearshore mortality rate is also weak, such that the difference between the HMZ and offshore is small and has little effect on overall mortality. The same trend also appears when the HMZ is narrower (or wider) than the habitat by an order of magnitude or more, such that larvae spend nearly all time prior to settling offshore of (or within) the HMZ, and are thus affected little by the heterogeneous mortality rate (compare, for instance, the blue and red curves in Fig. 3a).
When the dimensionless mortality rate is high ( is large) and spatially heterogeneous ( < 1 ), and the HMZ is similar in width to the habitat, the probability of settling may vary non-monotonically with diffusivity. The green curve in Fig. 3a illustrates this in the extreme case x m = 1 and = 0 (no mortality beyond the habitat), where S attains a global maximum at a dimensionless diffusivity 100 <̄< 1000 . Importantly, ̄= 1 (the smallest tested value of ̄ ) is a local minimum of S in this case, rather than a global maximum as in the uniform mortality case. In the case shown by the green curve in Fig. 3a, S is ∼1.8 times larger at its global maximum than at ̄= 1 . This suggests that despite an increased risk of wastage, moderately fast movement relative to the width of the habitat can be beneficial when the nearshore environment is very dangerous compared to the offshore one. The emergence of an intermediate optimal diffusion rate when is sufficiently small is shown for x m = 1 in Fig. 3b.
When mortality is high and the HMZ is larger than the habitat, S is maximized by very small and intermediate dimensionless diffusivities, but attains a relative minimum at moderately small diffusivities. In the case shown by the red curve in Fig. 3a, the values of S at its local and global maxima (at ̄= 1 and in 100 <̄< 1000 , respectively), are greater than the value of S at its local minimum at 1 <̄< 10 by factors of ∼1.3 and ∼2.3, respectively. The emergence of Fig. 3 The structure of the offshore mortality rate affects how the probability of settling, S, depends on diffusivity, ̄ . When the mortality rate varies substantially over regions larvae traverse, S may be maximized by intermediate diffusivities.
a Probability of settling, S, as a function of dimensionless eddy diffusivity, ̄ , in the following mortality schemes: = 1 (blue), = 0 and x m = 1 (green), and = 0 and x m = 2 (red). b and c display the critical value(s) of diffusivity, ̄ * , at which S is locally maximized (filled circles) or minimized (open squares) for each 0 ≤ ≤ 1 both local maxima and minima of S as the offshore mortality ratio decreases is illustrated in Fig. 3c. This trend suggests that high diffusivity relative to the habitat width is beneficial if it is intense enough to transport larvae beyond the HMZ, but deleterious if it merely moves larvae from the habitat into the dangerous region between the offshore edge of the habitat and the offshore edge of the HMZ.
Another important feature of these heterogeneous high mortality cases is that despite these intermediate extrema, S varies little over 1 ≤̄≤ 1000 compared with the uniform (or near-uniform) mortality cases considered. In the cases x m = 1 and 2, the maximal and minimal values of S over this range of ̄ are within a factor of 3 of each other, compared with the factor of 18 observed in the uniform mortality case. The insensitivity of S to ̄ in these cases indicates that reduced offshore mortality ensures that some larvae always survive and settle, even when diffusivity is strong.

How is the relationship between CBL width and larval supply affected by a spatially heterogeneous mortality rate?
Here, we introduce a CBL of width between 0 and 10 times that of the habitat ( 0 ≤ x b ≤ 10 ) to explore the interactive effects of low diffusivity and high mortality in the region close to shore. The probability of wastage, W, seems always to decrease with respect to CBL width (Fig. 4c), as reduced diffusivity close to shore slows the movement of larvae away from their spawning sites within the habitat. When the mortality rate is spatially uniform, this reduced movement away from the habitat also shortens the mean time larvae spend dispersing prior to settling, causing the probability of mortality, M, to decrease slightly with x b (Fig. 4b). Combined, these trends result in the probability of settling, S, increasing with respect to CBL width. In the case represented by the blue curve in Fig. 4a, S increases by a factor of 5.9 over 0 ≤ x b ≤ 10.
By contrast, when the mortality rate is higher nearshore than offshore, M increases with x b (Fig. 4b). This is because a wider CBL reduces the probability of a larva escaping the HMZ to benefit from the safer offshore environment. Due to the relationship (16) and the opposite trends of M and W with x b , S may increase, decrease, or vary non-monotonically with CBL width. If the HMZ is far narrower than the adult habitat or nearshore mortality is weak, then the trend between S and x b resembles that of the uniform mortality case. However, if the HMZ is similar in size to the habitat, S decreases over smaller CBL widths ( x b ⪅ 4 ), but increases over greater widths (Fig. 4a). A small to medium CBL increases mortality by retaining larvae in the HMZ, but does not substantially reduce wastage. A large CBL also retains larvae in the HMZ, but this cost is outweighed by a large decrease in wastage.

How might a spatially heterogeneous mortality rate influence alongshore transport?
We simulated the stochastic individual model (10) in two mortality schemes, uniform ( = 1 ) and heterogeneous ( = 0 ), until we obtained 10 4 simulations terminating in settling for each case. These simulations were used to estimate the distribution of (10) (time spent farther offshore than x = 10 prior to settling), a proxy for alongshore movement. The resulting histograms are shown in Fig. 5. The reference distance x = 10 was chosen because it is far enough offshore that, excluding potential effects of the mortality rate structure, larvae with = 100 are similarly likely to spend a long time within or beyond this distance. However, similar results are obtained using different values of x.
We observed that settling larvae are more likely to spend time far offshore when the mortality rate offshore is weak compared to when the mortality rate is spatially uniform. In particular, the distribution of (10) is has mean 0.51 in the heterogeneous case, compared with 0.42 in the uniform case. Additionally, in the heterogeneous case, 47% of successful larvae spend more than half of the larval duration beyond x = 10 (that is, (10) > 0.5 ), compared with only 21% in the heterogeneous case. These results suggest that in an environment where alongshore currents vary in the cross-shore direction, the spatial structure of the mortality rate may have a large effect on the currents to which dispersing larvae are subject.
The differences in the distribution of (10) across mortality rate structure are more pronounced at greater nearshore mortality rates , but the overall results are not changed. At lower values of , the distributions of (10) are nearly the same, although larvae still spend more time offshore in the heterogeneous case than in the homogeneous case. We did not observe any qualitative changes to these results as the widths of the CBL and HMZ were adjusted.

Discussion
Our analysis reveals that although the results and intuition provided by several past models appear unchanged by the structure of the coastal environment, there exist conditions in which larval supply may be highly sensitive to changes in the offshore mortality rate. These conditions include high mortality and diffusivity, such that larval supply is severely constrained by death and wastage. In such cases, we saw that assuming the nearshore mortality rate applies at all offshore locations can result in a substantial underestimate of larval supply. By contrast, using an average of total observed mortality over all locations, weighted by where larvae spend the most time, results in a more robust Fig. 4 Probabilities of a settling, S, b mortality, M, and c wastage, W, as functions of coastal boundary layer (CBL) width, x b , with mortality rate = 6 and the following mortality rate structures: = 1 (blue), = 0 and x m = 1 (green), and = 0 and x m = 3 (red). Typically, M increases and W decreases with x b , such that S may vary non-monotonically with x b . Note that the vertical axes in this figure are linear, but have different maxima estimate of larval supply unless the difference between the near-and offshore mortality rates is extreme.
We affirm the prior result that strong diffusivity often reduces settling by increasing wastage. However, this is not necessarily the case when the mortality rate is greater nearshore than offshore. Under this condition, settling can increase or vary non-monotonically with diffusivity due to the trade-off between the high probability of wastage larvae face offshore and the potentially higher risk of mortality they face nearshore. The same trade-off results in cases in which a low-diffusion coastal boundary layer (CBL) reduces, rather than increases, the proportion of larvae that settles. Under weak or spatially uniform mortality, the CBL reduces wastage and has little effect on mortality, thus increasing settling. When the mortality rate is greater nearshore than offshore, however, this reduction in wastage is outweighed by increased mortality due to slow movement in the nearshore high mortality zone (HMZ), unless the CBL is very wide.
Finally, we found that cross-shore heterogeneity in the mortality rate may affect alongshore travel by influencing the proportion of the larval duration a successful individual spends offshore, and, consequently, the alongshore currents to which they are exposed. This difference is particularly pronounced when nearshore mortality is moderate or high, and is notable because cross-shore structures are often omitted from studies of alongshore dispersal.

Interpretation of the dimensionless results
Our analysis primarily focused on the relationship between the probability of settling, S, and the unitless parameters describing the structure of the mortality rate and coastal environment in a non-dimensionalized model, (5). We identified the dimensionless nearshore mortality rate, = mT LD , and the dimensionless diffusion rate, (x) = K(X)T LD ∕X 2 h , as two of the most important determinants of whether offshore structure impacts the probability of settling. The exact effects of these parameters depend on the widths of the high mortality zone (HMZ) and the CBL relative to that of the habitat, x m = X m ∕X h and x b = X b ∕X h , respectively. These dimensionless results should be understood as commenting on the relationship between larval supply and the true parameters from which the dimensionless ones are constructed: larval duration, T LD ; nearshore mortality rate, m; diffusion rate, K; and habitat, HMZ, and CBL widths, X h , X m , X b , respectively. A thread that runs through our analysis is the question of which subset of dispersing larvae provides a greater share of the settling population: that which remains close to shore, or that which travels far offshore.
The dimensionless nearshore mortality rate, , can be interpreted as mortality exposure because it combines the mortality rate, m, with the duration of the exposure to this rate, T LD . When larvae face little nearshore mortality exposure due to a short larval duration or a low mortality rate, many larvae that remain close to the habitat and HMZ survive until competence and are well-positioned to settle, while larvae traveling far away comprise a smaller fraction of the settling population because comparatively few are diffused back to the habitat before wastage occurs. High nearshore mortality exposure due to a long larval duration or a high mortality rate results in far fewer larvae surviving close to shore. This increases the relative fraction of settlers that have been mostly offshore. The size of this latter subpopulation depends on the offshore mortality rate, resulting in greater sensitivity of the overall larval supply to offshore conditions. A wide HMZ reduces sensitivity to offshore conditions simply by reducing the number of larvae that experience reduced mortality exposure offshore.
The dimensionless diffusion rate = KT LD ∕X 2 h represents exposure to eddy diffusion (scaled by the width of the habitat, X h ). Our analysis supports prior results in the literature, which state that greater exposure to diffusion due to oceanographic conditions or a long larval duration typically increases wastage and reduces larval supply in the absence of advection or locomotion (Cowen et al. 2000;Largier 2003). Increased wastage is also achieved by reducing the size of the post-larval habitat, X h , which increases diffusion exposure in our model. However, we also observed that when larvae experience high mortality exposure over or near their post-larval habitat and weaker mortality exposure elsewhere, the probability of settling S is maximized by intermediate diffusion exposure (i.e., just enough to transport larvae away from nearshore hazards without risking excessive offshore wastage). This underscores the trade-off larvae face due to the spatial segregation of two forms of larval loss, mortality and Overlapping histograms of (10) , the fraction of the larval duration spent offshore of x = 10 , for 10 4 successful larvae in a uniform mortality rate ( = 1 , blue) and a heterogeneous mortality rate ( = 0 , red). The purple region indicates overlap between these two histograms. All other parameters are set to the default values in Table 2. In the heterogeneous mortality case, larvae typically spend more time far offshore prior to settling than in the uniform case wastage. Weak diffusion exposure due to low eddy diffusivity, a short larval duration, or a large habitat (contained in a larger HMZ) prevents individuals from moving far enough offshore to benefit from the heterogeneous mortality rate. On the other hand, strong diffusion exposure due to high eddy diffusivity, a long larval duration, or a small habitat results in too many larvae failing to return to shore before expiration. The optimum is attained when larvae diffuse just fast enough or for just long enough to escape nearshore dangers, but not faster or longer.
When the HMZ is broader than the habitat, one sees a minimum of S at a low diffusion exposure. This indicates that when the habitat is separated from safer offshore conditions by a hazardous non-habitat zone, diffusing too slowly or for too little time is worse than not diffusing at all because it allows larvae to be wasted without sufficient reprieve from nearshore conditions. The maxima at either very low or intermediate diffusivities represent two possible strategies that may appear in nature through selection. Species can feature either short larval durations compared to the size of their habitats or adaptations for weak diffusivity, or else they can have moderately long larval durations or adaptations for moderate diffusivity. This theoretical result supports the observation of Shanks et al. (2003) and Shanks (2009) that dispersal distances are bimodally distributedusually short or long, but rarely intermediate-even though larval durations are continuously distributed.
Another important consequence of S being maximized by intermediate diffusion exposure is that S is also least sensitive to variations in diffusion exposure about the optimal value, due to dS∕d̄= 0 at a local optimum. Therefore, intermediate diffusion exposure results in the greatest larval supply possible as well as the least susceptibibility to extinction due to environmental variability. One might expect some species with planktonic larvae to have adaptations for achieving moderate diffusion exposure through body structures, behaviors, and dispersal and developmental duration. This suggests that a long larval duration can be advantageous per se in a coastal environment with mortality exposure concentrated nearshore, and is not necessarily the result of development time or an adaptation for alongshore dispersal alone.

Interactive effects of the CBL and mortality rate heterogeneity upon larval supply and loss
Studies that have excluded spatial heterogeneity in the larval mortality rate have previously concluded that nearshore retention zones, such as CBLs, strictly improve larval supply by reducing wastage (Largier 2003;Largier 2004;Nickols et al. 2015). We verified that settling increases with CBL width in the case of a spatially uniform mortality rate, as well as when the mortality rate is heterogeneous but weak.
In the low-mortality case, the probability of mortality increases with CBL width because reduced diffusion exposure nearshore prevents larvae from escaping the HMZ. However, this increase in mortality was outweighed by the reduction in wastage in all cases we considered. In other words, there is no apparent trade-off between nearshore mortality and offshore wastage in the presence of a CBL.
The effect of the CBL is less consistent for heterogeneous mortality with high nearshore mortality. When the habitat and the HMZ have similar widths, reduced wastage due to a narrow or medium CBL is offset by increased mortality in the same region. As a result, a narrow or medium CBL reduces larval supply. A CBL extending beyond the HMZ, however, can further reduce wastage while only slightly increasing mortality nearshore, resulting in improved larval supply. The trade-off between nearshore mortality and offshore wastage is evident when considering the effect of CBL width, as it is impossible for the CBL to reduce wastage without increasing mortality simultaneously.

Implications for alongshore movement
Although the focus of this study has been on cross-shore movement, we emphasize that the cross-shore heterogeneity of the mortality rate is likely to have consequences for alongshore movement as well. Advection and diffusion in the alongshore direction frequently increase with distance from the shore, particularly in the presence of a CBL (Largier 2003;Largier 2004;Largier et al. 1993;Nickols et al. 2012). The modeling study of Largier (2003) showed that alongshore dispersal distance tends to increase nonlinearly with larval duration due to increased exposure to stronger alongshore currents far offshore. We illustrated here that successful larvae with longer larval durations (as well as those facing high nearshore mortality risks) spend more time offshore prior to settling when the mortality rate is weaker offshore. Successful larvae are also likely to experience strong alongshore currents, resulting in greater alongshore dispersal distances than would be predicted using a model with a spatially uniform mortality rate.

When is the cross-shore structure of the mortality rate important (or not)?
Researchers have historically omitted spatial heterogeneity in the mortality rate (or, in some cases, mortality in any form) from mathematical models of larval dispersal because it is poorly quantified, adds model complexity (i.e., increases the number of parameters that must be estimated), and may not seem relevant to the goals of a study, such as predicting alongshore dispersal (Cowen et al. 2000;Largier 2003;Nickols et al. 2015;Siegel et al. 2008).
Our results indicate that excluding this heterogeneity may be safe in some settings, but may alter model predictions in others. In particular, heterogeneity may be ignored when: 1. The species of interest has a short larval duration.
Since and both depend linearly on T LD , species with short larval durations will generally experience lower nearshore mortality and diffusivity exposure. Because larval supply and offshore duration vary with the offshore mortality rate and HMZ width only when (and secondarily, ) is sufficiently large, larval supply and alongshore movement will not be substantially affected by mortality rate heterogeneity in species with short larval durations. 2. The species of interest has a long larval duration, but experiences weak nearshore predation or diffusion (perhaps due to a wide CBL), or can settle into a large region in the environment of interest. If T LD is large, but the nearshore mortality rate m is small, then larvae will face little nearshore mortality exposure. Similarly, larvae will face weaker diffusivity exposure (compared to habitat width) if true diffusivity is weak, or if the habitat is large. These conditions result in small and , even when T LD is large, with the same outcome as mentioned in the short T LD case. Note that increasing the width, X b , of the CBL decreases the value of K(X) over each point X ∈ [0, X h ] for X b > X h , so a wide CBL has a similar effect to low diffusivity. 3. The species of interest experiences high predation nearshore, and its predators occupy a region extending offshore of the species' habitat. Such species experience high nearshore mortality exposure, . If the mortality rate is similar offshore over distances larvae are most likely to travel given their larval duration, the diffusion rate, and the size of the CBL, then most larvae may never experience reduced mortality rates offshore, and those that do are unlikely to settle.
Although mortality rates are notoriously difficult to quantify in the field, some of these criteria depend on well-known aspects of the species of interest (e.g., larval duration), measurable features of the nearshore environment (e.g., diffusivity and CBL structure), and the habitats of the species of interest and its nearshore predators. Thus, researchers need not directly measure the offshore mortality rate to determine whether that rate will influence model results. Additionally, while measurements of the offshore mortality rate may sometimes be necessary, models using a uniform mortality rate can still provide reasonable estimates of larval supply if measurements are appropriately averaged over locations and time.
In the scenarios in which weak offshore mortality may influence estimates of larval supply and alongshore movement, researchers must decide on a case-by-case basis whether these quantitative differences are important, and whether they may lead to qualitative differences as well. Two examples in which qualitative differences might result from weak offshore mortality arise in coastal population dynamics: 1. Complex life cycles: species with dispersive larvae have "complex" life cycles, in the sense that they have two or more life stages (larvae and post-larvae) that occupy different habitats (the plankton and the benthos). Roughgarden et al. (1988) observed that while some coastal post-larval populations are relatively stable from year to year, others exhibit large fluctuations. Using a two-life-stage model of coastal population dynamics, the authors showed that larval supply can be subject to annual variability. This results in fluctuations in the postlarval population unless the larval supply is consistently large enough to saturate the post-larval population's carrying capacity. Incorrect estimates of larval supply due to mischaracterization of the larval mortality rate, including its spatial structure, could result in the incorrect classification of a population as limited by larval supply rather than by post-larval carrying capacity. 2. Metapopulation connectivity: the extent to which alongshore movement allows nearby populations to exchange individuals and act as sources or sinks has long been a focus of the larval ecology and modeling literature (Cowen et al. 2006;Cowen and Sponaugle 2008;Largier 2003;O'Connor et al. 2007;Siegel et al. 2008;Swearer et al. 2002;Taylor and Hellberg 2003). In particular, many studies have sought to estimate the dispersal kernels (probability density functions of where larvae spawned from a given location ultimately settle) of species in particular environments (Siegel et al. 2003;Shanks 2009;Shaw et al. 2019). We have shown that when the mortality rate is weaker offshore than nearshore, successful larvae tend to spend proportionally more time offshore of the habitat prior to settling than would be estimated with a spatially uniform mortality rate. Given the relationship between offshore distance and alongshore currents (Largier 2003), this might result in dispersal kernels with heavier tails (i.e., greater variance) than would otherwise be predicted.

Omitted biophysical features and future directions
Several important aspects of marine larval biology and coastal oceanography were omitted from this analysis in order to highlight the effects of cross-shore heterogeneity in the larval mortality rate. For instance, our model considers larvae to be totally passive floaters moved only by random, time-homogeneous diffusion, with net advection due to currents and locomotion ignored. While variability in larvae's positions due to phenomena on length-and timescales shorter than those of dispersal (e.g., day-night cycles) are averaged into the eddy diffusivity, we have not accounted for phenomena that add variance on scales greater than or equal to those of dispersal (e.g., monthly cycles and longer) or that do not average to zero (Largier 2003;Okubo and Levin 2001), resulting in nonzero advection or time-varying diffusion.
From the results presented here, we hypothesize that netoffshore advection would result in a lower probability of settling due to fewer larvae returning to shore, more settled larvae arriving after a long offshore duration, and thus greater sensitivity of the larval supply and alongshore movement to the offshore mortality rate. By contrast, net-onshore advection would result in fewer larvae moving offshore. When the mortality rate is higher nearshore than offshore, these larvae would experience high mortality rates, while the exceptionally rare ones diffused offshore would comprise the majority of settlers, just as we observed here in the absence of advection.
Larvae of many species use locomotion to influence their net advection and diffusion, often in different ways during different stages of dispersal (Shanks 1995;Young 1995). Organisms with less sophisticated sensory abilities may move randomly to increase their diffusivity, which in turn may increase the probability of moving long distances at times when it is convenient to do so, effectively producing a time-dependent eddy diffusivity (Young 1995). Precompetent larvae in species with stronger buoyancy control may reside near-surface at night to exploit an offshore current driven by the land breeze, then descend toward the bottom during the day to escape the opposite sea breeze current, resulting in net-offshore advection. These organisms use an opposite pattern during competence to ensure movement back to the coastal habitat (Shanks 1995). That some larvae actively move offshore early in development is often attributed to the intense predation risk larvae face near the coast, which was the focus of this paper. We anticipate that by neglecting cross-shore movement due to locomotion, we have underestimated the probability of settling and its sensitivity to the offshore mortality rate.
Finally, we have focused only on larval supply and one proxy measurement for alongshore dispersal, while ignoring other other benefits of dispersal and complex life cycles (including those mentioned in the Introduction). A provocative question in the larval ecology literature is if dispersal is so dangerous, why do some organisms have such long larval durations? Our analysis identified one instance in which a long larval duration might result in a greater larval supply: when the mortality rate is high over the entire habitat and weaker offshore, a longer larval duration may allow larvae to exit the habitat during pre-competence and return before wastage. In other cases, species with long larval durations must experience other benefits that outweigh the reduction in larval supply predicted by most models. Longer larval durations may allow an individual's offspring to spread over a wider range, hedging bets against stochastic events that might wipe out all larvae present in a particular time and location. Another possibility, which has been observed in some species, is that larval durations are coordinated with seasonal changes in the coastal ecosystem: spawning and the larval duration can be timed so that larvae settle in specific locations or at specific times (Donahue et al. 2015;Morgan 1995). Incorporating these parent-controlled benefits of larval duration and release timing into models of dispersal is essential for understanding the ecology and evolution of organisms with planktonic larvae. Investigating how these mechanisms interact with offshore heterogeneities presents an interesting direction for future research.

Boundary conditions of the reaction-diffusion model
All three formulations of the reaction-diffusion model (the dimensional model (1), the non-dimensionalization (5), and the Fokker-Planck equation (18)) require boundary conditions. We always assume that zero larvae travel infinitely far away from shore (or that the probability of doing so is zero), In the absence of a coastal boundary layer, the diffusion rate is nonzero over all locations in [0, ∞) . This allows larvae to hit the shore, X = 0 ( x = 0 in the non-dimensionalization), and we assert that these larvae are reflected back into the interior of the domain, (0, ∞) . This results in no-flux boundary conditions, In the presence of a CBL, diffusivity vanishes at the shore X = 0 ( x = 0 ), and larvae are unable to reach the boundary. In this case, the choice of either a reflecting or absorbing boundary is immaterial; however, we assert that the boundary is absorbing because a no-flux boundary condition would result in division by 0 in our numerical algorithm:

Derivation of S, M, W
The probability density of the event t = x (and killing has not yet occurred) is p(t, x). Integrating p(1, x) over all locations x at which the larva could be at time t = 1 gives the probability of the event that the larva is located anywhere in the state space, and thus has not settled or died-that is, the probability of wastage, W, provided by (14).
Let i denote the rate of killing of type i, where i = s (settling) or m (mortality). The probability density of the larva having location x at time t is p(t, x). From (12), the probability density of killing of either kind occurring at time t given location x is  Finally, the probability that the type of killing that occurs is type i is i ∕( s + m ) . Combining these results, we get the probability densities of settling and killing occurring at location x and time t: respectively, they are Integrating m over the locations [0, ∞) and the times [0, 1] at which death may occur gives the expression for M in (15). Integrating s over the locations [0, 1] and times [t pc , 1] at which settling can occur (or simply over all locations [0, ∞) and all times [0, 1], since s ≡ 0 outside of this set) gives the expression for S in (13).

Data Availability
Julia code for the model and analysis is available through GitHub at https:// github. com/ alexd meyer/ larva-spati al-heter ogene ity.

Declarations
Consent for publication All authors consent to the publication of this manuscript.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/.