Skip to content

Commit afbacb8

Browse files
committed
Lab 3, UG second worksheet
1 parent 22e9510 commit afbacb8

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "1533bd8e",
6+
"metadata": {},
7+
"source": [
8+
"Names: "
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": 22,
14+
"id": "8be05185",
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"# your import statements\n"
19+
]
20+
},
21+
{
22+
"cell_type": "markdown",
23+
"id": "c17b4ce4",
24+
"metadata": {},
25+
"source": [
26+
"Consider a long hallway (length $L$) in an office building. If we assume that any\n",
27+
"cigarette smoke mixes across the width of the hallway and vertically\n",
28+
"through the depth of the hallway much faster than it mixes along the\n",
29+
"hallway, we can write the diffusion of cigarette smoke as an equation\n",
30+
"$$\\frac {\\partial S} {\\partial t}\n",
31+
"= \\frac {\\partial \\kappa \\partial S}{\\partial x^2}$$\n",
32+
"where $S$ is the concentration of smoke, $\\kappa$ is the rate of diffusion of\n",
33+
"smoke, t is the time and x is\n",
34+
"distance along the hallway. At the centre of the hallway is the smoker and here the smoke is 5 su (smoke units). At one end of the hallway (x=0) is an open window, here the smoke is 0. At the other end of the hallway (x=L) is a closed window (no smoke through the closed window)."
35+
]
36+
},
37+
{
38+
"cell_type": "markdown",
39+
"id": "9eb3d006",
40+
"metadata": {},
41+
"source": [
42+
"**Question 1**\n",
43+
"\n",
44+
"Under what conditions can you move $\\kappa$ outside the derivative? Make that assumption here, and also make the steady state assumption. What is your new differential equation?"
45+
]
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"id": "5f110569",
50+
"metadata": {},
51+
"source": []
52+
},
53+
{
54+
"cell_type": "markdown",
55+
"id": "ace733e0",
56+
"metadata": {},
57+
"source": [
58+
"**Question 2**\n",
59+
"\n",
60+
"Using a centre-difference scheme, separating your hallway into $N=10$ divisions (so $N+1=11$ grid points) write down linear equations for the 1th to $N/2-1=4$th grid points and the $N/2+1=6$th to $N-1=9$th grid points. Note that the 0th and $N=10$th grid points are boundary points and there is a special condition at the $N/2=5$th grid point."
61+
]
62+
},
63+
{
64+
"cell_type": "markdown",
65+
"id": "b0f3282e",
66+
"metadata": {},
67+
"source": []
68+
},
69+
{
70+
"cell_type": "markdown",
71+
"id": "6bcb3435",
72+
"metadata": {},
73+
"source": [
74+
"**Question 3**\n",
75+
"\n",
76+
"What type of boundary condition is at $x=0$ (0th grid point)? Write it as linear equation."
77+
]
78+
},
79+
{
80+
"cell_type": "markdown",
81+
"id": "1abcc6cf",
82+
"metadata": {},
83+
"source": []
84+
},
85+
{
86+
"cell_type": "markdown",
87+
"id": "305884ee",
88+
"metadata": {},
89+
"source": [
90+
"**Question 4**\n",
91+
"\n",
92+
"What type of boundary condition is at $x=L$ (N=10th grid point)? Write it as linear equation."
93+
]
94+
},
95+
{
96+
"cell_type": "markdown",
97+
"id": "9f3f791b",
98+
"metadata": {},
99+
"source": []
100+
},
101+
{
102+
"cell_type": "markdown",
103+
"id": "3ffd3078",
104+
"metadata": {},
105+
"source": [
106+
"**Question 5**\n",
107+
"\n",
108+
"Consider the condition at the centre of the hallway ($x=L/2$, $N/2=5$th grid point) Write it as linear equation."
109+
]
110+
},
111+
{
112+
"cell_type": "markdown",
113+
"id": "648910b3",
114+
"metadata": {},
115+
"source": []
116+
},
117+
{
118+
"cell_type": "markdown",
119+
"id": "68450247",
120+
"metadata": {},
121+
"source": [
122+
"**Question 6**\n",
123+
"\n",
124+
"Put all your equations into a matrix equation and solve the matrix equation. Plot the solution."
125+
]
126+
},
127+
{
128+
"cell_type": "code",
129+
"execution_count": null,
130+
"id": "577152a7",
131+
"metadata": {},
132+
"outputs": [],
133+
"source": []
134+
}
135+
],
136+
"metadata": {
137+
"kernelspec": {
138+
"display_name": "Python 3 (ipykernel)",
139+
"language": "python",
140+
"name": "python3"
141+
},
142+
"language_info": {
143+
"codemirror_mode": {
144+
"name": "ipython",
145+
"version": 3
146+
},
147+
"file_extension": ".py",
148+
"mimetype": "text/x-python",
149+
"name": "python",
150+
"nbconvert_exporter": "python",
151+
"pygments_lexer": "ipython3",
152+
"version": "3.10.1"
153+
}
154+
},
155+
"nbformat": 4,
156+
"nbformat_minor": 5
157+
}

0 commit comments

Comments
 (0)