Skip to content

Commit ce168fa

Browse files
jorgensdmleoni-pfjuliusghrossbm1MPenaR
authored
Dokken/bump release (#249)
* Update elasticity_scaling.md (#242) * Improve workflow handling (#118) * Create common action for all workflows and split them into multiple files * Dokken/update fspace and wmtgs (#127) * fix runs-on * Minor improvements in linearelasticity.md (#124) * Fix various things on release branch * Try adding trame * Revert fundamentals * Membrane code * More updates due to autoformatting * Lagrange -> CG back conversion * Change to github image --------- Co-authored-by: Julius Herb <43179176+juliusgh@users.noreply.github.com> * Update petsc arches * Fix bounding boxes and more (#135) * Start fixing code for nightly build * rerun all files * Try fixing subdomains * Fix meshio * PETSc python API update (#137) * Resolve #136 * Fixes related to: FEniCS/dolfinx#2703 * Update changelog * Make sure all notebooks run. Change to pathlib in some examples * Api changes related to: FEniCS/dolfinx#2763 (#142) * Bump version numbers * Bump version numbers (#149) * Fix petsc arch * Prepare v0.7.1 (#154) * Merge branch 'main' into release and bump versions * Delete obsolete file * Temporary shift path in nightly test * Make sure there are no warnigns in build * Tabulation * Updates compatible with nightly branch of DOLFINx (#156) * Replace VectorElement and FiniteElement with `basix.ufl.element`. Replace `dolfinx.fem.FunctionSpace` with `dolfinx.fem.functionspace` * More updates * And more * Last vector element updates * Bump pyvista and dolfinx to v0.7.2 (#159) * Bump pyvista and dolfinx to v0.7.2 * remove -r * Add further pyvista deps * Bump versions * Update petsc solver and pc links. Resolves #143 (#160) * Fix typo and issue Issue on page /fem.html #122 (#161) * Compute entity-cell connectivity before calling locate_dofs_topological. Remove soon to be deprecated pyvista syntax for updating time dependent fields. Fix range->np.arange conversion * Update backend in workflow * Fix broken link (#140) + http:// to https:// (#162) * Run book build prior to parallel run * Add back write frame * Fix wrong link * Fix typo in changelog * Merge main into release (#189) * Merge main into release * Apply suggestions from code review * Various fixes when reading through the diff * Further fixes * add missing checkout (#191) * add missing checkout * Add test docker on release PR and release (only push on tag * Remove unused import * Update text to resolve #194 (#195) * Dokken/update nonlin options (#203) * Update options for non-linear solver to sensible choice, ref #200 * Update docker path * Update python file as well * Update config ptr (#207) * Pressure correction equation fix (#196) * Update fundamentals.md (#199) on line 110, updated a typesetting error in equation (3) * Change from vector to petsc_vec (#206) * dolfinx.fem.Form changed to dolfinx.fem.form (#213) * Update compiler_parameters.ipynb In the text it was mentioned that `dolfinx.fem.Form` was used to compile the form, instead of `dolfinx.fem.form`. Not matching the code cell. * jupytext sync * Form -> form in both py and ipynb and LinearProblem -> fem.petsc.LinearProblem * Update book_stable.yml * Update test_stable.yml * Fix python path in test * Fix CI (#227) * Bump docker/build-push-action from 5 to 6 (#221) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v5...v6) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/configure-pages from 4 to 5 (#222) Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 4 to 5. - [Release notes](https://github.com/actions/configure-pages/releases) - [Commits](actions/configure-pages@v4...v5) --- updated-dependencies: - dependency-name: actions/configure-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update book_stable.yml (#225) * Update book_stable.yml * Update test_stable.yml * resolve #224 (#226) * Update test_stable.yml --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update test_stable.yml (#235) * Add libgl flag to ci (#238) * Update elasticity_scaling.md --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com> Co-authored-by: Jørgen S. Dokken <dokken@simula.no> Co-authored-by: Julius Herb <43179176+juliusgh@users.noreply.github.com> Co-authored-by: rossbm1 <120818149+rossbm1@users.noreply.github.com> Co-authored-by: Manuel Pena <mpena991@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update navierstokes.md (#247) * Improve workflow handling (#118) * Create common action for all workflows and split them into multiple files * Dokken/update fspace and wmtgs (#127) * fix runs-on * Minor improvements in linearelasticity.md (#124) * Fix various things on release branch * Try adding trame * Revert fundamentals * Membrane code * More updates due to autoformatting * Lagrange -> CG back conversion * Change to github image --------- Co-authored-by: Julius Herb <43179176+juliusgh@users.noreply.github.com> * Update petsc arches * Fix bounding boxes and more (#135) * Start fixing code for nightly build * rerun all files * Try fixing subdomains * Fix meshio * PETSc python API update (#137) * Resolve #136 * Fixes related to: FEniCS/dolfinx#2703 * Update changelog * Make sure all notebooks run. Change to pathlib in some examples * Api changes related to: FEniCS/dolfinx#2763 (#142) * Bump version numbers * Bump version numbers (#149) * Fix petsc arch * Prepare v0.7.1 (#154) * Merge branch 'main' into release and bump versions * Delete obsolete file * Temporary shift path in nightly test * Make sure there are no warnigns in build * Tabulation * Updates compatible with nightly branch of DOLFINx (#156) * Replace VectorElement and FiniteElement with `basix.ufl.element`. Replace `dolfinx.fem.FunctionSpace` with `dolfinx.fem.functionspace` * More updates * And more * Last vector element updates * Bump pyvista and dolfinx to v0.7.2 (#159) * Bump pyvista and dolfinx to v0.7.2 * remove -r * Add further pyvista deps * Bump versions * Update petsc solver and pc links. Resolves #143 (#160) * Fix typo and issue Issue on page /fem.html #122 (#161) * Compute entity-cell connectivity before calling locate_dofs_topological. Remove soon to be deprecated pyvista syntax for updating time dependent fields. Fix range->np.arange conversion * Update backend in workflow * Fix broken link (#140) + http:// to https:// (#162) * Run book build prior to parallel run * Add back write frame * Fix wrong link * Fix typo in changelog * Merge main into release (#189) * Merge main into release * Apply suggestions from code review * Various fixes when reading through the diff * Further fixes * add missing checkout (#191) * add missing checkout * Add test docker on release PR and release (only push on tag * Remove unused import * Update text to resolve #194 (#195) * Dokken/update nonlin options (#203) * Update options for non-linear solver to sensible choice, ref #200 * Update docker path * Update python file as well * Update config ptr (#207) * Pressure correction equation fix (#196) * Update fundamentals.md (#199) on line 110, updated a typesetting error in equation (3) * Change from vector to petsc_vec (#206) * dolfinx.fem.Form changed to dolfinx.fem.form (#213) * Update compiler_parameters.ipynb In the text it was mentioned that `dolfinx.fem.Form` was used to compile the form, instead of `dolfinx.fem.form`. Not matching the code cell. * jupytext sync * Form -> form in both py and ipynb and LinearProblem -> fem.petsc.LinearProblem * Update book_stable.yml * Update test_stable.yml * Fix python path in test * Fix CI (#227) * Bump docker/build-push-action from 5 to 6 (#221) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v5...v6) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/configure-pages from 4 to 5 (#222) Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 4 to 5. - [Release notes](https://github.com/actions/configure-pages/releases) - [Commits](actions/configure-pages@v4...v5) --- updated-dependencies: - dependency-name: actions/configure-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update book_stable.yml (#225) * Update book_stable.yml * Update test_stable.yml * resolve #224 (#226) * Update test_stable.yml --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update test_stable.yml (#235) * Add libgl flag to ci (#238) * Update navierstokes.md --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com> Co-authored-by: Jørgen S. Dokken <dokken@simula.no> Co-authored-by: Julius Herb <43179176+juliusgh@users.noreply.github.com> Co-authored-by: rossbm1 <120818149+rossbm1@users.noreply.github.com> Co-authored-by: Manuel Pena <mpena991@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Adding Acoustic Helmholtz equation to the tutorial (#232) * Acoustic Helmholtz scripts helmholtz.md contains the mathematical derivation of the variational formulation, while the helmholtz_code scripts contain the implementation. * Fix * equations rendering bug fixed * Update helmholtz.md Equations rendering second fix, missing spaces * Major updates to helmholtz * Add to toc * Updates to helmholtz * Update to work in parallel --------- Co-authored-by: jorgensd <dokken92@gmail.com> * Make helmholtz backwards compatible (#248) * Native arm build (#240) * Try new publish workflow * Fix platform choice * Update workflow to merge artifacts to one place * Set retention days to minimum * Fix name * change name to pattern * Minor improvements * Try new strategy * Remove duplicate tag * Revert platform tags * Use correct dockerfile * remove first login * Add merge skip if not pushing on release or tagging * Set push to false as we don't need the images before merging. * Remove push * Remove conditional to check that simpler code runs * Add back pushtrue * Revert comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: mleoni-pf <160495781+mleoni-pf@users.noreply.github.com> Co-authored-by: Julius Herb <43179176+juliusgh@users.noreply.github.com> Co-authored-by: rossbm1 <120818149+rossbm1@users.noreply.github.com> Co-authored-by: Manuel Pena <mpena991@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Antonio Baiano Svizzero <107617271+bayswiss@users.noreply.github.com>
1 parent 260fa82 commit ce168fa

7 files changed

+1036
-27
lines changed

.github/workflows/publish_docker.yml

+73-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Publish tutorial docker image
1+
# Recipe based on: https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
2+
name: Build and publish platform dependent docker image
23
on:
34
push:
45
branches:
@@ -15,8 +16,12 @@ env:
1516
IMAGE_NAME: ${{ github.repository }}
1617

1718
jobs:
18-
build-and-push-image:
19-
runs-on: ubuntu-latest
19+
build:
20+
strategy:
21+
matrix:
22+
os: ["ubuntu-24.04", "ubuntu-24.04-arm"]
23+
runs-on: ${{ matrix.os }}
24+
2025
permissions:
2126
contents: read
2227
packages: write
@@ -25,43 +30,88 @@ jobs:
2530
- name: Checkout repository
2631
uses: actions/checkout@v4
2732

28-
- name: Set up QEMU
29-
uses: docker/setup-qemu-action@v3
30-
31-
- name: Set up Docker Buildx
32-
uses: docker/setup-buildx-action@v3
33-
3433
- name: Log in to the Container registry
3534
uses: docker/login-action@v3
3635
with:
3736
registry: ${{ env.REGISTRY }}
3837
username: ${{ github.actor }}
3938
password: ${{ secrets.GITHUB_TOKEN }}
4039

40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
4143
- name: Extract metadata (tags, labels) for Docker
4244
id: meta
4345
uses: docker/metadata-action@v5
4446
with:
4547
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4648

47-
- name: Build Docker image
49+
- name: Set architecture tag (amd64)
50+
if: ${{ matrix.os == 'ubuntu-24.04' }}
51+
run: echo "ARCH_TAG=amd64" >> $GITHUB_ENV
52+
53+
- name: Set architecture tag (arm)
54+
if: ${{ contains(matrix.os, 'arm') }}
55+
run: echo "ARCH_TAG=arm64" >> $GITHUB_ENV
56+
57+
- name: Build and push by digest
58+
id: build
4859
uses: docker/build-push-action@v6
4960
with:
50-
context: .
51-
load: true
52-
push: false
5361
file: docker/Dockerfile
54-
platforms: linux/amd64
55-
tags: ${{ steps.meta.outputs.tags }}
62+
platforms: ${{ env.ARCH_TAG }}
5663
labels: ${{ steps.meta.outputs.labels }}
64+
outputs: type=image,"name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}",push-by-digest=true,name-canonical=true,push=true
5765

58-
- name: Build (arm) and push (amd/arm) Docker image
59-
uses: docker/build-push-action@v6
66+
- name: Export digest
67+
run: |
68+
mkdir -p ${{ runner.temp }}/digests
69+
digest="${{ steps.build.outputs.digest }}"
70+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
71+
72+
- name: Upload digest
6073
if: github.event_name == 'push'
74+
uses: actions/upload-artifact@v4
6175
with:
62-
context: .
63-
push: true
64-
file: docker/Dockerfile
65-
platforms: linux/amd64,linux/arm64
66-
tags: ${{ steps.meta.outputs.tags }}
67-
labels: ${{ steps.meta.outputs.labels }}
76+
name: digests-${{ env.ARCH_TAG }}
77+
path: ${{ runner.temp }}/digests/*
78+
if-no-files-found: error
79+
retention-days: 1
80+
81+
merge-and-publish:
82+
if: github.event_name == 'push'
83+
runs-on: ubuntu-latest
84+
needs:
85+
- build
86+
steps:
87+
- name: Download digests
88+
uses: actions/download-artifact@v4
89+
with:
90+
path: ${{ runner.temp }}/digests
91+
pattern: digests-*
92+
merge-multiple: true
93+
94+
- name: Log in to the Container registry
95+
uses: docker/login-action@v3
96+
with:
97+
registry: ${{ env.REGISTRY }}
98+
username: ${{ github.actor }}
99+
password: ${{ secrets.GITHUB_TOKEN }}
100+
101+
- name: Extract metadata (tags, labels) for Docker
102+
id: meta
103+
uses: docker/metadata-action@v5
104+
with:
105+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
106+
107+
108+
- name: Create manifest list and push
109+
working-directory: ${{ runner.temp }}/digests
110+
run: |
111+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
112+
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}@sha256:%s ' *)
113+
114+
- name: Inspect image
115+
run: |
116+
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ steps.meta.outputs.version }}
117+

_toc.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ parts:
3535
- file: chapter2/ns_code1
3636
- file: chapter2/ns_code2
3737
- file: chapter2/hyperelasticity
38+
- file: chapter2/helmholtz
39+
sections:
40+
- file: chapter2/helmholtz_code
41+
3842
- caption: Subdomains and boundary conditions
3943
chapters:
4044
- file: chapter3/neumann_dirichlet_code
@@ -48,4 +52,4 @@ parts:
4852
- file: chapter4/solvers
4953
- file: chapter4/compiler_parameters
5054
- file: chapter4/convergence
51-
- file: chapter4/newton-solver
55+
- file: chapter4/newton-solver

chapter2/elasticity_scaling.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ where $\beta = 1+\frac{\lambda}{\mu}$ is a dimensionless elasticity parameter an
1818
```
1919
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.
2020

21-
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$.
21+
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$.
2222

23-
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$.
23+
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$.

chapter2/helmholtz.md

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# The Helmholtz equation
2+
Author: Antonio Baiano Svizzero
3+
4+
The study of computational acoustics is fundamental in fields such as noise, vibration, and harshness (NVH), noise control, and acoustic design. In this chapter, we focus on the theoretical foundations of the Helmholtz equation - valid for noise problems with harmonic time dependency - and its implementation in FEniCSx to compute the sound pressure for any acoustic system.
5+
6+
## The PDE problem
7+
The acoustic Helmholtz equation in its general form reads
8+
9+
$$
10+
\begin{align}
11+
\nabla^2 p + k^2 p = -j \omega \rho_0 q \qquad\text{in } \Omega,
12+
\end{align}
13+
$$
14+
15+
where $k$ is the acoustic wavenumber, $\omega$ is the angular frequency, $j$ the imaginary unit and $q$ is the volume velocity ($m^3/s$) of a generic source field.
16+
In case of a monopole source, we can write $q=Q \delta(x_s,y_s,z_s)$, where $\delta(x_s,y_s,z_s)$ is the 3D Dirac Delta centered at the monopole location.
17+
18+
This equation is coupled with the following boundary conditions:
19+
20+
- Dirichlet BC:
21+
22+
$$
23+
\begin{align}
24+
p = \bar{p} \qquad \text{on } \partial\Omega_p,
25+
\end{align}
26+
$$
27+
28+
- Neumann BC:
29+
30+
$$
31+
\begin{align}
32+
\frac{\partial p}{\partial n} = - j \omega \rho_0 \bar{v}_n\qquad \text{on } \partial\Omega_v,
33+
\end{align}
34+
$$
35+
36+
- Robin BC:
37+
38+
$$
39+
\begin{align}
40+
\frac{\partial p}{\partial n} = - \frac{j \omega \rho_0 }{\bar{Z}} p \qquad \text{on } \partial\Omega_Z,
41+
\end{align}
42+
$$
43+
44+
where we prescribe, respectively, an acoustic pressure $\bar{p}$ on the boundary $\partial\Omega_p$,
45+
a sound particle velocity $\bar{v}_n$ on the boundary $\partial\Omega_v$ and
46+
an acoustic impedance $\bar{Z}$ on the boundary $\partial\Omega_Z$ where $n$ is the outward normal.
47+
In general, any BC can also be frequency dependant, as it happens in real-world applications.
48+
49+
## The variational formulation
50+
Now we have to turn the equation in its weak formulation.
51+
The first step is to multiplicate the equation by a *test function* $v\in \hat V$,
52+
where $\hat V$ is the *test function space*, after which we integrate over the whole domain, $\Omega$:
53+
54+
$$
55+
\begin{align}
56+
\int_{\Omega}\left(\nabla^2 p + k^2 p \right) \bar v ~\mathrm{d}x = -\int_{\Omega} j \omega \rho_0 q \bar v ~\mathrm{d}x.
57+
\end{align}
58+
$$
59+
60+
Here, the unknown function $p$ is referred to as *trial function* and the $\bar{\cdot}$ is the complex conjugate operator.
61+
62+
In order to keep the order of derivatives as low as possible, we use integration by parts on the Laplacian term:
63+
64+
$$
65+
\begin{align}
66+
\int_{\Omega}(\nabla^2 p) \bar v ~\mathrm{d}x =
67+
-\int_{\Omega} \nabla p \cdot \nabla \bar v ~\mathrm{d}x
68+
+ \int_{\partial \Omega} \frac{\partial p}{\partial n} \bar v ~\mathrm{d}s.
69+
\end{align}
70+
$$
71+
72+
Substituting in the original version and rearranging we get:
73+
74+
$$
75+
\begin{align}
76+
\int_{\Omega} \nabla p \cdot \nabla \bar v ~\mathrm{d}x
77+
- k^2 \int_{\Omega} p \bar v ~\mathrm{d} x = \int_{\Omega} j \omega \rho_0 q \bar v ~\mathrm{d}x
78+
+ \int_{\partial \Omega} \frac{\partial p}{\partial n} \bar v ~\mathrm{d}s.
79+
\end{align}
80+
$$
81+
82+
Since we are dealing with complex values, the inner product in the first equation is *sesquilinear*,
83+
meaning it is linear in one argument and conjugate-linear in the other,
84+
as explained in [The Poisson problem with complex numbers](../chapter1/complex_mode).
85+
86+
The last term can be written using the Neumann and Robin BCs, that is:
87+
88+
$$
89+
\begin{align}
90+
\int_{\partial \Omega} \frac{\partial p}{\partial n} \bar v ~\mathrm{d}s =
91+
-\int_{\partial \Omega_v} j \omega \rho_0 \bar v ~\mathrm{d}s
92+
- \int_{\partial \Omega_Z} \frac{j \omega \rho_0 \bar{v}_n}{\bar{Z}} p \bar v ~\mathrm{d}s.
93+
\end{align}
94+
$$
95+
96+
Substituting, rearranging and taking out of integrals the terms with $j$ and $\omega$ we get the variational formulation of the Helmholtz.
97+
Find $u \in V$ such that:
98+
99+
$$
100+
\begin{align}
101+
\int_{\Omega} \nabla p \cdot \nabla \bar v ~\mathrm{d}x
102+
+ \frac{j \omega }{\bar{Z}} \int_{\partial \Omega_Z} \rho_0 p \bar v ~\mathrm{d}s
103+
- k^2 \int_{\Omega} p \bar v ~\mathrm{d}x
104+
= j \omega \int_{\Omega} \rho_0 q \bar v ~\mathrm{d}x
105+
-j \omega\int_{\partial \Omega_v} \rho_0 \bar{v}_n \bar v ~\mathrm{d}s \qquad \forall v \in \hat{V}.
106+
\end{align}
107+
$$
108+
109+
We define the sesquilinear form $a(p,v)$ is
110+
111+
$$
112+
\begin{align}
113+
a(p,v) = \int_{\Omega} \nabla p \cdot \nabla \bar v ~\mathrm{d}x
114+
+ \frac{j \omega }{\bar{Z}} \int_{\partial \Omega_Z} \rho_0 p \bar v ~\mathrm{d}s,
115+
- k^2 \int_{\Omega} p \bar v ~\mathrm{d}x
116+
\end{align}
117+
$$
118+
119+
and the linear form $L(v)$ reads
120+
121+
$$
122+
\begin{align}
123+
L(v) = j \omega \int_{\Omega}\rho_0 q \bar v ~\mathrm{d}x - j \omega \int_{\partial \Omega_v} \rho_0 \bar{v}_n \bar v ~\mathrm{d}s.
124+
\end{align}
125+
$$

0 commit comments

Comments
 (0)