MS554: Numerical Methods for Marine Sciences One-dimensional advection / diffusion equation: Analytical Solutions Courtney Harris; ckharris@vims.edu OBJECTIVES: 1. 2. 3. 4. Review 1-dimensional advection / diffusion equation. Non-dimensional number: Peclet number. Analytical solutions. Boundary conditions. RESOURCES: Guymer, I., C.A.M.E. Wilson, and J.B. Boxall. 2005. Modelling solute transport processes in free surface flow CFD schemes. Chapter 3 in Computational Fluid Dynamics: Applications in Environmental Hydraulics; P.D. Bates, S.N. Lane, and R.I. Ferguson (editors). Chanson, H. 2004. Environmental Hydraulics of Open Channel Flows. Part 2: Turbulent mixing and dispersion in rivers and estuaries: an introduction. <Chapters 5&6>. Hornberger, G. and P. Wiberg. Finite difference methods for transport equations, Chapters 1, 9 in Numerical Methods in the Hydrological Sciences. <May help with lab>. Ji, Z.-G. 2008. Hydrodynamics and Water Quality: Modeling Rivers, Lakes and Estuaries. Sections 2.1 Hydrodynamic Processes; and 2.2 Governing Equations. Book on reserve shelf. <For further reading> NOTES: Scales of diffusion coefficients: From Knauss’s (1997; page 73) book Introduction to Physical Oceanography, vertical eddy coefficients in the ocean range from 10-4 to 10-3 m2/s; while horizontal eddy coefficients range from 10-1 to 103 m2/s. Vertical coefficients are smaller than horizontal ones because eddies in the ocean are smaller in the vertical than in the horizontal because of stratification and depth-limitation. Consider the conservative advection diffusion equation in one dimension: ¶c ¶c ¶2 c + u = Kx 2 ; ¶t ¶x ¶x (1) where c is tracer concentration, u is velocity, Kx is a diffusion coefficient, t is time, and x is distance. Here we have assumed that the diffusion coefficient is constant in space. The equation can be nondimensionalized as ¶c ¶c 1 ¶2c + = ; ¶tˆ ¶x̂ Pe ¶x̂ 2 (2) using non-dimensional variables tˆ = tu , x̂ = x , where L is the length scale of the transport L L process or system. The Peclet number compares the importance of advection and diffusion: Pe = uL (3) Kx Large values of the Peclet number indicate that advection dominates the problem, while small values indicate that transport is dominated by diffusion. Another way to think of the Peclet number is that it provides the ratios of the timescales over which advection and diffusion are important. The Peclet number can also be thought of in terms of time-scales, comparing the time that a tracer is in the system (L/u) to the time it takes to be mixed (L2/Kx). When Pe ≫ 1, diffusion is relatively unimportant, and the system can maintain large gradients in tracer concentration (¶ T ¶x 2 2 ) can be large . When Pe time gradients are diminished; ¶ T 1, however, the system is well-mixed by diffusion, so that over 2 ¶x 2 will decrease with time. Advection dominated system: Think about how a concentration profile should look for the case of an advection dominated one-dimensional system: ¶c ¶c + u = 0. ¶t ¶x (4) “The problem is to describe the downstream transport of the tracer when it is injected at location x = 0 such that the concentration in the stream at the injection point is held at 1 unit. That is, initially c is equal to zero everywhere, then c = 1 at x = 0 for all subsequent time. We can see intuitively what the solution to the problem is: the concentration "front" (c = 1 on the upstream side and c = 0 on the downstream side) propagates downstream at speed u” (copied from Hornberger and Wiberg’s book). At any given time, t, the concentration field could be described as c x, t 0 if x ut ; and c x, t 1 if x ut . In the example from today’s lab, I use the Heaviside function to quickly calculate an advected concentration profile; it is defined as: H (x) = 0 for x < 0; (5) H (x) = 1 for x > 0. Solving this problem requires boundary and initial conditions. Here, we initially assume concentration (almost) everywhere to be zero; our initial condition is c x,0 = 0 . For the special ( ) case of x = 0 , however, we assume a boundary condition that holds concentration equal to 1; c 0,t =1. For your lab work, you will change the initial and boundary conditions to create a ( ) concentration field that has a finite “slug” of tracer moving downstream. After we explore the analytical solutions, we will work on numerical solutions for these problems. For transport problems dominated by advection, numerical solutions can introduce numerical errors by creating artificial numerical diffusion that acts to “spread out” what should be a sharp gradient in concentration. Diffusion dominated system: Similarly, we can consider a situation where advection velocities are very low, so that diffusion dominates transport ¶c ¶2 c = Kx 2 . ¶t ¶x (6) Case D1: The analytical solution for the same type of problem (that is, concentration is held at a constant value of c(0,t)=1 for x=0) for the diffusion dominated case can be described using the ( (( ) ) ) error function. Set up the model domain 0 £ x £ ¥ , initial conditions c x,0 = 0 and boundary (( ) ) condition c 0,t = c0 for t>0 (similar to the case considered for purely advective flows), we could derive the analytical solution to be æ æ öö x ÷÷ ç ç c x,t = c0 1- erf ; ç 4tK ÷÷ ç è x øø è ( ) (7) where erf is the error function ( ) erf f = 2 p ò f 0 ( ) exp -t 2 d t (8) (see Chanson for more on the error function; Matlab has a function called “erf”). Note that as t gets large, the error function in equation 8 would approach zero, and concentrations throughout the domain would approach the boundary value (c0). Case D2: For your lab work you will assume that the spatial domain stretches from –∞ to ∞; and that initially the concentration is zero for x 0 ; and c0=1 for x 0 (our initial conditions). Assume that concentrations are held constant at the boundaries c -¥,t = 0; c ¥,t = c0 =1(our ( boundary conditions). The analytical solution is æ æ öö c0 ç x ÷÷ ç c x,t = 1+ erf . ç 4tK ÷÷ 2ç è x øø è ( ) ) ( ) (9) Diffusion of a “slug”: Suppose, instead, that a mass (“M”) of some tracer is instantaneously delivered to location “x=x0” of an infinitely long reach of a one-dimensional system at time t=0; and that the system is diffusive (u = 0). Hydrologists call this injection of a “slug”. The tracer will diffuse away from its initial location (x0) following a Gaussian distribution: 2ö æ x - x0 ÷ M ç (10) c x,t = exp ç ÷÷. 4tK ç 4p tK x x è ø ( ) ( ) Pay attention to the units. We are considering a depth-averaged and cross-channel averaged concentration – so here M might be a mass/area (kg/m2 of sediment) where the “area” represents the cross-channel and vertical dimensions. The concentration would then be mass/volume (kg/m3). At any time, t, you should be able to integrate and get M = ò c(x,t)dx. Case of advective diffusion: Often, both advection and diffusion are important, and neither term can be eliminated. Because equation (1) is linear, the solution for the advection – diffusion equation can be derived by adding the solutions for the advection part to the solution for the diffusion part. We didn’t really write out an equation for the advection – dominated system, but could do so by simply translating the x-variable by the advection distance calculated as a function of time l = ut . ( ) ( ) Redo Case D1 with advection: For Case D1; set up for model domain 0 £ x £ ¥ , initial (( ) ) (( ) ) conditions c x,0 = 0 and boundary condition c 0,t = c0 for t>0, the analytical solution for the advection – diffusion equation is found by substituting x - ut for x in equation 9: æ æ öö x - ut ÷÷ ç ç c x,t = c0 1- erf . ç 4K t ÷÷ ç è x øø è ( ) (11) Redo Case D2 with advection: Likewise, to get an analytical solution for the advection diffusion for the case where diffusion occurred in both directions, we add advection to equation 7 by substituting x – ut for x: æ æ öö c0 ç x ut ÷÷ ; (12) c x,t = 1+ erf ç ç ÷÷ ç 2 4K t è x øø è ( ) Remember that for the Case D2 the spatial domain stretches from –∞ to ∞; and initial concentration is zero for x < 0 ; and c0=1 for x ³ 0 . Advective diffusion of a slug: Suppose a mass “M” of tracer is instantly injected at x=0 in a system that initially had none of that tracer. To get the analytical solution, you replace c0 in equation 11 with 𝑀/√(4𝜋𝐾𝑥 𝑡). The concentration field will evolve as æ x - ut c x,t = exp çç ç 4K x t 4p K x t è ( ) M ( ) 2 ö ÷. ÷÷ ø I think that if it were injected at some point x0 (instead of the origin), the equation would be (13) æ x - x0 - ut c x,t = exp çç 4K x t ç 4p K x t è ( ) M ( ) 2 ö ÷. ÷÷ ø (14) Boundary Conditions: For simplicity, these examples both used reference boundary conditions where the value of concentration was held constant at both boundaries. These are sometimes called Neumann boundary conditions. Sometimes it is more convenient to specify some sort of flux boundary condition, sometimes called Dirichlet boundary conditions. This would allow the model domain to be closed on one or both sides; or perhaps open with tracer entering at a specified rate. A flux boundary condition would be set using (for example): ¶c = g at x = 0; or x = L. ¶x (15) The value of γ could depend on the actual flux coming in, the velocity near the boundary, and the diffusivity of the boundary. If the boundary is truly closed, then you’d use 0 . Chanson provides an analytical solution to a diffusion problem where one boundary is closed. Why Numerical Solutions? We can solve simple advection – diffusion problems using these types of analytical equations, but we need numerical models for more complicated situations. Remember that these analytical solutions were derived with several assumptions: (1) the system is uniform in the y and z directions; (2) diffusivity (Kx) was constant with time and space; (3) velocity (u) was constant in time and space; (4) the boundary conditions were easily specified and constant in time; and (5) the initial conditions were simple. The natural world, including marine environments, often seems to violate most of those assumptions. Numerical solutions exist that incorporate more than one-dimension, and can include time and spatial variations in the flow field and diffusivity, as well as different types of boundary conditions.