Residual streaming flows in buoyancy-driven cross-shore exchange

Abstract We present an analytical study of two-dimensional flow in a wedge driven by a time-dependent surface heat flux as a model problem to understand buoyancy-induced cross-shore flow. Besides the turbulent Prandtl number and the relevant Rayleigh number, both assumed to be of order unity, the solution is seen to depend on the geometry through a parameter $\beta$, representing the bottom slope. An analytic solution is sought in the asymptotic limit $\beta \ll 1$ for a water layer bounded by an adiabatic bottom surface subject to a harmonic heat flux on the upper surface. The analysis reveals that the motion at leading order can be expressed as the sum of a harmonic component and a steady component, the latter driven by nonlinear advection. This steady-streaming motion includes a near-shore vortex with associated recirculating motion that can affect cross-shore transport and dispersion in coastal environments. The analytical solution is compared with numerical solutions of the complete conservation equations for small values of $\beta$. Excellent quantitative agreement is found for values of the Rayleigh number below a critical value at which the periodic solution undergoes a period-doubling bifurcation, leading to the establishment of thermal-instability cells that dominate the offshore flow dynamics, while the near-shore dynamics remains well described by the analytical solution. The analysis illustrates that a periodic heat input that leads to a vertically inhomogeneous temperature distribution can result in residual motion, net heat fluxes and persistent temperature structure in the cross-shore direction.


