|
4 | 4 | "cell_type": "markdown", |
5 | 5 | "metadata": {}, |
6 | 6 | "source": [ |
7 | | - "# Run the `Heat` model through its BMI" |
| 7 | + "# Run the *Heat* model through its BMI" |
8 | 8 | ] |
9 | 9 | }, |
10 | 10 | { |
11 | 11 | "cell_type": "markdown", |
12 | 12 | "metadata": {}, |
13 | 13 | "source": [ |
14 | | - "`Heat` models the diffusion of temperature on a uniform rectangular plate with Dirichlet boundary conditions. View the source code for the [model](https://github.com/csdms/bmi-example-python/blob/master/heat/heat.py) and its [BMI](https://github.com/csdms/bmi-example-python/blob/master/heat/bmi_heat.py) on GitHub." |
| 14 | + "*Heat* models the diffusion of temperature on a uniform rectangular plate with Dirichlet boundary conditions. View the source code for the [model](https://github.com/csdms/bmi-example-python/blob/master/heat/heat.py) and its [BMI](https://github.com/csdms/bmi-example-python/blob/master/heat/bmi_heat.py) on GitHub." |
15 | 15 | ] |
16 | 16 | }, |
17 | 17 | { |
18 | 18 | "cell_type": "markdown", |
19 | 19 | "metadata": {}, |
20 | 20 | "source": [ |
21 | | - "Start by importing `os`, `numpy` and the `Heat` BMI:" |
| 21 | + "Start by importing *numpy* and the *Heat* BMI:" |
22 | 22 | ] |
23 | 23 | }, |
24 | 24 | { |
|
27 | 27 | "metadata": {}, |
28 | 28 | "outputs": [], |
29 | 29 | "source": [ |
30 | | - "import os\n", |
31 | 30 | "import numpy as np\n", |
32 | 31 | "\n", |
33 | 32 | "from heat import BmiHeat" |
|
62 | 61 | "metadata": {}, |
63 | 62 | "outputs": [], |
64 | 63 | "source": [ |
65 | | - "print(x.get_component_name())" |
| 64 | + "x.get_component_name()" |
66 | 65 | ] |
67 | 66 | }, |
68 | 67 | { |
69 | 68 | "cell_type": "markdown", |
70 | 69 | "metadata": {}, |
71 | 70 | "source": [ |
72 | | - "Start the `Heat` model through its BMI using a configuration file:" |
| 71 | + "Start the *Heat* model through its BMI using a configuration file:" |
73 | 72 | ] |
74 | 73 | }, |
75 | 74 | { |
|
78 | 77 | "metadata": {}, |
79 | 78 | "outputs": [], |
80 | 79 | "source": [ |
81 | | - "cat heat.yaml" |
| 80 | + "!cat heat.yaml" |
82 | 81 | ] |
83 | 82 | }, |
84 | 83 | { |
|
193 | 192 | "outputs": [], |
194 | 193 | "source": [ |
195 | 194 | "temperature = np.zeros(shape)\n", |
196 | | - "temperature[3, 4] = 100.0\n", |
197 | | - "x.set_value(\"plate_surface__temperature\", temperature)" |
| 195 | + "temperature[tuple(shape//2)] = 100.0\n", |
| 196 | + "temperature_flat = temperature.flatten()\n", |
| 197 | + "x.set_value(\"plate_surface__temperature\", temperature_flat)" |
198 | 198 | ] |
199 | 199 | }, |
200 | 200 | { |
|
268 | 268 | "metadata": {}, |
269 | 269 | "outputs": [], |
270 | 270 | "source": [ |
271 | | - "distant_time = 2.0\n", |
| 271 | + "distant_time = 10 * x.get_time_step()\n", |
272 | 272 | "while x.get_current_time() < distant_time:\n", |
273 | 273 | " x.update()" |
274 | 274 | ] |
|
0 commit comments