Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JSchoeberl committed May 13, 2024
1 parent 156b7fd commit 49baa20
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 175 deletions.
134 changes: 48 additions & 86 deletions _sources/aposteriori/equilibrated.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"$$\n",
"We assume that $f$ is element-wise polynomial of order $k-1$, and $\\lambda$ is element-wise constant and positive.\n",
"\n",
"\\qquad\n",
"\n",
"The residual $r(\\cdot) \\in V^*$ is \n",
"\n",
Expand Down Expand Up @@ -53,7 +52,7 @@
"$$\n",
"\\| r \\|^2 \\simeq \\eta^{res}(u_h, f)^2 := \\sum_T \\frac{ h_T^2}{\\lambda_T} \\| r_T \\|_{L_2(T)}^2 + \\sum_E \\frac{ h_E }{\\lambda_E} \\| r_E \\|_{L_2(E)}^2\n",
"$$\n",
"Here, $\\lambda_E$ is some averaging of the coefficients on the two elements containing the edge~$E$. The equivalence holds with constants depending on the shape of elements, the relative jump of the coefficient, and the polynomial order $k$.\n",
"Here, $\\lambda_E$ is some averaging of the coefficients on the two elements containing the edge $E$. The equivalence holds with constants depending on the shape of elements, the relative jump of the coefficient, and the polynomial order $k$.\n",
"\n",
"\n",
"The **equilibrated residual error estimator** $\\eta^{er}$ is defined in terms of the same data $r_T$ and $r_E$. It satisfies\n",
Expand Down Expand Up @@ -99,7 +98,7 @@
"Thus $\\operatorname{div} \\sigma = r$ in distributional sense reads as\n",
"\n",
"$$\n",
"\\operatorname{div} \\sigma{|T} = r_T \\qquad \\text{and} \\qquad [\\sigma \\cdot n]_E = -r_E\n",
"\\operatorname{div} \\sigma_{|T} = r_T \\qquad \\text{and} \\qquad [\\sigma \\cdot n]_E = -r_E\n",
"$$\n",
"for all elements $T$ and edges $E$. We could now pose the problem \n",
"\n",
Expand All @@ -111,7 +110,7 @@
"\n",
"We want to localize the construction of the flux. Local problems are associated with vertex-patches $\\omega_V = \\cup_{T : V \\in T} T$. We proceed in two steps:\n",
"* localization of the residual: $r = \\sum_V r^V$\n",
"* local liftings: find $\\sigma^V$ such that $\\operatorname{div} \\sigma^V = r^V$ on the vertex patch\n",
"* local liftings: find $\\sigma^V$ such that $\\operatorname{div} \\sigma^V = r^V$ on the vertex patch.\n",
"Then, for $\\sigma := \\sum \\sigma^V$ there holds $\\operatorname{div} \\sigma = r$\n",
"\n",
"The localization is given by multiplication of the $P^1$ vertex basis functions (hat-functions) $\\phi_V$:\n",
Expand Down Expand Up @@ -140,8 +139,8 @@
"* $\\int_E \\sigma\\cdot n \\, q_i$ with $q_i$ a basis for $ P^k(E)$\n",
"* $\\int_T \\operatorname{div} \\sigma \\, q_i$ with $q_i$ a basis for $ P^{k-1}(T) \\cap L_2^0(T)$\n",
"* $\\int_T \\sigma \\cdot \\operatorname{curl} q_i$ with $q_i$ a basis for $ P_0^{k+1}(T)$\n",
"\\end{enumerate}\n",
"Exercise: Show that these dofs are unisolvent. Count dimensions, and prove that $[ \\forall i: \\psi_i(\\sigma) =0 ] \\Rightarrow \\sigma = 0$.\n",
"\n",
"*Exercise:* Show that these dofs are unisolvent. Count dimensions, and prove that $[ \\forall i: \\psi_i(\\sigma) =0 ] \\Rightarrow \\sigma = 0$.\n",
"\n",
"\n",
"Now, we give an explicit construction of equilibrated fluxes on a vertex patch. Label elements $T_1, T_2, \\ldots T_n$ in a counter-clock-wise order. Edge $E_i$ is the common edge between triangle $T_{i-1}$ and $T_i$ (with identifying $T_0 = T_n$). We define $\\sigma$ by specifying the dofs of the BDM element:\n",
Expand Down Expand Up @@ -179,15 +178,12 @@
"source": [
"**Literature:**\n",
"\n",
"* D. Braess and J. Sch\\\"oberl.\n",
"\\newblock Equilibrated Residual Error Estimator for Maxwell's\n",
"Equations.\n",
"\\newblock {\\em Mathematics of Computation}, Vol 77(262), 651-672, 2008\n",
"* D. Braess, V. Pillwein and J. Sch\\\"oberl: \n",
"\\newblock Equilibrated Residual Error Estimates are p-Robust. Computer\n",
"\\newblock {\\em Methods in Applied Mechanics and Engineering.} Vol 198,\n",
"1189-1197, 2009\n",
"\\end{enumerate}"
"* D. Braess and J. Schöberl:\n",
"Equilibrated Residual Error Estimator for Maxwell's\n",
"Equations. *Mathematics of Computation*, Vol 77(262), 651-672, 2008\n",
"* D. Braess, V. Pillwein and J. Schöberl: \n",
"Equilibrated Residual Error Estimates are p-Robust. *Computer Methods in Applied Mechanics and Engineering.* Vol 198,\n",
"1189-1197, 2009"
]
},
{
Expand All @@ -200,54 +196,50 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "3cdbc555-35b2-41be-a421-b59f780ca66c",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "daba1e6ea6874032ae2df48eac7ec2ab",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"WebGuiWidget(layout=Layout(height='50vh', width='100%'), value={'gui_settings': {}, 'ngsolve_version': '6.2.24…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"from ngsolve import *\n",
"from ngsolve.webgui import Draw\n",
"\n",
"mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))\n",
"from netgen.occ import *\n",
"\n",
"r1 = Rectangle(1,1).Face()\n",
"r1.edges.Max(X).name='right'\n",
"r1.edges.Min(X).name='left'\n",
"r1.edges.Max(Y).name='top'\n",
"r1.edges.Min(Y).name='bottom'\n",
"r1.faces.name='air'\n",
"r2 = MoveTo(0.6,0.6).Rectangle(0.2,0.2).Face()\n",
"r2.faces.name='source'\n",
"\n",
"# r1 -= r2\n",
"# shape = Glue( [r1,r2] )\n",
"shape = r1\n",
"mesh = Mesh(OCCGeometry(shape,dim=2).GenerateMesh(maxh=0.1))\n",
"\n",
"# mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))\n",
"Draw (mesh);"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "e7af9796-4cad-4875-8667-7becbaab6bd1",
"metadata": {},
"outputs": [],
"source": [
"print (mesh.GetBoundaries(), mesh.GetMaterials())"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3ab864d6-4d50-4aee-91d6-c598d2f02724",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9247a92a900742e6805b7d3ed39a3958",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"WebGuiWidget(layout=Layout(height='50vh', width='100%'), value={'gui_settings': {}, 'ngsolve_version': '6.2.24…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"order = 3\n",
"order_equ = 3\n",
Expand All @@ -256,7 +248,7 @@
"u,v = fes.TnT()\n",
"\n",
"a = BilinearForm(grad(u)*grad(v)*dx).Assemble()\n",
"source = x*y\n",
"source = mesh.MaterialCF( { \"source\" : 1 }, default=1 )\n",
"f = LinearForm(source*v*dx).Assemble()\n",
"\n",
"gfu = GridFunction(fes, name=\"solution\")\n",
Expand Down Expand Up @@ -285,7 +277,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "c90bf199-096d-4dca-a96e-e3a2df287d91",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -318,25 +310,10 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "66f9da4c-629b-46a1-8beb-f0b5186bb636",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3387ba445c454b64a04fd11e497207a1",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"WebGuiWidget(layout=Layout(height='50vh', width='100%'), value={'gui_settings': {}, 'ngsolve_version': '6.2.24…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"fesflux = HDiv(mesh, order=order_equ)\n",
"equflux = GridFunction(fesflux)\n",
Expand All @@ -355,25 +332,10 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "7b0fa6cf-bf12-4925-9b8a-a8ecce296929",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ee3b100cf6454310b6e0fd9392405194",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"WebGuiWidget(layout=Layout(height='50vh', width='100%'), value={'gui_settings': {}, 'ngsolve_version': '6.2.24…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"Draw (div(equflux)+source, mesh, \"residuum\");"
]
Expand Down
30 changes: 8 additions & 22 deletions _sources/timedependent/waves/wave-leapfrogDG.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@
"\n",
"From integration by parts we obtain\n",
"\n",
"\\begin{eqnarray}\n",
"b(p,v) = \\sum_{T}\n",
"\\begin{align*}\n",
"b(p,v) &= \\sum_{T}\n",
"\\Big\\{ -\\int_T p \\operatorname{div} \\, v + \n",
"\\alpha \\int_{\\partial T} \\{ p \\} \\, v_n \\, ds +\n",
"(1-\\alpha) \\int_{\\partial T} p v_n \\, ds \\Big\\} = \n",
"(1-\\alpha) \\int_{\\partial T} p v_n \\, ds \\Big\\} \\\\\n",
"&= \n",
"\\Big\\{ -\\int_T p \\operatorname{div} \\, v + \n",
"\\alpha \\int_{\\partial T} p \\, [ v_n ] \\, ds +\n",
"(1-\\alpha) \\int_{\\partial T} p v_n \\, ds \\Big\\},\n",
"\\end{eqnarray}\n",
"\\end{align*}\n",
"\n",
"with the normal-jump $[v_n] := v_l n_l + v_r n_r$. If we choose $\\alpha = 1$, then the boundary terms cancel for normal-continuous $v $, even for discontinuous test-functions $p$.\n",
"\n",
Expand Down Expand Up @@ -209,26 +210,21 @@
"from ngsolve.webgui import Draw\n",
"from netgen.webgui import Draw as DrawGeo\n",
"\n",
"dim = 3\n",
"dim = 2\n",
"\n",
"if dim==2:\n",
" rect = MoveTo(-1,-1).Rectangle(2,2).Face()\n",
" circ = Circle((0.5,0), 0.2).Face()\n",
" shape = rect-circ\n",
" DrawGeo(shape)\n",
" geo = OCCGeometry(shape, dim=2)\n",
" h = 0.02\n",
" h = 0.05\n",
"\n",
"else:\n",
" box = Box((-1,-1,-1), (1,1,0))\n",
" sp = Sphere((0.5,0,0), 0.2)\n",
" shape = box-sp\n",
" geo = OCCGeometry(shape)\n",
" # from netgen.csg import *\n",
" # geo = CSGeometry()\n",
" # box = OrthoBrick (Pnt(-1,-1,-1), Pnt(1,1,0))\n",
" # hole = Sphere( Pnt(0.5, 0, 0), 0.2 )\n",
" # geo.Add ( (box-hole).bc(\"outer\"))\n",
" h = 0.1\n",
" \n",
" \n",
Expand Down Expand Up @@ -382,7 +378,7 @@
"gfu.vec[:] = 0\n",
"\n",
"if dim == 2:\n",
" scene = Draw (gfp, order=3);\n",
" scene = Draw (gfp, order=3, deformation=True);\n",
"else:\n",
" scene = Draw (gftr, draw_vol=False, order=3);\n",
"\n",
Expand Down Expand Up @@ -505,16 +501,6 @@
"help (PINVIT)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b8312770-c078-467a-a8d9-b3450b18ea2f",
"metadata": {},
"outputs": [],
"source": [
"## "
]
},
{
"cell_type": "markdown",
"id": "82520ac5",
Expand Down
71 changes: 47 additions & 24 deletions aposteriori/equilibrated.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=384b581d" />
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7" />

Expand Down
2 changes: 1 addition & 1 deletion intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=384b581d" />
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7" />

Expand Down
2 changes: 1 addition & 1 deletion mixedelasticity/dynamics.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=384b581d" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7" />

Expand Down
2 changes: 1 addition & 1 deletion plates/tdnnsplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="../_static/styles/sphinx-book-theme.css?v=384b581d" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="../_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7" />

Expand Down
2 changes: 1 addition & 1 deletion reports/timedependent/waves/wave-leapfrogDG.err.log
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ nbclient.exceptions.CellTimeoutError: A cell timed out while it was being execut
The message was: Cell execution timed out.
Here is a preview of the cell contents:
-------------------
['gfp.Interpolate( exp(-100*(x**2+y**2+z**2)))', 'gfu.vec[:] = 0', '', 'if dim == 2:', ' scene = Draw (gfp, order=3);']
['gfp.Interpolate( exp(-100*(x**2+y**2+z**2)))', 'gfu.vec[:] = 0', '', 'if dim == 2:', ' scene = Draw (gfp, order=3, deformation=True);']
...
[' cnt = cnt+1', ' if cnt%10 == 0:', ' if dim == 3:', ' gftr.vec.data = traceop * gfp.vec', ' scene.Redraw()']
-------------------
Expand Down
2 changes: 1 addition & 1 deletion search.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=384b581d" />
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7" />

Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

Loading

0 comments on commit 49baa20

Please sign in to comment.