@@ -297,15 +297,16 @@ splitting methods.
297297label{nonlin:splitting:RD_linearR}
298298
299299The methods above may be explored in detail through a specific
300- computational example in which we compute the convergence
301- rates associated with four different solution approaches for the
302- reaction-diffusion equation with a linear reaction term, i.e. $f(u)=-bu$.
303- The methods comprise solving without splitting (just straight Forward Euler),
304- ordinary splitting, first order Strang splitting, and second order Strang splitting.
305- In all four methods, a standard centered difference approximation is
306- used for the spatial second derivative. The methods share the error model
307- $E = C h^r$, while differing in the step $h$ (being either $dx^2$ or $dx$) and
308- the convergence rate $r$ (being either 1 or 2).
300+ computational example in which we compute the convergence rates
301+ associated with four different solution approaches for the
302+ reaction-diffusion equation with a linear reaction term,
303+ i.e. $f(u)=-bu$. The methods comprise solving without splitting (just
304+ straight Forward Euler), ordinary splitting, first order Strang
305+ splitting, and second order Strang splitting. In all four methods, a
306+ standard centered difference approximation is used for the spatial
307+ second derivative. The methods share the error model $E = C h^r$,
308+ while differing in the step $h$ (being either $\Delta x^2$ or $\Delta
309+ x$) and the convergence rate $r$ (being either 1 or 2).
309310
310311All code commented below is found in the file
311312"`split_diffu_react.py`": "${src_nonlin}/split_diffu_react.py". When executed,
@@ -314,65 +315,78 @@ rate computations are handled:
314315
315316@@@CODE src-nonlin/split_diffu_react.py fromto: def convergence_rates@
316317
317- Now, with respect to the error ($E = C h^r$), the Forward Euler scheme, the
318- ordinary splitting scheme and first order Strang splitting scheme are all
319- first order ($r = 1$), with a step $h = \Delta x^2 = K^{-1}\Delta t$, where
320- $K$ is some constant. This implies that the *ratio* $\frac{\Delta t}{\Delta x^2}$
321- must be held constant during convergence rate calculations. Furthermore,
322- the Fourier number $F = \frac{\alpha \Delta t}{\Delta x^2}$ is upwards limited to
323- $F = 0.5$, being the stability limit with explicit schemes. Thus, in these cases,
324- we use the fixed value of $F$ and a given (but changing) spatial resolution $\Delta x$ to
325- compute the corresponding value of $\Delta t$ according to the expression for $F$.
326- This assures that $\frac{\Delta t}{\Delta x^2}$ is kept constant. The loop in
327- `convergence_rates` runs over a chosen set of grid points (`Nx_values`) which gives
328- a doubling of spatial resolution with each iteration ($\Delta x$ is halved).
329-
330- For the second order Strang splitting scheme, we have $r = 2$ and a step
331- $h = \Delta x = K^{-1}\Delta t$, where $K$ again is some constant. In this case,
332- it is thus the ratio $\frac{\Delta t}{\Delta x}$ that must be held constant
333- during the convergence rate calculations. From the expression for $F$, it is
334- clear then that $F$ must change with each halving of $\Delta x$. In fact, if
335- $F$ is doubled each time $\Delta x$ is halved, the ratio $\frac{\Delta t}{\Delta x}$
336- will be constant (this follows, e.g., from the expression for $F$). This us utilized
337- in our code.
338-
339- A solver `diffusion_theta` is used in each of the four solution approaches:
318+ Now, with respect to the error ($E = C h^r$), the Forward Euler
319+ scheme, the ordinary splitting scheme and first order Strang splitting
320+ scheme are all first order ($r = 1$), with a step $h = \Delta x^2 =
321+ K^{-1}\Delta t$, where $K$ is some constant. This implies that the
322+ *ratio* $\frac{\Delta t}{\Delta x^2}$ must be held constant during
323+ convergence rate calculations. Furthermore, the Fourier number $F =
324+ \frac{\alpha \Delta t}{\Delta x^2}$ is upwards limited to $F = 0.5$,
325+ being the stability limit with explicit schemes. Thus, in these cases,
326+ we use the fixed value of $F$ and a given (but changing) spatial
327+ resolution $\Delta x$ to compute the corresponding value of $\Delta t$
328+ according to the expression for $F$. This assures that $\frac{\Delta
329+ t}{\Delta x^2}$ is kept constant. The loop in `convergence_rates` runs
330+ over a chosen set of grid points (`Nx_values`) which gives a doubling
331+ of spatial resolution with each iteration ($\Delta x$ is halved).
332+
333+ For the second order Strang splitting scheme, we have $r = 2$ and a
334+ step $h = \Delta x = K^{-1}\Delta t$, where $K$ again is some
335+ constant. In this case, it is thus the ratio $\frac{\Delta t}{\Delta
336+ x}$ that must be held constant during the convergence rate
337+ calculations. From the expression for $F$, it is clear then that $F$
338+ must change with each halving of $\Delta x$. In fact, if $F$ is
339+ doubled each time $\Delta x$ is halved, the ratio $\frac{\Delta
340+ t}{\Delta x}$ will be constant (this follows, e.g., from the
341+ expression for $F$). This is utilized in our code.
342+
343+ A solver `diffusion_theta` is used in each of the four solution approaches:
340344
341345@@@CODE src-nonlin/split_diffu_react.py fromto: def diffusion_theta@def reaction_FE
342346
343- For the no splitting approach with Forward Euler in time, this solver handles both
344- the diffusion and the reaction term. When splitting, `diffusion_theta` takes care
345- of the diffusion term only, while the reaction
346- term is handled either by a Forward Euler scheme in `reaction_FE`, or by a
347- second order Adams-Bashforth scheme from Odespy. The `reaction_FE` function
348- covers one complete time step `dt` during ordinary splitting, while Strang
349- splitting (both first and second order) applies it with `dt/2` twice during
350- each time step `dt`. Since the reaction term typically represents a much faster
351- process than the diffusion term, a further refinement of the time step is made
352- possible in `reaction_FE`. It was implemented as
347+ For the no splitting approach with Forward Euler in time, this solver
348+ handles both the diffusion and the reaction term. When splitting,
349+ `diffusion_theta` takes care of the diffusion term only, while the
350+ reaction term is handled either by a Forward Euler scheme in
351+ `reaction_FE`, or by a second order Adams-Bashforth scheme from
352+ Odespy. The `reaction_FE` function covers one complete time step `dt`
353+ during ordinary splitting, while Strang splitting (both first and
354+ second order) applies it with `dt/2` twice during each time step
355+ `dt`. Since the reaction term typically represents a much faster
356+ process than the diffusion term, a further refinement of the time step
357+ is made possible in `reaction_FE`. It was implemented as
353358
354359@@@CODE src-nonlin/split_diffu_react.py fromto: def reaction_FE@def ordinary_splitting
355360
356- With the ordinary splitting approach, each time step `dt` is covered twice. First
357- computing the impact of the reaction term, then the contribution from the diffusion term:
361+ With the ordinary splitting approach, each time step `dt` is covered
362+ twice. First computing the impact of the reaction term, then the
363+ contribution from the diffusion term:
358364
359365@@@CODE src-nonlin/split_diffu_react.py fromto: def ordinary_splitting@def Strang_splitting_1st
360366
361- For the two Strang splitting approaches, each time step `dt` is handled by first computing
362- the reaction step for (the first) `dt/2`, followed by a diffusion step `dt`, before the reaction step
363- is treated once again for (the remaining) `dt/2`. Since first order Strang splitting is no better than first order accurate, both the reaction and diffusion steps are computed explicitly. The
364- solver was implemented as
367+ For the two Strang splitting approaches, each time step `dt` is
368+ handled by first computing the reaction step for (the first) `dt/2`,
369+ followed by a diffusion step `dt`, before the reaction step is treated
370+ once again for (the remaining) `dt/2`. Since first order Strang
371+ splitting is no better than first order accurate, both the reaction
372+ and diffusion steps are computed explicitly. The solver was
373+ implemented as
365374
366375@@@CODE src-nonlin/split_diffu_react.py fromto: def Strang_splitting_1st@def Strang_splitting_2nd
367376
368- The second order version of the Strang splitting approach utilizes a second order Adams-Bashforth
369- solver for the reaction part and a Crank-Nicolson scheme for the diffusion part. The solver has the
370- same structure as the one for first order Strang splitting and was implemented as
377+ The second order version of the Strang splitting approach utilizes a
378+ second order Adams-Bashforth solver for the reaction part and a
379+ Crank-Nicolson scheme for the diffusion part. The solver has the same
380+ structure as the one for first order Strang splitting and was
381+ implemented as
371382
372383@@@CODE src-nonlin/split_diffu_react.py fromto: def Strang_splitting_2nd@def convergence_rates
373384
374- When executing `split_diffu_react.py`, we find that the estimated convergence rates
375- are as expected. The second order Strang splitting gives the least error (about $4e^{-5}$) and has second order convergence ($r = 2$), while the remaining three approaches have first order convergence ($r = 1$).
385+ When executing `split_diffu_react.py`, we find that the estimated
386+ convergence rates are as expected. The second order Strang splitting
387+ gives the least error (about $4e^{-5}$) and has second order
388+ convergence ($r = 2$), while the remaining three approaches have first
389+ order convergence ($r = 1$).
376390
377391
378392
@@ -411,7 +425,7 @@ diffusion problem solved by a Forward Euler method one has
411425where $F=\dfc\Delta t/\Delta x^2$ is the mesh Fourier number and $p=k\Delta x/2$
412426is a dimensionless number reflecting the spatial resolution (number of points
413427per wave length in space). For the decay problem $u'=-\beta u$, we have
414- $A=1 - q$, where $q$ is a dimensionless parameter reflecting the resolution
428+ $A=1 - q$, where $q$ is a dimensionless parameter for the resolution
415429in the decay problem: $q = \beta\Delta t$.
416430
417431The original model problem can also be discretized by a Forward Euler scheme,
@@ -443,5 +457,5 @@ Then we use this as input to the decay algorithm and arrive at
443457The splitting approximation over one step is therefore
444458
445459!bt
446- \[ E = 1 - 4F\sin^p -q - (1-q)(1-4F\sin^2 p) = -q(2 - F\sin^2 p)) \]
460+ \[ E = 1 - 4F\sin^p -q - (1-q)(1-4F\sin^2 p) = -q(2 - F\sin^2 p))\tp \]
447461!et
0 commit comments