-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:rhwhite/numeric_2024 into main
- Loading branch information
Showing
1 changed file
with
157 additions
and
0 deletions.
There are no files selected for viewing
157 changes: 157 additions & 0 deletions
157
worksheets/Worksheets_Lab3/Worksheet_UG_Lab3_2_2024.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1533bd8e", | ||
"metadata": {}, | ||
"source": [ | ||
"Names: " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 22, | ||
"id": "8be05185", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# your import statements\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c17b4ce4", | ||
"metadata": {}, | ||
"source": [ | ||
"Consider a long hallway (length $L$) in an office building. If we assume that any\n", | ||
"cigarette smoke mixes across the width of the hallway and vertically\n", | ||
"through the depth of the hallway much faster than it mixes along the\n", | ||
"hallway, we can write the diffusion of cigarette smoke as an equation\n", | ||
"$$\\frac {\\partial S} {\\partial t}\n", | ||
"= \\frac {\\partial \\kappa \\partial S}{\\partial x^2}$$\n", | ||
"where $S$ is the concentration of smoke, $\\kappa$ is the rate of diffusion of\n", | ||
"smoke, t is the time and x is\n", | ||
"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)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "9eb3d006", | ||
"metadata": {}, | ||
"source": [ | ||
"**Question 1**\n", | ||
"\n", | ||
"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?" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "5f110569", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ace733e0", | ||
"metadata": {}, | ||
"source": [ | ||
"**Question 2**\n", | ||
"\n", | ||
"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." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "b0f3282e", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6bcb3435", | ||
"metadata": {}, | ||
"source": [ | ||
"**Question 3**\n", | ||
"\n", | ||
"What type of boundary condition is at $x=0$ (0th grid point)? Write it as linear equation." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1abcc6cf", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "305884ee", | ||
"metadata": {}, | ||
"source": [ | ||
"**Question 4**\n", | ||
"\n", | ||
"What type of boundary condition is at $x=L$ (N=10th grid point)? Write it as linear equation." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "9f3f791b", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3ffd3078", | ||
"metadata": {}, | ||
"source": [ | ||
"**Question 5**\n", | ||
"\n", | ||
"Consider the condition at the centre of the hallway ($x=L/2$, $N/2=5$th grid point) Write it as linear equation." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "648910b3", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "68450247", | ||
"metadata": {}, | ||
"source": [ | ||
"**Question 6**\n", | ||
"\n", | ||
"Put all your equations into a matrix equation and solve the matrix equation. Plot the solution." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "577152a7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.1" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |