Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JSchoeberl committed Apr 10, 2024
1 parent 4191ad5 commit 87a3308
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 92 deletions.
70 changes: 40 additions & 30 deletions _sources/multigrid/analysisMG.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"\\| (I - P_l A_{l-1}^{-1} P_l^T A_l) u_l \\|_{L_2} \\preceq h \\, \\| u_l \\|_{H^1}\n",
"$$\n",
"\n",
"We can prove this similar to the Nitsche-lemma using full elliptic regularity.\n",
"We can prove this similar to the Aubin-Nitsche lemma using full elliptic regularity.\n",
"\n",
"We introduce the coarse grid projector\n",
"\n",
Expand All @@ -96,20 +96,20 @@
"$$\n",
"\n",
"\n",
"**Theorem [Approximation property]** There holds with a constant $C > 0$ independent of the refinement level:\n",
"\n",
"$$\n",
"\\forall \\, u_l \\in V_l : \\qquad \n",
"\\| u_l - \\Pi_{l-1} u_l \\|_{D_l}^2 \\leq C \\, \\| u_l - \\Pi_{l-1} u_l \\|_{A_l}^2\n",
"$$\n",
"> **Theorem [Approximation property]** There holds with a constant $C > 0$ independent of the refinement level:\n",
">\n",
"> $$\n",
" \\forall \\, u_l \\in V_l : \\qquad \n",
" \\| u_l - \\Pi_{l-1} u_l \\|_{D_l}^2 \\leq C \\, \\| u_l - \\Pi_{l-1} u_l \\|_{A_l}^2\n",
" $$\n",
"\n",
"*Proof:* We write $u_l$ for the coefficient vector as well as for the corresponding finite element function in $V_l$. For a given $u_l$, define the $A(.,.)$-orthogonal projection $u_{l-1} \\in V_{l-1}$ via\n",
"\n",
"$$\n",
"A(u_{l-1}, v_{l-1}) = A(u_l, v_{l-1}) \\qquad \\forall \\, v_{l-1} \\in V_{l-1}\n",
"$$\n",
"\n",
"The error $e_l = u_l - u_{l-1}$ is $A(.,.)$-orthogonal to $V_{l-1}$. As in the Nitsche-Lemma we define an artificial problem with the error as right hand side: find $\\varphi \\in H^1$ such that\n",
"The error $e_l = u_l - u_{l-1}$ is $A(.,.)$-orthogonal to $V_{l-1}$. As in the Aubin-Nitsche Lemma we define an artificial problem with the error as right hand side: find $\\varphi \\in H^1$ such that\n",
"\n",
"$$\n",
"A(\\varphi, \\psi) = (e_l, \\psi)_{L_2} \\qquad \\forall \\, \\psi \\in H^1.\n",
Expand Down Expand Up @@ -188,7 +188,6 @@
"source": [
"from ngsolve import *\n",
"from ngsolve.webgui import Draw\n",
"from netgen.geom2d import unit_square\n",
"mesh = Mesh(unit_square.GenerateMesh(maxh=0.02))\n",
"\n",
"fes = H1(mesh, order=1)\n",
Expand Down Expand Up @@ -222,12 +221,14 @@
"id": "public-hebrew",
"metadata": {},
"source": [
"**Theorem [Smoothing property]**\n",
"$$\n",
"\\| (I - D^{-1} A)^m u \\|_{A D^{-1} A}^2 \\leq \\frac{1}{2m+1} \\| u \\|_A^2\n",
"$$\n",
"> **Theorem [Smoothing property]**\n",
">\n",
"> $$\n",
" \\| (I - D^{-1} A)^m u \\|_{A D^{-1} A}^2 \\leq \\frac{1}{2m+1} \\| u \\|_A^2\n",
" $$\n",
"\n",
"*Proof:* We use spectral theory. Expanding $u$ in the eigensystem of $A z = \\lambda D z$ we can reformulate the inequality as\n",
"\n",
"$$\n",
"\\sum \\lambda_i^2 (1 - \\lambda_i)^{2m} u_i^2 \\leq \\frac{1}{2m+1} \\sum \\lambda_i u_i^2\n",
"$$\n",
Expand Down Expand Up @@ -261,13 +262,14 @@
"id": "broad-transport",
"metadata": {},
"source": [
"**Lemma [Improved smoothing property]**\n",
"\n",
"$$\n",
"\\| (I - D^{-1} A)^m u \\|_{A D^{-1} A}^2 \\leq \\frac{1}{2m} \\left( \\| u \\|_A^2 - \\| (I-D^{-1} A)^m u \\|_A^2 \\right)\n",
"$$\n",
"> **Lemma [Improved smoothing property]**\n",
">\n",
"> $$\n",
" \\| (I - D^{-1} A)^m u \\|_{A D^{-1} A}^2 \\leq \\frac{1}{2m} \\left( \\| u \\|_A^2 - \\| (I-D^{-1} A)^m u \\|_A^2 \\right)\n",
" $$\n",
"\n",
"*Proof:* Very similar, we have to verify\n",
"\n",
"$$\n",
"\\lambda^2 (1-\\lambda)^{2m} \\leq \\frac{1}{2m} \\left( \\lambda - \\lambda (1-\\lambda)^{2m} \\right)\n",
"$$"
Expand Down Expand Up @@ -298,20 +300,20 @@
"\n",
"We can now combine these properties to analyze the multigrid iteration:\n",
"\n",
"**Theorem:** Assume that the approximation property and the smoothing property are satisfied. Then there holds\n",
"> **Theorem:** Assume that the approximation property (with constant $C$) and the smoothing property are satisfied. Then there holds\n",
">\n",
"> $$\n",
" \\| M_l \\|_A \\leq \\delta \n",
" $$\n",
">\n",
"> with \n",
">\n",
"> $$\n",
" \\delta = \\frac{C}{C+2m} < 1.\n",
" $$\n",
"\n",
"$$\n",
"\\| M_l \\|_A \\leq \\delta \n",
"$$\n",
"\n",
"with \n",
"\n",
"$$\n",
"\\delta = \\frac{C}{C+2m} < 1.\n",
"$$\n",
"\n",
"\n",
"*Proof*: We prove the claim per induction. For $l=$ there holds $M_0 = 0$.\n",
"*Proof*: We prove the claim per induction. For $l=0$ there holds $M_0 = 0$.\n",
"\n",
"From $M_{l-1} = I - C_{l-1}^{-1} A_{l-1}$ there follows $C_{l-1}^{-1} = (I - M_{l-1}) A_{l-1}^{-1}$. \n",
"\n",
Expand Down Expand Up @@ -361,6 +363,14 @@
"\n",
"We used that by the choice of $\\delta$ the factor $\\delta - \\frac{(1-\\delta) C}{2m}$ is positive. The proof is complete."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2057ef66-ba2f-44a6-8ac4-ca8e7670e864",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
29 changes: 13 additions & 16 deletions _sources/multigrid/multilevel-extension.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
"\n",
"which is a decomposition $u = u_0 + \\sum w_l$.\n",
"\n",
"**Theorem** There holds\n",
"\n",
"$$\n",
"\\| u_0 \\|_{H^1}^2 + \\sum_{l=1}^L h_l^{-2} \\| w_l \\|_{L_2}^2 \\preceq L^2 \\, \\| u \\|_{H^1}^2\n",
"$$\n",
"> **Theorem** There holds\n",
">\n",
"> $$ \n",
" \\| u_0 \\|_{H^1}^2 + \\sum_{l=1}^L h_l^{-2} \\| w_l \\|_{L_2}^2 \\preceq L^2 \\, \\| u \\|_{H^1}^2\n",
" $$\n",
"\n",
"*Proof:* We use that there exists a stable decomposition $u = \\tilde u_0 + \\sum_{k=1}^L \\tilde w_k$. The computable choice is\n",
"\n",
Expand Down Expand Up @@ -93,7 +93,7 @@
"source": [
"Algorithm\n",
"---\n",
"The quasi-interpolant of $u in V_L$ to $u_l \\in V_l$,\n",
"The quasi-interpolant of $u \\in V_L$ to $u_l \\in V_l$,\n",
"\n",
"$$\n",
"\\Pi_l u := \\sum_{i=1}^{N_l} \\frac{ (u, \\varphi_{l,i})_{L_2} } { (1, \\varphi_{l,i} )_{L_2} } \\varphi_{l,i}\n",
Expand Down Expand Up @@ -130,7 +130,6 @@
"outputs": [],
"source": [
"from ngsolve import *\n",
"from netgen.geom2d import unit_square\n",
"from ngsolve.webgui import Draw"
]
},
Expand Down Expand Up @@ -160,9 +159,9 @@
"outputs": [],
"source": [
"bnd = mesh.Boundaries(\"left|bottom\")\n",
"gfu.Set (1-x-y+0.3*sin(30*x), definedon=bnd)\n",
"gfu.Set (1-x-y+0.3*sin(10*pi*x), definedon=bnd)\n",
"\n",
"Draw (gfu)\n",
"Draw (gfu, deformation=True)\n",
"print (\"Norm(u) = \", InnerProduct((a.mat*gfu.vec).Evaluate(), gfu.vec))"
]
},
Expand Down Expand Up @@ -229,16 +228,14 @@
"cell_type": "code",
"execution_count": null,
"id": "advance-wages",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"bndmass = BilinearForm(u*v*ds(bnd)).Assemble().mat\n",
"bndmass = BilinearForm(u*v*ds(bnd), check_unused=False).Assemble().mat\n",
"ext = MLExtension(fes, fes.mesh.levels-1, bndmass, fes.GetDofs(bnd))\n",
"ext.Extend(gfu.vec)\n",
"\n",
"Draw (gfu)\n",
"Draw (gfu, deformation=True)\n",
"print (\"Norm(uext) = \", InnerProduct(a.mat*gfu.vec, gfu.vec))"
]
},
Expand All @@ -261,7 +258,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -275,7 +272,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.4"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
66 changes: 38 additions & 28 deletions multigrid/analysisMG.html

Large diffs are not rendered by default.

31 changes: 14 additions & 17 deletions multigrid/multilevel-extension.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 87a3308

Please sign in to comment.