Skip to content

Commit

Permalink
Various improvements (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgensd authored Oct 15, 2024
1 parent a520bf4 commit dcecbeb
Show file tree
Hide file tree
Showing 27 changed files with 475 additions and 3,830 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "pip" # See documentation for possible values
directory: "python/"
schedule:
interval: "weekly"
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The DOLFINx tutorial

[![Test, build and publish](https://github.com/jorgensd/dolfinx-tutorial/actions/workflows/build-publish.yml/badge.svg)](https://github.com/jorgensd/dolfinx-tutorial/actions/workflows/build-publish.yml)
[![Test release branch against DOLFINx nightly build](https://github.com/jorgensd/dolfinx-tutorial/actions/workflows/nightly.yml/badge.svg)](https://github.com/jorgensd/dolfinx-tutorial/actions/workflows/nightly.yml)
[![Test, build and publish](https://github.com/jorgensd/dolfinx-tutorial/actions/workflows/deploy.yml/badge.svg)](https://github.com/jorgensd/dolfinx-tutorial/actions/workflows/deploy.yml)
[![Test release branch against DOLFINx nightly build](https://github.com/jorgensd/dolfinx-tutorial/actions/workflows/test_nightly.yml/badge.svg)](https://github.com/jorgensd/dolfinx-tutorial/actions/workflows/test_nightly.yml)

Author: Jørgen S. Dokken

Expand All @@ -26,6 +26,12 @@ python3 -m jupytext --sync */*.ipynb

Any code added to the tutorial should work in parallel.

To strip notebook output, one can use pre-commit.

```bash
pre-commit run --all-files
```

## Dependencies

It is adviced to use a pre-installed version of DOLFINx, for instance through conda or docker. Remaining dependencies can be installed with
Expand Down Expand Up @@ -55,3 +61,4 @@ from the root of this repository, and run
```

from the main directory.

38 changes: 19 additions & 19 deletions chapter1/complex_mode.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "116651d1-d44d-471d-b13c-36855d8464ec",
"id": "0",
"metadata": {},
"source": [
"# The Poisson problem with complex numbers\n",
Expand Down Expand Up @@ -40,7 +40,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b52b39d9-260d-4c54-b62a-7440c3b92e5a",
"id": "1",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -59,7 +59,7 @@
},
{
"cell_type": "markdown",
"id": "699ab6a9-4427-4c54-95c8-ce5de5d11b97",
"id": "2",
"metadata": {},
"source": [
"However, as we would like to solve linear algebra problems of the form $Ax=b$, we need to be able to use matrices and vectors that support real and complex numbers. As [PETSc](https://petsc.org/release/) is one of the most popular interfaces to linear algebra packages, we need to be able to work with their matrix and vector structures.\n",
Expand All @@ -72,7 +72,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "4d5b03e3-4d7f-45b7-95eb-9130a5141f34",
"id": "3",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -84,7 +84,7 @@
},
{
"cell_type": "markdown",
"id": "9ea24650-5027-4491-a459-375d7cf69fe3",
"id": "4",
"metadata": {},
"source": [
"## Variational problem\n",
Expand All @@ -94,7 +94,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "be8461a0-a089-4ff3-8bc8-61b016407e70",
"id": "5",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -108,7 +108,7 @@
},
{
"cell_type": "markdown",
"id": "d6f70a1e-d128-470b-9b32-b86dd807a0bf",
"id": "6",
"metadata": {},
"source": [
"Note that we have used the `PETSc.ScalarType` to wrap the constant source on the right hand side. This is because we want the integration kernels to assemble into the correct floating type.\n",
Expand All @@ -121,7 +121,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "779ab267-4609-4628-9577-a280b9c18b6d",
"id": "7",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -132,7 +132,7 @@
},
{
"cell_type": "markdown",
"id": "9efe0968-bf32-4184-85f7-4e8cc3401cfb",
"id": "8",
"metadata": {},
"source": [
"Similarly, if we want to use the function `ufl.derivative` to take derivatives of functionals, we need to take some special care. As `ufl.derivative` inserts a `ufl.TestFunction` to represent the variation, we need to take the conjugate of this to be able to use it to assemble vectors.\n"
Expand All @@ -141,7 +141,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d61c477a-d364-4a81-9362-42f1eb4cd8ee",
"id": "9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -153,7 +153,7 @@
},
{
"cell_type": "markdown",
"id": "1b664480-fc11-404d-83ea-7e2548894904",
"id": "10",
"metadata": {},
"source": [
"We define our Dirichlet condition and setup and solve the variational problem.\n",
Expand All @@ -163,7 +163,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "eb2357ae-ac71-4407-bf37-432f1b1e31d0",
"id": "11",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -177,7 +177,7 @@
},
{
"cell_type": "markdown",
"id": "053bfa60-c382-4216-beaf-c06e95e70067",
"id": "12",
"metadata": {},
"source": [
"We compute the $L^2$ error and the max error.\n",
Expand All @@ -188,7 +188,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "f51d9a7a-2cde-4d0f-8606-91f91c372c4b",
"id": "13",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -203,7 +203,7 @@
},
{
"cell_type": "markdown",
"id": "36431a2a-2063-4070-b1fc-3f58a3b7316b",
"id": "14",
"metadata": {},
"source": [
"## Plotting\n",
Expand All @@ -214,7 +214,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7a3f89d0-4771-4cc3-a0cd-ce8451a414ba",
"id": "15",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -232,7 +232,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9564e40a-ca18-497a-8de0-ef075aae3199",
"id": "16",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -247,7 +247,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c179fdda-6ae6-4979-a19b-fadfebab2f0e",
"id": "17",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -263,7 +263,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a63144b5-e3fc-445e-acea-b5d744bf7634",
"id": "18",
"metadata": {},
"outputs": [],
"source": []
Expand Down
Loading

0 comments on commit dcecbeb

Please sign in to comment.