Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Run the lecture notes and build webpage
run:
pixi run jupyter-book build . -W
pixi run jupyter-book build .

- uses: actions/upload-artifact@v4
# always upload artifact, which can include error messages
Expand Down
513 changes: 125 additions & 388 deletions L12 (FEniCS Intro)/L01_FEM_intro.ipynb

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions L12 (FEniCS Intro)/solutions.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "e70f320c",
"metadata": {},
"source": [
"# Solutions to L12\n",
"\n",
"```{solution} l12-1\n",
":class: dropdown\n",
":label: sol-l12-1\n",
"The weak form is $\\int u_x v_x + u v dx$.\n",
"Letting the matrix of the system be $(a_{ij})_{ij}$, we again see that when $|i - j | > 1$, $a_{ij} = 0$, so our matrix is (again) tridiagonal.\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "c9ade0a2",
"metadata": {},
"source": [
"\n",
"```{solution-start} l12-2\n",
":class: dropdown\n",
":label: sol-l12-2\n",
"This corresponds to coating an end of the rod in isolating material, meaning that no heat is allowed to flow out of the rod. It can be incorporated into the system of equations by modifying the boundary terms $-u_x(0) v(0) + u_x(1)v(0)$. So if you for example want to enforce $u_x(0) = 0$, just set the term $u_x(0)$ to 0.\n",
"```\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c229b0b1",
"metadata": {
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"print(\"Hello\")"
]
},
{
"cell_type": "markdown",
"id": "94402f14",
"metadata": {},
"source": [
"We did this because $a=b$"
]
},
{
"cell_type": "markdown",
"id": "c1c1f293",
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"source": [
"```{solution-end}\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "986acb03",
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"outputs": [],
"source": []
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,30 @@ pre-commit run

This will update the appropriate meta-data in the files (which in turn can be commited).
If you have any questions or issues with this, please contact [Jørgen S. Dokken](https://github.com/jorgensd/) or make an [issue](https://github.com/Simula-SSCP/SSCP_2024_lectures/issues/new).


# Installing the environment
[Pixi](https://pixi.sh/dev/installation/) is used to manage dependencies.
First install pixi (see above docs),
for instance by calling
```bash
curl -fsSL https://pixi.sh/install.sh | sh
```
Pixi might ask you to modify your path, please do:
For instance,
```bash
export PATH=/root/.pixi/bin:$PATH
```
then call
```bash
pixi install
```

To build the book call
```bash
pixi run python3 -m jupyter book build .
```
Go to [_build/html/index.html](_build/html/index.html)


You can run any dependency in the `pixi` environment with `pixi run ....`
4 changes: 3 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ sphinx:
config:
html_last_updated_fmt: "%b %d, %Y"
suppress_warnings: ["mystnb.unknown_mime_type"]

extra_extensions:
- sphinx_exercise

exclude_patterns:
- README.md
- .pixi/*
Expand Down
4 changes: 4 additions & 0 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ parts:
- file: "L12 (FEniCS Intro)/L01_FEM_intro.ipynb"
- file: "L12 (FEniCS Intro)/L02_FEniCS_Diffusion.ipynb"
- file: "L12 (FEniCS Intro)/L03_FEniCS_Darcy.ipynb"
- file: "L12 (FEniCS Intro)/solutions.ipynb"
- caption: Other SSCP_lectures
chapters:
- file: "L00 (Python Tutorial)/L1 - Intro to Python for Scientific Computing"

# - caption: FEniCS Electrophysiology
# chapters:
Expand Down
3,520 changes: 1,814 additions & 1,706 deletions pixi.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ git = ">=2.49.0"
# scientific packages
mpich = ">=4"
fenics-dolfinx = "0.9.*"

fenics = { version = "2019.2.0.*", channel = "conda-forge/label/fenics-dev" }
# specify pacakges from fenics-dev channel
fenics-dolfin = { channel = "conda-forge/label/fenics-dev" }
Expand Down Expand Up @@ -54,6 +55,7 @@ wurlitzer = ">=3.1.1"
tqdm = ">=4.67.1"

# Jupyter
sphinx-exercise = ">=1.0.0"
jupyterlab = "4.*"
jupyterhub-base = "==5.3.0"
jupyter-resource-usage = ">=1.1.1"
Expand All @@ -66,3 +68,4 @@ ipywidgets = ">=8.1.7"
nbgitpuller = ">=1.2.2"
binutils = ">=2.43"
jupyter-book = ">=1.0.4.post1"
jupytext = ">=1.17.3,<2"