tssafd_code.cc - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tssafd_code.cc (1145B)
---
1 const double dx2 = dx*dx, dy2 = dy*dy, d4 = 4*dx*dy, d2 = 2*dx*dy;
2
3 /* Coefficients of the discretization of the first equation; u first, then v. */
4 double eq1[] = {
5 0, -c_n/dy2, 0,
6 -4*c_w/dx2, (c_s+c_n)/dy2+(4*c_w+4*c_e)/dx2, -4*c_e/dx2,
7 0, -c_s/dy2, 0,
8 c_n/d4+c_w/d2, (c_w-c_e)/d2, -c_n/d4-c_e/d2,
9 (c_n-c_s)/d4, 0, (c_s-c_n)/d4,
10 -c_s/d4-c_w/d2, (c_e-c_w)/d2, c_s/d4+c_e/d2,
11 };
12
13 /* Coefficients of the discretization of the second equation; u first, then v. */
14 double eq2[] = {
15 c_w/d4+c_n/d2, (c_w-c_e)/d4, -c_e/d4-c_n/d2,
16 (c_n-c_s)/d2, 0, (c_s-c_n)/d2,
17 -c_w/d4-c_s/d2, (c_e-c_w)/d4, c_e/d4+c_s/d2,
18 0, -4*c_n/dy2, 0,
19 -c_w/dx2, (4*c_s+4*c_n)/dy2+(c_w+c_e)/dx2, -c_e/dx2,
20 0, -4*c_s/dy2, 0,
21 };
22
23 /* i indices */
24 const int I[] = {
25 i-1, i, i+1,
26 i-1, i, i+1,
27 i-1, i, i+1,
28 i-1, i, i+1,
29 i-1, i, i+1,
30 i-1, i, i+1,
31 };
32
33 /* j indices */
34 const int J[] = {
35 j+1, j+1, j+1,
36 j, j, j,
37 j-1, j-1, j-1,
38 j+1, j+1, j+1,
39 j, j, j,
40 j-1, j-1, j-1,
41 };
42
43 /* component indices */
44 const int C[] = {
45 0, 0, 0,
46 0, 0, 0,
47 0, 0, 0,
48 1, 1, 1,
49 1, 1, 1,
50 1, 1, 1,
51 };
52