Introduction
The cross-shore exchange of heat, mass and momentum is a key problem in coastal oceanography and limnology. In general, cross-shore transport in the inner shelf region can be forced by an array of mechanisms including tides, surface waves and internal waves and wind stress, over a wide range of time scales (cf. Lentz & Fewings 2012).
Buoyancy-driven flows can also provide an important mechanism for cross-shore exchange over non-uniform bathymetry. Considering an idealized wedge domain, relevant to many near-shore lake and coastal ocean settings, surface buoyancy fluxes across variable depth can set up cross-shore thermal variations with associated baroclinic pressure gradients. The resulting baroclinic exchange can affect flushing times for near-shore waters and deep water renewal (Ivanov et al. 2004;Molina et al. 2014), with implications for coastal ecology and near-shore water quality (Hatcher 1997;Monismith et al. 2006).
On seasonal time scales, winter cooling can drive cascading flows that rapidly flush shelf regions and produce significant mixing (Cooper & Vaux 1949;Hill et al. 1998;Wang & Symonds 1999;Fer, Lemmin & Thorpe 2002;Wang 2005). On shorter time scales, diurnal cycles in surface heat fluxes can create a 'thermal siphon', as described by Monismith, Imberger & Morison (1990), where shallower near-shore waters heat and cool more rapidly than deeper regions, driving diurnally reversing flows. Thermally driven diurnal exchanges have been observed in lakes (Monismith et al. 1990) and tropical reefs (Neiman et al. 2004;Monismith et al. 2006;Molina et al. 2014;Herdman, Hench & Monismith 2015), suggesting that they may be a persistent mechanism for cross-shore exchange in these environments. For tropical reefs, this mechanism for daily cross-shore heat flux may be important in moderating thermal stress that can lead to coral bleaching (Hoegh-Guldberg 1999;Monismith 2007;Safaie et al. 2018).
Cross-shore exchange is an essential physical process controlling larval connectivity on reefs and driving the shoreward transport of plankton that make up a large portion of the nutrient supply required to support reef metabolism (Hatcher 1997;Genin et al. 2009;Monismith et al. 2010). Diurnal thermally driven cross-shore exchange may interact with similar time scale biological mechanisms, such as the diel vertical swimming patterns of some larvae, to produce observed cross-shore distributions of larvae and patterns of connectivity among populations (Garland, Zimmer & Lentz 2002;Tapia et al. 2010). Cross-shore residual flow patterns may also influence the variability of pH and dissolved oxygen concentrations experienced by near-shore organisms, which may differ significantly from the offshore environment due to spatial gradients in rates of primary production and respiration (Hofmann et al. 2011).
Coastal ocean observations of thermally driven exchange suggest that the nature of the flow response to cyclical buoyancy forcing varies significantly in character depending on the dynamical balances that apply to a given site. For example, Molina et al. (2014) described observations on a fore reef slope on Oahu, Hawai'i where strong along-shore flows provided high effective vertical mixing. For this case, high turbulent transport distributes surface buoyancy fluxes vertically and an unsteady thermal response is observed, where the temperature is in quadrature with the surface buoyancy forcing. The resulting cross-shore baroclinic pressure gradient is in phase with the thermal response and drives a momentum response that is similarly in phase (i.e. in quadrature with the surface buoyancy forcing), reflecting a diffusive balance. In contrast, Monismith et al. (2006) described thermally driven cross-shore flow, observed at 8-16 m depth on a steep reef slope in the Gulf of Aqaba, where advective acceleration was dominant, leading to thermal and momentum responses that are in phase with the surface forcing.
A theoretical framework for buoyancy driven flow on a slope has been established for the steady-state flow response (Sturman, Oldham & Ivey 1999), the transient response to steady thermal forcing (Lei & Patterson 2002, 2005 and the periodic response to harmonic forcing (Farrow & Patterson 1993;Farrow 2004). Of particular relevance for our work is the seminal investigation of Farrow & Patterson (1993), who considered the motion induced in a fluid wedge by diurnal heating and cooling, with the thermal forcing introduced as a vertically uniform heating/cooling term in the energy equation. A solution was sought for small values of the bottom slope. In this limit, advection terms were found to be negligible at leading order, thereby enabling a closed-form solution in which the temperature is independent of the depth and the velocity is given by a linear balance between the local acceleration, the viscous force, and the buoyancy-induced horizontal pressure gradient. Higher-order terms were described in a follow-up study by Farrow (2004), who compared the results of the asymptotic analysis for the infinite wedge with those of numerical integrations in a triangular fluid domain limited by a vertical no-slip boundary. As expected, good agreement was found away from the vertical boundary for moderately large values of the relevant Grashof number, when the solution remains weakly nonlinear, with larger differences emerging when nonlinear effects become prevalent at large Grashof numbers. A triangular fluid domain was also considered by Mao, Lei & Patterson (2009) in a scaling analysis of natural convection induced by absorption of radiation. Also of interest is the investigation of Farrow (2016), who extended the early work by including interactions of thermal forcing with the simultaneous presence of flow forcing associated with a sea-breeze/gully wind system.
The heating/cooling model used by Farrow & Patterson (1993) neglects the attenuation of solar radiation, instead imposing a depth uniform heat flux that, in turn, results in a vertically uniform temperature structure. A more elaborate model was employed by Lei & Patterson (2006) in a numerical solution of the near-shore flow response to periodic thermal forcing in a trapezoidal flow domain, including a wedge-like section of linearly increasing depth followed by a constant-depth section ending at a vertical adiabatic wall. The model uses Beer's law for describing the decrease of the diurnal radiation intensity with depth along with a prescribed heat flux at the water surface for modelling the nocturnal heat loss. The same trapezoidal flow domain was employed in a subsequent numerical investigation (Bednarz, Lei & Patterson 2009), with the periodic heating/cooling introduced by harmonically varying the surface temperature. Both numerical studies (Lei & Patterson 2006;Bednarz et al. 2009) revealed a time lag of the flow response to the switch between day-time heating and night-time surface cooling as well as the existence of offshore thermal instabilities, more prominent in shallow reservoirs.
One important outcome of the previous theoretical works on thermally driven exchange is an understanding that the resulting dynamic regimes can vary with distance from shore and variable depth. For example, Farrow & Patterson (1993) examined the linearized case and found a phase shift between the shallow diffusive region and an unsteady response in deeper offshore waters. The cross-shore phase shift introduced transient convergence/divergence regions with associated down/upwelling regions. Additionally, thermally driven cross-shore exchange can be modulated by other persistent forcing mechanisms such as diurnal winds (Farrow 2013(Farrow , 2016 or tidal variations in along-shore flows (Molina et al. 2014;Ulloa et al. 2018). Monismith et al. (2006) examined the dynamics of the flow in the absence of rotation, using scaling of the momentum and thermal energy balance equations to examine different possible regimes of flow behaviour.
Harmonic forcing can give rise to residual components where a steady flow appears due to nonlinear contributions. Residual flows in the coastal zone are most commonly associated with wind-driven flow (Lentz & Fewings 2012) or with transport due to surface waves via Stokes drift (Xu & Bowen 1994;Lentz et al. 2008) and in the bottom boundary layer (Longuet-Higgins 1953;Davies & Villaret 1999). Exchanges at longer time scales can also be driven by low frequency seasonal buoyancy fluxes. The potential for residual flow components associated with thermally driven exchange flows has not been examined previously.
For the flows driven by harmonic thermal forcing analysed by Farrow & Patterson (1993) and Farrow (2004), at leading order in the limit of small slopes, the velocity and temperature exhibit a harmonic temporal variation with zero time average. The first-order correction to the temperature, computed by Farrow (2004), displays a steady component driven by the nonlinear heat advection associated with the leading-order solution. Steady-streaming motion (Riley 2001), partly driven by the steady buoyancy force associated with the temperature correction and partly driven by nonlinear advective terms, can be expected to appear in the first-order correction to the velocity field. The steady velocities for this residual motion, which were not examined by Farrow (2004), scale with the square of the slope, and therefore would provide a negligibly small contribution to the cross-shore transport rate. Clearly, other types of harmonic thermal forcing might give rise to a more pronounced residual motion, as could be tested by time-averaging results of numerical computations (e.g. Lei & Patterson 2006;Bednarz et al. 2009), but such an analysis has not been attempted.
Here, we explore a theoretical formulation for buoyancy-driven flow in a fluid wedge to show how cyclical thermal forcing may drive not only a harmonic flow response but also a steady residual motion, with both components appearing in the leading-order solution for small bottom slopes. Thermal forcing is introduced through a harmonically varying surface flux, an appropriate representation of heating/cooling in turbid waters, where the radiation penetration distance is much smaller than the local depth. Our analytical approach builds upon previous work by considering vertically varying heat input over sloping bathymetry -a situation common in natural near-shore environments. The solutions presented here, although limited in parameter space, show that a periodic thermal forcing can drive a net advective heat flux and persistent environmental gradients, an important result in connection with natural flows. The occurrence of a steady residual flow is reasoned to be a more general feature for any harmonic wedge flow with a vertically non-uniform thermal response.

Formulation
The two-dimensional problem considered here is schematically represented in figure 1. Cartesian coordinates are used in the description, with x measuring the horizontal distance to the shore and z pointing in the vertical direction opposite to the gravitational accelerationḡ = −gē z , withē z denoting the vertical unity vector. The water layer extends for x > 0 between the surface z = 0 and the bottom z = z s (x) < 0. The wedge-like near-shore region described here is assumed to be very slender, in that with the average slope β used as an asymptotically small parameter in the following description. To model diurnal heating by solar radiation and corresponding nocturnal cooling, a periodic heat flux q = −q o cos(ωt) is applied at the water surface, heat being transferred across the water layer by turbulent transport associated with a superposed along-shore motion, with corresponding turbulent thermal diffusivity κ t and associated eddy viscosity ν t , both assumed to be constant in the following analysis. As follows from a balance between local accumulation and heat conduction, away from the shore this heat flux results in the appearance of a near-surface Stokes thermal layer of characteristic thickness δ = (κ t /ω) 1/2 where we find temperature variations T − T o from the bulk temperature T o of order ΔT c = [q o /(ρ o c)]/(κ t ω) 1/2 , with ρ o and c representing the bulk water density and the water specific heat, respectively. The associated variations of the density due to heating are given by ( , with α 1/T o denoting the thermal-expansion coefficient, resulting in changes of the pressure from the unperturbed hydrostatic distribution p = p − ( p a − ρ o gz) of order p ∼ gαq/(cω) where p a is the ambient reference pressure. In the near-shore region, where −z s ∼ δ, the interactions of the heated layer with the bottom surface produce a horizontal pressure gradient. Considering an unsteady thermal balance with a corresponding balance between local acceleration and the pressure gradient yields a scale for the resulting cross-shore velocity u of order u c = βgα[q/(ρ o c)]/(κ t ω 3 ) 1/2 . Since the fluid domain is slender, the accompanying vertical velocity component w is much smaller, of order βu c u c , as follows from continuity.
The description of the periodic heating and associated induced motion in the near-shore region requires integration of the continuity, momentum and energy equations written in the Boussinesq approximation. The scales identified above are used to define dimensionless variables In what follows, the asterisks will be removed to simplify the notation. The problem reduces to that of integrating where Pr = ν t /κ is the turbulent Prandtl number and is the relevant Rayleigh number. The necessary boundary conditions include corresponding to stress-free flow with prescribed heat flux at the free water surface, which is modelled with the rigid-lid approximation, and corresponding to an adiabatic bottom with no-slip flow. As x → ∞ the fluid is at rest with a boundary temperature distribution which can be obtained from integration of the associated one-dimensional heat problem arising far from the shore. Besides the specific topography, defined by the negative function z s (x) with |z s | ∼ 1 for x ∼ 1 and z s → −βx as x → ∞, and the turbulent Prandtl number Pr = ν t /κ t , the solution depends on two parameters, namely, the Rayleigh number defined in (2.7) and the square of the average bottom slope β 2 . The oscillatory nature of the heat flux applied at the surface implies the existence of unstable thermal stratification over some portion of the cycle. Rayleigh-Bénard instabilities can be expected to develop in flow configurations for which the period of the heat-flux cycle is sufficiently large compared with the characteristic time for instability growth. The tendency toward instability development is measured by the Rayleigh number, the relevant bifurcation parameter governing convective instabilities. Periodic solutions to (2.3)-(2.10) can be expected to become unstable when the Rayleigh number increases above a critical value, leading to modifications in the flow that enhance heat transport rates (see, e.g. Yang et al. (2020) for a recent analysis of effects of time periodic modulation on Rayleigh-Bénard convection). This aspect of the problem is to be discussed further below in connection with the results of the direct numerical simulations.
An asymptotic solution is obtained below for small values of β in the distinguished limit Pr ∼ 1 and Ra ∼ 1. At leading order in the limit β 1 the problem becomes linear, as is clear from inspection of (2.3)-(2.9). An interesting feature of the associated periodic solution is that, besides harmonic temperature and velocity fields resulting from the harmonic forcing through the surface heat flux, the leading-order solution exhibits a steady component, including a residual temperature increase and associated steady-streaming velocity. The existence of this non-zero steady solution, additional to the expected harmonic response, can be anticipated by taking the time average of (2.6) to yield Integrating in z across the fluid layer with account taken of the boundary conditions given in (2.8) and (2.9) provides when use is made of the solution as x → ∞. The above exact result, independent of β, indicates that, since the product of two harmonic functions in general does not average to zero, the average temperature gradient must also be non-zero, which in turn induces an average motion with u / = 0 and w / = 0, as seen below.

Analytical solution for small slopes
3.1. Leading-order problems An asymptotic solution to (2.3)-(2.10) in the limit β 1 can be constructed by introducing expansions for the different variables in even powers of β (e.g. T = T 0 + β 2 T 1 + β 4 T 2 + · · · ). The leading-order terms, denoted by a zero subscript, satisfy linear problems, obtained by collecting the dominant terms in (2.3)-(2.9). The solution simplifies by expressing the velocity in terms of the streamfunction ψ 0 , defined such that Furthermore, guided by the previous discussion, we anticipate that each dependent variable can be expressed at leading order as the sum of a harmonic component and a steady component, the latter linearly proportional to Ra, as can be expected from (2.14). Thus, we choose to write the streamfunction and the temperature in the form where the terms Ψ h = Re(e it Ψ ) and T h = Re(e it Θ), carrying the temporal variation of the solution, are written in terms of the complex functions Ψ (x, z) and Θ(x, z), which satisfy (3.5a,b) The second terms on the right-hand sides of (3.2a,b) correspond to the time averages ψ 0 = Ra F and T 0 = Ra T , where the functions F and T , satisfy with boundary conditions Harmonic response The harmonic component can be expressed in closed form. The development begins by integrating (3.4) with the boundary conditions given in (3.5a,b) to give which has been expressed in terms of the auxiliary variables Introducing this result into (3.3) and integrating yields involving the particular solution Ψ p (Z) and the four functions A 4 (Z s ), to be obtained by application of the four homogeneous boundary conditions given for Ψ in (3.5a,b). The solution takes different forms depending on the value of Pr. Thus, we find with corresponding integration constants given by (3.14) ( 3.16) if Pr / = 1 and by if Pr = 1.

Steady components
In addition to the harmonic velocity and temperature fields described above, the solution at leading order has steady components, including a time-averaged temperature distribution T 0 (x) = RaT that is independent of the depth, as can be seen by integrating (3.7) subject to ∂T /∂z = 0 at z = 0 and z = z s . The function T (x) can be obtained by extending the analysis given here to a higher order or, alternatively, from the solvability condition stemming from (2.14). Integrating (3.21) with the boundary condition T (∞) = 0, consistent with the far-field distribution (2.10), provides wherex is a dummy integration variable. The accompanying streamfunction for the steady motion, is obtained in terms of the cross-shore temperature gradient (3.21) by straightforward integration of (3.6) subject to the boundary conditions stated in (3.8a,b).

Discussion of the analytical results
The expressions developed above can be used to investigate the resulting flow. Results are given below for the case of a plane bottom surface (i.e. z s = −x). Besides analysing the temperature and velocity fields, different aspects of cross-shore exchange will be quantified. A convenient measure of the instantaneous net transport rate associated with the thermally driven flow at a given offshore location is given by the depth-integrated speed where the 1/2 factor allows this quantity to be interpreted as an exchange flux, consistent with field studies (e.g. Molina et al. 2014). In addition, transport of heat is conveniently measured with use of the cross-shore advective flux The above two quantities and their corresponding time-averaged values Γ ex (x) and G ex (x) can be evaluated for the leading-order solution with use of and T 0 = T h + Ra T . It is worth mentioning that, since T is independent of z, its contribution to the advective flux G ex vanishes, with the result that the corresponding time-averaged value reduces to independent of the Rayleigh number.

Harmonic temperature and velocity variations
Streamlines and temperature distributions for the harmonic solution with Pr = 1 are shown in figure 2 for varying phases of the surface heat-flux cycle. The heat flux is defined so that midnight coincides with the beginning of the cycle, with t = π correspondingly representing conditions at noon, when the heating rate is maximum. The solution includes a near-shore region x ∼ 1 where the temperature exhibits cross-shore variation, with the vertical temperature distribution eventually approaching the Stokes profile (2.10) for x 1. The associated motion is characterized by a series of counterrotating vortices in the x − z plane. As can be seen, a pair of vortices is created in the near-shore region during each heat-flux cycle, with the generation from midnight to noon of a counterclockwise rotating vortex followed by the generation of a clockwise rotating vortex from noon to midnight. These vortices weaken as they propagate offshore.
The resulting phase relationships are more clearly evident in the surface velocity and temperature contours shown in figure 3. For x 1, both temperature and velocity are in quadrature with the surface heat flux so that the cooling response, with onshore flow at the surface, extends from midnight to noon. For x 1, the lag in the surface thermal response is diminished, reflecting a balance between unsteady cooling/heating and downward thermal diffusion. Temperature variations approach a constant amplitude offshore, consistent with the boundary condition in (2.10), while the vortical structures weaken exponentially although their propagating response persists as x → ∞.
To understand the propagating cell response, we examine the harmonic temperature component, T h = Re(e it Θ) using (3.9). For a plane bottom surface (z s = −x), far from shore (x 1), this reduces to when exponentially small terms are neglected. The first term on the right-hand side is the solution to the one-dimensional heat problem, given in (2.10). The second term is a perturbation to this solution that accounts for the presence of the lower boundary. This latter component is characterized by propagating temperature bands that follow lines with 2x + z = const. These perturbations to the one-dimensional solution are amplified near the bottom boundary and propagate upward via vertical diffusion. The horizontal gradient that results from the sloping bands thus propagates offshore, driving the translating momentum response apparent in the cells in figures 2 and 3(b). The persistent cell structure in the harmonic velocity solution is in contrast with that observed when the surface heat flux is assumed to be distributed uniformly throughout the depth, as in the analyses of Farrow & Patterson (1993) and Farrow (2013). For that case, no propagation is observed for x → ∞. There, the homogeneous vertical distribution of the cyclic surface heat flux ensures that a harmonic cross-shore pressure gradient persists, driving a flow that is in quadrature with the forcing, reflecting an unsteady dynamic balance. The plots in figure 4(a) indicate that heat tends to accumulate near shore, with the mean temperature reaching its maximum value at x = 0. The magnitude of the normalized temperature T , larger for smaller values of Pr, remains relatively small. The temperature variation with x is non-monotonic. The initial decay, eventually leading to negative values of T , is followed by a gentle increase. As can be inferred from (3.23), this non-monotonic variation of T leads to the formation of a sequence of cells with alternating circulatory flow of decreasing magnitude, with the boundaries of each cell defined by the locations where dT /dx vanishes. The steady vortex emerging near shore corresponds to clockwise rotation (i.e. negative values of the normalized streamfunction F). The next vortex, with counterclockwise rotation, has a similar magnitude for F, (F peak = −1.1 × 10 −2 for the first vortex and F peak = 9.5 × 10 −3 for the second vortex) although with notably weaker velocities due to the greater depth. The third vortex, whose streamlines do not appear in the figure, is much weaker, and plays a negligible role in the resulting near-shore dynamics.

Cross-shore exchange for the harmonic solution
The contribution of the harmonic motion to the net cross-shore exchange rate Γ ex can be investigated by evaluating (4.1) using u = ∂Ψ h /∂z. Corresponding time-averaged values Γ ex are represented in figure 5 for the three Prandtl numbers considered earlier in figure 4. Near shore, the exchange increases with increasing total depth, peaking at a distance x ∼ 1. For x 1, Γ ex decreases as the bottom depth exceeds the extent of the surface thermal layer (z s > 1) and the associated cross-shore baroclinic gradient diminishes.
Effects of variations in the Prandtl number on Γ ex are most easily interpreted in terms of changes in viscosity, since length scales for the problem are defined in terms of a thermal diffusion length. A reduction in Pr leads to an increase in stream function magnitudes as viscous effects are diminished, as evident in the first two terms in (3.11), with a corresponding increase in velocity magnitude and in Γ ex . Length scales for the harmonic flow response are primarily determined by the structure of the harmonic thermal response, which is independent of Pr. Cross-shore scales for the velocity field decrease slightly for smaller values of Pr, however, moving the peak in Γ ex shoreward.
We can similarly use the asymptotic results to examine the cross-shore advective flux of heat G ex . Its time-averaged value G ex , independent of the Rayleigh number, can be evaluated for different values of Pr using (4.4), with results given in figure 6. The observed trends, including the effects of variations in the Prandtl number, are consistent with those discussed earlier in connection with figure 5. The time-averaged advective heat flux associated with the harmonic solution is negative close to shore, switching to positive farther offshore (i.e. at x 5 for Pr = 1). The resulting divergence leads to a heat deficit at x 5 and an accumulation of heat toward shore. The shoreward advective heat transport is offset by an offshore-directed horizontal diffusive transport as reflected in the balance expressed in (2.14). The magnitude of the resulting time-averaged cross-shore thermal gradient is thus determined by the relative strength of thermal diffusion, which accounts for the dependence on Ra. The pressure difference associated with this thermal gradient then results in a steady component of the streamfunction that is also proportional to Ra. The resulting steady flow, shown in figure 4(b) for Pr = 1, is characterized by counterrotating cells with boundaries at x locations at which the cross-shore thermal gradient vanishes. The cross-shore scales for these cells are modulated by Pr, shifting shoreward for decreasing Pr. The temporal variation in the harmonic flow contribution to G ex is shown in figure 7. Here, G ex is evaluated with u = ∂Ψ h /∂z and T = T h , for Pr = 1. The observed variations in depth-integrated advective heat flux arise as a result of the phase relationship between the velocity and temperature. Very near to shore (x 1), the temperature response is largely uniform with depth so that the harmonic velocity field cannot drive a depth-averaged flux. For x 1, the thermal response diminishes and eventually shifts in phase as function of depth, while the velocity exchange structure spans the full depth, as shown in figure 2. The resulting differences in vertical scales lead to a phase relationship that can drive a net flux over the full heat cycle while varying with cross-shore distance. In figure 2, the cell closest to shore at t = 0 has a negative rotation and spans depths that exceed the thermal layer thickness (z > 1). As the cell propagates offshore, it drives cool water offshore at the surface and warm water onshore at depth over the late cooling phase, through t 3π/4 extending offshore to x 4. The flow at the surface and at depth therefore both contribute to the negative (shoreward) heat flux evident in the early part of the cycle in figure 7. A new cell, with positive rotation, forms close to shore by t = 3π/4 (see figure 2) advecting warm water shoreward at the surface and cool water offshore at depth over the late heating phase through t ∼ 3π/2 and x ∼ 4, resulting in a shoreward  heat flux that appears as a second peak at t ∼ 5π/4, as shown in figure 7. Together, these features result in the peak in cycle-averaged shoreward flux evident in figure 6 at x 3. Similar velocity-temperature phasing leads to a weaker seaward flux that peaks at x 6 (for Pr = 1). As for the cross-shore exchange, the cross-shore advective heat flux associated with the harmonic flow is also function of Pr, increasing and shifting shorewards at low Pr as the harmonic velocity magnitude increases.

Rayleigh number dependence
It is of interest to use the results of the analysis to address effects of increasing Rayleigh numbers, whose influence is carried by the time-independent terms in the asymptotic expressions (3.2a,b). Since the magnitude of the functions F and T is fairly small for all Prandtl numbers of interest, as revealed by the results in figure 4, significant quantitative effects can be expected to emerge only for moderately large values of Ra. In this respect, it is worth mentioning that, although the analysis assumes values of Ra of order unity in establishing the asymptotic ordering, the resulting leading-order solution (3.2a,b) remains valid as long as Ra β −2 , so that effects of advective transport can be neglected in writing the reduced equations (3.3)-(3.8a,b). For slopes with β ∼ 0.1 (comparable to steeper coastal settings), the asymptotic ordering leading to (3.2a,b) can thus be expected to hold up to Ra ∼ 10 2 (additional limitations arising from the development of hydrodynamic instabilities are to be addressed separately in the next section).
As previously mentioned, the analysis indicates that the time-averaged advective flux of heat G ex is independent of the Rayleigh number, so that the predictions given in figure 6 should remain valid irrespective of the value of Ra, a result to be tested later by means of direct numerical simulations. By way of contrast, the residual motion yields a non-zero contribution to the time-averaged net cross-shore exchange rate Γ ex , larger for larger values of Ra. This is illustrated in figure 5, where the solid curves represent results corresponding to Ra = 5 and Ra = 20 for Pr = 1. These results are to be compared with the purely harmonic case, depicted with a dotted curve. As expected, all three curves coincide at points where the time-averaged reduced velocity ∂F /∂z vanishes, corresponding to the boundaries separating the different circulation cells in figure 4(b). It is of interest that, since the definition of Γ ex involves the instantaneous absolute value of the velocity, the departure of the time-averaged cross-shore exchange rate Γ ex from its purely harmonic value is not linearly proportional to Ra, as might have been expected from (4.3).
The asymptotic expressions (3.2a,b) are used to generate the cross-sectional plots of temperature and streamlines shown in figure 8 for Pr = 1 and Ra = 5, to be compared with those shown in figure 4 for the harmonic solution with the same value of Pr = 1. As in the harmonic case, the plots reveal the alternating shedding of travelling counterrotating vortices from the near-shore region. The propagating cells interact with the stationary residual vortices (depicted in figure 4b) introducing asymmetry in the near-shore flow response (x < 5) with strengthening of the negative vortex for 0 < t < 3π/4 and a corresponding weakening of the positive vortex for π < t < 7π/4. For x > 5, the pattern is reversed, evidenced in the breakdown of the negative cell, apparent offshore beginning around t = 5π/4. The effects of increasing Ra on the velocity field and the advective heat flux are illustrated in figure 9 which can be compared with the associated plots for the harmonic solution in figures 3(b) and 7. The development of the diurnal asymmetry is apparent in the surface-velocity plot, which exhibits strengthened offshore velocity close to shore, associated with the warming phase response, and a corresponding increase in onshore flow farther from shore. As Ra increases, propagating cells offshore are replaced by quasi-steady cross-shore cells, reflecting the steady flow pattern in figure 4(b). Notably, a persistent surface divergence is established near x 5.
For the heat flux, G ex , although the time-averaged advective flux is unaffected by changes in Ra (figure 6), the product of the steady flow with the harmonic temperature introduces a temporal variation in G ex that modulates the diurnal patterns, as evident in figure 9. The superposition of the negative near-shore cell associated with the steady solution, with nightly cooling leads to an increase in onshore heat flux for 0 < t < π, which is offset by an offshore flux during the heating response. The amplitude of the time-variable advective fluxes increase concurrently with increasing Ra, with the resulting patterns eventually reflecting the influence of the steady flow cells.

Computational model
To test the accuracy of the asymptotic results, full numerical solutions of the conservation equations (2.3)-(2.6) were computed for finite values of the slope β. The numerical method employs a second-order Lagrange-Galerkin temporal discretization scheme in combination with P2/P1 Taylor-Hood finite elements for velocities and pressure, which are solved in a coupled fashion (for detailed information about the numerical method see, for example, Carpio, Prieto & Vera 2016). The method was implemented in the open source solver FreeFEM (Hecht 2012), using an interface with the multifrontal massively parallel sparse direct solver (MUMPS) to solve the discretized systems.
The computational domain, shown in figure 10, has a finite extent x max in the offshore direction. A clipped corner of size x min is introduced near the origin to avoid singularities. The values x min = 0.1 and x max = 24 were found to be sufficiently small/large to give well-converged results. The computational mesh was constructed so that the elements decrease in size towards the top surface and towards the near-shore corner, as shown in figure 10. Convergence tests were carried out to ensure the results are converged with respect to mesh refinement and temporal resolution. In particular, the instantaneous temperature and velocity at a central point in the domain, (x = 10, z = −5), was monitored over the course of ten cycles. Maximal changes in this temperature and velocity evolution were tracked between subsequent mesh refinements, each refinement consisting of a doubling of the number of triangular elements in the mesh. Mesh convergence was established when subsequent refinements produced maximal changes in the aforementioned velocity and temperature evolutions of less than 1 %. In the final mesh, which was employed for the computations, the smallest element measures 0.027 and the largest element has size 0.61. With respect to the temporal discretization, an analogous convergence test, in which the time step was decreased in 25 % decrements, showed that a fixed time step of 2π/192 was sufficiently small to ensure stability and convergence (i.e. a 25 % smaller time step produced changes in the results smaller than 1 %). In the numerical model, the bottom domain boundary Σ b and the small vertical near-shore boundary Σ n are adiabatic, no-slip surfaces, as dictated by (2.9), whereas the top boundary Σ t is a slip boundary subject to the periodically fluctuating heat flux expressed in (2.8).
The numerical computations were started at time t = π/2 -such that the heat flux at the surface is zero -using as initial conditions the approximate solution (3.2a,b) for β 1 that contains both the harmonic response at t = π/2 and the steady residual motion.
x min x max Figure 10. The computational domain and mesh employed in the numerical simulations.
The computations were carried out until a 2π periodic solution was reached, the criterion for convergence being that the root-mean-squared difference between average velocity and temperature fields (integrated over the entire fluid domain) be smaller than 10 −2 over subsequent cycles. It was found that the duration of the transient stage leading to the establishment of a periodic solution is very sensitive to the initial conditions. For instance, initializing the computations with an incorrect energetic balance sets up persistent convective currents across the domain that take a prohibitively long time to decay.

Validation of the analytical results
Numerical results corresponding to Ra = 5 and Pr = 1 are shown in figures 4-6. Time averages of the converged periodic solution confirmed the existence of near-shore heat accumulation with an accompanying residual motion. Vertical variations of the time-averaged temperature T at any cross-shore location x were verified to be smaller than 10 −3 , in agreement with the theoretical findings. The cross-shore variation of the depth-averaged mean temperature − 0 z s T dz/z s obtained numerically for β = 0.1 and β = 0.2 is compared in figure 4 with the leading-order predictions of the asymptotic analysis for β 1. The resulting agreement is excellent, with observed discrepancies being consistent with the expected errors of order β 2 associated with the asymptotic development.
The velocity field obtained numerically was employed to compute the net transport rate Γ ex and the cross-shore advective heat flux G ex , defined in (4.1) and (4. of accord is excellent in both cases. Computations for both larger and smaller values of Ra were seen to give distributions of G ex (x) that are virtually indistinguishable from those shown in figure 6 for Ra = 5, as expected from the analytical findings. Clearly, the consistency displayed by the comparisons in figures 4-6 provide increased confidence in the validity of the analytical results.

Development of thermal instabilities
As mentioned earlier, the application of a harmonic heat flux at the surface necessarily leads to the appearance of unstable thermal stratification over some portion of the cycle. Instabilities may develop if the fluid remains in an unstable configuration for a sufficiently long time, i.e. if the frequency of the heating cycle ω decreases below a threshold value. Correspondingly, the periodic solution described above can be expected to undergo a bifurcation to a different solution when the Rayleigh number Ra exceeds a critical value Ra c . Since the unperturbed solution is periodic, the linear stability analysis needed to determine Ra c involves Floquet theory (Davis 1976). Results are available for the related case of a horizontal fluid layer bounded by parallel surfaces subject to zero-mean boundary temperature modulation (Gershuni & Zhukhovitskii 1963;Or & Kelly 1999). As expected from classical Rayleigh-Bénard analyses (Drazin & Reid 2004), the instability tendency is seen to augment for increasing layer depths. The stability of a semi-infinite fluid domain subject to a surface heat flux with zero mean, relevant for the conditions found offshore in our flow configuration, has been addressed recently (T. Christopher, personal communication). The associated linear stability analysis reveals that the flow undergoes a period-doubling bifurcation for Ra c = 12.44.
To further explore this aspect of the problem, additional numerical computations were performed with β = 0.1 and Pr = 1 by sequentially increasing the value of Ra in unity increments. No instability development was observed up to Ra = 13, for which the resulting velocity and temperature fields were verified to exhibit excellent agreement with the analytical predictions across the domain. As shown in the temporal evolution of surface velocity in figure 11(a), convergence to a periodic solution with vanishing offshore motion was no longer achieved for Ra = 14. Instead, thermal-instability cells appeared offshore after a few tens of cycles and were seen to spread rapidly, eventually occupying the entire water surface beyond x 6. It is of interest that the offshore convective cells are 4π-periodic, consistent with the expected double-period bifurcation, while the near-shore solution remains stable owing to the stabilizing effect of the bottom wall, its 2π-periodic dynamics being still described by the analytical solution given above. Similar transient dynamics can be observed at higher values of Ra, for which the instability grows faster. As seen in figure 11(b), compared with the near-critical solution for Ra = 14, the cells of the bifurcated solution for Ra = 20 become larger and develop at smaller distances from shore, so that the cross-shore extent of the region of 2π-periodic stable flow shrinks for increasing Ra. These findings are consistent with those of previous numerical simulations (Mao, Lei & Patterson 2010).
The cross-sectional structure of the double-period thermal instability away from the bifurcation (i.e. for Ra = 20) is depicted in the snapshots of figure 12, corresponding to 16 evenly spaced phases spanning two periods of the heating/cooling cycle. The size of the non-slender convective cells is seen to be much larger than the characteristic thickness of the Stokes thermal layer δ used in scaling the coordinates x and z. The induced circulatory motion penetrates to depths exceeding 10δ, creating a non-uniform temperature field, markedly different from that of the stable case Ra = 5, depicted in figure 8.

Discussion
The theoretical analysis presented here describes the cyclical buoyancy-driven cross-shore exchange that arises within an idealized coastal wedge-shaped domain due to a harmonically varying surface heat flux. An important consequence of applying the heat flux at the surface is that the resulting harmonic temperature distribution is a function of both cross-shore distance and depth, which, coupled with the harmonic velocity field, results in a net advective cross-shore heat flux associated with the leading-order solution.
The surface heat-flux boundary condition used in (2.8) is thus critical to the steady temperature distribution and to the associated steady flow component. If we consider, instead, a heat flux applied uniformly in depth, through the introduction of a source term in (2.6), for example, then, at leading order, we would obtain a depth uniform temperature. The continuity equation (2.3), requires that the depth integral of the cross-shore velocity be zero, so that the horizontal advective heat flux would similarly be zero for all values of x. Any boundary condition for heat input that leads to a vertically inhomogeneous temperature distribution can introduce a net horizontal advective heat flux, however. For realistic parameters characteristic of environmental flows, this situation might arise from depth-variable radiative input, or from limited vertical mixing. Phase shifts between the vertical structure of temperature fields and cross-shore momentum consequently can lead to net heat fluxes and time-averaged temperature structure in the cross-shore.
For the heating phase, the heat-flux boundary condition used here is consistent with turbid conditions, for which the short-wave radiation input is confined to a near-surface layer. For more general water conditions, an exponentially decaying heat input (i.e. Beer's law, cf. Lei & Patterson 2006) would be more representative. This would alter the details of the theoretical solution, although we can expect that the resulting vertical heat distribution would similarly result in a non-uniform cross-shore gradient, as suggested by (2.14). Steady streaming components can thus be expected for numerical solutions like that presented by Lei & Patterson (2006). For very clear waters, bottom heating can further complicate the vertical distribution of heat, leading to thermal inversions and daytime convective mixing (Mao et al. 2009;Wells, Fram & Pawlak 2012); see also Hattori, Patterson & Lei (2015) for an analysis of the interplay between direct radiative heat absorption in the main water body, which leads to stable thermal stratification, and local heating from the bottom surface, which results in a near-boundary layer with unstable thermal stratification. Radiative input introduces a new length scale associated with the optical path length (or optical depth). In systems where this length scale is comparable to or larger than the heat-conduction thickness δ, the cross-shore extent of the thermally driven flow would be larger than that described above. Future work should also consider a depth-uniform heat flux as a more appropriate representation of the cooling phase in systems where vertical convection distributes heat rapidly, thereby homogenizing the existing thermal stratification.
Here we have presented a solution for a class of flows in which periodic thermal forcing over non-uniform bathymetry drives a net advective heat flux, resulting in persistent environmental gradients. While the parameter regime considered theoretically here cannot generally represent realistic environmental parameters, the generation of persistent gradients arising from the mechanisms highlighted in the analytical solution can be expected to be generic for natural flows where temperature and scalar fields will have vertical structures that differ from that of the diurnally varying velocity field. Spatial gradients in the physical environment, such as water temperature, are important in determining the community structure of near-shore coastal ecosystems (Blanchette et al. 2008;Tapia et al. 2009). For example, in coral reef ecosystems, persistent spatial differences in mean temperature and daily temperature variability have been shown to be among the most important factors determining resilience to thermal stress and bleaching (McClanahan et al. 2005;Carilli, Donner & Hartmann 2012;Safaie et al. 2018).
The asymptotic analysis presented here assumes small values of the bottom slope β 1. Effects of advective transport are found to be negligible at leading order, provided that β 2 Ra 1, so that our analysis is strictly valid for flow configurations with associated Rayleigh numbers Ra β −2 . For environmental scales, estimates for Ra using typical values (cf. Monismith et al. 2006;Molina et al. 2014) for cooling heat fluxes (200-500 W m −2 ), along-shore flow velocities (∼0.1 m s −1 ), drag coefficients (C D ∼ 10 −2 ) and using a depth-averaged eddy viscosity (cf. Fischer et al. 1979), yield values of Ra of a few thousand at depths of 10 m. For these flows, therefore, the advective-free flow predicted here applies only in situations where the slope is of order β ∼ 0.01, whereas for larger values of β one should expect significant nonlinear effects. Given this, however, it is worth mentioning that observations and analysis by Molina et al. (2014) for a moderately shallow slope β ∼ 0.03-0.04 at depths of 10 m show that a linear diffusive regime persists in configurations with β 2 Ra = O(1), and that the emergence of significant nonlinear advective effects requires larger values of β 2 Ra, associated with steeper slopes (Monismith et al. 2006). The persistence of the linear regime in environmental settings with relatively large Ra illustrates the relevance of the analysis presented here.
The applicability of the theoretical analysis developed here to realistic flows is further limited by the use of constant eddy viscosities and diffusivities. For environmental scale flows, both can be expected to vary in space and time. Because purely cross-shore flows are generally weak, directly forced turbulence and the associated turbulent transport can also generally be expected to be weak. In most coastal settings, however, turbulence will be dominated by wind-and tide-driven processes that operate on different time scales so that eddy diffusivities will be notably larger and can thus modulate the resulting cross-shore flow (Molina et al. 2014;Ulloa et al. 2018).
The analytical solution outlined here does not address any potential instability arising from inverted thermal profiles that occur during the cooling phase, consistent with the assumption of Ra ∼ 1. Numerical results for Pr = 1 confirm that the periodic solutions are stable for Ra ≤ 13 but become unstable for Ra ≥ 14. The ensuing dynamics is consistent with the onset of a double-period bifurcation at a critical value of the Rayleigh 920 A1-23 number 13 < Ra c < 14, slightly larger than the critical value Ra c 12.44 predicted by Floquet linear stability analyses in a semi-infinite domain (T. Christopher, personal communication), with the observed difference being attributable to the stabilizing effect of the wedge bottom surface. For the supercritical values of Ra considered in the simulations, the near-shore flow structure remains largely unaffected by the instability offshore, although we can anticipate unstable flow closer to shore with increasing Ra, in agreement with previous findings by Mao et al. (2010). For the observed bifurcation mode, unstable flow can be expected to effectively homogenize the temperature field, thus reducing the net advective heat flux that drives the residual circulation. At the large values for Ra associated with environmental scales we can further anticipate that nightly surface cooling will drive convective instability over time scales that are much shorter than the diurnal cycle with vertical mixing reducing thermal stratification (Sevadjian, McManus & Pawlak 2010;Molina et al. 2014). Advective thermal fluxes will thus be weaker during this phase. However, a cooling phase response that persists into the stabilizing heating phase, as observed here and in field observations (Molina et al. 2014;Ulloa et al. 2018) will result in an associated onshore heat flux. The stabilizing heating phase will tend towards increasing vertical stratification with a vertical phasing that will vary relative to the velocity structure in a similar manner to that described by the theory. Cross-shore variations in phasing can then lead to divergences in heat flux with associated cross-shore thermal gradients.
The numerical simulations described in § 5 required initialization using a solution with the correct energetic balance in order to achieve convergence within a practical time frame. This is consistent with the magnitudes for the function T and the advective heat flux G ex (x) shown in figures 4(a) and 6 which indicate that the time scale for establishing the steady temperature distribution will be t ∼ Ra. The long time scale evolution of the perturbed temperature field associated with the unstable cases was not examined, although we can anticipate that the mean temperature field will be modified accordingly with an associated long transient for adjustment. Though the direct analogy with realistic, turbulent environmental scale flows is tenuous, the long adjustment time scale suggests that high variability observed in real, coastal situations (Molina et al. 2014;Ulloa et al. 2018) would result in a slowly varying residual.
The Eulerian residual flow that arises here at leading order has further consequences for cross-shore exchange and dispersion. In particular, at higher Ra, the closed streamlines in the cross-shore cells associated with the streaming motion dominate the structure (e.g. figure 9) potentially introducing barriers to cross-shore flow. Convergences in surface flow (e.g. figure 8f ) can also be conducive to frontogenesis with important implications for larval transport (Scotti & Pineda 2007). Lagrangian transport associated with the non-uniform harmonic flow was not examined here, but can also be expected to play a role in dispersion.