Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update elasticity_scaling.md #242

Merged
merged 44 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
80d08db
Improve workflow handling (#118)
jorgensd Mar 22, 2023
da48de6
Merge branch 'main' into release
jorgensd Mar 22, 2023
625293c
Merge branch 'main' into release
jorgensd Mar 22, 2023
6b2db88
Dokken/update fspace and wmtgs (#127)
jorgensd Apr 19, 2023
8bcf5f9
Update petsc arches
jorgensd Jun 21, 2023
10a4939
Fix bounding boxes and more (#135)
jorgensd Jul 4, 2023
8eb2770
PETSc python API update (#137)
jorgensd Jul 5, 2023
dd30b8a
Make sure all notebooks run. Change to pathlib in some examples
jorgensd Aug 12, 2023
9e30cab
Api changes related to: https://github.com/FEniCS/dolfinx/pull/2763 (…
jorgensd Sep 23, 2023
662b8b2
Bump version numbers
jorgensd Oct 12, 2023
fb8e738
Bump version numbers (#149)
jorgensd Oct 12, 2023
d9a02c0
Merge branch 'main' into release
jorgensd Oct 12, 2023
b9c7990
Fix petsc arch
jorgensd Oct 12, 2023
8db8b94
Merge branch 'dokken/prepare-v0.7.0' into release
jorgensd Oct 12, 2023
ffe997e
Merge branch 'main' into release
jorgensd Oct 28, 2023
ecd6994
Prepare v0.7.1 (#154)
jorgensd Oct 28, 2023
26ad6bf
Merge branch 'main' into release
jorgensd Oct 28, 2023
69bf939
Updates compatible with nightly branch of DOLFINx (#156)
jorgensd Dec 7, 2023
1a885f2
Fix wrong link
jorgensd Jan 28, 2024
a36ae80
Fix typo in changelog
jorgensd Jan 28, 2024
b4c4a0c
Merge main into release (#189)
jorgensd Apr 30, 2024
f2775eb
Merge branch 'main' into release
jorgensd May 5, 2024
e32797a
add missing checkout (#191)
jorgensd May 5, 2024
45ea6bf
Remove unused import
jorgensd May 5, 2024
fb40ada
Update text to resolve #194 (#195)
jorgensd May 13, 2024
6a67d30
Dokken/update nonlin options (#203)
jorgensd Aug 12, 2024
50b0aad
Update python file as well
jorgensd Aug 12, 2024
4d19c14
Update config ptr (#207)
jorgensd Sep 26, 2024
bf06975
Pressure correction equation fix (#196)
jorgensd Sep 26, 2024
4706eef
Update fundamentals.md (#199)
rossbm1 Sep 26, 2024
1f872e5
Change from vector to petsc_vec (#206)
jorgensd Sep 26, 2024
adf0314
dolfinx.fem.Form changed to dolfinx.fem.form (#213)
MPenaR Oct 2, 2024
aa4ef09
Merge branch 'main' into release
jorgensd Oct 14, 2024
1fcb776
Update book_stable.yml
jorgensd Oct 14, 2024
336a89a
Update test_stable.yml
jorgensd Oct 14, 2024
94447f3
Fix python path in test
jorgensd Oct 14, 2024
ea69c78
Merge branch 'release'
jorgensd Oct 15, 2024
7b2ccb0
Merge branch 'main' into release
jorgensd Oct 15, 2024
0b3745e
Merge branch 'main' into release
jorgensd Oct 15, 2024
3138242
Fix CI (#227)
jorgensd Nov 19, 2024
3fd4b03
Update test_stable.yml (#235)
jorgensd Jan 6, 2025
260fa82
Add libgl flag to ci (#238)
jorgensd Jan 6, 2025
a6d6a5b
Update elasticity_scaling.md
mleoni-pf Jan 28, 2025
2cd6bf1
Merge branch 'main' into patch-2
jorgensd Feb 4, 2025
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
5 changes: 3 additions & 2 deletions .github/workflows/book_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ env:
HDF5_DIR: "/usr/local/"
DISPLAY: ":99.0"
DEB_PYTHON_INSTALL_LAYOUT: deb_system
LIBGL_ALWAYS_SOFTWARE: 1

jobs:
build-book:
runs-on: ubuntu-latest
container: ghcr.io/fenics/dolfinx/lab:v0.8.0
container: ghcr.io/fenics/dolfinx/lab:stable

env:
PYVISTA_TRAME_SERVER_PROXY_PREFIX: "/proxy/"
Expand All @@ -37,7 +38,7 @@ jobs:
run: jupyter-book build . -W

- uses: actions/upload-artifact@v4
if : always()
if: always()
with:
name: webpage
path: ./_build/html
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v4
uses: actions/configure-pages@v5

- name: Download docs artifact
uses: actions/download-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build Docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
load: true
Expand All @@ -56,7 +56,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}

- name: Build (arm) and push (amd/arm) Docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
if: github.event_name == 'push'
with:
context: .
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
PYVISTA_OFF_SCREEN: true
DISPLAY: ":99.0"
PYVISTA_JUPYTER_BACKEND: html
LIBGL_ALWAYS_SOFTWARE: 1

steps:
- uses: actions/checkout@v4
Expand All @@ -39,6 +40,9 @@ jobs:
- name: Test building the book
run: PYVISTA_OFF_SCREEN=false jupyter-book build -W .

- name: Test building the book
run: PYVISTA_OFF_SCREEN=false jupyter-book build -W .

- name: Test complex notebooks in parallel
working-directory: chapter1
run: |
Expand Down Expand Up @@ -67,7 +71,6 @@ jobs:
mpirun -n 2 python3 nonlinpoisson_code.py
mpirun -n 2 python3 ns_code1.py
mpirun -n 2 python3 ns_code2.py

- name: Test chapter 3
working-directory: chapter3
run: |
Expand All @@ -77,7 +80,6 @@ jobs:
mpirun -n 2 python3 robin_neumann_dirichlet.py
mpirun -n 2 python3 component_bc.py
mpirun -n 2 python3 em.py

- name: Test chapter 4
working-directory: chapter4
run: |
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/test_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ env:
HDF5_DIR: "/usr/local/"
DISPLAY: ":99.0"
DEB_PYTHON_INSTALL_LAYOUT: deb_system
LIBGL_ALWAYS_SOFTWARE: 1

jobs:
test:
runs-on: ubuntu-latest
container: ghcr.io/fenics/dolfinx/lab:v0.8.0
container: ghcr.io/fenics/dolfinx/lab:stable
env:
PYVISTA_OFF_SCREEN: true

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
with:
ref: release

- uses: ./.github/actions/install-dependencies

Expand All @@ -33,30 +36,30 @@ jobs:
run: |
export PKG_CONFIG_PATH=/usr/local/dolfinx-complex/lib/pkgconfig:$PKG_CONFIG_PATH
export PETSC_ARCH=linux-gnu-complex128-32
export PYTHONPATH=/usr/local/dolfinx-complex/lib/python3.10/dist-packages:$PYTHONPATH
export PYTHONPATH=/usr/local/dolfinx-complex/lib/python3.12/dist-packages:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/dolfinx-complex/lib:$LD_LIBRARY_PATH
python3 complex_mode.py
mpirun -n 2 python3 complex_mode.py

- name: Test chapter 1
working-directory: chapter1
run: |
python3 -c "from pyvista import start_xvfb; start_xvfb(0.1)"
mpirun -n 2 python3 fundamentals_code.py
mpirun -n 2 python3 nitsche.py
mpirun -n 2 python3 membrane_code.py
python3 -c "from pyvista import start_xvfb; start_xvfb(0.1)"
mpirun -n 2 python3 fundamentals_code.py
mpirun -n 2 python3 nitsche.py
mpirun -n 2 python3 membrane_code.py

- name: Test chapter 2
working-directory: chapter2
run: |
run: |
mpirun -n 2 python3 diffusion_code.py
mpirun -n 2 python3 heat_code.py
mpirun -n 2 python3 linearelasticity_code.py
mpirun -n 2 python3 hyperelasticity.py
mpirun -n 2 python3 nonlinpoisson_code.py
mpirun -n 2 python3 ns_code1.py
mpirun -n 2 python3 ns_code2.py

- name: Test chapter 3
working-directory: chapter3
run: |
Expand All @@ -66,7 +69,7 @@ jobs:
mpirun -n 2 python3 robin_neumann_dirichlet.py
mpirun -n 2 python3 component_bc.py
mpirun -n 2 python3 em.py

- name: Test chapter 4
working-directory: chapter4
run: |
Expand Down
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v0.9.0

- `scale` in `apply_lifting` has been renamed to `alpha`
- Use `dolfinx.fem.Function.x.petsc_vec` as opposed to `dolfinx.fem.Function.vector`

## v0.8.0

- Replace all `ufl.FiniteElement` and `ufl.VectorElement` with the appropriate `basix.ufl.element`
Expand Down
4 changes: 2 additions & 2 deletions chapter2/elasticity_scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ where $\beta = 1+\frac{\lambda}{\mu}$ is a dimensionless elasticity parameter an
```
is a dimensionless variable reflecting the ratio of the load $\rho g$ and the shear stress term $\mu \nabla^2u \sim \mu \frac{U}{L^2}$ in the PDE.

One option for the scaling is to chose $U$ such that $\gamma$ is of unit size ($U=\frac{\rho g L^2}{\mu}$). However, in elasticity, this leads to displacements of the size of the geometry. This can be achieved by choosing $U$ equal to the maximum deflection of a clamped beam, for which there actually exists a formula: $U=\frac{3}{2} \rho g L^2\frac{\delta^2}{E}$ where $\delta=\frac{L}{W}$ is a parameter reflecting how slender the beam is, and $E$ is the modulus of elasticity. Thus the dimensionless parameter $\delta$ is very important in the problem (as expected $\delta\gg 1$ is what gives beam theory!). Taking $E$ to be of the same order as $\mu$, which in this case and for many materials, we realize that $\gamma \sim \delta^{-2}$ is an appropriate choice. Experimenting with the code to find a displacement that "looks right" in the plots of the deformed geometry, points to $\gamma=0.4\delta^{-2}$ as our final choice of $\gamma$.
One option for the scaling is to choose $U$ such that $\gamma$ is of unit size ($U=\frac{\rho g L^2}{\mu}$). However, in elasticity, this leads to displacements of the size of the geometry. This can be achieved by choosing $U$ equal to the maximum deflection of a clamped beam, for which there actually exists a formula: $U=\frac{3}{2} \rho g L^2\frac{\delta^2}{E}$ where $\delta=\frac{L}{W}$ is a parameter reflecting how slender the beam is, and $E$ is the modulus of elasticity. Thus the dimensionless parameter $\delta$ is very important in the problem (as expected $\delta\gg 1$ is what gives beam theory!). Taking $E$ to be of the same order as $\mu$, which in this case and for many materials, we realize that $\gamma \sim \delta^{-2}$ is an appropriate choice. Experimenting with the code to find a displacement that "looks right" in the plots of the deformed geometry, points to $\gamma=0.4\delta^{-2}$ as our final choice of $\gamma$.

The simulation code implements the problem with dimensions and physical parameters $\lambda, \mu, \rho, g, L$ and $W$. However, we can easily reuse this code for a scaled problem: Just set $\mu=\rho=L=1$, $W$ as $W/L(\delta^{-1})$, $g=\gamma$ and $\lambda=\beta$.
The simulation code implements the problem with dimensions and physical parameters $\lambda, \mu, \rho, g, L$ and $W$. However, we can easily reuse this code for a scaled problem: Just set $\mu=\rho=L=1$, $W$ as $W/L(\delta^{-1})$, $g=\gamma$ and $\lambda=\beta$.
1 change: 1 addition & 0 deletions chapter2/ns_code2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@
" if pressure is not None:\n",
" p_diff[i] -= pressure[0]\n",
" break\n",
"progress.close()\n",
"vtx_u.close()\n",
"vtx_p.close()"
]
Expand Down
1 change: 1 addition & 0 deletions chapter2/ns_code2.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ def __call__(self, x):
if pressure is not None:
p_diff[i] -= pressure[0]
break
progress.close()
vtx_u.close()
vtx_p.close()

Expand Down
2 changes: 1 addition & 1 deletion chapter4/compiler_parameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"id": "2",
"metadata": {},
"source": [
"Next we generate a general function to assemble the mass matrix for a unit cube. Note that we use `dolfinx.fem.Form` to compile the variational form. For codes using `dolfinx.LinearProblem`, you can supply `jit_options` as a keyword argument."
"Next we generate a general function to assemble the mass matrix for a unit cube. Note that we use `dolfinx.fem.form` to compile the variational form. For codes using `dolfinx.fem.petsc.LinearProblem`, you can supply `jit_options` as a keyword argument."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion chapter4/compiler_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
print(f"Directory to put C files in: {cache_dir}")
# -

# Next we generate a general function to assemble the mass matrix for a unit cube. Note that we use `dolfinx.fem.Form` to compile the variational form. For codes using `dolfinx.LinearProblem`, you can supply `jit_options` as a keyword argument.
# Next we generate a general function to assemble the mass matrix for a unit cube. Note that we use `dolfinx.fem.form` to compile the variational form. For codes using `dolfinx.fem.petsc.LinearProblem`, you can supply `jit_options` as a keyword argument.

# +

Expand Down
6 changes: 3 additions & 3 deletions fem.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ The tutorial uses several dependencies for meshing, plotting and timings. A comp
To use the notebooks in this tutorial with DOLFINx on your own computer, you should use the docker image obtained using the following command:

```bash
docker run --init -p 8888:8888 -v "$(pwd)":/root/shared ghcr.io/jorgensd/dolfinx-tutorial:v0.7.2
docker run --init -p 8888:8888 -v "$(pwd)":/root/shared ghcr.io/jorgensd/dolfinx-tutorial:release
```

This image can also be used as a normal docker container by adding:

```bash
docker run --ti -v "$(pwd)":/root/shared --entrypoint="/bin/bash" ghcr.io/jorgensd/dolfinx-tutorial:v0.7.2
docker run --ti -v "$(pwd)":/root/shared --entrypoint="/bin/bash" ghcr.io/jorgensd/dolfinx-tutorial:release
```

The tutorials can also be exported as an IPython notebook or PDF by clicking the ![Download](save.png)-symbol in the top right corner of the relevant tutorial. The notebook can in turn be used with a Python kernel which has DOLFINx.
Expand All @@ -58,7 +58,7 @@ The [Dockerfile](https://github.com/FEniCS/dolfinx/blob/main/docker/Dockerfile)
provides a definitive build recipe. As the DOLFINx docker images are hosted at Docker-hub, one can directly access the image using:

```bash
docker run dolfinx/dolfinx:v0.8.0
docker run dolfinx/dolfinx:stable
```

There are several ways of customizing a docker container, such as mounting volumes/sharing folder, setting a working directory, sharing graphical interfaces etc. See `docker run --help` for an extensive list.
Expand Down