Skip to content

Commit 8bbf257

Browse files
authored
Merge pull request #142 from csrc-sdsu/doc/elliptic1D
Doc/elliptic1 d
2 parents 3ebd689 + f16b517 commit 8bbf257

12 files changed

Lines changed: 570 additions & 1 deletion
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
### Elliptic1D Homogenous Dirichlet Boundary Conditions
2+
3+
Solves the 1D Poisson equation with homogeneous Dirichlet boundary conditions.
4+
5+
$$
6+
-\nabla^2 u(x) = 1
7+
$$
8+
9+
with $x\in[0,1]$. The boundary conditions are given by
10+
11+
$$
12+
au + b\frac{du}{dx} = g
13+
$$
14+
15+
with
16+
17+
$$
18+
1u(0) + b\frac{du(0)}{dx} = 0
19+
$$
20+
21+
$$
22+
1u(1) + b\frac{du(1)}{dx} = 0
23+
$$
24+
25+
This corresponds to the call to addScalarBC1D of `addScalarBC1D(A,b,k,m,dx,dc,nc,v)`, where `dc`, `nc`, and `vc` are vectors which hold the coefficients for $a$, $b$, and $g$ in the above system of equations. $a=[1,1]$, $b=[0,0]$ and $g=[0,0]$. Substituting these values in gives:
26+
27+
$$
28+
u(0) = 0
29+
$$
30+
31+
$$
32+
u(1) = 0
33+
$$
34+
35+
The true solution is
36+
37+
$$
38+
u(x) = \frac{x(1-x)}{2}
39+
$$
40+
---
41+
42+
This example is implemented in:
43+
- [MATLAB/ OCTAVE](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DHomogeneousDirichlet.m)
44+
45+
Additional MATLAB/ OCTAVE variants of this example with different boundary conditions:
46+
- [Non-Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonHomogeneousDirichlet.m)
47+
- [Left Dirichlet, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightNeumann.m)
48+
- [Left Dirichlet, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightRobin.m)
49+
- [Left Neumann, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightNeumann.m)
50+
- [Left Neumann, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightRobin.m)
51+
- [Left Robin, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftRobinRightRobin.m)
52+
- [Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DPeriodicBC.m)
53+
- [Non-Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonPeriodicBC.m)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
### Elliptic1D Left Dirichlet and Right Neumann Boundary Conditions
2+
3+
Solves the 1D Poisson equation with left Dirichlet and right Neumann boundary conditions.
4+
5+
$$
6+
-\nabla^2 u(x) = 1
7+
$$
8+
9+
with $x\in[0,1]$. The boundary conditions are given by
10+
11+
$$
12+
a_nu + b_n\frac{du}{dx} = g_n
13+
$$
14+
15+
with the left hand side boundary condition (Neumann) satisfying
16+
17+
$$
18+
0u(0) + 1\frac{du(0)}{dx} = 0
19+
$$
20+
21+
and the right hand boundary condition (Dirichlet) satisfying
22+
23+
$$
24+
1u(1) + 0\frac{du(1)}{dx} = 0
25+
$$
26+
27+
This corresponds to the call to addScalarBC1D of `addScalarBC1D(A,b,k,m,dx,dc,nc,v)`, where `dc`, `nc`, and `vc` are vectors which hold the coefficients for $a$, $b$, and $g$ in the above system of equations. $a=[0,1]$, $b=[1,0]$ and $g=[0,0]$. Substituting these values in gives:
28+
29+
$$
30+
\frac{du(0)}{dx} = 0
31+
$$
32+
33+
$$
34+
u(1) = 0
35+
$$
36+
37+
The true solution is:
38+
39+
$$
40+
u(x) = \frac{1-x^2}{2}
41+
$$
42+
43+
---
44+
45+
This example is implemented in:
46+
- [MATLAB/ OCTAVE](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightNeumann.m)
47+
48+
Additional MATLAB/ OCTAVE variants of this example with different boundary conditions:
49+
- [Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DHomogeneousDirichlet.m)
50+
- [Non-Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonHomogeneousDirichlet.m)
51+
- [Left Dirichlet, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightRobin.m)
52+
- [Left Neumann, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightNeumann.m)
53+
- [Left Neumann, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightRobin.m)
54+
- [Left Robin, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftRobinRightRobin.m)
55+
- [Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DPeriodicBC.m)
56+
- [Non-Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonPeriodicBC.m)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
### Elliptic1D Left Dirichlet and Right Robin Boundary Conditions
2+
3+
Solves the 1D Poisson equation with left Dirichlet and right Robin boundary conditions.
4+
5+
$$
6+
-\nabla^2 u(x) = \pi^2 \sin(\pi x)
7+
$$
8+
9+
with $x\in[0,1]$.
10+
11+
The boundary conditions are given by
12+
13+
$$
14+
a_nu + b_n\frac{du}{dx} = g_n
15+
$$
16+
17+
with the left hand side boundary condition (Dirichlet) satisfying
18+
19+
$$
20+
1u(0) + 0\frac{du(0)}{dx} = 10
21+
$$
22+
23+
and the right hand boundary condition (Robin) satisfying
24+
25+
$$
26+
400u(1) + 1\frac{du(1)}{dx} = 15
27+
$$
28+
29+
This corresponds to the call to addScalarBC1D of `addScalarBC1D(A,b,k,m,dx,dc,nc,v)`, where `dc`, `nc`, and `vc` are vectors which hold the coefficients for $a$, $b$, and $g$ in the above system of equations. $a=[1,400]$, $b=[0,1]$ and $g=[10,15]$.
30+
Substituting these values in gives:
31+
32+
$$
33+
u(0) = 10
34+
$$
35+
36+
$$
37+
400u(1) + \frac{du(1)}{dx} = 15
38+
$$
39+
40+
The true solution is:
41+
42+
$$
43+
u(x) = \sin(\pi x) + \frac{\pi - 3985}{401}x + 10
44+
$$
45+
46+
---
47+
48+
This example is implemented in:
49+
- [MATLAB/ OCTAVE](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightRobin.m)
50+
51+
Additional MATLAB/ OCTAVE variants of this example with different boundary conditions:
52+
- [Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DHomogeneousDirichlet.m)
53+
- [Non-Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonHomogeneousDirichlet.m)
54+
- [Left Dirichlet, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightNeumann.m)
55+
- [Left Neumann, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightNeumann.m)
56+
- [Left Neumann, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightRobin.m)
57+
- [Left Robin, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftRobinRightRobin.m)
58+
- [Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DPeriodicBC.m)
59+
- [Non-Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonPeriodicBC.m)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
### Elliptic1D Pure Neumann Boundary Conditions
2+
3+
Solves the 1D Poisson boundary value problem with Neumann boundary conditions.
4+
5+
$$
6+
-\nabla^2 u(x) = x - \frac{1}{2}
7+
$$
8+
9+
with $x\in[0,1]$.
10+
11+
The boundary conditions are given by
12+
13+
$$
14+
au + b\frac{du}{dx} = g
15+
$$
16+
17+
with the left hand side boundary condition (Neumann) satisfying
18+
19+
$$
20+
0u(0) + 1\frac{du(0)}{dx} = 0
21+
$$
22+
23+
and the right hand boundary condition (Neumann) satisfying
24+
25+
$$
26+
0u(1) + 1\frac{du(1)}{dx} = 0
27+
$$
28+
29+
This corresponds to the call to addScalarBC1D of `addScalarBC1D(A,b,k,m,dx,dc,nc,v)`, where `dc`, `nc`, and `vc` are vectors which hold the coefficients for $a$, $b$, and $g$ in the above system of equations. $a=[0,0]$, $b=[1,1]$ and $g=[0,0]$.
30+
Substituting these values in gives:
31+
32+
$$
33+
\frac{du(0)}{dx} = 0
34+
$$
35+
36+
$$
37+
\frac{du(1)}{dx} = 0
38+
$$
39+
40+
The exact solution ( with constant $C$ ) is:
41+
42+
$$
43+
u(x) = C + \frac{x^2}{4} - \frac{x^3}{6}
44+
$$
45+
46+
---
47+
48+
This example is implemented in:
49+
- [MATLAB/ OCTAVE](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightNeumann.m)
50+
51+
Additional MATLAB/ OCTAVE variants of this example with different boundary conditions:
52+
- [Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DHomogeneousDirichlet.m)
53+
- [Non-Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonHomogeneousDirichlet.m)
54+
- [Left Dirichlet, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightNeumann.m)
55+
- [Left Dirichlet, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightRobin.m)
56+
- [Left Neumann, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightRobin.m)
57+
- [Left Robin, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftRobinRightRobin.m)
58+
- [Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DPeriodicBC.m)
59+
- [Non-Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonPeriodicBC.m)
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
### Elliptic1D Left Neumann Right Robin Boundary Conditions
2+
3+
Solves the 1D Poisson boundary value problem with left Neumann and right Robin boundary conditions.
4+
5+
$$
6+
-\nabla^2 u(x) = \pi^2 \sin(\pi x)
7+
$$
8+
9+
with $x\in[0,1]$.
10+
11+
The boundary conditions are given by
12+
13+
$$
14+
au + b\frac{du}{dx} = g
15+
$$
16+
17+
with the left hand side boundary condition (Neumann) satisfying
18+
19+
$$
20+
0u(0) + 1\frac{du(0)}{dx} = 10
21+
$$
22+
23+
and the right hand boundary condition (Robin) satisfying
24+
25+
$$
26+
400u(1) + 1\frac{du(1)}{dx} = 15
27+
$$
28+
29+
This corresponds to the call to addScalarBC1D of `addScalarBC1D(A,b,k,m,dx,dc,nc,v)`, where `dc`, `nc`, and `vc` are vectors which hold the coefficients for $a$, $b$, and $g$ in the above system of equations. $a=[0,400]$, $b=[1,1]$ and $g=[10,15]$.
30+
Substituting these values in gives:
31+
32+
$$
33+
\frac{du(0)}{dx} = 10
34+
$$
35+
36+
$$
37+
400u(1) + \frac{du(1)}{dx} = 15
38+
$$
39+
40+
The exact solution is:
41+
42+
$$
43+
u(x) = \sin(\pi x) + -(10 + \pi)x + \frac{402\pi + 4025}{400}
44+
$$
45+
46+
The example is taken from [this paper](https://www.scirp.org/journal/paperinformation?paperid=50586
47+
)
48+
49+
---
50+
51+
This example is implemented in:
52+
- [MATLAB/ OCTAVE](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightRobin.m)
53+
54+
Additional MATLAB/ OCTAVE variants of this example with different boundary conditions:
55+
- [Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DHomogeneousDirichlet.m)
56+
- [Non-Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonHomogeneousDirichlet.m)
57+
- [Left Dirichlet, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightNeumann.m)
58+
- [Left Dirichlet, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightRobin.m)
59+
- [Left Neumann, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightNeumann.m)
60+
- [Left Robin, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftRobinRightRobin.m)
61+
- [Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DPeriodicBC.m)
62+
- [Non-Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonPeriodicBC.m)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
### Elliptic1D Pure Robin Boundary Conditions
2+
3+
Solves the 1D Poisson boundary value problem with pure Robin boundary conditions.
4+
5+
$$
6+
-\nabla^2 u(x) = \pi^2 \sin(\pi x)
7+
$$
8+
9+
with $x\in[0,1]$.
10+
11+
The boundary conditions are given by
12+
13+
$$
14+
au + b\frac{du}{dx} = g
15+
$$
16+
17+
with the left hand side boundary condition (Robin) satisfying
18+
19+
$$
20+
-200u(0) + 1\frac{du(0)}{dx} = 10
21+
$$
22+
23+
and the right hand boundary condition (Robin) satisfying
24+
$$
25+
400u(1) + 1\frac{du(1)}{dx} = 15
26+
$$
27+
28+
This corresponds to the call to addScalarBC1D of `addScalarBC1D(A,b,k,m,dx,dc,nc,v)`, where `dc`, `nc`, and `vc` are vectors which hold the coefficients for $a$, $b$, and $g$ in the above system of equations. $a=[-200,400]$, $b=[1,1]$ and $g=[10,15]$.
29+
Substituting these values in gives:
30+
31+
$$
32+
-200u(0) + \frac{du(0)}{dx} = 10
33+
$$
34+
35+
$$
36+
400u(1) + \frac{du(1)}{dx} = 15
37+
$$
38+
39+
The exact solution is:
40+
41+
$$
42+
u(x) = \sin(\pi x) + \frac{35 - \pi}{403}x + \frac{402\pi - 3995}{80600}
43+
$$
44+
45+
The example is taken from [this paper](https://www.scirp.org/journal/paperinformation?paperid=50586
46+
)
47+
48+
---
49+
50+
This example is implemented in:
51+
- [MATLAB/ OCTAVE](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNRobinRightRobin.m)
52+
53+
Additional MATLAB/ OCTAVE variants of this example with different boundary conditions:
54+
- [Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DHomogeneousDirichlet.m)
55+
- [Non-Homogeneous Dirichlet](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonHomogeneousDirichlet.m)
56+
- [Left Dirichlet, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightNeumann.m)
57+
- [Left Dirichlet, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftDirichletRightRobin.m)
58+
- [Left Neumann, Right Neumann](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightNeumann.m)
59+
- [Left Neumann, Right Robin](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DLeftNeumannRightRobin.m)
60+
- [Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DPeriodicBC.m)
61+
- [Non-Periodic Boundary Conditions](https://github.com/csrc-sdsu/mole/blob/master/examples/matlab/elliptic1DNonPeriodicBC.m)

0 commit comments

Comments
 (0)