|
1 | 1 | """ |
2 | | -The patch module allows for a grid to be created and for data to be |
3 | | -defined on that grid. |
| 2 | +The patch module defines the classes necessary to describe finite-volume |
| 3 | +data and the grid that it lives on. |
4 | 4 |
|
5 | 5 | Typical usage: |
6 | 6 |
|
7 | | -create the grid |
| 7 | + -- create the grid |
8 | 8 |
|
9 | | - grid = Grid2d(nx, ny) |
| 9 | + grid = Grid2d(nx, ny) |
10 | 10 |
|
11 | 11 |
|
12 | | -create the data that lives on that grid |
| 12 | + -- create the data that lives on that grid |
13 | 13 |
|
14 | | - data = CellCenterData2d(grid) |
| 14 | + data = CellCenterData2d(grid) |
15 | 15 |
|
16 | | - bc = BCObject(xlb="reflect", xrb="reflect", |
17 | | - ylb="outflow", yrb="outflow") |
18 | | - data.register_var("density", bc) |
19 | | - ... |
| 16 | + bc = BCObject(xlb="reflect", xrb="reflect", |
| 17 | + ylb="outflow", yrb="outflow") |
| 18 | + data.register_var("density", bc) |
| 19 | + ... |
20 | 20 |
|
21 | | - data.create() |
| 21 | + data.create() |
22 | 22 |
|
23 | 23 |
|
24 | | -initialize some data |
| 24 | + -- initialize some data |
25 | 25 |
|
26 | | - dens = data.get_var("density") |
27 | | - dens[:,:] = ... |
| 26 | + dens = data.get_var("density") |
| 27 | + dens[:,:] = ... |
28 | 28 |
|
29 | 29 |
|
30 | | -fill the ghost cells |
| 30 | + -- fill the ghost cells |
31 | 31 |
|
32 | | - data.fill_BC("density") |
| 32 | + data.fill_BC("density") |
33 | 33 |
|
34 | 34 | """ |
35 | 35 |
|
@@ -59,15 +59,50 @@ def define_bc(type, function): |
59 | 59 |
|
60 | 60 | class BCObject: |
61 | 61 | """ |
62 | | - boundary condition container -- hold the BCs on each boundary |
| 62 | + Boundary condition container -- hold the BCs on each boundary |
63 | 63 | for a single variable |
64 | 64 | """ |
65 | 65 |
|
66 | 66 | def __init__ (self, |
67 | 67 | xlb="outflow", xrb="outflow", |
68 | 68 | ylb="outflow", yrb="outflow", |
69 | 69 | odd_reflect_dir=""): |
| 70 | + """ |
| 71 | + Create the BCObject. |
| 72 | +
|
| 73 | + Parameters |
| 74 | + ---------- |
| 75 | + xlb : {'outflow', 'periodic', 'reflect', 'reflect-even', |
| 76 | + 'reflect-odd', 'dirichlet', 'neumann', |
| 77 | + user-defined}, optional |
| 78 | + The type of boundary condition to enforce on the lower |
| 79 | + x boundary. user-defined requires one to have defined |
| 80 | + a new boundary condition type using define_bc() |
| 81 | + xrb : {'outflow', 'periodic', 'reflect', 'reflect-even', |
| 82 | + 'reflect-odd', 'dirichlet', 'neumann', |
| 83 | + user-defined}, optional |
| 84 | + The type of boundary condition to enforce on the upper |
| 85 | + x boundary. user-defined requires one to have defined |
| 86 | + a new boundary condition type using define_bc() |
| 87 | + ylb : {'outflow', 'periodic', 'reflect', 'reflect-even', |
| 88 | + 'reflect-odd', 'dirichlet', 'neumann', |
| 89 | + user-defined}, optional |
| 90 | + The type of boundary condition to enforce on the lower |
| 91 | + y boundary. user-defined requires one to have defined |
| 92 | + a new boundary condition type using define_bc() |
| 93 | + yrb : {'outflow', 'periodic', 'reflect', 'reflect-even', |
| 94 | + 'reflect-odd', 'dirichlet', 'neumann', |
| 95 | + user-defined}, optional |
| 96 | + The type of boundary condition to enforce on the upper |
| 97 | + y boundary. user-defined requires one to have defined |
| 98 | + a new boundary condition type using define_bc() |
| 99 | + odd_reflect_dir : {'x', 'y'}, optional |
| 100 | + The direction along which reflection should be odd |
| 101 | + (sign changes). If not specified, a boundary condition |
| 102 | + of 'reflect' will always be set to 'reflect-even' |
70 | 103 |
|
| 104 | + """ |
| 105 | + |
71 | 106 | # note: "reflect" is ambiguous and will be converted into |
72 | 107 | # either reflect-even (the default) or reflect-odd if |
73 | 108 | # odd_reflect_dir specifies the corresponding direction ("x", |
|
0 commit comments