-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
486 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
...bddc-2023/jupyter/.ipynb_checkpoints/Dirichlet-BDDC-High-Order-Histogram-checkpoint.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Dirichlet BDDC Example" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# dependencies\n", | ||
"using Pkg\n", | ||
"Pkg.activate(\"./\")\n", | ||
"Pkg.instantiate()\n", | ||
"using LFAToolkit\n", | ||
"using LinearAlgebra\n", | ||
"using Plots" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"code_folding": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# setup\n", | ||
"p = 4\n", | ||
"mesh = Mesh2D(1.0, 1.0)\n", | ||
"\n", | ||
"# diffusion operator\n", | ||
"diffusion = GalleryOperator(\"diffusion\", p + 1, p + 2, mesh)\n", | ||
"\n", | ||
"# Dirichlet BDDC smoother\n", | ||
"bddc = DirichletBDDC(diffusion)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"code_folding": [ | ||
14, | ||
16, | ||
27 | ||
], | ||
"scrolled": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# full operator symbols\n", | ||
"numbersteps = 4\n", | ||
"maxeigenvalue = 0\n", | ||
"θ_min = -π/2\n", | ||
"θ_max = 3π/2\n", | ||
"θ_step = (2π-2π/numbersteps)/(numbersteps-1)\n", | ||
"θ_range = θ_min:θ_step:θ_max\n", | ||
"\n", | ||
"# compute and plot smoothing factor\n", | ||
"# setup\n", | ||
"ω = [1.0]\n", | ||
"eigenvalues = []\n", | ||
"\n", | ||
"# compute\n", | ||
"for i in 1:numbersteps, j in 1:numbersteps\n", | ||
" θ = [θ_range[i], θ_range[j]]\n", | ||
" if sqrt(abs(θ[1])^2 + abs(θ[2])^2) > π/128\n", | ||
" A = computesymbols(bddc, ω, θ)\n", | ||
" currenteigenvalues = [abs(val) for val in eigvals(I - A)]\n", | ||
" push!(eigenvalues, currenteigenvalues)\n", | ||
" end\n", | ||
"end\n", | ||
"\n", | ||
"# plot\n", | ||
"histogram(\n", | ||
" eigenvalues,\n", | ||
" title=\"Dirichlet BDDC Eigenvalues\",\n", | ||
" legend=false,\n", | ||
" aspect_ratio=:equal,\n", | ||
" normalize=:density,\n", | ||
" color=:cividis\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"savefig(\"DirichletBDDCHighOrderEigenvalues\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Julia 1.9.2", | ||
"language": "julia", | ||
"name": "julia-1.9" | ||
}, | ||
"language_info": { | ||
"file_extension": ".jl", | ||
"mimetype": "application/julia", | ||
"name": "julia", | ||
"version": "1.9.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
126 changes: 126 additions & 0 deletions
126
...igh-order-bddc-2023/jupyter/.ipynb_checkpoints/Dirichlet-BDDC-High-Order-checkpoint.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Dirichlet BDDC Example" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# dependencies\n", | ||
"using Pkg\n", | ||
"Pkg.activate(\"./\")\n", | ||
"Pkg.instantiate()\n", | ||
"using LFAToolkit\n", | ||
"using LinearAlgebra\n", | ||
"using Plots" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"code_folding": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# setup\n", | ||
"p = 4\n", | ||
"mesh = Mesh2D(1.0, 1.0)\n", | ||
"\n", | ||
"# diffusion operator\n", | ||
"diffusion = GalleryOperator(\"diffusion\", p + 1, p + 2, mesh)\n", | ||
"\n", | ||
"# Dirichlet BDDC smoother\n", | ||
"bddc = DirichletBDDC(diffusion)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"code_folding": [ | ||
14, | ||
16, | ||
27 | ||
], | ||
"scrolled": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# full operator symbols\n", | ||
"numbersteps = 250\n", | ||
"maxeigenvalue = 0\n", | ||
"θ_min = -π/2\n", | ||
"θ_max = 3π/2\n", | ||
"θ_step = 2π/(numbersteps-1)\n", | ||
"θ_range = θ_min:θ_step:θ_max\n", | ||
"\n", | ||
"# compute and plot smoothing factor\n", | ||
"# setup\n", | ||
"ω = [1.0]\n", | ||
"maxeigenvalues = zeros(numbersteps, numbersteps)\n", | ||
"\n", | ||
"# compute\n", | ||
"for i in 1:numbersteps, j in 1:numbersteps\n", | ||
" θ = [θ_range[i], θ_range[j]]\n", | ||
" if sqrt(abs(θ[1])^2 + abs(θ[2])^2) > π/128\n", | ||
" A = computesymbols(bddc, ω, θ)\n", | ||
" eigenvalues = [abs(val) for val in eigvals(I - A)]\n", | ||
" maxeigenvalues[i, j] = max(eigenvalues...)\n", | ||
" maxeigenvalue = max(maxeigenvalue, maxeigenvalues[i, j])\n", | ||
" end\n", | ||
"end\n", | ||
"\n", | ||
"# plot\n", | ||
"println(\"max eigenvalue: \", maxeigenvalue)\n", | ||
"xrange = θ_range/π\n", | ||
"heatmap(\n", | ||
" xrange,\n", | ||
" xlabel=\"θ/π\",\n", | ||
" xtickfont=font(12, \"Courier\"),\n", | ||
" xrange,\n", | ||
" ylabel=\"θ/π\",\n", | ||
" ytickfont=font(12, \"Courier\"),\n", | ||
" maxeigenvalues,\n", | ||
" title=\"Dirichlet BDDC Symbol\",\n", | ||
" transpose=true,\n", | ||
" aspect_ratio=:equal,\n", | ||
" color=:cividis\n", | ||
")\n", | ||
"xlims!(θ_min/π, θ_max/π)\n", | ||
"ylims!(θ_min/π, θ_max/π)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"savefig(\"DirichletBDDCHighOrder\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Julia 1.9.2", | ||
"language": "julia", | ||
"name": "julia-1.9" | ||
}, | ||
"language_info": { | ||
"file_extension": ".jl", | ||
"mimetype": "application/julia", | ||
"name": "julia", | ||
"version": "1.6.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
116 changes: 116 additions & 0 deletions
116
...er-bddc-2023/jupyter/.ipynb_checkpoints/Lumped-BDDC-High-Order-Histogram-checkpoint.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Lumped BDDC Eigenvalue Histogram" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# dependencies\n", | ||
"using Pkg\n", | ||
"Pkg.activate(\"./\")\n", | ||
"Pkg.instantiate()\n", | ||
"using LFAToolkit\n", | ||
"using LinearAlgebra\n", | ||
"using Plots" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"code_folding": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# setup\n", | ||
"p = 8\n", | ||
"mesh = Mesh2D(1.0, 1.0)\n", | ||
"\n", | ||
"# diffusion operator\n", | ||
"diffusion = GalleryOperator(\"diffusion\", p + 1, p + 2, mesh)\n", | ||
"\n", | ||
"# bddc smoother\n", | ||
"bddc = LumpedBDDC(diffusion)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"code_folding": [ | ||
14, | ||
16, | ||
27 | ||
], | ||
"scrolled": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# full operator symbols\n", | ||
"numbersteps = 4\n", | ||
"maxeigenvalue = 0\n", | ||
"θ_min = -π/2\n", | ||
"θ_max = 3π/2\n", | ||
"θ_step = 2π/(numbersteps-1)\n", | ||
"θ_range = θ_min:θ_step:θ_max\n", | ||
"\n", | ||
"# compute and plot smoothing factor\n", | ||
"# setup\n", | ||
"ω = [1.0]\n", | ||
"eigenvalues = []\n", | ||
"\n", | ||
"# compute\n", | ||
"for i in 1:numbersteps, j in 1:numbersteps\n", | ||
" θ = [θ_range[i], θ_range[j]]\n", | ||
" if sqrt(abs(θ[1])^2 + abs(θ[2])^2) > π/128\n", | ||
" A = computesymbols(bddc, ω, θ)\n", | ||
" currenteigenvalues = [abs(val) for val in eigvals(I - A)]\n", | ||
" push!(eigenvalues, currenteigenvalues)\n", | ||
" end\n", | ||
"end\n", | ||
"\n", | ||
"# plot\n", | ||
"histogram(\n", | ||
" eigenvalues,\n", | ||
" title=\"Lumped BDDC Eigenvalues\",\n", | ||
" legend=false,\n", | ||
" aspect_ratio=:equal,\n", | ||
" color=:cividis,\n", | ||
" normed=true\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"savefig(\"lumpedBDDCHighOrderEigenvalues\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Julia 1.9.2", | ||
"language": "julia", | ||
"name": "julia-1.9" | ||
}, | ||
"language_info": { | ||
"file_extension": ".jl", | ||
"mimetype": "application/julia", | ||
"name": "julia", | ||
"version": "1.6.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
Oops, something went wrong.