Skip to content

Commit fb32dc7

Browse files
authored
Merge pull request #100 from devitocodes/devito
Contributing guidelines, corrections and tests.
2 parents ad72950 + baf2253 commit fb32dc7

22 files changed

+2099
-125
lines changed

CONTRIBUTING.md

Lines changed: 1239 additions & 0 deletions
Large diffs are not rendered by default.

chapters/advec/advec.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ u^{n+1}_i = u^{n-1}**i - C(u**{i+1}^n-u_{i-1}^n)\tp
775775
$$
776776
A special scheme is needed to compute $u^1$, but we leave that problem for
777777
now. Anyway, this special scheme can be found in
778-
[`advec1D.py`](https://github.com/hplgit/fdm-book/tree/master/src/advec/advec1D.py).
778+
[`advec1D.py`](https://github.com/devitocodes/devito_book/tree/main/src/advec/advec1D.py).
779779
780780
### Implementation
781781
We now need to work with three time levels and must modify our solver a bit:
@@ -1171,7 +1171,7 @@ def run(scheme='UP', case='gaussian', C=1, dt=0.01):
11711171
print 'Integral of u:', integral.max(), integral.min()
11721172
```
11731173
The complete code is found in the file
1174-
[`advec1D.py`](https://github.com/hplgit/fdm-book/tree/master/src/advec/advec1D.py).
1174+
[`advec1D.py`](https://github.com/devitocodes/devito_book/tree/main/src/advec/advec1D.py).
11751175
11761176
## A Crank-Nicolson discretization in time and centered differences in space {#sec-advec-1D-CN}
11771177

chapters/appendices/formulas/formulas.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ $$ {#eq-form-Dop-tn3-fw}
226226
227227
Application of finite difference operators to polynomials and exponential
228228
functions, resulting in the formulas above, can easily be computed by
229-
some `sympy` code (from the file [`lib.py`](https://github.com/hplgit/fdm-book/tree/master/src/formulas/lib.py)):
229+
some `sympy` code (from the file `src/formulas/lib.py` in this repository):
230230
231231
```python
232232
from sympy import *

chapters/appendices/softeng2/softeng2.qmd

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,19 @@ $$
3636
[D_{2x}u]^n_i=0,
3737
$$
3838
at a boundary point $i$. The details of how the numerical scheme
39-
is worked out are described in ref[Sections @sec-wave-pde2-Neumann
40-
and @sec-wave-pde2-var-c][ in [@Langtangen_deqbook_wave]][in
41-
the document [Finite difference methods for wave motion](http://tinyurl.com/k3sdbuv/pub/wave)
42-
[@Langtangen_deqbook_wave]].
39+
is worked out are described in @sec-wave-pde2-Neumann
40+
and @sec-wave-pde2-var-c.
4341
4442
## A solver function
4543
4644
The general initial-boundary value problem
4745
solved by finite difference methods can be implemented as shown in
4846
the following `solver` function (taken from the
49-
file [`wave1D_dn_vc.py`](https://github.com/hplgit/fdm-book/tree/master/src/wave/wave1D/wave1D_dn_vc.py)).
47+
file [`wave1D_dn_vc.py`](https://github.com/devitocodes/devito_book/tree/main/src/wave/wave1D/wave1D_dn_vc.py)).
5048
This function builds on
5149
simpler versions described in
52-
ref[Sections @sec-wave-pde1-impl, @sec-wave-pde1-impl-vec
53-
@sec-wave-pde2-Neumann, and @sec-wave-pde2-var-c][ in
54-
[@Langtangen_deqbook_wave]][in
55-
the document [Finite difference methods for wave motion](http://tinyurl.com/k3sdbuv/pub/wave)
56-
[@Langtangen_deqbook_wave]].
50+
@sec-wave-pde1-impl, @sec-wave-pde1-impl-vec,
51+
@sec-wave-pde2-Neumann, and @sec-wave-pde2-var-c.
5752
There are several quite advanced
5853
constructs that will be commented upon later.
5954
The code is lengthy, but that is because we provide a lot of
@@ -286,7 +281,7 @@ Such actions must be
286281
taken care of outside the `solver` function, more precisely in the
287282
`user_action` function that is called at every time level.
288283
289-
We have, in the [`wave1D_dn_vc.py`](https://github.com/hplgit/fdm-book/tree/master/src/wave/wave1D/wave1D_dn_vc.py)
284+
We have, in the [`wave1D_dn_vc.py`](https://github.com/devitocodes/devito_book/tree/main/src/wave/wave1D/wave1D_dn_vc.py)
290285
code, implemented the `user_action`
291286
callback function as a class `PlotAndStoreSolution` with a
292287
`__call__(self, x, t, t, n)` method for the `user_action` function.
@@ -357,7 +352,7 @@ The `hashed_input` argument, used to name the
357352
resulting archive file with all solutions, is supposed to be a
358353
hash reflecting all import parameters in the problem such that this
359354
simulation has a unique name.
360-
The `hashed_input` string is made in the [`solver`](https://github.com/hplgit/fdm-book/tree/master/src/wave/wave1D/wave1D_dn_vc.py) function, using the `hashlib`
355+
The `hashed_input` string is made in the [`solver`](https://github.com/devitocodes/devito_book/tree/main/src/wave/wave1D/wave1D_dn_vc.py) function, using the `hashlib`
361356
and `inspect` modules, based on the arguments to `solver`:
362357
363358
```python
@@ -419,10 +414,7 @@ solutions to machine precision. With Dirichlet boundary conditions
419414
we can construct a function that is linear in $t$ and quadratic in
420415
$x$ that is also an exact solution of the scheme, while with Neumann
421416
conditions we are left with testing just a constant solution
422-
(see comments in ref[Section @sec-wave-pde1-verify][ in
423-
[@Langtangen_deqbook_wave]][in
424-
the document [Finite difference methods for wave motion](http://tinyurl.com/k3sdbuv/pub/wave)
425-
[@Langtangen_deqbook_wave]]).
417+
(see comments in @sec-wave-pde1-verify).
426418
427419
### Convergence rates
428420
@@ -435,9 +427,7 @@ $$
435427
r = \frac{\ln(E_{i}/E_{i-1})}{\ln(h_{i}/h_{i-1})},
436428
$$
437429
where $E_i$ is the error corresponding to $h_i$ and $E_{i-1}$ corresponds to
438-
$h_{i-1}$. ref[Section @sec-wave-pde2-fd-standing-waves][ in [@Langtangen_deqbook_wave]][The
439-
section "Using an analytical solution of physical significance": ""
440-
in [@Langtangen_deqbook_wave]] explains the details of this type of verification and how
430+
$h_{i-1}$. @sec-wave-pde2-fd-standing-waves explains the details of this type of verification and how
441431
we introduce the single discretization parameter $h=\Delta t = \hat c\Delta t$,
442432
for some constant $\hat c$. To compute the error, we had to rely on
443433
a global variable in the user action function. Below is an implementation
@@ -449,15 +439,12 @@ error (which is always considered an advantage).
449439
```
450440
451441
The returned sequence `r` should converge to 2 since the error
452-
analysis in ref[Section @sec-wave-pde1-analysis][in
453-
[@Langtangen_deqbook_wave]][the section "Analysis of the difference
454-
equations": "" in [@Langtangen_deqbook_wave]] predicts various error measures to behave
442+
analysis in @sec-wave-pde1-analysis predicts various error measures to behave
455443
like $\Oof{\Delta t^2} + \Oof{\Delta x^2}$. We can easily run
456444
the case with standing waves and the analytical solution
457445
$u(x,t) = \cos(\frac{2\pi}{L}t)\sin(\frac{2\pi}{L}x)$. The call will
458446
be very similar to the one provided in the `test_convrate_sincos` function
459-
in ref[Section @sec-wave-pde1-impl-verify-rate][ in [@Langtangen_deqbook_wave]][the section "Verification: convergence rates": "" in
460-
[@Langtangen_deqbook_wave]], see the file [`wave1D_dn_vc.py`](https://github.com/hplgit/fdm-book/tree/master/src/wave/wave1D/wave1D_dn_vc.py) for details.
447+
in @sec-wave-pde1-impl-verify-rate, see the file `src/wave/wave1D/wave1D_dn_vc.py` for details.
461448
462449
Many who know about class programming prefer to organize their software
463450
in terms of classes. This gives a richer application programming interface
@@ -482,7 +469,7 @@ how this may be counteracted by introducing a super class `Parameters` that allo
482469
code to be parameterized. In addition, it is convenient to collect the
483470
arrays that describe the mesh in a special `Mesh` class and make
484471
a class `Function` for a mesh function (mesh point values and its mesh).
485-
All the following code is found in [`wave1D_oo.py`](https://github.com/hplgit/fdm-book/tree/master/src/softeng2/wave1D_oo.py).
472+
All the following code is found in [`wave1D_oo.py`](https://github.com/devitocodes/devito_book/tree/main/src/softeng2/wave1D_oo.py).
486473
487474
## Class Parameters
488475
@@ -1222,22 +1209,21 @@ is reproduced (within machine precision).
12221209
12231210
## Speeding up Cython code {#sec-wave2D3D-impl-Cython}
12241211
1225-
We now consider the [`wave2D_u0.py`](https://github.com/hplgit/fdm-book/tree/master/src/wave/wave2D_u0/wave2D_u0.py)
1212+
We now consider the [`wave2D_u0.py`](https://github.com/devitocodes/devito_book/tree/main/src/wave/wave2D_u0/wave2D_u0.py)
12261213
code for solving the 2D linear wave equation with constant wave
12271214
velocity and homogeneous Dirichlet boundary conditions $u=0$.
12281215
We shall in the present chapter extend this code with computational
12291216
modules written in other languages than Python. This extended version is
1230-
called [`wave2D_u0_adv.py`](https://github.com/hplgit/fdm-book/tree/master/src/softeng2/wave2D_u0_adv.py).
1217+
called [`wave2D_u0_adv.py`](https://github.com/devitocodes/devito_book/tree/main/src/softeng2/wave2D_u0_adv.py).
12311218
12321219
The `wave2D_u0.py` file contains a `solver` function, which calls an
12331220
`advance_*` function to advance the numerical scheme one level forward
12341221
in time. The function `advance_scalar` applies standard Python loops
12351222
to implement the scheme, while `advance_vectorized` performs
12361223
corresponding vectorized arithmetics with array slices. The statements
1237-
of this solver are explained in ref[Section @sec-wave-2D3D-impl, in
1238-
particular Sections @sec-wave2D3D-impl-scalar and
1239-
@sec-wave2D3D-impl-vectorized][ in [@Langtangen_deqbook_wave]][in
1240-
the document [Finite difference methods for wave motion](http://tinyurl.com/k3sdbuv/pub/wave) [@Langtangen_deqbook_wave]].
1224+
of this solver are explained in @sec-wave-2D3D-impl, in
1225+
particular @sec-wave2D3D-impl-scalar and
1226+
@sec-wave2D3D-impl-vectorized.
12411227
12421228
Although vectorization can bring down the CPU time dramatically
12431229
compared with scalar code, there is still some factor 5-10 to win in
@@ -1519,7 +1505,7 @@ to a single index.
15191505
## The Fortran subroutine
15201506
15211507
We write a Fortran subroutine `advance` in a file
1522-
[`wave2D_u0_loop_f77.f`](https://github.com/hplgit/fdm-book/tree/master/src/softeng2/wave2D_u0_loop_f77.f)
1508+
[`wave2D_u0_loop_f77.f`](https://github.com/devitocodes/devito_book/tree/main/src/softeng2/wave2D_u0_loop_f77.f)
15231509
for implementing the updating formula
15241510
(@eq-wave-2D3D-impl1-2Du0-ueq-discrete) and setting the solution to zero
15251511
at the boundaries:
@@ -1867,13 +1853,13 @@ void advance(double* u, double* u_1, double* u_2, double* f,
18671853
## The Cython interface file
18681854
18691855
All the code above appears in the file
1870-
[`wave2D_u0_loop_c.c`](https://github.com/hplgit/fdm-book/tree/master/src/softeng2/wave2D_u0_loop_c.c).
1856+
[`wave2D_u0_loop_c.c`](https://github.com/devitocodes/devito_book/tree/main/src/softeng2/wave2D_u0_loop_c.c).
18711857
We need to compile this file together with C wrapper code such that
18721858
`advance` can be called from Python. Cython can be used to generate
18731859
appropriate wrapper code.
18741860
The relevant Cython code for interfacing C is
18751861
placed in a file with extension `.pyx`. This file, called
1876-
[`wave2D_u0_loop_c_cy.pyx`](https://github.com/hplgit/fdm-book/tree/master/src/softeng2/wave2D_u0_loop_c_cy.pyx), looks like
1862+
[`wave2D_u0_loop_c_cy.pyx`](https://github.com/devitocodes/devito_book/tree/main/src/softeng2/wave2D_u0_loop_c_cy.pyx), looks like
18771863
18781864
```python
18791865
import numpy as np
@@ -1903,7 +1889,7 @@ def advance_cwrap(
19031889
19041890
We first declare the C functions to be interfaced.
19051891
These must also appear in a C header file,
1906-
[`wave2D_u0_loop_c.h`](https://github.com/hplgit/fdm-book/tree/master/src/softeng2/wave2D_u0_loop_c.h),
1892+
[`wave2D_u0_loop_c.h`](https://github.com/devitocodes/devito_book/tree/main/src/softeng2/wave2D_u0_loop_c.h),
19071893
19081894
```python
19091895
extern void advance(double* u, double* u_n, double* u_nm1, double* f,
@@ -2047,8 +2033,8 @@ interfaces for a wide range of
20472033
languages, including Python, Perl, Ruby, and Java.
20482034
However, SWIG is a comprehensive tool with a correspondingly
20492035
steep learning curve. Alternative tools, such as
2050-
[Boost Python](http://www.boost.org/doc/libs/1_51_0/libs/python/doc/index.html), [SIP](http://riverbankcomputing.co.uk/software/sip/intro),
2051-
and [Shiboken](http://qt-project.org/wiki/Category:LanguageBindings::PySide::Shiboken)
2036+
[Boost Python](https://www.boost.org/doc/libs/release/libs/python/doc/html/index.html), [SIP](https://riverbankcomputing.com/software/sip/),
2037+
and [Shiboken](https://wiki.qt.io/Qt_for_Python)
20522038
are similarly comprehensive. Simpler tools include
20532039
[PyBindGen](http://code.google.com/p/pybindgen/).
20542040

chapters/appendices/trunc/trunc.qmd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ D1u + D2u*dt/2 + D3u*dt**2/6 + D4u*dt**3/24
401401
```
402402
The truncation error consists of the terms after the first one ($u'$).
403403
404-
The module file [`trunc/truncation_errors.py`](https://github.com/hplgit/fdm-book/tree/master/src/trunc/truncation_errors.py) contains another class `DiffOp` with symbolic expressions for
404+
The module file [`trunc/truncation_errors.py`](https://github.com/devitocodes/devito_book/tree/main/src/trunc/truncation_errors.py) contains another class `DiffOp` with symbolic expressions for
405405
most of the truncation errors listed in the previous section.
406406
For example:
407407
@@ -777,7 +777,7 @@ we pick the rate $r_{m-2}$, which we believe is the best estimation since
777777
it is based on the two finest meshes.
778778
779779
The `estimate` function is available in a module
780-
[`trunc_empir.py`](https://github.com/hplgit/fdm-book/tree/master/src/trunc/trunc_empir.py).
780+
[`trunc_empir.py`](https://github.com/devitocodes/devito_book/tree/main/src/trunc/trunc_empir.py).
781781
Let us apply this function to estimate the truncation
782782
error of the Forward Euler scheme. We need a function `decay_FE(dt, N)`
783783
that can compute (@eq-trunc-decay-FE-R-comp) at the
@@ -814,7 +814,7 @@ The agreement between the theoretical formula (@eq-trunc-decay-FE-R)
814814
and the computed quantity (ref(@eq-trunc-decay-FE-R-comp)) is
815815
very good, as illustrated in
816816
Figures @fig-trunc-fig-FE-rates and @fig-trunc-fig-FE-error.
817-
The program [`trunc_decay_FE.py`](https://github.com/hplgit/fdm-book/tree/master/src/trunc/trunc_decay_FE.py)
817+
The program [`trunc_decay_FE.py`](https://github.com/devitocodes/devito_book/tree/main/src/trunc/trunc_decay_FE.py)
818818
was used to perform the simulations and it can easily be modified to
819819
test other schemes (see also Exercise @sec-trunc-exer-decay-estimate).
820820
@@ -1532,6 +1532,7 @@ in both equations:
15321532
$$
15331533
R_u^{n-\half}= \Oof{\Delta t^2}, \quad R_v^n = \Oof{\Delta t^2}\tp
15341534
$$
1535+
15351536
## Linear wave equation in 1D {#sec-trunc-wave-1D}
15361537
15371538
The standard, linear wave equation in 1D for a function $u(x,t)$ reads
@@ -2234,7 +2235,7 @@ Section @sec-trunc-vib-undamped describes two ways of discretizing
22342235
the initial condition $u'(0)=V$ for a vibration model
22352236
$u''+\omega^2u=0$: a centered difference $[D_{2t}u=V]^0$ or
22362237
a forward difference $[D_t^+u=V]^0$.
2237-
The program [`vib_undamped.py`](https://github.com/hplgit/fdm-book/tree/master/src/vib/vib_undamped.py)
2238+
The program [`vib_undamped.py`](https://github.com/devitocodes/devito_book/tree/main/src/vib/vib_undamped.py)
22382239
solves $u''+\omega^2u=0$ with $[D_{2t}u=0]^0$ and features
22392240
a function `convergence_rates` for computing the order of the
22402241
error in the numerical solution. Modify this program such

chapters/devito_intro/what_is_devito.qmd

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,41 @@ This approach has several limitations:
4949
With Devito, the same problem becomes:
5050

5151
```python
52-
from devito import Grid, TimeFunction, Eq, Operator
52+
from devito import Grid, TimeFunction, Eq, Operator, solve, Constant
53+
54+
# Problem parameters
55+
Nx = 100
56+
L = 1.0
57+
alpha = 1.0 # diffusion coefficient
58+
F = 0.5 # Fourier number (for stability, F <= 0.5)
59+
60+
# Compute dt from stability condition: F = alpha * dt / dx^2
61+
dx = L / Nx
62+
dt = F * dx**2 / alpha
5363

5464
# Create computational grid
55-
grid = Grid(shape=(101,), extent=(1.0,))
65+
grid = Grid(shape=(Nx + 1,), extent=(L,))
5666

5767
# Define the unknown field
5868
u = TimeFunction(name='u', grid=grid, time_order=1, space_order=2)
5969

6070
# Set initial condition
61-
u.data[0, 50] = 1.0
71+
u.data[0, Nx // 2] = 1.0
6272

63-
# Define the PDE update equation
64-
eq = Eq(u.forward, u + alpha * dt * u.dx2)
73+
# Define the PDE symbolically and solve for u.forward
74+
a = Constant(name='a')
75+
pde = u.dt - a * u.dx2
76+
update = Eq(u.forward, solve(pde, u.forward))
6577

6678
# Create and run the operator
67-
op = Operator([eq])
68-
op(time=1000, dt=dt)
79+
op = Operator([update])
80+
op(time=1000, dt=dt, a=alpha)
6981
```
7082

7183
This approach offers significant advantages:
7284

73-
1. **Mathematical clarity**: The equation `u.forward = u + alpha * dt * u.dx2`
74-
directly mirrors the mathematical formulation
85+
1. **Mathematical clarity**: The PDE `u.dt - a * u.dx2 = 0` is written symbolically,
86+
and Devito derives the update formula automatically using `solve()`
7587
2. **Automatic optimization**: Devito generates C code with loop tiling,
7688
SIMD vectorization, and OpenMP parallelization
7789
3. **Dimension-agnostic**: The same code structure works for 1D, 2D, or 3D

chapters/diffu/diffu_analysis.qmd

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,7 @@ make Taylor expansions of $A/\Aex$ to see the error more analytically.
216216
217217
As an alternative to examining the accuracy of the damping of a wave
218218
component, we can perform a general truncation error analysis as
219-
explained in ref[Appendix @sec-ch-trunc][ in
220-
[@Langtangen_deqbook_trunc]]["Truncation error analysis": ""
221-
[@Langtangen_deqbook_trunc]]. Such results are more general, but
219+
explained in @sec-ch-trunc. Such results are more general, but
222220
less detailed than what we get from the wave component analysis. The
223221
truncation error can almost always be computed and represents the
224222
error in the numerical model when the exact solution is substituted
@@ -324,17 +322,11 @@ $$
324322
$$
325323
### Truncation error
326324
We follow the theory explained in
327-
ref[Appendix @sec-ch-trunc][ in
328-
[@Langtangen_deqbook_trunc]]["Truncation error analysis": ""
329-
[@Langtangen_deqbook_trunc]]. The recipe is to set up the
325+
@sec-ch-trunc. The recipe is to set up the
330326
scheme in operator notation and use formulas from
331-
ref[Section @sec-trunc-table][ in
332-
[@Langtangen_deqbook_trunc]]["Overview of leading-order error terms in finite difference formulas": ""
333-
[@Langtangen_deqbook_trunc]] to derive an expression for
327+
@sec-trunc-table to derive an expression for
334328
the residual. The details are documented in
335-
ref[Section @sec-trunc-diffu-1D][ in
336-
[@Langtangen_deqbook_trunc]]["Linear diffusion equation in 1D": ""
337-
[@Langtangen_deqbook_trunc]]. We end up with a truncation error
329+
@sec-trunc-diffu-1D. We end up with a truncation error
338330
$$
339331
R^n_i = \Oof{\Delta t} + \Oof{\Delta x^2}\tp
340332
$$
@@ -423,9 +415,7 @@ $F\leq\half$.
423415
424416
### Truncation error
425417
The truncation error is derived in
426-
ref[Section @sec-trunc-diffu-1D][ in
427-
[@Langtangen_deqbook_trunc]]["Linear diffusion equation in 1D": ""
428-
[@Langtangen_deqbook_trunc]]:
418+
@sec-trunc-diffu-1D:
429419
$$
430420
R^{n+\half}_i = \Oof{\Delta x^2} + \Oof{\Delta t^2}\tp
431421
$$

chapters/diffu/diffu_fd1.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Section @sec-diffu-pde1-analysis.
195195
196196
## Implementation {#sec-diffu-pde1-FE-code}
197197
198-
The file [`diffu1D_u0.py`](https://github.com/hplgit/fdm-book/tree/master/src/diffu/diffu1D_u0.py)
198+
The file [`diffu1D_u0.py`](https://github.com/devitocodes/devito_book/tree/main/src/diffu/diffu1D_u0.py)
199199
contains a complete function `solver_FE_simple`
200200
for solving the 1D diffusion equation with $u=0$ on the boundary
201201
as specified in the algorithm above:
@@ -1015,7 +1015,7 @@ and a smooth Gaussian function,
10151015
$$
10161016
I(x) = e^{-\frac{1}{2\sigma^2}(x-L/2)^2}\tp
10171017
$$
1018-
The functions `plug` and `gaussian` in [`diffu1D_u0.py`](https://github.com/hplgit/fdm-book/tree/master/src/diffu/diffu1D_u0.py) run the two cases,
1018+
The functions `plug` and `gaussian` in [`diffu1D_u0.py`](https://github.com/devitocodes/devito_book/tree/main/src/diffu/diffu1D_u0.py) run the two cases,
10191019
respectively:
10201020
10211021
```python
@@ -1409,7 +1409,7 @@ The `scipy.sparse.linalg.spsolve` function utilizes the sparse storage
14091409
structure of `A` and performs, in this case, a very efficient Gaussian
14101410
elimination solve.
14111411
1412-
The program [`diffu1D_u0.py`](https://github.com/hplgit/fdm-book/tree/master/src/diffu/diffu1D_u0.py)
1412+
The program [`diffu1D_u0.py`](https://github.com/devitocodes/devito_book/tree/main/src/diffu/diffu1D_u0.py)
14131413
contains a function `solver_BE`, which implements the Backward Euler scheme
14141414
sketched above.
14151415
As mentioned in Section @sec-diffu-pde1-FE,

chapters/diffu/diffu_fd2.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def solver_theta(I, a, L, Nx, D, T, theta=0.5, u_L=1, u_R=0,
108108
u_n, u = u, u_n
109109
```
110110

111-
The code is found in the file [`diffu1D_vc.py`](https://github.com/hplgit/fdm-book/tree/master/src/diffu/diffu1D_vc.py).
111+
The code is found in the file [`diffu1D_vc.py`](https://github.com/devitocodes/devito_book/tree/main/src/diffu/diffu1D_vc.py).
112112

113113
## Stationary solution {#sec-diffu-varcoeff-stationary}
114114

@@ -171,7 +171,7 @@ $x$ lies, and then start evaluating a formula like
171171
(@eq-diffu-fd2-pde-st-sol-pc). In Python, vectorized expressions may
172172
help to speed up the computations.
173173
The convenience classes `PiecewiseConstant` and
174-
`IntegratedPiecewiseConstant` in the [`Heaviside`](https://github.com/hplgit/fdm-book/tree/master/src/diffu/Heaviside.py)
174+
`IntegratedPiecewiseConstant` in the [`Heaviside`](https://github.com/devitocodes/devito_book/tree/main/src/diffu/Heaviside.py)
175175
module were made to simplify programming with
176176
functions like (@eq-diffu-fd2-pde-st-pc-alpha) and expressions like
177177
(@eq-diffu-fd2-pde-st-sol-pc). These utilities not only represent

0 commit comments

Comments
 (0)